Repository navigation
fix(units): raise the blank-unit debt of a unitField re-pointed at a new field; name unused code-keyed mapping entries; say what a capped walk did not judge - #37268
Conversation
…new field; name unused code-keyed mapping entries; say a capped walk judged only the rows it examined Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011y7As5bdhV5T4N9vpjmZzH
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011y7As5bdhV5T4N9vpjmZzH
📓 Docs Drift Check6 anchor(s) derived from 2 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run. What this run could not see
Coarse fallback — 27 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin f5ae5fb8f81f029b9a64b4db6adc8f5c36b3fb06 && git checkout f5ae5fb8f81f029b9a64b4db6adc8f5c36b3fb06
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 7939732f3520015a9201f924998632deda118ea6 0237272ee3f9eee0f4ed263f354ef3eb12dbb684 && git checkout -B drift-repro 7939732f3520015a9201f924998632deda118ea6 && git merge --no-ff 0237272ee3f9eee0f4ed263f354ef3eb12dbb684
node scripts/docs-audit/affected-docs.mjs --json 7939732f3520015a9201f924998632deda118ea6 |
|
repo:objectstack#7 · os-alice · session_011y7As5bdhV5T4N9vpjmZzH L1 review — PR #37268 at
|
|
repo:objectstack#7 · os-alice · session_011y7As5bdhV5T4N9vpjmZzH 席位核对 — ACCEPT · head 0237272
|
|
repo:objectstack#7 · os-alice · session_011y7As5bdhV5T4N9vpjmZzH Landing — seat arms #37268
|
repo:objectstack#7 · os-alice · session_011y7As5bdhV5T4N9vpjmZzH
Part of #35885
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
Three follow-up gaps of the unit-code backfill door (ADR-0158 R1), each inside the claim's file surface:
unitFieldre-pointed at a new field raises its blank-unit debt.detectDestructiveObjectChangesnow raises 409DESTRUCTIVE_CHANGEwithunit_mode_to_recordon a storedrecord-mode quantity whoseunitFieldis re-pointed at a field that held no stored unit before the save (new in it, or unstored before it). The message names the re-point, the blank beside every stored quantity, and the""entry of the unit-code run, CLI and REST. It reads no row andforce: truelifts it. The once-only rule ofnewlyDeclaredUnitCodeFieldsOfis kept: a re-point onto a stored text field still raisesunit_code_field_declaredalone (it names the quantity), and a re-point onto a field that already was a unit code field still raises nothing (thecurrency_field_repointedsibling, out of R1). Code choice: the existingunit_mode_to_record, not a newunit_field_repointed. The debt is the same blank-unit debt, the spec'sissues[].codedescribe text lists the codes and stays unchanged, and a new code would be apackages/specedit outside the claim.member,retired,other-dimension) that is also a mapping key no row used now carriesunusedEntry(the code that entry names) in the report, and the printed report adds one line per such entry. An entry that some row did use, for example in another organization where the text is not a unit, is not named.record-currency-backfill.tswrites over a walk themaxRecordscap cut short and reports it. The unit backfill now does the same thing in the same words: the printed report says the rows past the cap were not judged, so any of them may hold a value with no mapping entry, and that an apply run wrote only the rows it examined. An unscoped run also gets the currency report's line that the organization check saw only the rows examined. The CLI prints these lines from the shared formatter, so nopackages/cliedit was needed. Refusing apply over a truncated preview would be a narrowing the currency twin does not have.The module header of
unit-code-backfill.tsis amended. "One run converts the whole field or nothing" now holds over the rows the run examines.Read first (by risk):
packages/metadata-protocol/src/protocol-write-face.ts, the new re-point branch ahead of theunit_mode_to_recordswitch branch. The risk is the predicate:prevUnitField !== unitFieldand!prevUnitCodeFields.has(unitField), with thedeclaredUnitCodeFieldsgate shared with the switch branch.packages/objectql/src/protocol-destructive-unit-mode.test.ts, the new pin and the widened once-onlyit.eachloop, which now also checks re-points.packages/objectql/src/unit-code-backfill.ts, theunusedEntrypass after the walk and the truncated lines in the formatter.Tests
Readings taken on head
0237272ee3f(final commit; based62f9e9c05a).DESTRUCTIVE_CHANGE/unit_mode_to_record, assertingcodeandstatus. The test checks the message, reads no row, and confirmsforce: truelifts it. The once-onlyit.eachgains two re-point cases, and its debt loop now covers re-points as well as switches.unit-code-backfill.test.ts:unusedEntryand its report line, and an apply run capped at 2 rows. That run writes the 2 rows it examined, leaves the unseen unmatched rows as stored, prints the not-judged line, and the uncapped run is still refusedVALIDATION_ERROR/ 400.Package tests and typecheck
pnpm --filter @objectstack/objectql --filter @objectstack/metadata-protocol typecheck, then each package'spnpm test, under the verify lock:VERDICT command-exit 0.Test Files 370 passed | 9 skipped (379),Tests 23417 passed | 45 skipped (23462).Test Files 638 passed (638),Tests 14428 passed (14428).Test Files 3 passed (3),Tests 75 passed (75), for the destructive-unit-mode, unit-code backfill and record-currency backfill test files.Ablations (one per fix, through scripts/ablation-replace.mjs; each restored, blob equals HEAD and git diff HEAD is empty)
prevUnitField !== unitFieldwas changed to a never-true comparison. metadata-protocol was rebuilt, andablation-dist-preflightfound the marker present in 2 built files. Result: 3 failed, 21 passed, namely the new pin and the two newit.eachre-point cases. Restore leg: rebuilt, and the marker is absent from all 24 built files.unusedEntryassignment was removed. Result: 1 failed, 28 passed, the new N3 pin.Gates
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack(69 families). Each one was run locally, with its exit code captured before any pipe.pnpm check:dual-build-cjs-loadsexited 3,PREREQUISITE NOT MET — this gate reads built output, and some package has no dist/. That is NOT MEASURED, because a fullpnpm buildwas not run. CI'sLint & Repo Gatesmeasures it.--ranreconciliation:69 derived, 69 run, 0 NOT-MEASURED, 0 UNRUN. The runner's NOT-MEASURED claim is corrected by the dual-build line above.Acceptance notes
docs/adr/**is outside the claim's file surface and is a governed Tier H path, which would make this code PR Tier H. So this PR saysPart of, and the amendment is left to the owning seat as its own ADR-note PR. Proposed text: in Open item 9, replace the sentence carried by the card with "AunitFieldre-pointed onto a field new in the same save, or unstored before it, raisesunit_mode_to_recordon the quantity, for the blanks beside it; one re-pointed onto a field that already was a unit code field raises nothing in R1 (the sibling ofcurrency_field_repointed)". In Open item 12's Dry-run-and-apply point, replace "A preview cut short at its row limit is reported as truncated" with "A walk cut short at its row limit judges only the rows it examined: an apply run writes those, and the report says that the rows past the limit were not judged, as the currency backfill's does; a mapping entry whose key is stored as a unit code and that no row used is named in the report".unit_mode_to_recorddescribe in the spec (issues[].code) and the generated protocol reference are unchanged: the code list did not move.packages/cliuntouched: the CLI prints the formatter's lines. Its ownunit-codestests were not run locally (the package's public face is additive, an optional field); CI'sTest Coreruns them.Verification
Run
pnpm --filter @objectstack/objectql exec vitest run --maxWorkers=2 src/protocol-destructive-unit-mode.test.ts src/unit-code-backfill.test.tsafter building metadata-protocol. Expect every test to pass, including the three new pins named above.Generated by Claude Code