Repository navigation
feat(lint)!: a validation rule's message is a {{ }} template over the judged record, and a single brace there is refused - #38687
Conversation
…udged record (wip) Claude-Session: https://claude.ai/code/session_01ADHkmQ6vV3YvhJWKF1gSDs Co-authored-by: Claude <noreply@anthropic.com>
…doors Claude-Session: https://claude.ai/code/session_01ADHkmQ6vV3YvhJWKF1gSDs Co-authored-by: Claude <noreply@anthropic.com>
…e message template Claude-Session: https://claude.ai/code/session_01ADHkmQ6vV3YvhJWKF1gSDs Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 2 package(s): 6 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 5 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 182 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 f3308de15d13bfc567fda598731fa51ea15ae854 && git checkout f3308de15d13bfc567fda598731fa51ea15ae854
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 5ac1ee0bc8a79ab2238ded80123ba91623ad6081 1264da285dd1d917c63cd8be483e7a017d57d692 && git checkout -B drift-repro 5ac1ee0bc8a79ab2238ded80123ba91623ad6081 && git merge --no-ff 1264da285dd1d917c63cd8be483e7a017d57d692
node scripts/docs-audit/affected-docs.mjs --json 5ac1ee0bc8a79ab2238ded80123ba91623ad6081
|
|
repo:objectstack#3 · os-steve · session_01ADHkmSAjFEZHRpRq3WCj6z Contract-review-claim: session_01ADHkmSAjFEZHRpRq3WCj6z · head 1264da2 · 2026-11-30T04:39Z |
|
repo:objectstack#3 · os-steve · session_01ADHkmQm8PTU4AkVU5kdwEv 席位核对ACCEPT @ Read at head:
For the seat, not blocking:
|
|
repo:objectstack#3 · os-steve · session_01ADHkmSAjFEZHRpRq3WCj6z Contract reviewServed-tier: PR 1 of 3 of card #37909, judged against ruling 7239726323 (P3) and the parameters PR 1 owns: 1 (roots and hole shape, the door half), 2 (string on the wire), 3 (the doors), 4 (the single-brace refusal and the showcase rewording). Read: the card body and all nine comments, the PR body, the 16-file net diff against Gate verdicts (check-runs on this head, read 2026-11-30T05:07Z, all completed): 72 runs, 62 success, 10 skipped, 0 failed. Success includes Check Changeset, Spec property liveness, Type Check (source gates, workspace, consumer gates, UI), Test Core 12/12, Test UI 16/16, Dogfood Regression Gate, Lint · PM dispatch-gates, PR-body guards and Governed Surface Queue Guard. The ten skipped runs, by name: 18.x upgrade harness (opt-in), Packed-tarball smoke (opt-in), Temporal Conformance (live PG + MySQL), Dogfood Verify CLI, the unexpanded Dogfood Regression Gate matrix row, Lint UI, UI Published Artifacts, Queue verdict, Borrowed queue verdict and the Schedule gate. A skipped run is no verdict; the 18.x upgrade harness in particular did not run on this narrowing. No derived gate is red on this head. ① Derived judgments
② Semver level
③ Boundary flagsDev deviations (report 7268936971):
Open questions:
Parameters deferred, not missing:
Forward flags for PR 2, raised by what this door accepts:
SQL push-down: the diff adds no query, no id materialisation and no in-app join. Nothing to flag. ④ Design judgmentNo must-fix, no should-fix.
Nits (none affects correctness or the contract):
Implemented-by: VERDICT: PASS |
|
repo:objectstack#3 · os-steve · session_01ADHkmSAjFEZHRpRq3WCj6z 维护者速读
Seat opinion: land as is, and keep PR 2 (rendering) in the same stable release; 席位核对ACCEPT at head
ACCEPT → PR #38687 comment 7269047325 · Contract review → comment 7269393846 |
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 46372872221 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
… holes with the judged record's values (objectstack-ai#38736) <!-- claude-projects-attribution: {"github_login":"os-steve"} --> _Requested by **Steve** · [project thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9SNzk6FfxPPrxLwCB5BftuN)_ Part of objectstack-ai#37909 — PR 2 of the ruling's sequencing (`domain:server`: render in `authoredRuleMessage`, currency and readable-field handover, the empty-on-unreadable pins). PR 1 (objectstack-ai#38687, spec + lint, merged as 9cbb41b) is the doors; PR 3 (skills and docs) stays on the card. Clause-②: yes (widening) Metadata-protocol: semantic Skills-docs: follow-up objectstack-ai#37909 (PR 3 of the ruling's sequencing: skills and docs) ## 维护者速读 - 用户能看到什么变化:校验规则拦下保存时,提示语里的 `{{ record.字段 }}` 会填上被拦记录的真实值(比如「总价 ¥1,200.00 低于已收 ¥1,500.00」),金额按组织默认币种、按用户语言格式化;看不到或被遮罩的字段一律留空。系统身份替某人执行的写(如该人触发的系统流程)按该人的权限判定,没有安全服务时全部留空并记日志。 - 为什么做:维护者已裁(P3);这是第二步,让第一步定下的写法真正生效,HotCRM 的改单拦截才能说出差多少钱。 - 出错会怎样:最坏是某个洞该显示的值显示成空;规则拦不拦不受影响,值也不会写进错误的其它字段;撤回这次合并即回到「原样显示」。 - 要你做什么:组织没设默认币种时,提示语里不带币种的金额占位怎么处理,正等你在决策卡上定;本 PR 暂按席位推荐的 A(该占位留空、日志提醒设置默认币种)实现,你选别的方案只改一个函数,改完再请你审批。 ## What changes Ruling P3 (card comment 7239726323), parameters 5–8, and the forward flags of PR 1's contract review (7269393846). - **`@objectstack/objectql`** — `authoredRuleMessage` (`validation/rule-validator.ts`) now fills the sentence it picks: - translation first (parameter 7): the translated template is picked and filled; if it does not render, the authored template is filled instead and the write's logger names the translation (`objects.O._validations.R.message`, the locale); an authored message that does not render (one stored before the doors) is shown as written and the logger names the rule; - the fill is `renderRuleMessage` (new `validation/rule-message-render.ts`) through the formula `templateEngine` — no second engine — over the merged record (`record`) and the stored row (`previous`, `null` on an insert), in the refusal's negotiated locale, with the tenant default currency and the reference timezone. Every rule kind that emits an authored message fills it: `script` / `cross_field`, `format`, `json_schema`, `state_machine`, and a `conditional` branch. A `script` rule's holes read the record as judged before related rows are hydrated into reference fields, so `{{ record.account }}` is the stored id, never the related row; - what a hole may show (parameter 6) is `ValidationMessageContext.rendering`, computed once per write by the new `engine-rule-message-rendering.ts` (`attachRuleMessageRendering`), called beside `validationMessageContext` on the three paths that build it: `engine-insert.ts`, `engine-update.ts` (the by-id and bulk legs share it) and `engine-validate.ts` (the dry run). It is computed only when the object's rule messages or their translations carry a `{{`, so no other write asks the security service anything new. - **The showable fields** — `getReadableFields` ∩ `getQueryableFields` of the registered security service (the contract: "the difference between the two is exactly the fields this caller sees masked"); with no `getQueryableFields`, or `undefined` from it, every `maskingRule` field counts as masked (the contract's prescribed fallback). Every field the engine masks or omits on a read (`secret`, generic `password`, `internal`) is never showable. A hole is empty twice over: blanked before the render, and absent from the scope the engine evaluates. - **Whose read (contract review M1, fix (a))** — both projections are asked under the write's own context, except on an elevated write (`isSystem`) that names a person (`userId`): a `runAs: 'system'` flow, an action body (`{ ...caller, isSystem: true }`), the approvals mirror. There they are asked for that person: the same context with `isSystem: false`, carrying the positions and permission sets it carries, or, where it carries none (the flow's and the approvals mirror's context), the person's own grants resolved through `resolveUserAuthzGrants` (`@objectstack/core`), as a `runAs: 'user'` hook fired by the same write seeds them. Grants that cannot be read: every hole empty. A user-less system write (a schedule, a platform sweep) keeps the system's answer; its sentence reaches the server log alone. - **Fail closed, and say why (S1)** — no security service registered (the kernel throws on an unregistered name; a bare engine's slot is empty), a service that cannot be asked (no function in the slot, no `getReadableFields`), one that answers `undefined` or throws, and unreadable grants of the person an elevated write was made for: nothing is showable, every hole renders empty, and the write's logger gets one line naming the cause (`RuleMessageRendering.unanswered`), once per write. - **What the log is told (S2)** — a hole no reader could ever see filled (another root, a bare root, a read through a field, a field the object does not declare: a message stored before the doors) is named with its rule and the hole. A hole empty only for this reader (unreadable, masked) is never logged. Each distinct line is written once per write, so a bulk refusal does not repeat it (N1). - **The currency** (parameter 5) — the write's `ExecutionContext.currency` (the organization's `localization.currency`, which the request context already resolves), when it is a three-capital ISO 4217 code. **Pending the maintainer's ruling (parameter 8 fork, put to the maintainer as a decision card by the seat):** with no tenant default, a `currency` hole with no argument passes the doors but cannot render. Provisionally (option A, the seat's recommendation) that hole renders empty and the write's logger names the rule, the hole and the setting, saying the organization has none set or the write carried none (N1) (Setup → Localization, `localization.currency`); the rest of the sentence renders. It is isolated in one function, `tenantCurrencyHole` (`validation/rule-message-render.ts`), and pinned by one test; a different ruling changes those two and the changeset's sentence, nothing else. ⛔ The amount is never formatted in a currency nobody chose, nor shown unformatted. - **`@objectstack/spec` + `@objectstack/lint`** — the roots export is renamed before its first release, `VALIDATION_MESSAGE_TEMPLATE_ROOTS` → `VALIDATION_RULE_MESSAGE_TEMPLATE_ROOTS` (contract review N2: `@objectstack/spec/system` already has a `VALIDATION_MESSAGE_*` field-constraint family that binds no roots), with its lint importer, the translation describe that names it, and the regenerated `api-surface/data.json`, `export-origins/data.json` and `docs/references/system/translation.md`. PR 1's changeset is edited to name the final export (both ship in one release). ### Decisions this PR takes - **N5, `previous.FIELD` on an insert-only rule:** the doors keep accepting it and it renders empty, as on every insert (parameter 1 allows it; a rule with `events: ['insert', 'update']` reads it on one leg only). Pinned. - **A hole over a root other than `record` / `previous`, a bare root, a read through a field, an undeclared field:** the doors refuse each (PR 1); a rule stored before them renders each empty, never the built-in sentence's own parameters. ### Deliberate correction of a pending release note `.changeset/37909-rule-message-template-holes.md` (PR 1's, pending, not yet released) is edited in one sentence: its **Exports** bullet named `VALIDATION_MESSAGE_TEMPLATE_ROOTS`, which this PR renames, so it now reads "`@objectstack/spec/data` gains `VALIDATION_RULE_MESSAGE_TEMPLATE_ROOTS` (`['record', 'previous']`)". Restoring it would publish a release note naming an export the release does not carry. `check-empty-changeset` stays red on that file by design; the dispatching seat confirms the correction by its own record. ### Outside the claimed file surface - `packages/services/service-automation/src/flow-rule-message-reader.integration.test.ts` (new, test only): contract review M1 asks for the flow path pinned end to end (`runAs: 'system'` → `innerRefusal`), which only a test composing the automation engine reaches. No service-automation source changes. - `content/docs/permissions/system-context.mdx` (one register row, 29g, and the regenerated register): the new `readerContext` reads `isSystem` to de-elevate, and `pnpm check:system-context-census` requires every such read to be owned by a row naming its symbol. ### Tests forced to change - `packages/objectql/src/validation/rule-validator.state-machine-option-labels.test.ts` — "leaves an author-written message exactly as written — no holes are filled in it" pinned the contract this card changes (ruling P3). Its intent stays: the built-in sentence's `{{from}}` / `{{to}}` never fill an authored message. Those are holes over another root, so they now render empty; the code and `constraint` assertions are unchanged. ## Tests - `packages/objectql/src/validation/rule-message-render.test.ts` (19, through `evaluateValidationRules`): formatters and locale, the tenant currency, `previous` on update and on insert, plain text and a single brace as written; the field floor (outside `showable`, never logged; no rendering at all; read-through / bare root / other root / undeclared, each logged with its rule; the stored id of a hydrated reference; no value in the machine fields); the scope floor on its own, a hole the blanking builds (N5); an unanswered field security, its cause logged; every rule kind (`conditional` branch, `format`, `state_machine`); translation first, its fallback with the warning, a pre-door authored message as written; and the provisional no-currency arm (that hole empty, the rest rendered, the rule and the setting named). - `packages/objectql/src/engine-rule-message-rendering.test.ts` (15, a real engine with the security service as a double in its source slot): readable and unmasked shows, masked / `password` / `internal` empty; unreadable empty; no `getQueryableFields` → `maskingRule` empty; a lifted mask shows; `undefined`, a throw from either projection, a throwing source, a service without `getReadableFields` → every hole empty, the write still refused, one log line naming each cause; no service registered → every hole empty and the line; a reader-only blank never logged; stored structural holes logged once per write across a bulk insert. Elevated writes (M1): `{ ...caller, isSystem: true }` asked for the caller with their sets, never as the system; `{ isSystem: true, userId }` with no sets on an engine with no permission store → grants unreadable, every hole empty, the cause logged; CONTROL a user-less system write keeps the system answer; CONTROL the same person's own write reads the same. `| currency` in the context's currency and locale; `previous` on a real update; the dry run fills the same sentence. - `packages/services/service-automation/src/flow-rule-message-reader.integration.test.ts` (4, ObjectKernel + ObjectQLPlugin + driver-sql on better-sqlite3 + identity objects + the real SecurityPlugin + the real AutomationEngine): a member profile withholds `margin`; a `runAs: 'system'` flow started by that member, refused by the rule, carries `Amount -1 is below the margin on Acme.` in `innerRefusal.message` (run against the previous head's build it carried `… the margin 30 …`); `runAs: 'user'` and the member's own request read the same; CONTROL a user-less system write shows `30`. - Ablations: dropping the masked-field judgement reds 2 engine tests; building the scope from the whole row instead of the showable values reds the N5 pin (`SSN 123-45-6789 end`). ## Acceptance notes - The render ships in the same release as PR 1 (objectstack-ai#38687, merged): PR 1 alone teaches holes that render as written. This branch was restarted from `main` after PR 1 merged and its four commits rebased onto it. - The rendered sentence is written to the server log by the engine's existing `Insert operation failed` warning, as the authored message was; it carries only fields the person the refusal is worded for may read. - Out of scope, from contract review 7273883345: N2 (an `Intl` `RangeError` for a locale tag or time zone `Intl` does not know shows the template as written; whether such a tag reaches a write's context is not established), N3 (`objectstack validate`'s seed-row refusal, `packages/lint/src/seed-row-refusals.ts`, now prints blank holes; a follow-up hands it a `rendering` over the seed row's declared fields, or prints the template), N7 (the projections are asked on every write to an object whose messages carry a hole, refused or not; asking at the first refusal needs an async render). Each goes to PR 3 or a follow-up card, as the seat files it. ## Verification - `pnpm --filter @objectstack/objectql exec vitest run --maxWorkers=2 src/validation/rule-message-render.test.ts src/engine-rule-message-rendering.test.ts`: 34 passed; `pnpm --filter @objectstack/service-automation exec vitest run src/flow-rule-message-reader.integration.test.ts`: 4 passed. - Two-minute check: in `examples/app-showcase`, give a validation rule the message `Total {{ record.total_price | currency }} is too low.`, set Setup → Localization → Default currency, and save a record the rule refuses: the refusal names the amount. <details><summary>Local gates at head 331b47d</summary> - `node scripts/pm/dispatch-gates.mjs --commands` (derived after the last commit): 125 commands, each run with stdin closed through the verify lock; 124 `exit 0`, and `node scripts/check-empty-changeset.mjs --base origin/main :: exit 1`, the deliberate correction above. `--ran` reconciliation: 125 derived, 125 run, 0 NOT-MEASURED, 0 UNRUN. - The run at 8f25796 (104 derived) had one other red, `pnpm check:system-context-census` (the `readerContext` read had no owning row); 331b47d adds row 29g and the census passes in the 125. - `pnpm --filter @objectstack/objectql exec vitest run --maxWorkers=2` on the tree committed as 6a49759 + 8f25796: 643 files, 14602 tests, all passed (lock VERDICT command-exit 0). - Dogfood battery (`pnpm --filter @objectstack/dogfood test`) at 331b47d: lock VERDICT command-exit 0; Test Files 495 passed, 3 skipped; Tests 4187 passed, 68 skipped; no failure. - `pnpm build --concurrency=2` (whole workspace) on the rebased head 9b716a3: lock VERDICT command-exit 0; `@objectstack/objectql` rebuilt at the fix (exit 0) before the service-automation test ran against it. </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01ADHkmQ6vV3YvhJWKF1gSDs <!-- signed: repo:objectstack@os-steve · os-steve · session_01ADHkmQ6vV3YvhJWKF1gSDs --> --------- Co-authored-by: Claude <noreply@anthropic.com>
…ack-ai#38787) <!-- claude-projects-attribution: {"github_login":"os-steve"} --> _Requested by **Steve** · [project thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9SNzk6FfxPPrxLwCB5BftuN)_ Part of objectstack-ai#37909 — PR 3 of the ruling's sequencing (skills and docs), claim amendment 5 (7279412658). PR 1 (objectstack-ai#38687, merged as 9cbb41b) is the doors; PR 2 (objectstack-ai#38736, merged as 49c09ed) is the render. This PR teaches what the merged tree does. Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:没有运行时变化;技能 objectstack-data 与文档「Validation metadata」页开始教规则提示语里的 `{{ record.字段 }}` 占位、格式化器、币种规则(你选的 A)、看不到的字段留空、译文先填、提示语是纯文本。 - 为什么做:维护者已裁(P3);前两步已合入,这是第三步,让写元数据的 AI 和人知道怎么写、写了会显示什么。 - 出错会怎样:最坏是教错一句,AI 写出的提示语被发布校验拒(会点名正确写法)或某个占位显示为空;不影响任何保存是否被拒。 - 要你做什么:skills 是受管面,请 os-zhuang 审批;ratchet 行按「A:先削重复,余额按实测提高」抬了 235 个 token(先删了 699 字节重复)。 ## What changes Ruling P3 (card comment 7239726323), the currency ruling A (7277046538), and the items PR 1's and PR 2's contract records left to this PR. - **`skills/objectstack-data/rules/validation.md`** gains § Messages — Record Values in Holes: the `record` / `previous` roots (`previous` empty on insert), one segment, own fields; the formatter whitelist with `| currency:EUR`; what the doors refuse (a single brace, a read through a field, another root, logic); a bare `| currency` in the organization's default currency, and with none set that hole empty while the server log names the setting (ruling A); a field holding its own currency names the code or uses `| number:2` (PR 2 contract record, E2); a field the person whose write was refused cannot read, or sees masked, renders empty, `default:` included; the translation takes the same holes and is filled first; the sentence is plain text (PR 2 contract record: "PR 3's docs should say the sentence is text"). - **`content/docs/data-modeling/validation.mdx`** — the `message` row of Common Properties points at a new § Messages with a worked example, the two roots, the formatter table, currency, the field floor (including writes an automation makes on someone's behalf, and a person-less system write), translations and plain text. - **`content/docs/ui/translations.mdx`** — the one bullet that said a validation message is "substituted whole — there is no interpolation … `{variable}` placeholders in it are not filled", false since PR 2, now says a translation fills the same `{{ }}` holes, translation first, the fallback, and that a single brace is refused at publish. - **`packages/spec/src/migrations/entries/semantic/19.validation-rule-message-template-holes.ts`** — PR 1's contract record N3: the example renamed the field between FROM (`{received}`) and TO (`record.received_amount`); FROM now reads `{received_amount}`. One word; nothing else in the entry moves. ### Token ratchet (`scripts/check-skills-token-ratchet.mjs`) `skills/objectstack-data/rules/validation.md` had no headroom (3862 / 3862). Paid down first inside the file: § Incorrect vs Correct and its table-of-contents entry are deleted, since its one example (a rule with no `events` runs on insert and update; scope it with `events: ['update']`) restates § Events, which stays. -699 bytes cut, +1638 added: 15448 -> 16387 bytes (+939) -> `ceil(16387 / 4)` = 4097 tokens; the row moves 3862 -> 4097, the measured remainder, pinned at the measurement. Raise path: the standing maintainer ruling 2026-10-27 「A:先削重复,余额按实测提高」 (ruling record 6513306068). `SKILL.md` gains no byte. No other row moves. ### Outside the original claimed file surface The seat widened the surface by its relay of 2026-11-30T13:21Z: `content/docs/ui/translations.mdx` (that one bullet), the ratchet row, the `.changeset` note, and the one word in the semantic entry. ## Acceptance notes - Read before writing: the merged `rule-message-render.ts`, `engine-rule-message-rendering.ts`, the formula `templateEngine` formatters (`TEMPLATE_FORMATTERS`, `splitHoleFormatter`) and `ExecutionContext.timezone`. - Plain text: no console error or toast renderer in `ui/packages` puts a message through `dangerouslySetInnerHTML` (the files that use it are page HTML, rich text, charts, markdown and code blocks). `@object-ui/core`'s deprecated `ObjectValidationEngine` was not audited (PR 2 contract record, outside the diff). - Out of scope: PR 1's N4 (private copies of the hole grammar, a code dedupe) and PR 2's N3 (`packages/lint/src/seed-row-refusals.ts` prints blank holes), as the seat agreed; PR 2's N2 and N7 stand as recorded; N8 is objectstack-ai#38759. - No eval case: the file surface holds no eval file. ## Verification Head `17319d01f6c6dfc2eb9b7c9ef0daebf764eed391`, on main `49c09ed902`. - Full build: `bash scripts/pm/os-verify-lock.sh -c 'pnpm build --concurrency=2'` → VERDICT command-exit 0 (123/123 tasks). - Derived gates (`node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack`, re-derived after the last commit, same 133): each run with stdin closed, recorded `cmd :: exit N`. All 133 exit 0. - First round on `995a1318c6`: 132 green, `pnpm check:skill-links` red — the table-of-contents link `#messages--record-values-in-holes` did not match the heading, whose code span slugs to `messages--record-values-in---holes`. Root fix in `17319d01f6`: the heading drops the code span (its body shows the holes), the link now resolves, and the ratchet row is pinned at the new measurement (4097). The 15 skills / changeset / ratchet gates were re-run on the new head, all exit 0; no other file changed. - `node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --ran=FILE` → 133 derived, 133 run, 0 NOT-MEASURED, 0 UNRUN. - `node scripts/check-skills-token-ratchet.mjs` and `--self-test` → exit 0; `node scripts/check-skill-links.mjs` → 290 links, 161 fragments resolve. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01ADHkmQ6vV3YvhJWKF1gSDs <!-- signed: repo:objectstack@os-steve · os-steve · session_01ADHkmQ6vV3YvhJWKF1gSDs --> --------- Co-authored-by: Claude <noreply@anthropic.com>
Requested by Steve · project thread
Part of #37909 — PR 1 of the ruling's sequencing (spec + lint: describe, doors, translation judge, showcase rewording). PR 2 (filling the holes in
authoredRuleMessage, currency and readable-field handover, the empty-on-unreadable pins) and PR 3 (skills and docs) stay on the card.Clause-②: no (narrowing)
Metadata-protocol: narrowed
Skills-docs: follow-up #37909 (PR 3 of the ruling's sequencing: skills and docs)
维护者速读
What changes
Ruling P3 (card comment 7239726323, maintainer 「两个产品决策 同意」), parameters 1–4, PR 1 only.
@objectstack/spec— the six validation-rule variants'messagedescribe states the template: a{{ }}hole overrecord(the merged record the rule judged) orprevious(the stored row on update), one of the object's own fields, one segment deep, optional whitelisted formatter; the single brace refused at the doors; still a string.TranslationDataSchema's_validations.RULE.messagedescribe and docblock say the translation is the same template. New exportVALIDATION_MESSAGE_TEMPLATE_ROOTS(['record', 'previous'],@objectstack/spec/data) — the roots the doors judge against and PR 2's renderer binds. ADR-0087 semantic entryvalidation-rule-message-template-holes(step 19). No schema shape changes; the parse judges nothing new.@objectstack/lint— newvalidate-rule-message-templates.ts:closedScopeTemplateRefusalover the spec's roots, thenvalidateExpression('template', …), then the one-segment own-field rule (a bare root, a read through a field, and — where the object's fields are known — an undeclared field, with the nearest one named). Wired intorunStackExpressionPasses:judgeValidationRule) judges each rule'smessageand every nestedconditionalbranch's, atobjects[N].validations[M].message/.then.message; the extension walk reuses it (objectExtensions[N].validations[M].message), against the target's fields as served;translations[N].LOCALE.objects.OBJECT._validations.RULE.messageat build;translationwrite the walk runs that pass alone over the written item (translations[0].objects.…), against the door's live objects —validateStackExpressionsgainstranslationin itsruntimeTypes.Every finding is an
error(expression-invalid):objectstack validate/compilefail, and the publish gate answers 422 on anobject,object_extensionortranslationwrite.support_config_shape's message and itsen/zh-CNbundle entries reworded without braces (the only refused messages in the corpus, below).Census on
origin/main1fef2ed (before code)authoredRuleMessage(packages/objectql/src/validation/rule-validator.ts~L4106) still returns the authored message or its catalog translation verbatim; no interpolation. Unchanged here (PR 2).closedScopeTemplateRefusalcallers:lint/validate-action-copy-templates.ts(action copy),lint/validate-expressions.ts(bulkconfirmText),spec/data/declared-entry.zod.ts(hook/action refusal and text entries);lint/validate-hook-refusal-templates.tscompiles the same family. No caller read a validation-rule message._validationstranslation reachable from the 137 non-test modules that mentionvalidations(examples/**, platform-objects incl. its generated translation bundles, plugins, services), each judged byclosedScopeTemplateRefusaloverrecord/previous: 40 rule messages, 196 translations → 3 refused, allsupport_config_shape(the rule, itsenandzh-CNentries); 0 carry a{{ }}hole. (27 of the 137 modules are runtime code that does not import standalone; none declares metadata.)Tests forced to change
packages/lint/src/runtime-gate.translation-writes-38623.test.ts— two pins named exactly one rule on atranslationwrite;validateStackExpressionsnow joins it (for the translated-message pass), so both pins list it besidevalidateReferenceIntegrity.packages/lint/src/authored-site-expression.test.ts— the enumeration of every call in the rule pass:ruleMessages(plumbing),ruleMessageTemplateIssues(a pass with nothing to say at the MCP tool's predicate site — its probe rule's message is plain text) andruleMessageTranslationIssues(a whole-walk push, no rule or field expression) classified.Tests
packages/lint/src/validate-rule-message-templates.test.ts: the judge (clean sentences under both roots and formatters; single-brace path token with its{{ }}spelling; unbound single brace;${…}; other roots; logic; unknown formatter; bare root; read through a field; undeclared field with suggestion; unknown object judged on depth only),validateStackExpressions(object rule at its key path, nested branch, extension rule against the served target, per-locale translation, a clean stack), and the publish gate (objectwrite 422 at the message path,translationwrite 422 at the item path, a clean translation write).Acceptance notes
authoredRuleMessagedoes not fill it yet); the changeset says so. PR 2 should land in the same release.conditionalwrapper's ownmessageis judged too, though the branch supplies the violation: one contract for the key on every variant.previous.FIELDis accepted on a rule whoseeventsincludeinsert; it renders empty there (PR 2), as the ruling's parameter 1 reads.Verification
pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2 src/validate-rule-message-templates.test.ts: all green.examples/app-showcase, setsupport_config_shape's message back to'Support Config must be { tier: standard }.'and runobjectstack validate: oneexpression-invaliderror atobjects[…].validations[…].message, naming the token.Local gates at head 1264da2 (after merging origin/main 39064f6)
pnpm build --concurrency=2(whole workspace, after the merge): 123/123 tasks, lock VERDICT command-exit 0.pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2: Test Files 1007 passed, Tests 30508 passed, 1 todo (pre-merge head; the merge touched onlyaiknowledge-source spec files).pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2at 1264da2: Test Files 249 passed, Tests 10025 passed (the first run, before the fixes in this diff, failed 3: two meta-test enumerations and the receiver scan ofvalidate-expressions.ts).pnpm --filter @objectstack/spec check:generated: all artifacts up to date (after--fixregeneratedapi-surface,export-origins,docs); re-run after the merge, green.pnpm --filter @objectstack/spec typecheck,pnpm --filter @objectstack/lint typecheck: exit 0.node scripts/pm/dispatch-gates.mjs --commands(derived against merge base 39064f6): 122 commands, each run with stdin closed, every oneexit 0;--ranreconciliation: 122 derived, 122 run, 0 NOT-MEASURED, 0 UNRUN.pnpm --filter @objectstack/dogfood test, lock VERDICT command-exit 0) at 1264da2: Test Files 495 passed, 3 skipped; Tests 4187 passed, 68 skipped; no failure.test:reponot run locally (CI'sTest Core).