Skip to content

docs(spec): guard the nullable amount in the docs examples and the validation condition example - #31358

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-2zrqid
Nov 8, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-2zrqid

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Leehom · project thread
Fixes #31334

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:七个文档页和 ValidationRule.condition 的 spec 示例里,对可空 amount 的比较补上 record.amount != null && … 守卫;common-patterns 的报销单把 amount 改为 required: true;用 gen:docs 重新生成 references/data/validation.mdx(只变 4 行)。
  • 为什么改:发布期空值守卫规则会拒绝对可空字段做未守卫的大小比较或算术;照抄这些示例,要么发布被拒,要么 requiredWhen 静默失效(什么都不强制)。
  • 风险与回滚:纯文档与 spec 描述文字,不改 schema 形状、不移动任何接受集;@objectstack/spec patch;回滚即 revert。
  • 先看:content/docs/getting-started/common-patterns.mdx(唯一选了 required: true 而非守卫的一处);packages/spec/src/data/validation.zod.ts L180;content/docs/data-modeling/formulas.mdx L394 起的说明文字。
  • 两分钟验证:pnpm --filter @objectstack/spec run check:docs,预期 exit 0(生成页与源一致);下方表格是每处表达式经真实规则 validateStackExpressions 的前后读数。
  • 需要你做的:无,席位落地。

What changes

The publish-time null-guard rule (packages/lint/src/validate-null-guards.ts, wired by validateStackExpressions, which os build, os validate, os lint and the runtime publish gate all run) refuses an ordering or arithmetic operator on a declared-nullable field unless a != null / == null / isBlank() test guards it. Every site in the card compared record.amount unguarded in a gated position. Each is fixed with the shape the formula skill teaches (skills/objectstack-formula/SKILL.md L112-L122, L404).

Site Surface Fix Why this fix
content/docs/getting-started/common-patterns.mdx L312, flow edges e2/e3 record_change flow on expense_report amount declared required: true The example declares its object, and the flow branches on amount (< 100 auto-approves, >= 100 asks). Guarding the start condition instead would let a submitted report with no amount launch no flow at all, so it would skip approval silently. An expense report always has an amount, so required: true is the honest fix. The edges stay as written.
content/docs/automation/approvals.mdx L145, start condition record_change flow start on opportunity guard: record.amount != null && record.amount >= 50000 && … The object is not declared. Per the ruling, a flow is guarded at its start condition, which covers every edge and branch (validate-expressions.ts L2967-L2976).
content/docs/automation/hook-bodies.mdx L74 hook condition guard The object is not declared.
content/docs/data-modeling/formulas.mdx L119 field requiredWhen guard The Invoice example declares fields, but not amount (nor subtotal, tax_rate, invoice_no, customer); it is a fragment for amount, so it is guarded rather than given a required declaration it does not have.
content/docs/data-modeling/formulas.mdx L356 field requiredWhen guard The object is not declared.
content/docs/data-modeling/formulas.mdx L394 validation rule condition guard, plus one sentence under it saying why an optional field needs the != null test The object is not declared.
content/docs/data-modeling/validation.mdx L329 validation rule condition (a validations: fragment) guard The object is not declared.
content/docs/automation/flows.mdx L2473 flow start-node condition (syntax table) guard The object is not declared.
packages/spec/src/data/validation.zod.ts L180 .describe() validation condition guard: P`record.amount != null && record.amount < 0` The object is not declared. content/docs/references/data/validation.mdx L170/L291/L505/L571 regenerated with pnpm --filter @objectstack/spec gen:schema && gen:docs, never hand-edited.
packages/spec/src/data/validation.zod.ts L257 and L532 (doc comments) cross_field and conditional rule examples guard Bounded in-place fix, see below.

Bounded in-place fix (same file, outside the card's table). The two doc-comment examples in validation.zod.ts (the cross_field discount_limit at L257, and the conditional enterprise_high_value then at L532) have the same defect, and the rule refuses both (table below). All four conditions hold: the same defect class, the same mechanical guard shape, no other claim on the file (PR #31322 touches hook.zod.ts, not this file), and the same gate families. The doc comments ship in @objectstack/spec's .d.ts, where an author or agent reads them. They do not reach the generated reference page.

Not changed (out of scope by ruling): validation.mdx L51 (amount is required: true at L31), the ui/ SchemaForm test constant, release notes and CHANGELOGs.

Tests

Each changed expression was run, in its declared context, through the real gating rule: validateStackExpressions from the built @objectstack/lint dist/ (built on this branch's base dc7f5c4b4). The fixture object declares amount as { type: 'currency' }, which is nullable (no required, no default), as on the CRM example's opportunity. Counts are error-severity null-guard findings; every row had 0 other errors.

Site Before After
common-patterns flow e2/e3 REFUSED (2: edge e2, edge e3) accepted (amount required: true)
approvals.mdx start condition REFUSED (1: start condition) accepted
hook-bodies.mdx hook condition REFUSED (1) accepted
formulas.mdx L119 / L356 requiredWhen REFUSED (1) accepted
formulas.mdx L394 / validation.mdx L329 script rule REFUSED (1) accepted
flows.mdx L2473 start condition REFUSED (1) accepted
validation.zod.ts L180 condition REFUSED (1) accepted
validation.zod.ts L257 cross_field REFUSED (2: discount, amount) accepted
validation.zod.ts L532 conditional then REFUSED (1) accepted
Probe output
REFUSED  | null-guard errors 2 | other errors 0 | common-patterns.mdx flow e2/e3 (amount declared nullable) | flow 'expense_approval' · edge 'e2' (check_amount→auto_approve) condition; flow 'expense_approval' · edge 'e3' (check_amount→request_approval) condition
accepted | null-guard errors 0 | other errors 0 | common-patterns.mdx flow e2/e3 (amount required: true)
REFUSED  | null-guard errors 1 | other errors 0 | approvals.mdx L145 start condition BEFORE | flow 'opportunity_approval' · node 'start' (start) condition
accepted | null-guard errors 0 | other errors 0 | approvals.mdx L145 start condition AFTER
REFUSED  | null-guard errors 1 | other errors 0 | hook-bodies.mdx L74 hook condition BEFORE | hook 'h' (opportunity) condition
accepted | null-guard errors 0 | other errors 0 | hook-bodies.mdx L74 hook condition AFTER
REFUSED  | null-guard errors 1 | other errors 0 | formulas.mdx L119/L356 requiredWhen BEFORE | object 'opportunity' · field 'po_number' requiredWhen
accepted | null-guard errors 0 | other errors 0 | formulas.mdx L119/L356 requiredWhen AFTER
REFUSED  | null-guard errors 1 | other errors 0 | formulas.mdx L394 / validation.mdx L329 script rule BEFORE | object 'opportunity' · validation rule 'amount_positive'
accepted | null-guard errors 0 | other errors 0 | formulas.mdx L394 / validation.mdx L329 script rule AFTER
REFUSED  | null-guard errors 1 | other errors 0 | flows.mdx L2473 start condition BEFORE | flow 'opportunity_approval' · node 'start' (start) condition
accepted | null-guard errors 0 | other errors 0 | flows.mdx L2473 start condition AFTER
REFUSED  | null-guard errors 1 | other errors 0 | validation.zod.ts L180 condition BEFORE | object 'opportunity' · validation rule 'r'
accepted | null-guard errors 0 | other errors 0 | validation.zod.ts L180 condition AFTER
REFUSED  | null-guard errors 2 | other errors 0 | validation.zod.ts L257 cross_field (jsdoc) BEFORE | object 'opportunity' · validation rule 'discount_limit'; object 'opportunity' · validation rule 'discount_limit'
REFUSED  | null-guard errors 1 | other errors 0 | validation.zod.ts L532 conditional then (jsdoc) BEFORE | object 'opportunity' · validation rule 'enterprise_high_value' then → 'amount_approval'
accepted | null-guard errors 0 | other errors 0 | validation.zod.ts L257 cross_field (jsdoc) AFTER
accepted | null-guard errors 0 | other errors 0 | validation.zod.ts L532 conditional then (jsdoc) AFTER

No test file changes: this is docs and description text. No test pins the old describe string (git grep over packages/**).

Acceptance notes

  • packages/spec/src/automation/flow.zod.ts L1070-L1071, the FlowSchema @example, has the same record.amount < 500 / >= 500 edges. As written its start node carries no config.objectName, so the rule has no object to resolve and does not refuse it (probe: 0 findings as written, 2 once the start is bound to an order with a nullable amount). Outside this card's surface and not refused at a public door today, so it is noted, not filed.
  • skills/objectstack-data/rules/validation.md L164 (discount_limit) is already guarded.

Verification

On head c4bbb0ad (merge base dc7f5c4b4), after building the @objectstack/lint closure, then @objectstack/spec and the @objectstack/client-react closure, under NODE_OPTIONS=--max-old-space-size=8192: 98 of the 99 commands from node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack exit 0. pnpm check:dual-build-cjs-loads exits 3 (PREREQUISITE NOT MET: it needs every workspace package's dist/), so it is NOT MEASURED locally and CI reads it. dispatch-gates --ran: 99 derived, 98 run, 1 NOT-MEASURED, 0 UNRUN (exit 0). Changed lines: 35 + the changeset, 9 files.

Also run: packages/spec src/data/validation.test.ts + validation-boundary-description.test.ts (2 files, 90 / 90 passed, lock VERDICT command-exit 0); eslint on validation.zod.ts (exit 0); node scripts/check-commit-card-trailers.mjs --range origin/main..HEAD (exit 0); pnpm check:skill-frame-freshness (exit 0). pnpm check:dev-prereqs exits 1 on local state only (65 of 107 packages have no dist/ in this worktree, since only the needed closures were built); its self-test passes, and it is not a finding about this diff.

The NOT MEASURED families dispatch-gates names outside the derived list (CI-only steps, type-check lanes, the dogfood and build jobs) run in CI.

Each command with its exit code (head c4bbb0a)
node scripts/check-adr-0087-registration.mjs --base origin/main :: exit 0
node scripts/check-adr-0087-registration.mjs --self-test :: exit 0
node scripts/check-adr-links.mjs :: exit 0
node scripts/check-adr-links.mjs --self-test :: exit 0
node scripts/check-changeset-no-major.mjs --base origin/main :: exit 0
node scripts/check-closing-keyword-parity.mjs :: exit 0
node scripts/check-closing-keyword-parity.mjs --self-test :: exit 0
node scripts/check-comment-mask-adoption.mjs :: exit 0
node scripts/check-comment-mask-adoption.mjs --self-test :: exit 0
node scripts/check-comment-mask-corpus.mjs :: exit 0
node scripts/check-dev-prereqs.mjs --self-test :: exit 0
node scripts/check-doc-route-spelling.mjs --advisory :: exit 0
node scripts/check-doc-route-spelling.mjs --self-test :: exit 0
node scripts/check-docs-section-name.mjs :: exit 0
node scripts/check-docs-section-name.mjs --self-test :: exit 0
node scripts/check-dts-emitted.mjs --self-test :: exit 0
node scripts/check-empty-changeset.mjs --base origin/main :: exit 0
node scripts/check-empty-changeset.mjs --self-test :: exit 0
node scripts/check-issue-citations.mjs :: exit 0
node scripts/check-plugin-teardown-shape.mjs :: exit 0
node scripts/check-plugin-teardown-shape.mjs --self-test :: exit 0
node scripts/check-section-landing-index.mjs :: exit 0
node scripts/check-section-landing-index.mjs --self-test :: exit 0
node scripts/ci/assert-turbo-remote-cache.mjs --self-test :: exit 0
node scripts/ci/plan-test-core-shards.mjs --self-test :: exit 0
node scripts/ci/prune-turbo-cache.mjs --self-test :: exit 0
node scripts/ci/snapshot-next.mjs --self-test :: exit 0
node scripts/docs-audit/check-affected-docs.mjs :: exit 0
node scripts/docs-audit/check-drift-comment.mjs :: exit 0
node scripts/pm/release-rehearsal-clone.mjs --self-test :: exit 0
node scripts/release-pending-publish.mjs --self-test :: exit 0
pnpm --filter @objectstack/lint run check:doc-formula-expressions :: exit 0
pnpm --filter @objectstack/lint run check:doc-security-posture :: exit 0
pnpm --filter @objectstack/spec run check:api-surface :: exit 0
pnpm --filter @objectstack/spec run check:authorable-surface :: exit 0
pnpm --filter @objectstack/spec run check:browser-reachable-entries :: exit 0
pnpm --filter @objectstack/spec run check:docs :: exit 0
pnpm --filter @objectstack/spec run check:dual-source-exports :: exit 0
pnpm --filter @objectstack/spec run check:duration-unit-keys :: exit 0
pnpm --filter @objectstack/spec run check:empty-state :: exit 0
pnpm --filter @objectstack/spec run check:entry-nameability :: exit 0
pnpm --filter @objectstack/spec run check:export-origins :: exit 0
pnpm --filter @objectstack/spec run check:exported-any :: exit 0
pnpm --filter @objectstack/spec run check:generated :: exit 0
pnpm --filter @objectstack/spec run check:liveness :: exit 0
pnpm --filter @objectstack/spec run check:llms-txt :: exit 0
pnpm --filter @objectstack/spec run check:skill-examples :: exit 0
pnpm --filter @objectstack/spec run check:skill-refs :: exit 0
pnpm --filter @objectstack/spec run check:strictness-ledger :: exit 0
pnpm --filter @objectstack/spec run check:variant-docs :: exit 0
pnpm --filter @objectstack/spec run check:yaml-examples :: exit 0
pnpm check:adr-symbol-anchors :: exit 0
pnpm check:changeset-gate-self-tests :: exit 0
pnpm check:ci-filter-parity :: exit 0
pnpm check:closed-ceremony-text :: exit 0
pnpm check:corpus-claim-drift :: exit 0
pnpm check:cross-package-test-inputs :: exit 0
pnpm check:dispatcher-error-vocabulary :: exit 0
pnpm check:doc-anchors :: exit 0
pnpm check:doc-authoring :: exit 0
pnpm check:doc-frontmatter :: exit 0
pnpm check:docs-audit-scope :: exit 0
pnpm check:docs-redirects :: exit 0
pnpm check:docs-single-h1 :: exit 0
pnpm check:docs-spec-enumerations :: exit 0
pnpm check:docs-transcript-drift :: exit 0
pnpm check:driver-memory-census :: exit 0
pnpm check:dts-closure :: exit 0
pnpm check:dual-build-cjs-loads :: exit 3
pnpm check:gitlink-declared :: exit 0
pnpm check:issue-citations :: exit 0
pnpm check:keyed-text-bounds :: exit 0
pnpm check:lean-entry-closure :: exit 0
pnpm check:logger-receiver-detach :: exit 0
pnpm check:merge-driver :: exit 0
pnpm check:nul-bytes :: exit 0
pnpm check:org-identifier :: exit 0
pnpm check:page-declaration-shape :: exit 0
pnpm check:platform-object-tenancy-census :: exit 0
pnpm check:pm-prior-rulings :: exit 0
pnpm check:published-files :: exit 0
pnpm check:published-readme-links :: exit 0
pnpm check:react-page-adapter-contract :: exit 0
pnpm check:refd-timer-probe :: exit 0
pnpm check:registry-log-declared :: exit 0
pnpm check:rest-log-spy-declared :: exit 0
pnpm check:role-word :: exit 0
pnpm check:skill-identifier-liveness :: exit 0
pnpm check:slot-lookup :: exit 0
pnpm check:sourcemap-no-sources-content :: exit 0
pnpm check:spec-docblock-symbol-anchors :: exit 0
pnpm check:spec-parsed-alias :: exit 0
pnpm check:system-context-census :: exit 0
pnpm check:test-source-alias :: exit 0
pnpm check:tier-file-adoption :: exit 0
pnpm check:undeclared-dep-imports :: exit 0
pnpm check:vendor-version-stamps :: exit 0
pnpm check:vouch-for-reference-callers :: exit 0
pnpm check:watch-hint-literal :: exit 0

Generated by Claude Code

The publish-time null-guard rule refuses an ordering or arithmetic operator
on a nullable field unless a `!= null` test guards it. Seven docs pages and
the ValidationRule condition example compared `record.amount` unguarded in a
gated position (flow start/edge, hook condition, requiredWhen, validation
condition).

- Guard with `record.amount != null && …` where the example does not declare
  the field; a flow is guarded at its start condition.
- common-patterns: declare the expense report's `amount` `required: true`,
  since the approval flow branches on it.
- Regenerate content/docs/references/data/validation.mdx with gen:docs.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5kcxM8mwtPqSQpzbVT
@github-actions github-actions Bot added size/s documentation Improvements or additions to documentation protocol:data tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 8, 2026
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

1 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run.

What this run could not see
  • the SDK route bridge reached 64 of 227 client-bound route-ledger rows — the other 163 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 163: 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; 104 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 — 171 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 d0512c2fbec9e0abd2f7fbd09986e4fdab73211d → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 7d9b9b47f4798aa2d819f64be13459afcef25d38 — the merge of head c4bbb0adeae3326cd6975f0a2c891df974607c45 into base d0512c2fbec9e0abd2f7fbd09986e4fdab73211d, 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 7d9b9b47f4798aa2d819f64be13459afcef25d38 && git checkout 7d9b9b47f4798aa2d819f64be13459afcef25d38
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin d0512c2fbec9e0abd2f7fbd09986e4fdab73211d c4bbb0adeae3326cd6975f0a2c891df974607c45 && git checkout -B drift-repro d0512c2fbec9e0abd2f7fbd09986e4fdab73211d && git merge --no-ff c4bbb0adeae3326cd6975f0a2c891df974607c45

node scripts/docs-audit/affected-docs.mjs --json d0512c2fbec9e0abd2f7fbd09986e4fdab73211d

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

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:devx#3 · os-project-manager · session_01FEkQ5njkh3xbcDN6EtSfw7

席位核对

Verdict: ACCEPT · head c4bbb0adeae3326cd6975f0a2c891df974607c45 · card #31334 · report 6717074863 · contract review on this head (PASS, schema face, CONTRACT_REVIEW_TIER).

  • Shape: draft → main, Fixes #31334. 9 files: 6 docs pages, the regenerated references/data/validation.mdx, packages/spec/src/data/validation.zod.ts and one changeset. All inside the claim's surface. NOT governed.
  • Card's ask, read in the diff: every site in the table now guards the nullable record.amount where the rule reads it; flows are guarded at the start condition. The dev's real-rule probe refused all nine site shapes before the change and accepts them after. The reviewer traced each one through validate-null-guards.
  • Seat reading, common-patterns declares required: true instead of a start guard: right. A guarded start would let a submission with no amount skip approval silently, and per-edge guards are what the ruling rules out.
  • Seat reading, the two extra validation.zod.ts doc-comment examples (cross_field, conditional): inside the claimed file's example strings, same class, and refused by the rule as written. Accepted under the in-place exemption. Only the .describe() text and the TSDoc change: no schema shape, accept set or export changes. The reference page is regenerated (its only change is the describe string).
  • Changeset: @objectstack/spec patch, Clause-②: no, Metadata-protocol: none are correct, and Check Changeset is green.
  • Out of scope held: no ui/ file, no release notes or CHANGELOG, and validation.mdx L51 untouched.
  • Gates: check-runs on this head: 57 success, 8 skipped, 0 failed, 0 running. Build Core's check:dual-build-cjs-loads step concluded success, which closes the one local NOT MEASURED.
  • Follow-up filed by the seat: the FlowSchema @example in flow.zod.ts (around L1070) has the same unguarded edges. It is not refused today only because its start node has no objectName.
  • Landing: under 「按照 pm-dispatch 规则复核过的都授权」 (2026-10-25T11:35Z) and 「你应该使用 pm-dispatch 技能审核和落地pr」 (2026-11-07T16:59Z): pr_ready + automerge_enable now.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 8, 2026 04:36
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 8, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:devx#3 · os-project-manager · session_01FEkQ5njkh3xbcDN6EtSfw7

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: c4bbb0adeae3326cd6975f0a2c891df974607c45
Local-runs: none
Scope: packages/spec/src/data/validation.zod.ts + content/docs/references/data/validation.mdx (generated from it), packages/lint/src/validate-null-guards.ts (isNullableField is in validate-expressions.ts ≈L483, truthGuards ≈L512, provenNonNullKeys ≈L605, findUnguardedNullableOperands ≈L639), packages/lint/src/validate-expressions.ts (rulePredicates ≈L659, buildNullableFieldIndex ≈L2307, checkNullGuards ≈L2486, the flow null-guard block ≈L2959-L2977, the validation-rule walk ≈L3418-L3470), packages/spec/scripts/build-docs.ts (gen:docs / check:docs), skills/objectstack-formula/SKILL.md (≈L112-L122, ≈L399-L407), .changeset/31334-validation-amount-null-guard-example.md, and the seven docs pages (content/docs/automation/approvals.mdx, flows.mdx, hook-bodies.mdx, content/docs/data-modeling/formulas.mdx, validation.mdx, content/docs/getting-started/common-patterns.mdx), widened in because the card's table names every one of them and the seat asked for each site to be judged. Cited code read on origin/main d0512c2fb; the merge base is dc7f5c4b4, and none of the five commits between them touches a file in the diff or a cited file. Face: schema (record-recognisers --paths over the nine files returns the one hit, packages/spec/src/data/validation.zod.ts). No governed-register path is in the diff.

① Derived judgments

Inputs: card #31334 (body, triage audit 6716403823, the seat's claim 6716759332, the os-dev report 6717074863), the PR body and file list (9 files, +31 / −16), the net diff against the merge base, PR #31322 and its record 6715980957 for context, and the check-runs on the head. Nothing was built, run or re-run: this container has no installed dependencies (empty node_modules, a 23 MB pnpm store), so the dev's probe could not be re-executed without an install and a three-package build; each site was instead traced through the rule's own code, named below, and the dev's probe table on the PR body was checked against the trace.

  • No accept set moves. RIGHT. validation.zod.ts changes three strings: the .describe() of ScriptValidationSchema.condition (L180) and two TSDoc examples (cross_field ≈L257, conditional then ≈L532). The schema stays EvaluatedExpressionInputSchema, inside the same strictObject; no refine, default, alias, export or type changes. The reference page's four changed rows (L170, L291, L505, L571) are the one describe string, verbatim, in the four nested-shape tables that render ScriptValidation.
  • Published description text changes, as a patch. RIGHT. The string ships in the built json-schema projection (gitignored, gen:schema), the .d.ts doc comments and the generated reference page. The committed json-schema.manifest/data.json does not carry it. A grep over the head for the describe sentence outside those carriers finds nothing, so no test pins the old text.
  • The L180 example passes the rule it cites. RIGHT, traced. rulePredicates yields the script rule's condition; checkNullGuards runs findUnguardedNullableOperands with fail-closed. record.amount != null && record.amount < 0: the && visit hands the right conjunct truthGuards(left), and != against the null literal yields {record.amount}; the < operand is that key, so report returns before any finding. Before, on an object whose amount is { type: 'currency' } with no required, defaultValue, default option or autonumber (isNullableField → nullable), the bare < is one finding. Matches the dev's 1 → 0.
  • The two doc-comment examples pass. RIGHT, traced. cross_field: ((discount != null && amount != null) && discount > (amount * 0.40)) — truthGuards of the left conjunct is the union {record.discount, record.amount}, which covers the > operand and the * operand; before, both operands are findings (the dev's 2 → 0). conditional: rulePredicates recurses into then at depth 1 and checkNullGuards runs on it; ((amount != null && amount > 100000) && approval == null) guards the > inside its own conjunction, and == is never flagged (1 → 0).
  • The six guarded docs sites pass, and each guard sits where the rule reads it. RIGHT, traced.
    • approvals.mdx L145: triggerType: 'record-after-update' resolves to record_change, so the start condition is the trigger gate, judged with no presumption; record.amount != null && record.amount >= 50000 && record.stage == 'proposal' parses left-associative and the >= is inside the conjunction its guard dominates; the == is inert. The flow's edges carry labels, not conditions, so there is nothing downstream to presume. Guard on the start, as the ruling asks (validate-expressions.ts ≈L2967-L2976 passes provenNonNullKeys(start) as presumed to every edge and decision slot).
    • flows.mdx L2473: a start-node condition row in the syntax table; the guard dominates the >.
    • hook-bodies.mdx L74: hook condition, covered row; record.status == "open" && record.amount != null && record.amount > 1000 — the last conjunct's guard set is truthGuards(status == "open" && amount != null) = {record.amount}.
    • formulas.mdx L119 and L356: field requiredWhen, covered row (fail-open, so an unguarded predicate enforced nothing); guard dominates.
    • formulas.mdx L394 and validation.mdx L329: script rule conditions, same trace as L180. The two added sentences under L394 state the gate's rule correctly (<, <=, >, >= or arithmetic on a nullable field needs a null test first) and name no tracker number.
  • common-patterns declares amount required: true instead of a guard. RIGHT, and it is the honest fix (judged in ④).
  • The reference page was regenerated, not hand-edited. RIGHT. pnpm --filter @objectstack/spec check:docs (build-docs.ts --check) runs in Type Check · source gates as the step "Check generated reference docs are in sync with the spec"; that step is continue-on-error, so the job's green is not enough on its own — the step's own conclusion on this head is success. Independently, the page's only change is the describe string, byte-identical in all four rows, with no other hunk.
  • Labels. protocol:data is on the PR, applied by Auto Label from .github/labeler.yml (packages/spec/src/data/**); documentation, size/s and tooling likewise. Nothing is owed by hand.

② Semver level

'@objectstack/spec': patch is right. Ruling A in check-changeset-no-major.mjs reads the level off the Metadata-protocol: line alone: none requires every introduced entry to be patch and no authorable-surface/ baseline to move; both hold (the check:authorable-surface step is green on the head). Clause-②: no is right: description and doc-comment text only, no accept set widens or narrows, so no (narrowing) arm, no BREAKING banner and no ADR-0087 disposition marker is owed (that gate asks for one only on a declared breaking change). Both lines are line-initial in the changeset and in the PR body, and the changeset text names all three string changes, including the two doc comments. The docs pages belong to no published package, so no second changeset is owed. Check Changeset is green on this head.

On the spec-lane question: the card's suggested shape says the spec example "rides with a spec-lane note"; the triage ruling (6716403823) says only that it "rides the same PR as a spec doc-example change". No rule in AGENTS.md or os-dev.md owes a note of that name, the PR body states the spec-file change and the regeneration in both languages, and the protocol:data label is already applied. Not owed.

③ Boundary flags

  • Deviation: the two validation.zod.ts doc-comment examples (≈L257, ≈L532) are outside the card's table. Accepted, on the code. os-dev.md's in-place exemption has four conditions and two debts: ① same defect class — yes (the same rule refuses both, by trace); ② mechanical fix with a pinned shape — yes (the formula skill's record.x != null && …); ③ no other claim on the file — yes (among open PRs only docs(spec): guard the nullable amount in the docs examples and the validation condition example #31358 touches validation.zod.ts; docs(skills, spec): guard the nullable amount in the approval-flow and hook-condition examples #31322 touches hook.zod.ts); ④ same gate family, no new verification surface — yes. The debts: the claim already names the file (the claim's "(example string)" reads as the file's example strings; both additions are example strings in that file, so no amendment is needed), and the PR body names the fix with before/after evidence. No escalation.
  • The ruling "guard the start condition, not each edge" is followed. approvals.mdx guards the start; common-patterns.mdx leaves its edges as written and removes the nullability instead, which is the one case where a start guard would have been the wrong fix (④).
  • Out of scope held. No ui/ file in the diff (the SchemaForm.erasedArmMark-9830.test.tsx constant is untouched); no release notes or CHANGELOG; validation.mdx L51 untouched (its one hunk is L329, and amount at L31 is required: true on main).
  • Labels not sent by pr_create. The order named none and the relay refuses an empty list; Auto Label supplied them. Not a contract matter.
  • check:dual-build-cjs-loads NOT MEASURED locally (exit 3, prerequisite not met). It runs in ci.yml's build-core job (Build Core) on every PR. Build Core is green on this head, and its step "Every published require entry point actually loads" (pnpm check:dual-build-cjs-loads) concluded success, so the one locally not-measured gate is measured green in CI. Check-runs as read by this review: 65 runs, 57 success, 8 skipped (opt-in and schedule-gated jobs), 0 failure, 0 running, including all eight Test Core shards, the four Type Check jobs, every Lint job, Check Changeset, PR-body guards, Governed Surface Queue Guard, Build Docs, Live E2E UI and Build & E2E UI.
  • Report's "PR docs(skills, spec): guard the nullable amount in the approval-flow and hook-condition examples #31322 touches none of these files". True: docs(skills, spec): guard the nullable amount in the approval-flow and hook-condition examples #31322's files are hook.zod.ts, hook.mdx, the automation skill reference and its changeset.
  • main moved five commits since the base (dc7f5c4b4 → d0512c2fb); none touches a file in the diff or a cited lint or spec file. GitHub had not finished recomputing mergeability at read time; nothing in the moved commits can conflict.
  • out_of_scope_findings 1: packages/spec/src/automation/flow.zod.ts ≈L1070 FlowSchema @example spells record.amount < 500 / >= 500 on edges e2 / e3. Confirmed on main: its start node carries no config.objectName, so nullGuardObject is undefined and the gate does not run; an author who binds it to an object with a nullable amount is refused. Not a defect of this PR and not in the card's table; should-fix for the seat, outside this PR: file it as a sibling card (spec @example text, protocol:automation), the way skills + spec: approval-flow edge conditions in state-machines-and-approvals.md and the HookSchema.condition example compare a nullable amount unguarded, which the publish-time null-guard rule refuses #31206 produced this card.
  • out_of_scope_findings 2 is the deviation above. open_questions: none. Security: none.

④ Design judgment

No must-fix. No should-fix inside the PR.

  • packages/spec/src/data/validation.zod.ts: holds. Against the rule it cites: all three examples pass findUnguardedNullableOperands on an object whose amount (and discount) is nullable, by the traces in ①, and the dev's probe table agrees at every count. Against the first consumer: an author or agent who copies the describe example, the cross_field example or the conditional example into a script / cross_field rule on a nullable field now gets metadata that os build, os validate, os lint and the runtime publish gate accept, where before the write path faulted (null < 0 has no overload) and the rule refused every row with a null amount, which is not what "amount must be non-negative" means. The guarded reading is the honest semantics: a null amount is the required check's business, not the sign check's. I tried to break it: the added text carries no quote character, so the single-quoted TS describe string and the backticked P\…`inside it keep their shape;&&and!=survive MDX escaping (the same form already renders inhook.mdx, and Build Docsis green); thecross_field fields: ['discount', 'amount']still names exactly the two operands; theconditional when` is an equality the gate never flags; no other comparison in the file is unguarded.
  • content/docs/getting-started/common-patterns.mdx: holds, and required: true is the right fix. The flow branches on amount at e2 / e3; its start condition is a state transition on status. A guard on the start condition (the ruling's default) would make a submitted report with no amount launch no flow at all: never auto-approved, never routed, with the write landing — the silent skip the dev names. Guarding each edge is what the ruling forbids, and a null would then match neither branch and strand the run at check_amount. Declaring amount required moves the refusal to the write, where the author sees it: an expense report without an amount is not a report. With it, isNullableField is false, amount leaves the nullable index, and e2 / e3 pass as written; title was already required and status has a default, so the object's shape stays coherent. The example has no seed to break, the flow's nodes and edges are untouched, and the check_amount decision node carries no config, so no decision slot is judged. The one-line comment says why the field is required, which is the teaching the page owes.
  • The six guarded pages: hold. Each guard is in the slot the rule reads (start condition, hook condition, requiredWhen, script condition), spelled record.x != null && … as the formula skill teaches, and the formulas.mdx sentence under L394 states the gate correctly without restating the rule's provenance.

Implemented-by: claude/project-thread-2zrqid
Reviewed-by: session_01FEkQ5njkh3xbcDN6EtSfw7

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:devx#3 · os-project-manager · session_01FEkQ5njkh3xbcDN6EtSfw7

Order-of-acts note 2026-11-08T04:37Z · The seat's ACCEPT (6717291997) and the enqueue went out before the contract-review record. The record's first post was refused for two future-dated stamps, and the seat's script did not stop on that refusal. The record is now posted as 6717305815: PASS, the same head c4bbb0adeae3326cd6975f0a2c891df974607c45, with its content unchanged apart from the two stamps. If a queue-side check reads the record's timing and refuses this PR, the seat re-enqueues it once the check passes.

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 size/s 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.

docs: nullable record.amount compared unguarded in gated positions on nine more docs pages and the validation spec example (after #31206)

1 participant