Repository navigation
fix(spec): one rename rule for every unknown-key suggester - #35639
Conversation
ObjectSchema.create() and defineSeed carried their own copy of the max(2, len/3) budget without the short-key screen the strict refusal gained, so a short key still drew an unrelated guess there. The budget and screen now live once in shared/rename-guess.ts (a leaf, not re-exported), and all three doors call suggestRename. Claude-Session: https://claude.ai/code/session_01L6bhgUZrkMKgGrXXe8zPGq Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6bhgUZrkMKgGrXXe8zPGq Co-authored-by: Claude <noreply@anthropic.com>
…; changeset Claude-Session: https://claude.ai/code/session_01L6bhgUZrkMKgGrXXe8zPGq Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6bhgUZrkMKgGrXXe8zPGq Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 3 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
What this run could not see
Coarse fallback — 174 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 5e2e661ef88f302a62a07e4ad5d7ec8b16e2c6c9 && git checkout 5e2e661ef88f302a62a07e4ad5d7ec8b16e2c6c9
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 2495486fd542c9aa1d48bfda32fae3b3f6a48a61 945afc35d4a67b11f297c257be5f69a819c80ebe && git checkout -B drift-repro 2495486fd542c9aa1d48bfda32fae3b3f6a48a61 && git merge --no-ff 945afc35d4a67b11f297c257be5f69a819c80ebe
node scripts/docs-audit/affected-docs.mjs --json 2495486fd542c9aa1d48bfda32fae3b3f6a48a61
|
|
repo:objectstack#1 · os-sales · session_01L6bhgUZrkMKgGrXXe8zPGq Contract review brief — PR #35639 @
|
|
repo:objectstack#1 · os-sales · session_01L6bhgUZrkMKgGrXXe8zPGq Final green head · 2026-11-19T20:44Z · Generated by Claude Code |
|
repo:objectstack#1 · os-sales · session_01L6bhgTcFanGhTvqS1V2Q4U 维护者速读
席位核对 — ACCEPT (L1-a) · repo:objectstack#1 · head
|
lintAuthoredRecordKeys passed a flat distance of 3 to findClosestMatches; it now calls suggestRename like the other unknown-key doors. The leaf's header names every door, and the class guard also refuses a hand-passed distance. Claude-Session: https://claude.ai/code/session_01L6bhgUZrkMKgGrXXe8zPGq Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#1 · os-sales · session_01L6bhgUZrkMKgGrXXe8zPGq Contract review brief — PR #35639 @
|
|
repo:objectstack#1 · os-sales · session_01L6bhgUZrkMKgGrXXe8zPGq Final head · 2026-11-19T21:30Z · Generated by Claude Code |
|
repo:objectstack#1 · os-sales · session_01L6bhgTcFanGhTvqS1V2Q4U 维护者速读
席位核对 — ACCEPT (L1-a, delta) · repo:objectstack#1 · head
|
|
repo:objectstack#1 · os-sales · session_01L6bhgUZrkMKgGrXXe8zPGq Contract reviewServed-tier: Inputs read: card #35420 (body and all 7 comments), PR #35639 (body, 17-file list, net diff ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgmentNo must-fix, no should-fix. Per
Implementing file:
Nits (none affects correctness or the contract):
Implemented-by: VERDICT: PASS Generated by Claude Code |
|
repo:objectstack#1 · os-sales · session_01L6bhgUZrkMKgGrXXe8zPGq Landing · 2026-11-19T21:35Z · head
State change: Generated by Claude Code |
|
repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob L2 adoption · 2026-11-19T21:36Z · The seat adopts area b1-C's isolated record 7022843538 for head The nits are dispositioned as follows. N4 is fixed in the body. N1, N2, N3 and N5 are accepted. N1 asks for an |
Requested by Sales · project thread
Part of #35420 — the shared budget rule lands here; the retired-key half (the card's last sentence) needs no code change under the standing ruling, see Acceptance notes. The card is closed by hand after merge with that reading.
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
One rename rule for every unknown-key suggester in
packages/spec, in a new leaf modulepackages/spec/src/shared/rename-guess.ts(imports nothing; not re-exported fromshared/index.ts, likealias-probe.ts):renameBudget(key)=max(2, floor(len / 3)), andsuggestRename(key, knownKeys)= the settled rule from the strict refusal: above five characters the firstfindClosestMatchesanswer inside the budget; at five or fewer only a candidate one edit away, an adjacent swap counted as one; nothing for an empty key.levenshteinDistanceandfindClosestMatchesmoved into the leaf with their docblocks verbatim and are re-exported fromsuggestions.zod.ts, so the published names and import path are unchanged (check:api-surfacegreen;export-origins/regenerated for the two moved origins). The leaf exists sodata/*.zod.tscan share the rule without a cycle throughsuggestions.zod.tsand without adding a published export.strictUnknownKeyError(unchanged behaviour),ObjectSchema.create()(its privateeditDistance+suggestKeycopy is deleted)defineSeed(its inlinemax(2, floor(len / 3))is deleted) and the authoring-key lintlintAuthoredRecordKeysindata/authoring-key-lint.ts, whichdefineStackand the CLI report through (its flatfindClosestMatches(key, candidates, 3, 1)is replaced; thehint?.to ?? (hint?.why ? undefined : …)precedence is unchanged). The leaf's header now names every unknown-key door; the value-vocabulary suggesters (error-map.zod.tsenum hint,suggestFieldType) stay onfindClosestMatches' default on purpose.field-value.zod.tsanddefault-value-shape.tsheld no code copy: they read the rule throughstrictObjectalready. Their comments restated the old budget and lookup and now namesuggestRename.strictUnknownKeyErrordocblock said its fallback matchedsuggestKeyinobject.zod.ts(comment 7004171725); it now namessuggestRename, which both doors call, so the sentence is true by construction.packages/rest/src/rest-meta-packaged-action-permission-refusal.test.tsnamed the retired data route for the permission-set clone; it now namesPOST /api/v1/security/permission-sets/:name/clone, the route the regime table's refusal spells.Observable change, suggestion text only:
ObjectSchema.create({ page: 1 })no longer says "did you meanname",defineSeedno longer answers a record keykindwithid, and the authoring-key report no longer answersariawithareasor an eight-character key three edits away (descrptn) at all, whiledfltValue→defaultValue(nine characters, budget 3) is still answered. One-edit slips (nmae,labl,queeu) are still answered. No key is accepted or refused differently.Tests
Pins, one per door, plus the rule and a class guard
data/object.test.ts:pagegets no rename;nmae→name,labl→labelstill answered.data/define-seed-record-keys.test.ts:kindgets no rename;queeu→queue(adjacent swap) still answered.data/field-value.test.ts:LocationValueSchemalongets no rename;lgn→lngstill answered.data/default-value-shape.test.ts:checkLiteralDefaultValueon a location default, same pair.data/authoring-key-lint.test.ts:ariagets no rename;lableandlbael→labelstill answered;descrptn(8 characters, 3 edits) gets nothing whiledfltValue(9 characters, 3 edits) →defaultValue.shared/suggestions.test.ts:renameBudget,suggestRename(short, long, empty key), and a guard that no non-test source file underpackages/spec/srcother thanrename-guess.tsspellsMath.max(2, Math.floor(or handsfindClosestMatchesits own distance (a third argument) in code (comment lines skipped).shared/strict-object.test.ts(unchanged).Readings (head 945afc3)
pnpm --filter @objectstack/spec build && pnpm --filter @objectstack/spec check:generated→ exit 0 (all 14 artifacts up to date);pnpm --filter @objectstack/spec typecheck→ exit 0;vitest run src/shared/ src/data/authoring-key-lint.test.ts src/data/object.test.ts src/data/define-seed-record-keys.test.ts src/data/field-value.test.ts src/data/default-value-shape.test.ts→ 45 files, 1359 tests passed; the lint's consumerssrc/kernel/metadata-authoring-lint.test.ts src/cron-typed-positions-retirement.test.ts src/stack.test.ts src/kernel/functional-completeness.test.ts→ 4 files, 216 tests passed.dispatch-gates.mjs --commandsderives the same 96 commands and no full spec suite;--ran→ 93 run, 3 NOT MEASURED (shallow-clone fixture, full-workspace dist), includingcheck:lean-entry-closureexit 0 after building objectql.findClosestMatches(key, candidates, 3, 1)[0](import held, then the call replaced; both anchors x1 then x0, blob ebad5a51 to ad0aef4d):authoring-key-lint.test.ts+suggestions.test.ts→ 3 failed / 54 passed (the short-key and length-relative cases and the class guard red; the one-edit slip control stays green). Restored: blob == HEAD ebad5a51,git diff HEADempty.pnpm --filter @objectstack/spec build && pnpm --filter @objectstack/spec check:generated→ GEN_EXIT=0 (14 artifacts up to date after theexport-origins/regeneration).pnpm --filter @objectstack/spec typecheck→ TC_EXIT=0.pnpm --filter @objectstack/spec test→ Test Files 858 passed (858), Tests 27414 passed, 1 todo; TEST_EXIT=0.node scripts/ablation-replace.mjsonrename-guess.ts, anchorfoldForScoring(candidate)) <= 1);hit x1 then x0, blob 06f10119 to 9292b58e; the six harness files ran 8 failed / 367 passed (6 files red: object, seed, field-value, default-value-shape, strict-object, suggestions). Restored by the tool; working blob hash equal to the HEAD blob 06f10119,git diff HEADempty. Expected direction (red) observed.Acceptance notes
/metawrite door (the realPUT /api/v1/meta/:type/:nameroute handler of an in-processRestServerover a realObjectStackProtocolImplementationandSchemaRegistry, built dists, head b8bdbfb): a form view body withdefaultSortanswers422 INVALID_METADATAwith "Unrecognized key(s) on this inline form view:defaultSort. Did you meandefaultSort→defaults? Keys retired before the previous protocol major are no longer prescribed here — see the protocol upgrade guide…", and theunrecognized_keysentry inissues[]names the upgrade guide too. The same probe withariaanswers with no guess (the short-key rule working at the door). The ADR-0087 2026-10-26 amendment (spec: retire tombstones, conversions and migration entries older than one protocol major; a strict unknown-key refusal with an upgrade-guide link takes over (maintainer ruling D2 = A) #25767 D2 = A) rules that once a retirement kit ages out "a removed key is refused as a strict unknown key whose refusal names the protocol upgrade guide" (ADR-0087 status line; the same words under D2), which is exactly the reading above. The amendment is silent on the rename guess a strict unknown-key refusal carries, so the guess stays the ordinary strict-refusal behaviour. Keeping a rename guess off a retired key would mean the spec remembers aged-out keys again, which that amendment chose not to do. The seat routed this half to that ruling (no B or C option, nothing put to the maintainer); the card is closed after merge citing this reading.access-security.packaged-permission-set-lifecyclewas left unchanged: its title already says "at the retired sys_permission_set data door" and itsretiredReasonalready namesPOST /api/v1/security/permission-sets/:name/clone; its steps describe what the item tested before it retired.packages/formula/src/validate.ts(nearest),packages/lint/src/object-graph.ts,packages/cli/src/utils/collect-docs.ts. Prose that still describes the pre-screen budget:kernel/manifest.zod.ts(thehostsalias comment says the fallback would answerhooks; the short-key screen now refuses that guess on its own, so the alias fills a gap rather than overruling a wrong answer).Out of scope
Other copies of the rename budget, found by grep and not changed here. None was measured at a public door, and no card is filed:
packages/formula/src/validate.ts:1497(nearest):max(2, floor(len / 3))without the short-key screen.packages/lint/src/object-graph.ts:809: the same budget, without the screen.packages/cli/src/utils/collect-docs.ts:974: the same budget, without the screen.Verification
Read first, by risk:
packages/spec/src/shared/rename-guess.ts—suggestRename(the moved rule; the empty-key guard moved into it).packages/spec/src/shared/suggestions.zod.ts— the re-export line and thestrictUnknownKeyErrorcall site.packages/spec/src/data/object.zod.ts—unknownKeyErrornow callssuggestRename.Two-minute check:
pnpm --filter @objectstack/spec exec vitest run src/data/object.test.ts src/data/define-seed-record-keys.test.ts— expect both files green, including the two newa short unknown key gets the shared rename ruledescribes.🤖 Generated with Claude Code
https://claude.ai/code/session_01L6bhgUZrkMKgGrXXe8zPGq