Repository navigation
fix(spec): a ctx.text key is literal at save only when its closing quote ends the argument - #36666
Conversation
…ote ends the argument
A key built from a literal ('k' + suffix, 'k'.concat(suffix)) is a computed
key, left to the run-time refusal, as the hookTextKeysAskedIn docblock already
says. Pins lit and dark on the hook and action save doors.
Claude-Session: https://claude.ai/code/session_011y7As8yeqbR9TKANdPKRxt
Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift Check1 anchor(s) derived from 1 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 — 175 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 2113393e6464a0287a5822d2c7ce8f4a3dd287f6 && git checkout 2113393e6464a0287a5822d2c7ce8f4a3dd287f6
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 6a731859def47e2c8cefcab4d635a1c45c60c2c1 dc8f1abe60d3f9b070197b9f02a8ebf904401f95 && git checkout -B drift-repro 6a731859def47e2c8cefcab4d635a1c45c60c2c1 && git merge --no-ff dc8f1abe60d3f9b070197b9f02a8ebf904401f95
node scripts/docs-audit/affected-docs.mjs --json 6a731859def47e2c8cefcab4d635a1c45c60c2c1 |
|
repo:objectstack#7 · os-alice · session_011y7As88pUDUZHGdwFmizG4 Contract reviewServed-tier: Inputs read: card #35698 (body, triage 7026722554, claim 7097848971, dev report 7098411542; no ruling and no earlier record on the thread), PR #36666 (body, 4-file list, net diff against ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgment
No must-fix, no should-fix. Attempts to break the lookahead
Docblocks, sentence by sentence: the section header ("the quote closing the argument ... a key built from a literal included"), the
Read, not a finding on this diff (same on Implemented-by: VERDICT: PASS |
|
repo:objectstack#7 · os-alice · session_011y7As88pUDUZHGdwFmizG4 维护者速读
席位核对Verdict: ACCEPT at head
|
|
repo:objectstack#7 · os-alice · session_011y7As8yeqbR9TKANdPKRxt Landing · 2026-11-23T11:26Z · head
State: ready + auto-merge. On MERGED, #35698 closes by |
…quote closes the value (objectstack-ai#38044) <!-- claude-projects-attribution: {"github_login":"os-tesla"} --> _Requested by **Tesla** · [project thread](https://claude.ai/code/project/chan_01AXsQkLFKRdQCqQ3RTr6Jao?thread=cmsg_01AXsQkLFKRdQCqQ3RTr6Jao6KhaLUWiS7aqNWvg6hcE74)_ Fixes objectstack-ai#36670 repo:objectstack#3 · os-tesla · session_01L9qibykc1XS5J4B4J16dLb Clause-②: no Metadata-protocol: none Clause-② citation, the published docblock of `hookRefusalCodesThrownIn` (`packages/spec/src/data/hook-refusal-codes.ts`) on `origin/main` 3e8edf7: "A code that arrives any other way — a helper's parameter (`refuse('…', code)`), a variable, a computed value — is left to the run-time refusal". A code or reason built from a literal (`'OVER' + suffix`, `'OVER'.concat(suffix)`) is a computed value, so its save refusal was a false refusal; this PR removes only that, as PR objectstack-ai#36666 did for the text-key reader (objectstack-ai#35698) on the same ground. Every literal refused before is still refused, in the same words (the lit pins below). ## 维护者速读 - 搭建者在钩子或动作代码里用拼接方式拼出拒绝码或拒绝原因时,保存不再被误拒;直接写死的拒绝码和原因照旧在保存时检查,用户无其它感知变化。 - 属于钩子与动作「按声明的拒绝目录拒绝」这条线,替写拼接拒绝码的搭建者解决保存被误拒的问题,和已合并的文本键同类修复是一族。 - 出错的话,拼接出的码或原因若没有声明,会在运行时才报错并点名它(本来就有的运行时拒绝);改动可以直接撤回。 - 无 ## What changes - The four save-time readers in `packages/spec/src/data/hook-refusal-codes.ts` (`CODE_PROPERTY`, `CODE_ASSIGNMENT`, `REASON_PROPERTY`, `REASON_ASSIGNMENT`), which both save doors use (`HookSchema` and `ActionSchema`, through `hookRefusalCodesThrownIn` / `hookRefusalReasonsThrownIn`), now end with a lookahead after the closing quote: - `PROPERTY_VALUE_END` (the two property readers): `,` or `}` follows, after optional whitespace (a comment there is blanked to whitespace by the existing masking first). - `ASSIGNMENT_VALUE_END` (the two assignment readers): `;`, `,`, `}` or `)` follows after optional whitespace, or the source ends, or a line end follows whose next line does not continue the expression. A next line opening with an operator, a member access, a call or index bracket or a template (`+ suffix`, `.concat(suffix)`) continues it, as JavaScript reads it. - Anything else after the quote leaves the value to the run-time refusal, which already names the code or reason (`undeclaredHookRefusalAtRun`, `undeclaredHookRefusalReasonAtRun` and the action twins). - A reason under a computed code is no longer read either: the existing rule reads a property reason only beside exactly one literal code, and a computed code is no longer one. - A template literal with a `${}` hole needed no change: the masking already blanks it. Pinned anyway (property form). - `,` is in the assignment set beyond the card's list (`e.code = 'X', e.reason = 'y'`): the comma operator ends the assignment, and leaving it out would have stopped refusing a literal the save refuses today. - Docblocks of the two lookaheads and of `hookRefusalCodesThrownIn` / `hookRefusalReasonsThrownIn` say what "literal" means now. No export, schema shape, `.describe()` or error sentence changed. - `patch` changeset for `@objectstack/spec`. ## Tests One new top-level `describe` in each existing harness file: - `packages/spec/src/data/hook-refusals.test.ts`: - **lit code** (13 shapes): property closed by `}`, by `,`, with a line break or a comment before the close, a backtick with no hole, inside `Object.assign`; assignment closed by `;`, a line end, a comment and a line end, `,`, `}`, `)`, the source end. Each is still refused at `body.source` with the unchanged sentence. - **dark code** (9 shapes plus an inline handler): property `+`, `+` on the next line, backtick `+`, `.concat`, template hole; assignment `+`, `+` on the next line, `.concat` on the next line, backtick `+`. Each passes the save, and the reader returns nothing. - **lit reason** (5) / **dark reason** (5): the same split for reasons, a listed reason (`reasons: [{ reason }]`) included. - **CONTROL**: a literal code beside a computed one in the same body is still refused, exactly once. - `packages/spec/src/ui/action-refusals.test.ts`: the action twin, lit code 5, dark code 4, lit reason 2, dark reason 2. <details><summary>Before the fix, after, and ablation</summary> - Before (new pins on the `origin/main` 3e8edf7 reader, file restored tree-only): `Failed Tests 20`, all dark cases except the template hole (already blanked by the masking); every lit case green. - After, at 291adbd: the two harness files `Tests 195 passed (195)`; together with `hook.test.ts`, `hook-texts.test.ts`, `action-texts.test.ts` before the new pins, `Tests 326 passed (326)`. - Ablation through `scripts/ablation-replace.mjs` on the committed fix (tests import `src` relatively, so no dist leg); each restore `blob == HEAD (9afc30e) and git diff HEAD is empty`: - `REASON_PROPERTY` lookahead removed: `Tests 4 failed | 191 passed (195)`, the 4 property-reason dark pins. - `REASON_ASSIGNMENT` lookahead removed: `3 failed`, the assignment-reason dark pins. - `CODE_PROPERTY` lookahead removed: `7 failed`, the property-code dark pins and the handler pin. - `CODE_ASSIGNMENT` lookahead removed: `6 failed`, the assignment-code dark pins. - Line-end branch made non-continuing (`[ \t]*\r?\n` only): `4 failed`, the next-line dark pins. - Line-end branch removed: `4 failed`, the line-end lit pins (hook code ×2, action code, hook reason). - `pnpm --filter @objectstack/spec build` exit 0; `pnpm --filter @objectstack/spec test` at 291adbd: `Test Files 909 passed (909)`, `Tests 28797 passed | 1 todo (28798)`; `typecheck` exit 0; `check:generated` exit 0 ("All 14 generated artifacts are up to date"). </details> ## Acceptance notes - Derived local gate set at 291adbd: `dispatch-gates --ran` reconciles 85 derived, 83 run (all exit 0), 2 NOT MEASURED, 0 unrun. `@objectstack/formula`, `@objectstack/lint` and `@objectstack/objectql` were built first so `check:doc-formula-expressions` and `check:lean-entry-closure` could measure (both exit 0). `eslint` on the three changed `.ts` files exit 0. - Declared narrowing, the 2 NOT MEASURED (exit 3, prerequisite not met), both CI's: `check-plugin-teardown-shape.mjs --self-test` reads a fixture pinned to a commit this shallow clone cannot reach; `check:dual-build-cjs-loads` needs every package's `dist/` (a full `pnpm build`), which this card's diff does not move. - The assignment terminators add `,` to the card's list (`;`, line end, `}`, `)`): the comma operator closes the assignment (`e.code = 'X', e.reason = 'y'`), and leaving it out would have stopped refusing a literal the save refuses today. A line end counts unless the next line continues the expression; the continuation set is the operator, member-access, bracket and template openers JavaScript does not end a statement before, broader than the claim's "a leading `+` or `.`" example. - Out of scope, noted not filed: none found. ## Verification Read first (by risk): 1. `packages/spec/src/data/hook-refusal-codes.ts`: `PROPERTY_VALUE_END` and `ASSIGNMENT_VALUE_END`, and the four readers that append them. 2. `packages/spec/src/data/hook-refusals.test.ts`: the new lit/dark/CONTROL describe at the end. 3. `packages/spec/src/ui/action-refusals.test.ts`: the action twin. Two-minute check: `pnpm --filter @objectstack/spec exec vitest run src/data/hook-refusals.test.ts src/ui/action-refusals.test.ts` shows 195 passing; delete `+ PROPERTY_VALUE_END` from `CODE_PROPERTY` and the same command shows 7 dark cases failing. --- _Generated by [Claude Code](https://claude.ai/code/session_01L9qibykc1XS5J4B4J16dLb)_ Co-authored-by: Claude <noreply@anthropic.com>
Fixes #35698
repo:objectstack#7 · os-alice · session_011y7As8yeqbR9TKANdPKRxt
Clause-②: no
Metadata-protocol: none
Clause-② citation, the published docblock of
hookTextKeysAskedIn(packages/spec/src/data/hook-refusal-codes.ts) onorigin/main9348f02: "A key that arrives any other way (a variable, a computed value) is left to the run-time refusal." A key built from a literal ('k' + suffix,'k'.concat(suffix)) is a computed value, so its save refusal was a false refusal; this PR removes only that. Every literal ask refused before is still refused, in the same words (the lit pins below).维护者速读
What changes
TEXT_CALL, the one reader both save doors use (HookSchemaandActionSchema, throughhookTextKeysAskedIn), now ends with the lookahead(?=\s*[,)])after the closing quote: a key is literal only when its closing quote ends the argument,,or)following after optional whitespace (a comment there is blanked to whitespace by the existing masking first).+, a member access) leaves the argument to the run-time refusal, which already names the key (undeclaredHookTextAtRun/undeclaredActionTextAtRun).${}hole needed no change: measured onorigin/main, the masking already blanks it (its contents are not a snake_case key), so it was never read as literal. Pinned anyway.TEXT_CALL,hookTextKeysAskedInand the hook-texts section header say what "literal" means now. No export, schema shape,.describe()or error sentence changed.patchchangeset for@objectstack/spec.Tests
New top-level
describein each existing harness file (packages/spec/src/data/hook-texts.test.ts,packages/spec/src/ui/action-texts.test.ts):body.sourcewith the unchanged sentence.'k' + suffix, the same on the next line (hook), in the optional call, a backtick concatenation,'k'.concat(suffix), a template hole (plus the optional call, hook). Each passes the save.Before the fix (origin/main reader, new pins), after, and ablation
Tests 10 failed | 68 passed (78), the 10 being every dark+/ member-access case on both doors; the 4 template-hole dark cases and every lit case were already green.hook.test.tsandaction-refusals.test.ts:Test Files 4 passed (4),Tests 207 passed (207).scripts/ablation-replace.mjs; tests importsrcrelatively, so no dist leg):anchor 1 -> 0, blob c25b9072dccd -> 8bd13ccf2097→Tests 10 failed | 68 passed (78), direction red as predicted; restoreblob == HEAD (c25b9072dccd) and git diff HEAD is empty.pnpm --filter @objectstack/spec testat dc8f1ab:Test Files 879 passed | 1 skipped (880),Tests 28083 passed | 1 skipped | 1 todo (28085), lockVERDICT command-exit 0.pnpm --filter @objectstack/spec typecheckat dc8f1ab:VERDICT command-exit 0(test layer: debt ledger held).Acceptance notes
dist-reading spec families (check:api-surface,check:docs,check:authorable-surface, …) and the remaining 67 are CI's. No export, schema or.describe()changed, so none of them should move.code: 'X',e.code = 'X',reason: 'x',e.reason = 'x') also stop at the closing quote. Measured at the hook save door: a body throwing{ code: 'OVER' + suffix }withrefusalsdeclaringOVER_LIMITis refused atbody.sourceas code'OVER', against thehookRefusalCodesThrownIndocblock ("a computed value — is left to the run-time refusal"). Their terminator set differs from a call argument's (,}for a property,;/ line end for an assignment), so it is not this PR's mechanical shape; reported to the seat for one family card.Verification
Read first (by risk):
packages/spec/src/data/hook-refusal-codes.ts: theTEXT_CALLhunk, the one behavioural line.packages/spec/src/data/hook-texts.test.ts: the new lit/dark describe.packages/spec/src/ui/action-texts.test.ts: the action twin.Two-minute check:
pnpm --filter @objectstack/spec exec vitest run src/data/hook-texts.test.ts src/ui/action-texts.test.tsshows every lit and dark case passing; delete(?=\s*[,)])fromTEXT_CALLand the same command shows 10 dark cases failing.Generated by Claude Code