Skip to content

feat(lint)!: a validation rule's message is a {{ }} template over the judged record, and a single brace there is refused - #38687

Merged
os-zhuang merged 4 commits into
mainfrom
claude/project-thread-h25bs8
Nov 30, 2026
Merged

os-zhuang merged 4 commits into
mainfrom
claude/project-thread-h25bs8

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

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)

维护者速读

  • 用户能看到什么变化:业务作者写校验规则的报错文案时,可以用双花括号引用被拦记录的字段(如订单总价),单花括号写法在校验、编译和发布时被拒并给出改法;示例应用里一条带花括号的文案已改写。
  • 为什么做:替 HotCRM 解决「拦下改单时说不出差多少钱」的问题,这是第一步,先把文案的写法定下来并在入口把关。
  • 出错会怎样:旧文案里写了单花括号的规则,下次保存或发布会被拒,已存的规则照常加载;现有内置与示例里只有那一条命中,已同步改好,可整体撤回。
  • 要你做什么:无。

What changes

Ruling P3 (card comment 7239726323, maintainer 「两个产品决策 同意」), parameters 1–4, PR 1 only.

  • @objectstack/spec — the six validation-rule variants' message describe states the template: a {{ }} hole over record (the merged record the rule judged) or previous (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.message describe and docblock say the translation is the same template. New export VALIDATION_MESSAGE_TEMPLATE_ROOTS (['record', 'previous'], @objectstack/spec/data) — the roots the doors judge against and PR 2's renderer binds. ADR-0087 semantic entry validation-rule-message-template-holes (step 19). No schema shape changes; the parse judges nothing new.
  • @objectstack/lint — new validate-rule-message-templates.ts: closedScopeTemplateRefusal over the spec's roots, then validateExpression('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 into runStackExpressionPasses:
    • the rule pass (judgeValidationRule) judges each rule's message and every nested conditional branch's, at objects[N].validations[M].message / .then.message; the extension walk reuses it (objectExtensions[N].validations[M].message), against the target's fields as served;
    • a translation pass judges each translations[N].LOCALE.objects.OBJECT._validations.RULE.message at build;
    • on a translation write the walk runs that pass alone over the written item (translations[0].objects.…), against the door's live objects — validateStackExpressions gains translation in its runtimeTypes.
      Every finding is an error (expression-invalid): objectstack validate / compile fail, and the publish gate answers 422 on an object, object_extension or translation write.
  • examples/app-showcase — support_config_shape's message and its en / zh-CN bundle entries reworded without braces (the only refused messages in the corpus, below).

Census on origin/main 1fef2ed (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).
  • closedScopeTemplateRefusal callers: lint/validate-action-copy-templates.ts (action copy), lint/validate-expressions.ts (bulk confirmText), spec/data/declared-entry.zod.ts (hook/action refusal and text entries); lint/validate-hook-refusal-templates.ts compiles the same family. No caller read a validation-rule message.
  • Single-brace census: every validation rule and every _validations translation reachable from the 137 non-test modules that mention validations (examples/**, platform-objects incl. its generated translation bundles, plugins, services), each judged by closedScopeTemplateRefusal over record / previous: 40 rule messages, 196 translations → 3 refused, all support_config_shape (the rule, its en and zh-CN entries); 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 a translation write; validateStackExpressions now joins it (for the translated-message pass), so both pins list it beside validateReferenceIntegrity.
  • 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) and ruleMessageTranslationIssues (a whole-walk push, no rule or field expression) classified.

Tests

  • New 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 (object write 422 at the message path, translation write 422 at the item path, a clean translation write).

Acceptance notes

  • Between this PR and PR 2 a hole that passes the doors is returned as written (authoredRuleMessage does not fill it yet); the changeset says so. PR 2 should land in the same release.
  • A conditional wrapper's own message is judged too, though the branch supplies the violation: one contract for the key on every variant.
  • previous.FIELD is accepted on a rule whose events include insert; 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.
  • Two-minute check: in examples/app-showcase, set support_config_shape's message back to 'Support Config must be { tier: standard }.' and run objectstack validate: one expression-invalid error at objects[…].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 only ai knowledge-source spec files).
  • pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2 at 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 of validate-expressions.ts).
  • pnpm --filter @objectstack/spec check:generated: all artifacts up to date (after --fix regenerated api-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 one exit 0; --ran reconciliation: 122 derived, 122 run, 0 NOT-MEASURED, 0 UNRUN.
  • Dogfood battery (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:repo not run locally (CI's Test Core).

@github-actions github-actions Bot added size/l documentation Improvements or additions to documentation protocol:data protocol:system tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/lint, @objectstack/spec, touching 24 documentable anchor(s). ⚠️ 3 changed file(s) yielded no anchor (packages/spec/api-surface/data.json, packages/spec/docs/references/system/translation.md, packages/spec/export-origins/data.json), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

6 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/api/metadata-api.mdx (via object_extension (literal, a string literal in runtimeTypes))
  • content/docs/data-modeling/object-extensions.mdx (via object_extension (literal, a string literal in runtimeTypes))
  • content/docs/deployment/cli.mdx (via object_extension (literal, a string literal in runtimeTypes))
  • content/docs/deployment/validating-metadata.mdx (via AUTHORING_RULES (symbol, a top-level const object), runtimeTypes (symbol, a field of const object AUTHORING_RULES), object_extension (literal, a string literal in runtimeTypes))
  • content/docs/kernel/cluster.mdx (via object_extension (literal, a string literal in runtimeTypes))
  • content/docs/ui/actions.mdx (via object_extension (literal, a string literal in runtimeTypes))

⛔ 5 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v18/18-3.mdx (via object_extension (literal, a string literal in runtimeTypes))
  • content/docs/releases/v18/18-4.mdx (via object_extension (literal, a string literal in runtimeTypes))
  • content/docs/releases/v18/18-5.mdx (via object_extension (literal, a string literal in runtimeTypes))
  • content/docs/releases/v18/18-6.mdx (via object_extension (literal, a string literal in runtimeTypes))
  • content/docs/releases/v19/index.mdx (via object_extension (literal, a string literal in runtimeTypes))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 3 changed file(s) yielded no anchor (packages/spec/api-surface/data.json, packages/spec/docs/references/system/translation.md, packages/spec/export-origins/data.json) — pages documenting those are invisible to this run
  • 1 anchor(s) matched too much of the corpus to be a work list: objectName (symbol, 61 pages)
  • 6 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 69 of 252 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 182 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 5ac1ee0bc8a79ab2238ded80123ba91623ad6081 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from f3308de15d13bfc567fda598731fa51ea15ae854 — the merge of head 1264da285dd1d917c63cd8be483e7a017d57d692 into base 5ac1ee0bc8a79ab2238ded80123ba91623ad6081, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# 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

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 5ac1ee0bc8a79ab2238ded80123ba91623ad6081 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-steve · session_01ADHkmSAjFEZHRpRq3WCj6z

Contract-review-claim: session_01ADHkmSAjFEZHRpRq3WCj6z · head 1264da2 · 2026-11-30T04:39Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-steve · session_01ADHkmQm8PTU4AkVU5kdwEv
L1-a, the seat's L1 thread · 2026-11-30T04:44Z · first review

席位核对

ACCEPT @ 1264da285dd1d917c63cd8be483e7a017d57d692 (card #37909 PR 1 of ruling P3 7239726323, Part of, the seat's card thread). This is a narrowing and owes L2 at CONTRACT_REVIEW_TIER. The seat has claimed it (7268983201) and lands at Tier H.

Read at head:

  • The judge (validate-rule-message-templates.ts) runs three steps in order.
    1. closedScopeTemplateRefusal over the spec's VALIDATION_MESSAGE_TEMPLATE_ROOTS. It catches single-brace and ${…} tokens, and a hole over another root.
    2. validateExpression('template', …). It catches logic, an unknown formatter, and an empty hole.
    3. holeShapeRefusals. It catches a bare root, a read through a field, and an undeclared field, naming the nearest field.
      Each step returns before the next once it has findings, so a sentence gets one family of findings, and every finding is an error.
  • The field set is the same on every door. buildFieldIndex adds the injected system columns after the declared fields (validate-expressions.ts:241-266). So {{ record.owner_id }} resolves at the build as at the door. The extension walk reads the target as served.
  • The wiring.
    • The rule pass judges each rule's message and every nested then / otherwise branch's, through ruleMessages, at rulePath.KEY.
    • Off an object write, the translation pass reads translations[N].LOCALE….
    • A translation write returns early with that pass alone, over the written item at translations[0], against the door's live objects. runtimeTypes gains translation.
  • My own runs, in a clean worktree at this head, after building the @objectstack/lint^... closure.
    • The new suite, the 38623 gate pins and authored-site-expression: 3 passed, 90 passed (90).
    • My ablation dropped step 3 (holeShapeRefusals): 4 failed | 10 passed.
    • My ablation turned the translation early return into return []: 1 failed, "a translation write answers with the error at the item's path".
    • Both restored; the tree is clean.
  • Declarations.
    • The title has !. Clause-②: no (narrowing) and Metadata-protocol: narrowed are declared, with a BREAKING banner and two FROM → TO rows.
    • lint and spec are minor, at least the floor for a kind on each moved package.
    • adr-0087: registered validation-rule-message-template-holes. The v19 semantic entry exists, and its surface, replacement, reason and acceptanceCriteria are true against the judge above. Its "no conversion is registered" matches a semantic-only entry.
    • Skills-docs: follow-up #37909. The card is open, and the ruling's sequencing puts skills and docs in its PR 3, so the line names a live carrier.
  • Read sentence by sentence; all true against the code above.
    • The changeset: the refusal list (four bullets, the same four families the judge has), "the schema is unchanged … judged at its next save", the export, and "until it lands, a hole that passes the doors is returned as written". authoredRuleMessage is unchanged in this PR.
    • The message describe (the six variants share it) and the _validations translation describe.
    • content/docs/references/data/validation.mdx: the nine regenerated message rows carry that describe.
    • The showcase rewording leaves the rule and both locales brace-free.
  • The forced test edits are explained. The 38623 pins now list validateStackExpressions beside validateReferenceIntegrity on a translation write. The authored-site-expression enumeration classifies the three new calls.
  • Dogfood. The full battery is recorded at this head, 1264da285d: 495 / 4187, no failure.
  • Checks. At this read: 25 success, 10 expected skip, 0 failed and 34 in progress. They must be green before the queue.

For the seat, not blocking:

  • Between this PR and PR 2 a hole passes the doors but renders as written. A {{ record.total_price }} an author writes now reaches the person verbatim until authoredRuleMessage fills it. The changeset says so. Landing PR 2 in the same release, as the body suggests, is the seat's sequencing call.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-steve · session_01ADHkmSAjFEZHRpRq3WCj6z

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 1264da285dd1d917c63cd8be483e7a017d57d692
Local-runs: none
Scope: packages/spec/src/data/validation.zod.ts, packages/spec/src/system/translation.zod.ts, packages/spec/src/migrations/entries/semantic/19.validation-rule-message-template-holes.ts + packages/lint/src/validate-rule-message-templates.ts, packages/lint/src/validate-expressions.ts, packages/lint/src/authoring-rules.ts
Security-touching: no
Rule-change-verified: none

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 main, the os-dev report 7268936971, and the check-runs on this head. Cited code was read at the PR head through git show; nothing was built or run.

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

  • Accept set, objectstack validate / compile (narrowed) — right. A rule message (the rule's own, each nested then / otherwise branch's, and an objectExtensions[] entry's) that carries a single-brace or ${…} token, a hole over a root other than record / previous, a bare root, a hole reading through a field, a hole over a field the object does not declare (only where the object's fields are known), logic, an unknown formatter or an unbalanced hole is now an expression-invalid error. Parameters 1, 3 and 4. ruleMessages walks the same then / otherwise tree rulePredicates walks, and judgeValidationRule does not recurse into branches, so a nested message is reported once.
  • Accept set, translations at build (narrowed) — right. Each translations[N].LOCALE.objects.OBJECT._validations.RULE.message is judged by the same function; an object the stack does not carry is judged on depth alone, so a bundle translating another package's object draws no false field refusal.
  • Accept set, publish gate (narrowed) — right. object and object_extension writes already ran validateStackExpressions; the message pass rides judgeValidationRule on both. translation joins the rule's runtimeTypes, and runStackExpressionPasses returns after the one translation pass on that write, before any other loop. The save-door reading of the written item (locale on the item, paths without a locale segment, an item with no locale judged as nothing) is the reading validateTranslationReferences already uses at that door. The door's live objects are served (foldPendingObjectExtensions in runtime-authoring-gate.ts), so a field a published or pending extension adds resolves. The gate's differential cancels a finding only when the baseline holds it, and the stored self of the written item cancels nothing, so a stored refused message is judged at its next save, as the changeset says.
  • Parse accept set (unchanged) — right. message stays z.string() on all six variants and on the translation entry; the parse judges nothing new, so stored rules and bundles keep loading. Parameter 2, and parameter 3's last sentence.
  • Public surface (widened by one name) — right as a surface, see N1 and N2. @objectstack/spec/data gains the const VALIDATION_MESSAGE_TEMPLATE_ROOTS; api-surface/data.json and export-origins/data.json each gain exactly that row.
  • Published describes — right. The six variants share one message describe through BASE_VALIDATION_SHAPE; the _validations.RULE.message describe and docblock state the same template; both generated reference pages are regenerated.
  • ADR-0087 — right. One semantic entry under step 19 and no conversion: a brace in a stored message was prose or a placeholder that never rendered, and no conversion can tell which. The registry concatenates entries/semantic/ by file, so the new file is its whole registration.
  • Run time (unchanged) — right for PR 1. authoredRuleMessage is not in the diff; a hole that passes the doors is still returned as written. See ③ (2).

② Semver level

  • @objectstack/lint minor and @objectstack/spec minor, under Metadata-protocol: narrowed: a refused value takes at least minor on each package the diff moves, and both move (lint: the judge; spec: the describes, the export, the ledger entry). The level is right.
  • The changeset carries the BREAKING banner, the FROM → TO pairs, the one-line fix, both declaration lines and exactly one ADR-0087 marker (registered validation-rule-message-template-holes), and that id is the entry's id. The PR body carries the same two lines plus Skills-docs: follow-up #37909, which is PR 3 of the ruling's sequencing.
  • Clause-②: no (narrowing) as declared. The arm is right. The value is not what the diff shows, on the letter of the question the line answers (does this change widen an accept set or enlarge the public surface): the accept set only narrows, but the public surface gains one export, and the ruling writes yes (narrowing) on parameter 4, the arm this PR ships. Under either spelling the level is minor, the breaking arm is read and the ADR-0087 disposition is the same, so nothing ships wrong. Graded N1 below.

③ Boundary flags

Dev deviations (report 7268936971):

  • translation.zod.ts outside the first claim's surface: answered by claim amendment 7268637423, which names it. The ruling's first bullet puts the translations in the contract.
  • Four-line maintainer summary instead of six: process, no contract effect.
  • Overlapping gate runners on the first pass: the check-runs on this head are the gate verdicts; nothing to judge.
  • Hole shape enforced at the doors: question (3) below.

Open questions:

  • (2) Is PR 1 alone safe for a release? Safe to land on main: no behaviour regresses, since a {{ }} hole in a rule message was shown as written before this PR and still is, and the only moved behaviour is the refusal. Not safe to release alone: the message describe, the regenerated reference page, the semantic entry and the changeset's FROM → TO all teach the hole as the way to name a value, and an author (or an AI author reading the describe) who follows them ships {{ record.total_price | currency }} verbatim to the person the refusal is shown to. PR 2 must be in the same release. main is in next prerelease mode (19.0.0-next.2), so a prerelease can be cut between the two; the changeset says holes are not filled yet, which covers a next cut, but HotCRM's messages (hotcrm#2827) and any stable release wait for PR 2. The seat holds that coupling on the card; if a stable release is planned before PR 2, that is the maintainer's call.
  • (3) Does enforcing "one segment deep, own fields only" at the doors copy the ruling? Yes. Parameter 1 states the hole shape, and parameter 8 presumes that what passes the doors renders, so the doors are where the shape is refused; the bare-root, through-a-field and undeclared-field arms each follow from parameter 1's sentence, and they are errors as parameter 3 says findings are. "Own fields" is read through the same field index a rule's condition is judged against (authored fields, fields an extension adds, the system columns the platform injects on that object), so a message can name exactly what its condition can read one segment deep. One consequence for the seat to know, not a finding: at the translation save door the undeclared-field arm is an error that depends on the live objects, where the Metadata API saves a translation of an unknown key as valid #38623 reference rule at the same door is warning-only by design. A stored translation whose hole names a field a later object change drops is refused at its next save until that hole is fixed. That follows parameter 3, and the harm differs from an orphan key (a blank fragment inside a sentence shown to people, with the fix named), so I read it as ruled.
  • (4) Clause-②: no (narrowing) for PR 1? Refuted on the letter, immaterial in effect. The seat's reading is right that PR 1 widens no accept set: every string PR 1 accepts was accepted before. But the line also asks about the public surface, and packages/spec/api-surface/data.json gains VALIDATION_MESSAGE_TEMPLATE_ROOTS (const) in this diff; the ruling's own spelling for this arm is yes (narrowing). PR 2 widens neither the accept set nor (unless it exports something) the surface; it changes what a hole means, so PR 2 does not obviously "carry the widening" either. See N1.
  • (5) The name VALIDATION_MESSAGE_TEMPLATE_ROOTS. No identifier collision in any @objectstack/spec subpath. One misleading reading: @objectstack/spec/system already exports a VALIDATION_MESSAGE_* family (VALIDATION_MESSAGE_KEY_PREFIX, VALIDATION_MESSAGE_FALLBACK_LOCALE, renderValidationMessage, interpolateValidationMessage) for the built-in field-constraint catalog, whose placeholders are flat names ({{min}}, {{label}}, {{field}}) with no roots. The new name reads as that family's roots. See N2.

Parameters deferred, not missing:

  • Parameter 5 (formatting): the door half is here (an unknown formatter is refused by the template compile); threading the tenant default currency is PR 2.
  • Parameter 6 (field security), parameter 8 (fork rule): PR 2.
  • Parameter 7 (translation first, then filled, with the authored fallback and its warning): the door half is here (each translation is judged); the pick and the fallback are PR 2.
  • Skills and docs: PR 3 (Skills-docs: follow-up #37909).

Forward flags for PR 2, raised by what this door accepts:

  • The door accepts | currency with no argument unconditionally. The engine refuses that hole at render when the caller hands it no default currency (currencyDefaultRefusal, packages/formula/src/template-engine.ts). A deployment with no default currency is then a template that passes the doors and cannot render, which is parameter 8's fork condition. PR 2 states that case.
  • The door judges names, not field types. A hole over a secret or masked field passes; parameter 6 (renders empty) is what protects it, so PR 2's empty-on-unreadable pins should include a field the caller wrote but cannot read back.

SQL push-down: the diff adds no query, no id materialisation and no in-app join. Nothing to flag.

④ Design judgment

No must-fix, no should-fix.

packages/spec/src/data/validation.zod.ts — holds. The roots are the two a rule's condition already reads (record, previous); parent, which a condition may also read on a master-detail line, is left out, as parameter 1 rules. Each sentence of the const's docblock and of the shared describe agrees with the judge in validate-rule-message-templates.ts: the three doors, the single-brace refusal, other roots, a read through a field, an undeclared field, logic, an unknown formatter, and "stays a string". The describe states the hole in the present tense while the first consumer (authoredRuleMessage, packages/objectql/src/validation/rule-validator.ts) does not fill it at this head; that is the sequencing the ruling set, answered in ③ (2), and a describe should not narrate a transitional state.

packages/spec/src/system/translation.zod.ts — holds. "The doors judge every translation exactly as they judge the authored message" is true of the code: one function, the same roots, the same three steps, errors at build and at the translation write. "Not this parse" is true: the entry stays z.string().optional().

packages/spec/src/migrations/entries/semantic/19.validation-rule-message-template-holes.ts — holds. Surface, replacement, reason and acceptance criteria describe what the doors do, and the "no conversion" reasoning is sound. One slip, N3.

packages/lint/src/validate-rule-message-templates.ts — agrees with the contract. Step 1 hands closedScopeTemplateRefusal the spec's roots, not a copy. Step 2 is the compile the action-copy pass runs. Step 3's hole reader matches the engine's hole and path grammar (HOLE_RE, PATH_ONLY_RE, [i] read as .i) and judges only holes whose root is bound, so it cannot contradict step 1. Tried and held: a token touching another brace (left to the compile, which names the unbalanced hole); {{ record[total_price] }} (read as the engine resolves it); a repeated hole (named once); a non-string message (the schema's to refuse); an unknown object (depth only); a locale tag carrying - (bracketed in the path, as the reference rule spells it). N4 and N5 below.

packages/lint/src/validate-expressions.ts — agrees. The translation early return sits beside the view and page ones and before every other loop, so "that pass alone, by construction" is true. The rule-message loop reads fieldIndex over the objects as served, so "a field an extension adds resolves" is true at the build; the extension walk reaches it through the same judgeValidationRule. The build-side translation pass is skipped on an object write, whose snapshot carries no bundle, as its comment says.

packages/lint/src/authoring-rules.ts — agrees. translation in runtimeTypes is what dispatches the rule on that write; the comment's account of the one pass matches runStackExpressionPasses. The census figures in the comment are the dev's measurement and were not re-run.

Nits (none affects correctness or the contract):

  • N1 (nit) — the Clause-②: value. On the letter it is yes (narrowing): the diff adds a public export and the ruling writes that spelling for this arm. No gate reads a difference here (level, breaking arm and ADR-0087 disposition are the same). The line lives in the PR body and the changeset body and the two must agree, so correcting it moves the head; left as an accepted deviation unless the head moves for another reason, in which case both lines flip together. The seat records on the card that the departure from the ruling's spelling was seen.
  • N2 (nit) — the export name reads into the existing VALIDATION_MESSAGE_* family of @objectstack/spec/system, which names the built-in catalog and binds no roots. VALIDATION_RULE_MESSAGE_TEMPLATE_ROOTS (or the alternative RULE_MESSAGE_TEMPLATE_ROOTS, which matches the lint module's own "rule message" wording) does not. The name is the seat's call. A rename is free until the first release that carries the export and breaking after it, so if it is wanted it rides PR 2, which ships in the same release.
  • N3 (nit) — the semantic entry's replacement example renames the field between its two halves: FROM Total {total_price} is below {received}, TO … {{ record.received_amount | currency }}. The changeset's pair is consistent ({received_amount}). Follow-up with PR 2 or PR 3, when the entry's text is next touched.
  • N4 (nit) — HOLE, HOLE_PATH and segmentsOf are a third private copy of the hole grammar (the engine's, flow-text-slot-template.ts's pathHoles / pathRoot, and now lint's). They agree today. A follow-up exports the spec's reader so lint imports it.
  • N5 (nit) — previous.FIELD is accepted on a rule whose events is ['insert'] alone, where it can only render blank; the door refuses an undeclared field for that same reason. The PR's acceptance notes state the choice and parameter 1 allows it. PR 2 decides whether the door should refuse it.

Implemented-by: claude/project-thread-h25bs8
Reviewed-by: session_01ADHkmSAjFEZHRpRq3WCj6z

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-steve · session_01ADHkmSAjFEZHRpRq3WCj6z

维护者速读

  • 用户能看到什么变化:写校验规则提示语的人可以在提示里用 {{record.字段}} 这类占位,发布前会检查占位写得对不对;提示语里出现单个花括号会被当场拒收(这是不兼容的那一刀)。占位真正替换成记录值要等下一个 PR,在那之前占位会原样显示。
  • 为什么做:维护者已裁(「两个产品决策 同意」,方案 P3),让校验提示能说出被拒的那条记录的值,比如金额;这是三个 PR 里的第一个,只管写法和检查。
  • 出错会怎样:最坏是某条旧提示语因为单花括号被拒,改成双花括号或去掉即可;已存的规则在下次保存前照常加载,撤回这次合并即恢复。
  • 要你做什么:这是收窄(breaking)改动,需要你审批。契约复审 PASS 在评论 7269393846,Head-sha 1264da285dd1d917c63cd8be483e7a017d57d692;批准后由席位落地。下一个 PR(替换占位)要和它进同一个正式版。

Seat opinion: land as is, and keep PR 2 (rendering) in the same stable release; main is in next prerelease mode, and the changeset says holes are not filled yet. Two accepted deviations: the Clause-②: letter should read yes (narrowing) per the ruling (the new public export is a widening; level, breaking arm and ADR-0087 disposition are identical either way), and the export is renamed VALIDATION_RULE_MESSAGE_TEMPLATE_ROOTS in PR 2 to stay clear of the existing VALIDATION_MESSAGE_* field-constraint family. Neither moves this head.

席位核对

ACCEPT at head 1264da285dd1d917c63cd8be483e7a017d57d692 · narrowing (!, Metadata-protocol: narrowed) · Part of #37909

  1. Shape: PR 1 of 3 per ruling 7239726323: spec describes for rule message and _validations.<rule>.message, the closed-scope template judge at validate / compile / publish and the translation save door, single brace refused, showcase rewording, ADR-0087 semantic entry (step 19), changeset with BREAKING FROM→TO.
  2. Premise measured: the thread re-measured authoredRuleMessage, the judge's callers and the single-brace census on origin/main before code; the census is in the PR body.
  3. Gates: check-runs on this head 62 success, 10 expected skips, 0 failed; derived gates 122/122, full build, lint and spec suites green; local full dogfood 4187 passed, 0 failed.
  4. Accepted deviations: N1 Clause-② letter, N2 export name (renamed in PR 2), N3 example field name, N4 a third private copy of the hole grammar, N5 previous.* on insert-only rules (PR 2 decides).
  5. Out of scope and where it went: rendering, currency, field security and translation fallback → PR 2 of Validation rules: an authored rule message cannot name record values, so a refusal cannot say "total 8,000 is below received 10,000" #37909 (claimed by amendment next); skills and docs → PR 3.
  6. Landing: L1 ACCEPT 7269047325 on this head; L2 contract review PASS 7269393846 on this head. Lands after os-zhuang approves.

ACCEPT → PR #38687 comment 7269047325 · Contract review → comment 7269393846

@objectstack-fleet objectstack-fleet Bot added the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 30, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review November 30, 2026 07:19
@os-zhuang
os-zhuang enabled auto-merge November 30, 2026 07:19
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⛔ merge queue 构建失败 — 先分诊,再决定要不要重排

队列构建 46372872221 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集),
所以失败的测试可能在本 PR 没碰过的包里 —— 那不是重排能修的。每次盲目重排都会让排在后面的所有 PR 重建一轮。

分类:failure —— 按下面的日志分诊。

失败的 job(日志抽取,best effort):

  • Dogfood Regression Gate (3/3) — 失败步骤: Boot example apps and exercise real user flows

    @objectstack/dogfood:test:  FAIL   isolated  test/package-move-in.dogfood.test.ts > dogfood: POST /packages/:id/move-in, the move door (#38150) > A3 (#37468) and the set rule: flow, dataset and report
      ↳ 失败原因: @objectstack/dogfood:test: AssertionError: expected 404 to be 200 // Object.is equality
    

↳ 失败原因 是判读的关键:超时(Test timed out in … / Hook timed out in …)多半是负载/时序,不是本 PR 的回归;
断言(AssertionError: …)才指向真实的行为改变。两者的 FAIL 行长得一模一样,只有这一行能区分。

⚠️ 断言这一侧有一类例外,判据是断言在测什么,不是它是不是 AssertionError。 断言的对象是产品行为(一个值、一个形状、一次拒收)⇒ 照上面读:真实的行为改变,去查,⛔ 不要重排掉;
断言的对象是这次实验自身的有效性前提(跑完的耗时、负载下的先后、任何只在时间预算内才成立的条件)⇒ 它跟超时是同一类,同样对负载敏感,重排一次是合法的判别手段。
识别是机械的:断言的消息或它比较的值本身点名了一段时长、一个时间戳、一个耗时计数。实测过的一对 —— AssertionError: SecurityPlugin.init() ran: expected false to be true 测的是产品行为(真回归);
AssertionError: this run took over a second, so second-precision stamps could have differed too: expected 1006 to be less than 1000 测的是实验前提:它守护的那条不变式当时是绿的,同一个 head 原样重排一次即成功。
穿着 AssertionError 外衣的时间测量,仍然是时间测量。(⛔ 这只改「怎么读一次红」,不改「哪些测试可以重排」——后者由别处管。)

跨 PR 相同签名(24h,按失败测试文件聚合):

历史信号:

  • 本 PR 过去 24h 无队列失败记录(首次)。
  • 过去 24h 队列共有 6 个失败构建(不含本次)。

分诊清单:

  1. 失败测试在本 PR 改动的包里 → 真回归,修 PR。
  2. 失败测试与本 PR 无关 → 看上面的「跨 PR 相同签名」;已有汇总 issue ⇒ flaky/环境问题实锤,去那张 issue 上谈,修好前重排只会再烧一轮全队列。
  3. 两者都不是 → 可能与同组 PR 语义冲突;等前面的 PR 落地或失败出队后再重排一次即可,不要连续重排。

Generated by Claude Code · merge-queue-triage workflow (#4859)

@os-zhuang
os-zhuang deleted the claude/project-thread-h25bs8 branch November 30, 2026 08:03
@objectstack-fleet objectstack-fleet Bot removed the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 30, 2026
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
… 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>
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation protocol:data protocol:system size/l tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants