Found while measuring the shard package set for #10016. Filed unassigned. Inert today — nothing reads the stale field — which is why this is an observation rather than a bug report.
scripts/check-cross-package-test-inputs.mjs's unionInto() reads the turbo ls --output=json payload, pushes the newly-unioned packages onto parsed.packages.items, and writes the document back:
items.push({ name,path: join(REPO_ROOT,dir)});…writeFileSync(listPath,JSON.stringify(parsed));parsed.packages.count is never touched. Measured on main (c1731d023) with a changed-file list of exactly scripts/sync-template-versions.mjs:
$ node scripts/check-cross-package-test-inputs.mjs --union-into ls.json --changed changed.txt
Cross-package scans pulled into this run because the diff touched their declared inputs:
+ @objectstack/spec (declared glob matched scripts/sync-template-versions.mjs)
+ create-objectstack (declared glob matched scripts/sync-template-versions.mjs)
$ # the resulting document:
count: 0 items: ['@objectstack/spec', 'create-objectstack']
turbo ls --affected returns ZERO packages for that diff, so count stays at the pre-union 0 while items carries two — the document now says two contradictory things about its own size.
Why it is harmless today, stated so nobody has to re-derive it: the only consumer, scripts/partition-test-shards.mjs, reads parsed?.packages?.items and never count; I grepped both scripts and neither mentions packages.count.
Why it is still worth closing:partition-test-shards.mjs deliberately asserts the payload shape loudly — its header says turbo ls is experimental and "the partition script asserts its output shape loudly so an upgrade that changes it turns into a red step naming the cause, not a silently empty shard". A hand-mutated document that no longer satisfies its own schema is the input to that assertion. A future consumer (or a turbo ls upgrade that makes count authoritative) reaching for the obvious field would compute an empty or truncated shard, and the failure shape is the silent one the surrounding machinery exists to prevent: a green Test Core that tested nothing.
Two candidate fixes, both one line, and the choice is a judgment I did not want to make in passing:
- set
parsed.packages.count = items.length before the write — keeps the document a valid turbo ls payload; or - delete
parsed.packages.count — makes any consumer that reaches for it fail loudly rather than read a plausible wrong number, which is more in keeping with this script's "the default for an undeclared scan is a RED GATE, never a silent skip" posture.
Either way a --self-test case pinning the invariant would keep it from rotting back.
Refs: #10016 (where this surfaced), #7802 (the failure family this script exists for).
Generated by Claude Code
Found while measuring the shard package set for #10016. Filed unassigned. Inert today — nothing reads the stale field — which is why this is an observation rather than a bug report.
scripts/check-cross-package-test-inputs.mjs'sunionInto()reads theturbo ls --output=jsonpayload, pushes the newly-unioned packages ontoparsed.packages.items, and writes the document back:parsed.packages.countis never touched. Measured onmain(c1731d023) with a changed-file list of exactlyscripts/sync-template-versions.mjs:turbo ls --affectedreturns ZERO packages for that diff, socountstays at the pre-union0whileitemscarries two — the document now says two contradictory things about its own size.Why it is harmless today, stated so nobody has to re-derive it: the only consumer,
scripts/partition-test-shards.mjs, readsparsed?.packages?.itemsand nevercount; I grepped both scripts and neither mentionspackages.count.Why it is still worth closing:
partition-test-shards.mjsdeliberately asserts the payload shape loudly — its header saysturbo lsis experimental and "the partition script asserts its output shape loudly so an upgrade that changes it turns into a red step naming the cause, not a silently empty shard". A hand-mutated document that no longer satisfies its own schema is the input to that assertion. A future consumer (or aturbo lsupgrade that makescountauthoritative) reaching for the obvious field would compute an empty or truncated shard, and the failure shape is the silent one the surrounding machinery exists to prevent: a greenTest Corethat tested nothing.Two candidate fixes, both one line, and the choice is a judgment I did not want to make in passing:
parsed.packages.count = items.lengthbefore the write — keeps the document a validturbo lspayload; orparsed.packages.count— makes any consumer that reaches for it fail loudly rather than read a plausible wrong number, which is more in keeping with this script's "the default for an undeclared scan is a RED GATE, never a silent skip" posture.Either way a
--self-testcase pinning the invariant would keep it from rotting back.Refs: #10016 (where this surfaced), #7802 (the failure family this script exists for).
Generated by Claude Code