Uh oh!
There was an error while loading. Please reload this page.
docs(tooling): rewrite metadata's DEBT note to its measured composition - #10775
Merged
Conversation
`DEBT['@objectstack/metadata']` recorded `errors: 89` while its own note itemised 34 + 24 + 34 = 92 and stated "Re-measured 92 at 5ab0842". The entry was evidently lowered 92 -> 89 without the note being rewritten alongside it, the same class PR #10721 just repaired for `@objectstack/service-automation`. Prose only. `errors: 89` is unchanged -- re-measured at 4b84834 against a built dependency closure, the package reports exactly 89. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DdCnBGcHeufjrq7drTD3wt
os-zhuang
marked this pull request as ready for review
August 21, 2026 11:13
os-zhuang
enabled auto-merge
August 21, 2026 11:14
Uh oh!
There was an error while loading. Please reload this page.
os-zhuang pushed a commit
that referenced
this pull request
Aug 21, 2026
…er minting the drift `DEBT`/`TEST_DEBT` pair a measured `errors` with free prose, and nothing read the prose: a note could narrate any count at all, including one its own field contradicted, with every gate green. Four hand repairs of that shape are on record (#7038, #8982, #10721, #10775), the last two on the same day. None of them closed the class, because `--lower` MINTS it -- its regex capture ends at the digits, so the sanctioned one-command way to close a surplus is also the way to desynchronise a note. Both halves land together, because neither is safe alone. A check without the tool fix leaves the ledger RED after the next `--lower` run, in whoever's PR ran it, breaking the "closing an entry is FREE" invariant #5278/#6376 paid for. The tool fix without the check leaves today's instances undetected. COMPOSITION reads exactly one thing -- the house-convention tier itemisation the notes already open with -- and abstains, silently, everywhere else. A tier counted twice or a further tier count later in the note means the note quotes its own history and the entry is skipped rather than guessed at. Per-code tallies (`TS2835 x67, ...`) are deliberately NOT summed: they are partial by construction, and plugin-rest's sums to 147 while saying "composition as counted at 153". `--lower` now plans a `compositionAt` declaration alongside each lowering that would strand an itemisation, and writes it as a sibling field beside the number it already locates -- no prose surgery, no invented composition. The staleness becomes a declared fact the check reads and the green summary reports, instead of a silent one nothing reads at all. `compositionAt` may only ever declare a pile LARGER than the field, so it cannot launder a raise. Measured: over all 33 entries on main, 11 are checked and 0 fire. Over the tree before #10721 landed, exactly the two known instances fire and nothing else. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DdCnBGcHeufjrq7drTD3wt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes#10723
DEBT['@objectstack/metadata']recordederrors: 89while its own note itemised34 + 24 + 34 = 92 and stated "Re-measured 92 at 5ab0842, up from 87". The entry was
evidently lowered 92 -> 89 without the note being rewritten alongside it — the same class
PR #10721 repaired for
@objectstack/service-automationan hour earlier.Prose only.
errors: 89is unchanged — no count moves.Measured, not adopted
Re-derived with the gate's own invocation (
tscErrorCount()'s), from the repo rootagainst a built dependency closure, at base
4b84834a32:89 exactly — matching the field.
TS2322, which the old note itemised at x4, ismeasurably absent (0 occurrences in the output).
The measurement is valid, not a silent zero: the output carries none of the codes in
the gate's own
TSC_SETUP_ERRORset (TS5058/5083/6053/18003/5012/2688), and tsc's exit 2came with 89 recognisable diagnostics, so the gate's "refusing to record 0" guard does not
fire.
What moved — and it is fully attributable
Against the composition the note itself recorded at 92:
-4 +1 +0 = -3, and 92 - 3 = 89. The delta closes exactly, so the new note states the
attribution rather than falling back on the file's own escape hatch at
:167-173("whenthe delta cannot be attributed, say so in the note rather than inventing composition").
Read across the entry's history, the code tier is the only churning one: TS2353 gave way
to TS2322, and TS2322 has now gone too. TS2345 x30 is its only lasting resident.
Two inherited claims re-derived — one of which never held
Per the dispatch, neither the tier split nor the per-file claim was carried forward
unchecked.
metadata.test.ts= 34 andregister-notifies-watchers.test.ts= 16 today, the same two numbers the note carried at92. The whole -3 landed in the other ten files.
the note claimed. It was not true at 92 either (50/92 = 54%), so this was a wrong claim
at both endpoints rather than a stale one. The rewrite says "over HALF" and names both
numbers it was wrong at.
The residue restated as what it actually is
The 89 is three mechanical repairs, not 89 problems:
metadata.test.tsbetween lines 608and 945, every one the same mock
PluginContextobject literal missingregisterServiceFactoryandgetServiceScoped. Verified rather than assumed: 30/30 ofthose diagnostics carry the identical "is not assignable to parameter of type
'PluginContext'" head and the identical "missing the following properties ...
registerServiceFactory, getServiceScoped" continuation. One shared fixture closes the
code tier outright.
import wanting an explicit
.jsextension undernode16resolution.Mutation verified, not assumed
This is a prose edit inside a multi-line string concatenation, exactly where a zero-match
edit reads as a clean no-op. Repo-wide phrase counts across
scripts/, before -> after:Re-measured 92 at 5ab08428code-tier 34 (TS2345 x30, TS2322 x4)Two thirds of the pileRe-measured 89 at 4b84834a32Re-measured(every ledger note)@objectstack/metadata...Re-measuredholding at 30 is the neighbour check — one occurrence was swapped for one, sono other entry's note moved. The replacement itself asserted a match count of exactly 1
before writing.
git diff --statis 1 file, +12/-4, and noerrors:line appears in thediff at all.
Deliberately not in this PR
:167-173speaks only about counts going up; this entry drifteddown. Extending that wording, and adding a note-vs-field consistency check, are [finding] nothing reads a DEBT/TEST_DEBT
note, and--lowerrewrites only the digits — so the advertised way to lower an entry desynchronises its prose by construction #10722— which names the mechanical cause:
lowerLedgerEntries()rewrites only theerrors:digits and never the note, so
--lowermints a fresh instance of this class every time itruns.
check:type-check-coveragewith a whole source directory outside tsc —packages/objectql/scripts/**is invisible to its owntypecheck#10756 is open against this same file about ledger completeness. Different aspect,untouched here.
Gates
Derived with
node scripts/pm/dispatch-gates.mjs(no paths — merge base4b84834a3,1 committed path, 0 working-tree, 0 untracked), then run at
464fe41468:check:type-check-coveragecheck:type-check-debt(--re-measure)check:cross-package-test-inputscheck:nul-bytesThe re-measure half refused correctly on the first attempt — "43 workspace
dependenc(ies) of the ledgered packages have no built type entry point on disk ... measuring
now would not fail, it would silently measure a DIFFERENT WORLD" — and was re-run after
pnpm exec turbo run build --filter='./packages/*' --filter='./packages/*/*'(70/70successful). That refusal is the evidence the number came from a real closure.
Its one informational line is
@objectstack/plugin-authTEST_DEBT 109 recorded vs 97measured — pre-existing, unrelated to this card, explicitly not an error, and already owned
by #6376 / #10615.
@objectstack/metadatais not among the surplus entries, which isthe gate's own independent confirmation that it measures its recorded 89 exactly.
No changeset: gate-ledger prose publishes nothing, so this carries
skip-changeset.Generated by Claude Code