main
1// The one rewrite gate c's recorder makes, shared by both ways src/ runs under test: node's own loader (worker threads
2// and child processes, test/space/failsite-hook.mjs) and vitest's transform (the test files themselves, the plugin in
3// vitest.config.ts). It serves src/errors.ts with one call added at the head of plyError's implementation, on the
4// declaration's own line: every other line of the module, and every line and column of every other module, is where
5// the file has it. plyError is the constructor every fail site reaches (`fail`, `thrown`, the wrappers and limits.ts
6// all build their error with it), so a stack captured there names the site.
7//
8// Only runs when PLY_FAILSITES is set; src/, the bundle and its size are untouched.
9import { join, dirname } from 'node:path';
10import { fileURLToPath, pathToFileURL } from 'node:url';
12export const ROOT = join(dirname(fileURLToPath(import.meta.url)), '../..');
13export const ERRORS = join(ROOT, 'src/errors.ts');
14export const ERRORS_URL = pathToFileURL(ERRORS).href;
15export const KEY = Symbol.for('ply.failsite');
16const DECL = 'export function plyError(code: string, message: string, ...extra: [] | [object]): Thrown {';
17// plyError's one return: the error it built goes through the recorder's `made`, which can then tell whether a test
18// ever read it (same line, so only errors.ts's own columns move, and its frames are not sites)
19const RET = ' return Object.assign(new Error(message), { code, ...extra[0] });';
21export function instrument(source) {
22 if (!source.includes(DECL)) throw new Error(`failsite: src/errors.ts no longer declares \`${DECL}\`; update test/space/failsite-instrument.mjs`);
23 if (!source.includes(RET)) throw new Error(`failsite: src/errors.ts plyError no longer ends with \`${RET.trim()}\`; update test/space/failsite-instrument.mjs`);
24 return source
25 .replace(DECL, `${DECL} globalThis[Symbol.for('ply.failsite')]?.(plyError);`)
26 .replace(RET, ` return (globalThis[Symbol.for('ply.failsite')]?.made ?? ((e: Thrown): Thrown => e))(Object.assign(new Error(message), { code, ...extra[0] }));`);
27}
Diagnostics4 git calls · 369 ms
CallStatusSizeTime0369 ms
discover200152 B3 ms
git.upload-pack discover http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=3 git.response.bytes=152 git.server.agent=gitty/1.0 git.server.object_format=sha1 git.server.caps=agent ls-refs fetch object-format git.server.fetch=shallow filter sideband-all git.protocol.version=2 git.pkt.frames=8 git.pkt.data=6 git.pkt.flush=2 git.pkt.delim=0 git.pkt.bytes=152 git.pkt.payload.max=34
ls-refs200145 B · hit3 ms
git.upload-pack ls-refs http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=3 git.response.bytes=145 git.response.cache=HIT git.response.duration_ms=3 git.protocol.version=2 git.pkt.frames=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=145 git.pkt.payload.max=76 git.ls_refs.count=2 git.ls_refs.head=refs/heads/main
fetchblob:none · deepen 1020038 KiB · hit3 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=363 git.response.bytes=38434 git.response.cache=HIT git.response.duration_ms=3 git.fetch.filter=blob:none git.fetch.filter.requested=tree:0 git.fetch.filter.fallback=blob:none git.fetch.filter.learned=false git.fetch.wants=19912563f540228593df0c489082e5e2508e21e4 git.fetch.haves.count=0 git.fetch.deepen=10 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=6 git.pkt.data=4 git.pkt.flush=1 git.pkt.delim=1 git.pkt.bytes=38434 git.pkt.payload.max=38339 git.sideband.band1.bytes=38338 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=63 git.pack.bytes=38338 git.pack.ofs_delta=0 git.pack.ref_delta=8 git.pack.chain.max=8 git.pack.trailer=0bc36ab7adf82d3109177f11f1ea93f1ce071f77 git.pack.full=55Open pack map
fetch2001.0 KiB363 ms
git.upload-pack fetch http.response.status_code=200 git.response.bytes=1039 git.response.cache=MISS git.response.duration_ms=363 git.fetch.wants=0baa87bd5fc9b10694c1c6d3e20572c725e2d3b8 git.fetch.haves.count=0 git.fetch.deepen=0 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=1039 git.pkt.payload.max=1018 git.sideband.band1.bytes=1017 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0
Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.
- Remote
- https://5ad2236b39de4c8bd8f6270ea63f3ea9.artifacts.cloudflare.net/git/public-v0/ply.git
- Ref
- refs/heads/main
- Commit
- 19912563f540228593df0c489082e5e2508e21e4
- cf-ray
- a5e341cd8c0c6e2a
- Request
- 49f2e19f…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format