main
1// Tree-shaking is a property we have to earn, so it is asserted: bundle the edit entry and check what it carries.
2// Every symbol in ABSENT is general-client machinery that must not ride along. Those structural checks fail.
3// Byte sizes are REPORT-ONLY (ivar, 2026-10-31: "Until this thing fucking works do not microoptimize on bundle size"):
4// each entry's minified and gzip bytes are printed against the last budget, and a size never fails a test. The dated
5// notes below are that history.
6import { test } from 'vitest';
7import assert from 'node:assert/strict';
8import { build } from 'esbuild';
9import { gzipSync } from 'node:zlib';
11const bundle = async entry => (await build({ entryPoints: [entry], bundle: true, format: 'esm', minify: true, write: false, logLevel: 'silent', metafile: true }));
12// Report-only: prints `entry min|gz bytes (budget N, ±d)` and never fails.
13const size = (entry, kind, got, budget) => console.log(`bundle ${entry.padEnd(8)} ${kind.padEnd(3)} ${String(got).padStart(7)} B (budget ${budget}, ${got - budget >= 0 ? '+' : ''}${got - budget})`);
14const retained = out => Object.entries(Object.values(out.metafile.outputs)[0].inputs).map(([k, v]) => [k.replace(/^src\//, '').replace(/\.ts$/, '.js'), v.bytesInOutput]).sort((a, b) => b[1] - a[1]);
16test('edit entry carries only what the edit path uses', async () => {
17 const out = await bundle('src/edit.ts');
18 const js = out.outputFiles[0].text;
19 const ABSENT = {
20 // the delta resolver (parsePack/resolvePack/applyDelta) rides along since 2026-10-23: the blob:none fallback for servers
21 // that refuse tree:0 (Cloudflare Artifacts) gets multi-object, possibly deltified packs. The generator does not.
22 'delta generator': /copyOps|makeDelta/,
23 'negotiation': /negotiate|promisor/,
24 'receive-pack advertisement': /git\.receive\.caps|receiveCaps/,
25 'discover canary': /git\.server\.agent/,
26 'buffered fetchPack': /git\.pack\.chain\.max|fetchPackOnce/,
27 'classes': /\bclass\s+\w+\s*(extends\s+[\w.]+\s*)?\{/,
28 'node builtins': /node:/,
29 'tree encoding': /treeSort|encodeTree/,
30 };
31 for (const [what, re] of Object.entries(ABSENT)) assert.ok(!re.test(js), `${what} leaked into the edit bundle (${re})`);
32 const files = retained(out).map(([k]) => k);
33 for (const f of ['fetchpack.js', 'negotiate.js', 'receivecaps.js', 'discover.js', 'client.js', 'packcache.js', 'merge.js', 'linemerge.js', 'rebase.js', 'attributes.js', 'changes.js', 'memtree.js']) assert.ok(!files.includes(f), `${f} is in the edit bundle`);
34 const min = js.length, gz = gzipSync(js, { level: 9 }).length;
35 console.log(` edit bundle: ${min} B min, ${gz} B gz; modules: ${retained(out).map(([k, b]) => `${k}=${b}`).join(' ')}`);
36 // 2026-10-23: 49.9 KB / 18.9 KB gz (was 42.6 / 16.5): +4.2 KB packresolve.js, +2.6 KB fetch.js for the blob:none fallback
37 // 2026-10-25: 55.1 KB / 20.8 KB gz. take(), format facts, and fsck checks in parseTree/assertFetched.
38 // 2026-10-27: 56,087 B. The shared header checker, the encoding field it round-trips, and the one-unpack guard.
39 // 2026-10-27: 59,643 B / 22,823 B gz. Aggregate caps and the branded ident validator live on the edit path
40 // (parsePack, inflate, encodeCommit, validateIdent) so a missing limit cannot fall open.
41 // 2026-10-27: 60,436 B / 23,089 B gz. http.js streams advertisements into maxPackBytes, keeps a 4 KiB
42 // error-page prefix, and rejects CR/LF in caller header fields. That module is on every entry.
43 // 2026-10-30: 60,525 B / 23,128 B gz. push.js refuses a pack over maxPackBytes before sending it (issue #11).
44 // 2026-10-30: 60,668 B / 23,229 B gz. the size-varint cap in readObjHeader/applyDelta and the counted scan (issue #13).
45 // 2026-10-30: 60,701 B / 23,239 B gz. resolvePack counts delta chain length per link and runs its fixpoint to completion (issue #14).
46 // 2026-10-30: 62,215 B / 23,900 B gz. the credential scrub (12-character fragments, the user rule) and the redirect refusal in http.js, the span scrub in otel.js (issue #15).
47 // 2026-10-30: 62,420 B / 23,943 B gz. ls-refs keeps only symref-target and a checked peeled, report options and merge maps have no prototype, scrubError walks them (issue #16).
48 // 2026-10-30: 62,836 B / 24,093 B gz. URL userinfo sent as git sends it (percent-decoded bytes, `user:` for a user alone), the token-as-user scrub rule, a typed bad URL (issue #32).
49 // 2026-10-30: 63,168 B / 24,230 B gz. v2Step caps band 1 and band 2 at maxPackBytes for every consumer, zlibBound in spStep and inflate, push caps band 2, the declared-size check before begin() in streamBlobEdit (issue #36).
50 // 2026-10-30: 63,709 B / 24,444 B gz. Explicit credentials as UTF-8 bytes and refused when they send nothing, the scrub module shared with SSH (issue #40).
51 // 2026-10-30: 63,197 B / 24,217 B gz. checkWide: the blob:none fallback drops an extra over a limit instead of failing (issue #46).
52 // 2026-10-30: 64,070 B / 24,571 B gz. merge of #48 and #47 (credential handling, issue #40, with checkWide, issue #46).
53 // 2026-10-30: 64,399 B / 24,708 B gz. merge of #49 and #48 (body and zlib bounds, issue #36, with credential handling, issue #40).
54 // 2026-10-30: 63,148 B / 24,220 B gz. parseTree refuses one name twice anywhere in a tree, orders on raw bytes with fsck's S_ISDIR, and refuses decode-twins (issue #34).
55 // 2026-10-30: 65,439 B / 25,067 B gz. The push outcome as an allowlist: the response stream as a step machine (streamStep), the report classified against git's exact grammar (classifyReport), an exhaustive decideOutcome, push_partial (SPACE.md, SAFETY.md I36).
56 // 2026-10-30: 64,903 B / 24,908 B gz. names, messages, idents and ref names as bytes (decodeBytes/encodeBytes, surrogate-escaped), BOM kept, sideband text decoded across frames (issue #43).
57 // 2026-10-30: 68,764 B / 26,407 B gz. merge of #49, #50, #51, #52, #53, #55 and #54 on main (train/1): #36 caps, #34 parseTree, the push outcome space, #41/#42 merge base, #43 bytes, #35 span contract.
58 // 2026-10-31: 71,208 B / 27,424 B gz. parseTree is fsck_tree: utf8.c/path.c's .git and .gitmodules spellings, nullSha1, largePathname, dotfiles that are not blobs, canon_mode (hole #4, space/fsck-tree).
59 // 2026-10-31: 73,215 B / 28,144 B gz. release/1: train/1, #19, #57, #58, #62, #64, #65, #66, #67, #70.
60 // 2026-10-31: 73,369 B / 28,212 B gz. validatePushRef: receive-pack's funny refname refused before sending (#73).
61 size('edit', 'min', min, 73_370);
62 // 2026-10-31: 73,090 B / 28,222 B gz. strict TS (T2: objects, format, validate, scrub): min down, gz up a few dozen bytes from strict-lint forms (/u regexes, Number.parseInt, explicit length checks, noUncheckedIndexedAccess guards) and identifier remangling.
63 // 2026-10-31: 72,968 B / 28,246 B gz. lsRefs reads an unborn HEAD through an injected reader (issue #103): the edit path pays for the result field and the request flag (+99 B min, +25 B gz), not the parser or the advertisement probe.
64 size('edit', 'gz', gz, 28_247);
65});
67test('merge entry: the line merge rides with merge/rebase only, under its own budget', async () => {
68 const out = await bundle('src/merge.ts');
69 const js = out.outputFiles[0].text, files = retained(out).map(([k]) => k);
70 assert.ok(files.includes('linemerge.js'));
71 assert.ok(!/node:|\bclass\s+\w+\s*(extends\s+[\w.]+\s*)?\{/.test(js), 'no node builtins or classes');
72 const min = js.length, gz = gzipSync(js, { level: 9 }).length;
73 console.log(` merge bundle: ${min} B min, ${gz} B gz; modules: ${retained(out).map(([k, b]) => `${k}=${b}`).join(' ')}`);
74 // 2026-10-20: 63.9 KB — line merge (xdiff port incl. Myers) ≈ 10.4 KB, .gitattributes ≈ 5.5 KB; the edit bundle carries neither
75 // 2026-10-23: 67.4 KB with the blob:none fallback (fetchPackTree0, fetchWide)
76 // 2026-10-25: 72.5 KB. The same parser checks the edit and read bundles grew by.
77 // 2026-10-27: 77,245 B. Merge validates idents before I/O and the ancestors walk is an index, not q.shift.
78 // 2026-10-27: 78,147 B. The same http.js advertisement and header checks, plus parsers taking transport limits.
79 // 2026-10-30: 78,403 B. The same pre-send push refusal, and encodeTree refusing a duplicate name (issue #11).
80 // 2026-10-30: 78,515 B. The same size-varint cap (issue #13).
81 // 2026-10-30: 78,548 B. The same delta chain bound (issue #14).
82 // 2026-10-30: 80,062 B. The same credential scrub and redirect refusal (issue #15).
83 // 2026-10-30: 80,435 B. The same, plus the [:class:] table as a Map (issue #16).
84 // 2026-10-30: 80,904 B. The walk's packs held to the deepen contract and checked with assertFetched before harvest (issue #18).
85 // 2026-10-30: 81,313 B. The same URL userinfo handling (issue #32).
86 // 2026-10-30: 81,582 B. The same pack-byte cap in v2Step, zlib-length bound and push band-2 cap (issue #36).
87 // 2026-10-30: 82,181 B. The same credential handling (issue #40).
88 // 2026-10-30: 81,669 B. The same checkWide, also on the merge-base walk's blob:none packs (issue #46).
89 // 2026-10-30: 82,537 B. merge of #48 and #47 (credential handling, issue #40, with checkWide, issue #46).
90 // 2026-10-30: 82,807 B. merge of #49 and #48 (body and zlib bounds, issue #36, with credential handling, issue #40).
91 // 2026-10-30: 81,637 B. The same parseTree duplicate and order rules (issue #34).
92 // 2026-10-30: 83,907 B. The same push outcome allowlist (SAFETY.md I36).
93 // 2026-10-30: 81,773 B. A settled cut one best base reaches and another does not keeps the merge-base walk going (#42);
94 // rebase fetches a base named only at the window's cut (#41).
95 // 2026-10-30: 83,592 B. The same, plus .gitattributes paths matched on their bytes and an annotated tag refused by name (issue #43).
96 // 2026-10-30: 87,511 B. merge of #49, #50, #51, #52, #53, #55 and #54 on main (train/1): #36 caps, #34 parseTree, the push outcome space, #41/#42 merge base, #43 bytes, #35 span contract.
97 // 2026-10-31: 89,918 B. parseTree is fsck_tree: utf8.c/path.c's .git and .gitmodules spellings, nullSha1, largePathname, dotfiles that are not blobs, canon_mode (hole #4, space/fsck-tree).
98 // 2026-10-31: 91,966 B. release/1: train/1, #19, #57, #58, #62, #64, #65, #66, #67, #70.
99 // 2026-10-31: 92,121 B. validatePushRef: receive-pack's funny refname refused before sending (#73).
100 size('merge', 'min', min, 92_122);
101});
103test('log entry: readLog carries no push, merge, pack building or rebase code', async () => {
104 const out = await bundle('src/log.ts');
105 const js = out.outputFiles[0].text, files = retained(out).map(([k]) => k);
106 // discover.js: an unborn HEAD is classified from the advertisement, and only after a ref miss (read.js). client.js stays out.
107 for (const f of ['push.js', 'pack.js', 'merge.js', 'linemerge.js', 'rebase.js', 'attributes.js', 'edit.js', 'sign.js', 'negotiate.js', 'receivecaps.js', 'client.js', 'tree.js', 'checkout.js']) assert.ok(!files.includes(f), `${f} is in the log bundle`);
108 const ABSENT = { 'receive-pack': /git-receive-pack|report-status/, 'pack building': /buildPack|zlibDeflate|CompressionStream/, 'classes': /\bclass\s+\w+\s*(extends\s+[\w.]+\s*)?\{/, 'node builtins': /node:/ };
109 for (const [what, re] of Object.entries(ABSENT)) assert.ok(!re.test(js), `${what} leaked into the log bundle (${re})`);
110 const min = js.length, gz = gzipSync(js, { level: 9 }).length;
111 console.log(` log bundle: ${min} B min, ${gz} B gz; modules: ${retained(out).map(([k, b]) => `${k}=${b}`).join(' ')}`);
112 // 2026-10-30: 43,164 B / 17,227 B gz, first measured (issue #56): ls-refs, the commit-only window (fetchPackTree0
113 // with the blob:none fallback, so the delta resolver), the deepen-contract check and readCommit's commit view.
114 // 2026-10-31: 49,521 B / 19,807 B gz. release/1: train/1, #19, #57, #58, #62, #64, #65, #66, #67, #70.
115 size('log', 'min', min, 49_522);
116 size('log', 'gz', gz, 19_808);
117});
119test('full entry is the superset and still carries no node builtins', async () => {
120 const out = await build({ entryPoints: ['src/index.ts'], bundle: true, format: 'esm', minify: true, write: false, logLevel: 'silent', metafile: true });
121 const js = out.outputFiles[0].text;
122 assert.ok(!/node:/.test(js));
123 for (const f of ['packresolve.js', 'fetchpack.js', 'negotiate.js', 'receivecaps.js', 'discover.js', 'client.js', 'packcache.js', 'edit.js']) assert.ok(retained(out).map(([k]) => k).includes(f), `${f} missing from full bundle`);
124 console.log(` full bundle: ${js.length} B min, ${gzipSync(js, { level: 9 }).length} B gz`);
125});
127test('read entry: readFile/listTree carry no push, merge, pack building or rebase code', async () => {
128 const out = await bundle('src/read.ts');
129 const js = out.outputFiles[0].text, files = retained(out).map(([k]) => k);
130 // discover.js: an unborn HEAD is classified from the advertisement, and only after a ref miss. client.js stays out.
131 for (const f of ['push.js', 'pack.js', 'merge.js', 'linemerge.js', 'rebase.js', 'attributes.js', 'edit.js', 'sign.js', 'fetchpack.js', 'negotiate.js', 'receivecaps.js', 'client.js']) assert.ok(!files.includes(f), `${f} is in the read bundle`);
132 const ABSENT = { 'receive-pack': /git-receive-pack|report-status/, 'pack building': /buildPack|zlibDeflate|CompressionStream/, 'line merge': /histogram|xdl_/, 'classes': /\bclass\s+\w+\s*(extends\s+[\w.]+\s*)?\{/, 'node builtins': /node:/ };
133 for (const [what, re] of Object.entries(ABSENT)) assert.ok(!re.test(js), `${what} leaked into the read bundle (${re})`);
134 const min = js.length, gz = gzipSync(js, { level: 9 }).length;
135 console.log(` read bundle: ${min} B min, ${gz} B gz; modules: ${retained(out).map(([k, b]) => `${k}=${b}`).join(' ')}`);
136 // 2026-10-23: 36.3 KB / 13.9 KB gz, of which packresolve.js 4.2 KB is the blob:none fallback's delta resolver
137 // 2026-10-25: 42.0 KB / 16.0 KB gz. take(), format facts, and fsck checks in parseTree/assertFetched.
138 // 2026-10-27: 44,745 B / 17,299 B gz. Tree and commit parsers take the transport caps, and ls-refs requires the flush.
139 // 2026-10-27: 45,553 B / 17,616 B gz. The read path uses the same capped HTTP advertisement and error-page reader.
140 // 2026-10-30: 45,568 B / 17,625 B gz. openBlob is exported for checkout.js (issue #12): its name is no longer mangled.
141 // 2026-10-30: 45,680 B / 17,679 B gz. The same size-varint cap, which bounds openBlob's header phase (issue #13).
142 // 2026-10-30: 45,713 B / 17,690 B gz. The same delta chain bound (issue #14).
143 // 2026-10-30: 47,227 B / 18,349 B gz. The same credential scrub and redirect refusal (issue #15).
144 // 2026-10-30: 47,398 B / 18,400 B gz. The same ls-refs attribute whitelist and scrub walk (issue #16).
145 // 2026-10-30: 47,393 B / 18,399 B gz. openBlob's pump failure records itself and ends both spans (failHere); with #16 merged it minifies under the budget above.
146 // 2026-10-30: 47,831 B / 18,565 B gz. The same URL userinfo handling (issue #32).
147 // 2026-10-30: 48,307 B / 18,778 B gz. The same pack-byte cap and zlib-length bound, which is what caps openBlob's body; openBlob's stream wraps DecompressionStream's refusals as pack_corrupt (issue #36).
148 // 2026-10-30: 48,703 B / 18,909 B gz. The same credential handling (issue #40).
149 // 2026-10-30: 48,192 B / 18,710 B gz. The same checkWide (issue #46).
150 // 2026-10-30: 49,064 B / 19,053 B gz. merge of #48 and #47 (credential handling, issue #40, with checkWide, issue #46).
151 // 2026-10-30: 49,538 B / 19,272 B gz. merge of #49 and #48 (body and zlib bounds, issue #36, with credential handling, issue #40).
152 // 2026-10-30: 48,142 B / 18,699 B gz. The same parseTree duplicate and order rules (issue #34).
153 // 2026-10-30: 47,849 B / 18,572 B gz. errors.js gains push_partial (SAFETY.md I36); no push code rides along.
154 // 2026-10-30: 49,816 B / 19,369 B gz. The same bytes-as-strings mapping (issue #43).
155 // 2026-10-30: 49,381 B / 19,155 B gz. git.read.blob follows the root and records a consumer's cancel (issue #35).
156 // 2026-10-30: 51,502 B / 20,042 B gz. merge of #49, #50, #51, #52, #53, #55 and #54 on main (train/1): #36 caps, #34 parseTree, the push outcome space, #41/#42 merge base, #43 bytes, #35 span contract.
157 // 2026-10-31: 53,946 B / 21,069 B gz. parseTree is fsck_tree: utf8.c/path.c's .git and .gitmodules spellings, nullSha1, largePathname, dotfiles that are not blobs, canon_mode (hole #4, space/fsck-tree).
158 // 2026-10-31: 55,816 B / 21,786 B gz. release/1: train/1, #19, #57, #58, #62, #64, #65, #66, #67, #70.
159 size('read', 'min', min, 55_817);
160 // 2026-10-31: 55,506 B / 21,791 B gz. T2 strict TS (see the edit budget).
161 // 2026-10-31: 55,484 B / 21,805 B gz. lsRefs' unborn field and request flag (issue #103; see the edit budget).
162 size('read', 'gz', gz, 21_806);
163});
165test('tree entry: pushTree is Workers-safe; the directory walk (node:fs) lives only in tree-node.js', async () => {
166 const out = await bundle('src/tree.ts');
167 const js = out.outputFiles[0].text, files = retained(out).map(([k]) => k);
168 for (const f of ['tree-node.js', 'merge.js', 'linemerge.js', 'rebase.js', 'attributes.js', 'read.js', 'fetchpack.js', 'negotiate.js', 'receivecaps.js', 'client.js', 'discover.js']) assert.ok(!files.includes(f), `${f} is in the tree bundle`);
169 assert.ok(!/node:|\bclass\s+\w+\s*(extends\s+[\w.]+\s*)?\{/.test(js), 'no node builtins or classes');
170 const min = js.length, gz = gzipSync(js, { level: 9 }).length;
171 console.log(` tree bundle: ${min} B min, ${gz} B gz; modules: ${retained(out).map(([k, b]) => `${k}=${b}`).join(' ')}`);
172 // 2026-10-30: 57,232 B / 22,070 B gz, first measured (issue #11): the edit path's fetch and push plus encodeTree,
173 // makeDelta and the tree diff; no streamed blob scanner, no merge.
174 // 2026-10-30: 57,344 B / 22,128 B gz. The same size-varint cap (issue #13).
175 // 2026-10-30: 57,377 B / 22,136 B gz. The same delta chain bound (issue #14).
176 // 2026-10-30: 58,891 B / 22,787 B gz. The same credential scrub and redirect refusal (issue #15).
177 // 2026-10-30: 59,096 B / 22,842 B gz. The same (issue #16).
178 // 2026-10-30: 59,520 B / 23,000 B gz. The same URL userinfo handling (issue #32).
179 // 2026-10-30: 59,849 B / 23,158 B gz. The same pack-byte cap, zlib-length bound and push band-2 cap (issue #36).
180 // 2026-10-30: 60,391 B / 23,353 B gz. The same credential handling (issue #40).
181 // 2026-10-30: 59,881 B / 23,141 B gz. The same checkWide (issue #46).
182 // 2026-10-30: 60,752 B / 23,494 B gz. merge of #48 and #47 (credential handling, issue #40, with checkWide, issue #46).
183 // 2026-10-30: 61,079 B / 23,631 B gz. merge of #49 and #48 (body and zlib bounds, issue #36, with credential handling, issue #40).
184 // 2026-10-30: 59,847 B / 23,153 B gz. The same parseTree duplicate and order rules (issue #34).
185 // 2026-10-30: 62,111 B / 23,985 B gz. The same push outcome allowlist (SAFETY.md I36).
186 // 2026-10-30: 61,621 B / 23,854 B gz. The same (issue #43).
187 // 2026-10-30: 65,489 B / 25,330 B gz. merge of #49, #50, #51, #52, #53, #55 and #54 on main (train/1): #36 caps, #34 parseTree, the push outcome space, #41/#42 merge base, #43 bytes, #35 span contract.
188 // 2026-10-31: 67,878 B / 26,343 B gz. parseTree is fsck_tree: utf8.c/path.c's .git and .gitmodules spellings, nullSha1, largePathname, dotfiles that are not blobs, canon_mode (hole #4, space/fsck-tree).
189 // 2026-10-31: 69,891 B / 27,043 B gz. release/1: train/1, #19, #57, #58, #62, #64, #65, #66, #67, #70.
190 // 2026-10-31: 70,045 B / 27,104 B gz. validatePushRef: receive-pack's funny refname refused before sending (#73).
191 size('tree', 'min', min, 70_046);
192 // 2026-10-31: 69,763 B / 27,134 B gz. T2 strict TS (see the edit budget).
193 size('tree', 'gz', gz, 27_135);
194 const full = await build({ entryPoints: ['src/index.ts'], bundle: true, format: 'esm', write: false, logLevel: 'silent', metafile: true });
195 assert.ok(!retained(full).map(([k]) => k).includes('tree-node.js'), 'the full entry does not carry the Node walk');
196 const node = await build({ entryPoints: ['src/tree-node.ts'], bundle: true, format: 'esm', platform: 'node', write: false, logLevel: 'silent' });
197 assert.match(node.outputFiles[0].text, /node:fs\/promises/);
198 // src/ imports node: builtins in exactly the three Node adapters
199 const { readdirSync, readFileSync } = await import('node:fs');
200 const withNode = readdirSync('src').filter(f => /\.[jt]s$/.test(f) && /from 'node:/.test(readFileSync(`src/${f}`, 'utf8'))).sort();
201 assert.deepEqual(withNode, ['checkout-node.ts', 'repo-node.ts', 'tree-node.ts']);
202});
204test('checkout entry: checkoutTree is Workers-safe and carries no push or merge code; the directory writer is checkout-node.js', async () => {
205 const out = await bundle('src/checkout.ts');
206 const js = out.outputFiles[0].text, files = retained(out).map(([k]) => k);
207 // discover.js: checkout resolves refs through read.js, which classifies an unborn HEAD from the advertisement. client.js stays out.
208 for (const f of ['checkout-node.js', 'tree-node.js', 'tree.js', 'push.js', 'pack.js', 'edit.js', 'merge.js', 'linemerge.js', 'rebase.js', 'attributes.js', 'sign.js', 'negotiate.js', 'receivecaps.js', 'client.js']) assert.ok(!files.includes(f), `${f} is in the checkout bundle`);
209 const ABSENT = { 'receive-pack': /git-receive-pack|report-status/, 'pack building': /buildPack|zlibDeflate|CompressionStream/, 'classes': /\bclass\s+\w+\s*(extends\s+[\w.]+\s*)?\{/, 'node builtins': /node:/ };
210 for (const [what, re] of Object.entries(ABSENT)) assert.ok(!re.test(js), `${what} leaked into the checkout bundle (${re})`);
211 const min = js.length, gz = gzipSync(js, { level: 9 }).length;
212 console.log(` checkout bundle: ${min} B min, ${gz} B gz; modules: ${retained(out).map(([k, b]) => `${k}=${b}`).join(' ')}`);
213 // 2026-10-30: 42,396 B / 16,829 B gz, first measured (issue #12): the read path's ls-refs and blob stream, plus the
214 // buffered fetchPack and delta resolver for the tree pack and the blob batches. Smaller than the read entry because
215 // it does not carry readFile's tree:0 walk or readCommit's views.
216 // 2026-10-30: 42,508 B / 16,894 B gz. The same size-varint cap (issue #13).
217 // 2026-10-30: 42,541 B / 16,901 B gz. The same delta chain bound (issue #14).
218 // 2026-10-30: 44,055 B / 17,546 B gz. The same credential scrub and redirect refusal (issue #15).
219 // 2026-10-30: 44,226 B / 17,576 B gz. The same ls-refs attribute whitelist and scrub walk (issue #16).
220 // 2026-10-30: 44,221 B / 17,573 B gz. The same openBlob pump-failure span fix, with #16 merged.
221 // 2026-10-30: 44,658 B / 17,768 B gz. The same URL userinfo handling (issue #32).
222 // 2026-10-30: 45,292 B / 18,032 B gz. The same pack-byte cap, zlib-length bound and openBlob stream wrap (issue #36).
223 // 2026-10-30: 45,530 B / 18,115 B gz. The same credential handling (issue #40).
224 // 2026-10-30: 44,697 B / 17,804 B gz. fetchPackOnce takes a `check` for fetchPackTree0 (issue #46); checkWide itself is shaken out.
225 // 2026-10-30: 45,569 B / 18,149 B gz. merge of #48 and #47 (credential handling, issue #40, with checkWide, issue #46).
226 // 2026-10-30: 46,201 B / 18,389 B gz. merge of #49 and #48 (body and zlib bounds, issue #36, with credential handling, issue #40).
227 // 2026-10-30: 44,984 B / 17,893 B gz. The same parseTree duplicate and order rules (issue #34).
228 // 2026-10-30: 44,676 B / 17,775 B gz. errors.js gains push_partial (SAFETY.md I36); no push code rides along.
229 // 2026-10-30: 46,321 B / 18,459 B gz. The same (issue #43).
230 // 2026-10-30: 45,887 B / 18,246 B gz. The same blob-stream cancel and follows spans (issue #35).
231 // 2026-10-30: 48,181 B / 19,164 B gz. merge of #49, #50, #51, #52, #53, #55 and #54 on main (train/1): #36 caps, #34 parseTree, the push outcome space, #41/#42 merge base, #43 bytes, #35 span contract.
232 // 2026-10-31: 50,542 B / 20,121 B gz. parseTree is fsck_tree: utf8.c/path.c's .git and .gitmodules spellings, nullSha1, largePathname, dotfiles that are not blobs, canon_mode (hole #4, space/fsck-tree).
233 // 2026-10-31: 52,917 B / 20,911 B gz. release/1: train/1, #19, #57, #58, #62, #64, #65, #66, #67, #70.
234 size('checkout', 'min', min, 52_918);
235 // 2026-10-31: 52,604 B / 20,928 B gz. T2 strict TS (see the edit budget).
236 size('checkout', 'gz', gz, 20_929);
237 const full = await build({ entryPoints: ['src/index.ts'], bundle: true, format: 'esm', write: false, logLevel: 'silent', metafile: true });
238 assert.ok(!retained(full).map(([k]) => k).includes('checkout-node.js'), 'the full entry does not carry the Node writer');
239 const node = await build({ entryPoints: ['src/checkout-node.ts'], bundle: true, format: 'esm', platform: 'node', write: false, logLevel: 'silent' });
240 assert.match(node.outputFiles[0].text, /node:fs\/promises/);
241});
243test('repo entry: pushRepo (node:fs) lives only in repo-node.js; the delta generator stays out of the edit, tree and checkout bundles', async () => {
244 for (const entry of ['src/edit.ts', 'src/tree.ts', 'src/checkout.ts']) {
245 const files = retained(await bundle(entry)).map(([k]) => k);
246 for (const f of ['delta.js', 'repo-node.js']) assert.ok(!files.includes(f), `${f} is in the ${entry} bundle`);
247 }
248 const full = await build({ entryPoints: ['src/index.ts'], bundle: true, format: 'esm', write: false, logLevel: 'silent', metafile: true });
249 const inFull = retained(full).map(([k]) => k);
250 assert.ok(!inFull.includes('repo-node.js'), 'the full entry does not carry the Node repository reader');
251 assert.ok(inFull.includes('delta.js'), 'encodeDelta and planDeltas are on the full entry');
252 const node = await build({ entryPoints: ['src/repo-node.ts'], bundle: true, format: 'esm', platform: 'node', write: false, logLevel: 'silent' });
253 assert.match(node.outputFiles[0].text, /node:fs\/promises/);
254});
Diagnostics4 git calls · 29 ms
CallStatusSizeTime029 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=23 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
fetch2006.7 KiB · hit23 ms
git.upload-pack fetch http.response.status_code=200 git.response.bytes=6830 git.response.cache=HIT git.response.duration_ms=23 git.fetch.wants=2f7724d83fab80513a3a387b1124d363d10f0b40 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=6830 git.pkt.payload.max=6809 git.sideband.band1.bytes=6808 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
- a5e20dc508807f3b
- Request
- bedacf0d…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format