docs(skills): state which record each validation rule type is judged against - #15046

Merged
os-zhuang merged 1 commit into
mainfrom
claude/issue-15011-validation-table-judged-record
Sep 4, 2026
Merged

docs(skills): state which record each validation rule type is judged against#15046
os-zhuang merged 1 commit into
mainfrom
claude/issue-15011-validation-table-judged-record

Conversation

@claude

@claudeclaudeBot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Fixes#15011

The rule-type table under "Available Rule Types" in skills/objectstack-data/rules/validation.md said what each type is for and when it fails, but never which record the predicate is evaluated on — and the answer is not uniform across the six. An author who reads "use a script rule for an invariant" and reasonably generalises it to "validations[] holds invariants" reaches for format to enforce a stored-data invariant and gets a write gate instead: no error, no signal, and legacy rows never checked.

One column added, Judged against, one short cell per row. Table only — no new prose section, no new heading, no example block, no change to the tool-choice paragraph at the head of Script Validation (merged at c454640a), no second file. Net 0 lines; the column is added to the eight existing table lines.

Before

| Type | Purpose | When Validation Fails |
|:-----|:--------|:---------------------|
| `script` | CEL predicate over the record | When predicate evaluates to `true` |
| `state_machine` | Legal state transitions | When transition not allowed |
| `format` | Regex or built-in format | When format doesn't match |
| `cross_field` | CEL predicate comparing fields | When predicate evaluates to `true` |
| `json_schema` | Validate JSON field | When JSON doesn't match schema |
| `conditional` | Apply nested rule when a predicate holds | When nested rule fails |

After

| Type | Purpose | When Validation Fails | Judged against |
|:-----|:--------|:---------------------|:---------------|
| `script` | CEL predicate over the record | When predicate evaluates to `true` | Merged record — prior row plus this write |
| `state_machine` | Legal state transitions | When transition not allowed | Written value vs the prior row's, only when the write sets the field (insert: `initialStates`) |
| `format` | Regex or built-in format | When format doesn't match | Write payload only — an omitted field is never judged |
| `cross_field` | CEL predicate comparing fields | When predicate evaluates to `true` | Merged record — prior row plus this write |
| `json_schema` | Validate JSON field | When JSON doesn't match schema | Write payload only — an omitted field is never judged |
| `conditional` | Apply nested rule when a predicate holds | When nested rule fails | Its `when` on the merged record; the nested rule as its own type |

Engine evidence, per row

Every cell is measured on this branch from packages/objectql/src/validation/rule-validator.ts, not copied from the card. The context the dispatch hands out is built at :2000-2012:

const previous = mode === 'update' && priorRecord ? materializeDeclaredFields({ ...priorRecord }, fields) : priorRecord;
const merged = { ...(previous ?? {}), ...data }; // type annotation elided: see the note below
if (groundTruth) materializeDeclaredFields(merged, fields);
const ctx: RuleContext = { data, merged, previous, mode, ... };

The one type annotation elided above is the plain record-map type; it is dropped only because a tag-shaped fragment does not survive this platform's body sanitizer. RuleContext's own docblock (:271-275) states the split independently: "data is the raw incoming write (a PATCH on update); merged overlays it on the prior record … Field-scoped rules (state_machine, format, json_schema) key off data to decide whether the write actually touched their field."

evaluateRule's switch is at :2177-2191:

RowDispatch, evaluateRuleCheckerRecord handed to it
scriptcheckPredicate(rule, ctx.merged, ctx.previous, …)checkPredicate:2332ctx.merged — the prior row overlaid with the write. Bound as CEL record, with previous alongside.
cross_fieldsame case as script, same callcheckPredicate:2332ctx.merged, identically
formatcheckFormat(rule, ctx.data, …)checkFormat:2384ctx.data — opens if (!(rule.field in data)) return null, then reads data[rule.field], so an omitted field is not judged
json_schemacheckJsonSchema(rule, ctx.data, …)checkJsonSchema:2451ctx.data — same field in data guard, then data[rule.field]
state_machinecheckStateMachine(rule, ctx.mode, ctx.data, ctx.previous, ctx)checkStateMachine:2209update leg: same field in data guard, then from = previous[rule.field], to = data[rule.field]. Insert leg: data[rule.field] against rule.initialStates, no prior row.
conditionalcheckConditional(rule, ctx)checkConditional:2499its when on ctx.merged (record: ctx.merged, previous: ctx.previous), then evaluateRule(branch, ctx) re-dispatches the nested rule through the same switch with the same ctx — so a nested format still reads the payload

All six agree with the reading the card predicted; no row had to be written against it.

Six rows is still the complete set.ValidationRuleSchema (packages/spec/src/data/validation.zod.ts:351-359) is a discriminatedUnion over exactly ScriptValidationSchema, StateMachineValidationSchema, FormatValidationSchema, CrossFieldValidationSchema, JSONValidationSchema, ConditionalValidationSchema — the six z.literal types at :179, :194, :211, :293, :314, :545. No seventh type, so the "There is no other type" sentence under the table stands untouched.

Ratchet and size readings

Both readings the published-skills contract asks for, lines and tokens (ceil(utf8 bytes / 4), the ratchet's own unit):

ReadingBeforeAfterDelta
Whole filerules/validation.md — lines3423420
Whole filerules/validation.md — tokens24992601+102
Whole packageskills/**, all 46 .md — lines13599135990
Whole packageskills/**, all 46 .md — tokens152000152102+102
Whole package, the 11 SKILL.md alone — lines / tokens6835 / 792396835 / 792390 / 0

The SKILL.md sum is unmoved because the edited file is a rules/ file, not a SKILL.md; the all-.md row is the reading that actually moves and is reported beside it rather than instead of it.

Ceiling untouched. The gate's own line, after the change:

✓ check-skills-token-ratchet: skills/objectstack-data/rules/validation.md is 2601 tokens (ceiling 3109; headroom 508).
✓ check-skills-token-ratchet: 36 authored bundle file(s) within their ceilings; 11 generator-owned file(s) measured, not ratcheted.

+102 of the 610 tokens of headroom, leaving 508. No ceiling edited, no lines bought — so nothing is owed to the "delete content to pay the ratchet" rule.

The sibling line ratchet was run to confirm it does not cover this path, and it does not — its population is .claude/** plus the two repo-root instruction files:

✓ check-skill-line-ratchet: AGENTS.md is 1157 lines (ceiling 1162; headroom 5).
✓ check-skill-line-ratchet: declared cross-file moves: 1, total ceilings down 1 line.

Gates

Family re-derived after the commit from the real changeset — node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack — which named 20 families for this path; the dispatch list named those 20 plus check:skill-docs. The union of 21 was run. Verification run head: 09802409, tree clean, diff exactly one file (8 insertions, 8 deletions).

Each exit code was captured before any pipe; each line below is the gate's own verdict text.

GateVerdict line
check-ci-filter-parityOK: all 135 declared cross-package glob(s) (95 unique) are covered by \core` or `crosspkg`, every `crosspkg` entry still covers one, and the `test` job's `if:` still names both filters.`
check-closing-keyword-paritycheck-closing-keyword-parity: OK (3 parsers agree on all 9 keywords and both measured separators; sweep found 5 file(s) carrying the grammar across 8180 tracked file(s), all registered).
check-comment-mask-corpus✓ comment-mask corpus sweep [scripts/js-comment-mask.mjs]: 5833 files, 0 disagree, 0 unparseable, 42.4s (comparator self-test: 12 cases pass).
check-cross-package-test-inputs (node)OK: 25 package(s) read outside themselves, all declared, and turbo.json hashes every declared glob.
check-shard-attestation✓ check-shard-attestation: 2 aggregate gate(s) count 3 declared leg(s) across 3 attesting job(s).
check-skills-token-ratchet✓ check-skills-token-ratchet: 36 authored bundle file(s) within their ceilings; 11 generator-owned file(s) measured, not ratcheted.
check-test-completenessNOT MEASURED, in the gate's own words — see below
check:doc-formula-expressions✓ check:doc-formula-expressions (spec TSDoc, #6763): 9 @example(s) judged clean across 1137 packages/spec/src files — rls-predicate=8, hook-record-condition=1, record-formula=0; 0 exempt.
check:skill-docs✅ Skill docs in sync
check:agent-test-spelling✓ check-agent-test-spelling: 0 violations — 432 file(s) · 5850 bare \--` token(s) · 1390 launcher-rooted run(s) · 9 separator(s) JUDGED · 5 vitest-backed script name(s) derived from 81 manifest(s)`
check:corpus-claim-driftcheck-corpus-claim-drift: OK, no new claim sites beside a pinned spelling.
check:cross-package-test-inputs (pnpm)All 117 self-test cases passed. / OK: 25 package(s) read outside themselves, all declared, and turbo.json hashes every declared glob.
check:doc-authoring✓ doc authoring guard: 46 published skill files clean — no internal issue-id references.
check:nul-bytescheck-nul-bytes: OK (scanned 8173 text file(s) -- 8173 tracked, 0 untracked-not-ignored; skipped 7 binary; no raw ASCII control bytes).
check:pm-governed-merges✓ check-governed-merges --self-test: 245 assertions (…) / live: the real generator declared 9 output(s) and certified this tree — the enumeration in the middle is elided here for length only
check:refd-timer-probeOK check-refd-timer-probe: 5828 source file(s) swept; the process-global timer probe is read in packages/qa/refd-timer-testkit/src/index.ts and nowhere else.
check:role-wordcheck-role-word: OK, no new occurrences of the reserved word.
check:skill-compatibility✓ check-skill-compatibility-version: 11 SKILL.md file(s) reconciled against 79 workspace packages
check:skill-frame-sync✓ check-skill-frame-sync: 2 copies of the decision frame are structurally isomorphic across 2 files
check:skill-identifier-livenesscheck-skill-identifier-liveness OK — Leg 1: 465 citation(s) over 46 published file(s) checked against 94464 implementation word tokens (3 ledgered exemption(s)); Leg 2: 8 registered exhaustive section(s), 0 ledgered gap(s).
check:watch-hint-literal✓ check-watch-hint-literal: 48 declaration(s) across 4 rostered name(s) … no unrostered spelling of the idiom in the tree.

20 green, 1 NOT MEASURED.check-test-completeness exited 3, which is that gate's prerequisite code, not a finding's 1. Its own text:

check-test-completeness: PREREQUISITE NOT MET — this gate grades a saved `turbo run test` log, and no log was named.
⚠ Arrived here from the gate family `scripts/pm/dispatch-gates.mjs` derives?
That list names this script with NO argument, which is this branch. There is no
local log to hand it, so the local reading for this gate is NOT MEASURED.
⛔ It is not a red, and there is nothing here to fix.

check:doc-formula-expressions first exited 3 the same way (PREREQUISITE NOT MET — the workspace package @objectstack/formula is not built, then the same for @objectstack/lint). That one was fixable locally: pnpm exec turbo run build --filter=@objectstack/formula and --filter=@objectstack/lint, after which it was re-run and produced the real green quoted above. It is reported as measured; check-test-completeness is not, because nothing local can produce the log it grades.

Heavy runs went through scripts/pm/os-verify-lock.sh (slot issue-15011): the 21-gate sweep held the lock 75s, waited 0s.

Scope and landing

Governed surface (skills/**) — opened as a draft, no reviewers requested, auto-merge not armed, ready not flipped; the dispatching seat reviews in-seat and requests the approvers, and the landing is the maintainer's.

skip-changeset: this diff publishes nothing from any package — it changes one Markdown file inside the published skills catalog, which ships as documentation rather than as a released package artifact. Same reading the recent skills PRs on this path used.


Generated by Claude Code

…against
The rule-type table in skills/objectstack-data/rules/validation.md said what
each type is for and when it fails, but never which record the predicate is
evaluated on -- and the answer is not uniform across the six. An author who
generalises "validations[] holds invariants" reaches for `format` to guard
stored data and silently gets a write gate instead.
Adds one column, "Judged against", each cell measured from evaluateRule's
dispatch in packages/objectql/src/validation/rule-validator.ts:
- script / cross_field -> ctx.merged, the prior row overlaid with the write
- format / json_schema -> ctx.data, the write payload, behind a
`field in data` guard, so an omitted field is
never judged
- state_machine -> ctx.data value against ctx.previous, same guard;
the insert leg checks initialStates instead
- conditional -> its `when` on ctx.merged, then the nested rule
re-dispatched through the same switch
Table only: no prose, heading, example or tool-choice changes. Net lines 0.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019RfFHiRCSs3JXLK4cwcfox
@os-zhuang
os-zhuang marked this pull request as ready for review September 4, 2026 03:39
@os-zhuang
os-zhuang added this pull request to the merge queueSep 4, 2026
Merged via the queue into main with commit 5c58423Sep 4, 2026
36 checks passed
@os-zhuang
os-zhuang deleted the claude/issue-15011-validation-table-judged-record branch September 4, 2026 04:06
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentationsize/sskip-changesetPR has no user-facing published change; bypasses the changeset gate

Projects

None yet

2 participants

@os-zhuang@claude
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all \u003cpre\u003e\u003ccode\u003e blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks"); } } catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); } })(); (function(){ try { var __m = "github.com"; var __re = new RegExp('^' + "github\\.com" + '
Skip to content

docs(skills): state which record each validation rule type is judged against - #15046

Merged
os-zhuang merged 1 commit into
mainfrom
claude/issue-15011-validation-table-judged-record
Sep 4, 2026
Merged

docs(skills): state which record each validation rule type is judged against#15046
os-zhuang merged 1 commit into
mainfrom
claude/issue-15011-validation-table-judged-record

Conversation

@claude

@claudeclaudeBot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Fixes#15011

The rule-type table under "Available Rule Types" in skills/objectstack-data/rules/validation.md said what each type is for and when it fails, but never which record the predicate is evaluated on — and the answer is not uniform across the six. An author who reads "use a script rule for an invariant" and reasonably generalises it to "validations[] holds invariants" reaches for format to enforce a stored-data invariant and gets a write gate instead: no error, no signal, and legacy rows never checked.

One column added, Judged against, one short cell per row. Table only — no new prose section, no new heading, no example block, no change to the tool-choice paragraph at the head of Script Validation (merged at c454640a), no second file. Net 0 lines; the column is added to the eight existing table lines.

Before

| Type | Purpose | When Validation Fails |
|:-----|:--------|:---------------------|
| `script` | CEL predicate over the record | When predicate evaluates to `true` |
| `state_machine` | Legal state transitions | When transition not allowed |
| `format` | Regex or built-in format | When format doesn't match |
| `cross_field` | CEL predicate comparing fields | When predicate evaluates to `true` |
| `json_schema` | Validate JSON field | When JSON doesn't match schema |
| `conditional` | Apply nested rule when a predicate holds | When nested rule fails |

After

| Type | Purpose | When Validation Fails | Judged against |
|:-----|:--------|:---------------------|:---------------|
| `script` | CEL predicate over the record | When predicate evaluates to `true` | Merged record — prior row plus this write |
| `state_machine` | Legal state transitions | When transition not allowed | Written value vs the prior row's, only when the write sets the field (insert: `initialStates`) |
| `format` | Regex or built-in format | When format doesn't match | Write payload only — an omitted field is never judged |
| `cross_field` | CEL predicate comparing fields | When predicate evaluates to `true` | Merged record — prior row plus this write |
| `json_schema` | Validate JSON field | When JSON doesn't match schema | Write payload only — an omitted field is never judged |
| `conditional` | Apply nested rule when a predicate holds | When nested rule fails | Its `when` on the merged record; the nested rule as its own type |

Engine evidence, per row

Every cell is measured on this branch from packages/objectql/src/validation/rule-validator.ts, not copied from the card. The context the dispatch hands out is built at :2000-2012:

const previous = mode === 'update' && priorRecord ? materializeDeclaredFields({ ...priorRecord }, fields) : priorRecord;
const merged = { ...(previous ?? {}), ...data }; // type annotation elided: see the note below
if (groundTruth) materializeDeclaredFields(merged, fields);
const ctx: RuleContext = { data, merged, previous, mode, ... };

The one type annotation elided above is the plain record-map type; it is dropped only because a tag-shaped fragment does not survive this platform's body sanitizer. RuleContext's own docblock (:271-275) states the split independently: "data is the raw incoming write (a PATCH on update); merged overlays it on the prior record … Field-scoped rules (state_machine, format, json_schema) key off data to decide whether the write actually touched their field."

evaluateRule's switch is at :2177-2191:

RowDispatch, evaluateRuleCheckerRecord handed to it
scriptcheckPredicate(rule, ctx.merged, ctx.previous, …)checkPredicate:2332ctx.merged — the prior row overlaid with the write. Bound as CEL record, with previous alongside.
cross_fieldsame case as script, same callcheckPredicate:2332ctx.merged, identically
formatcheckFormat(rule, ctx.data, …)checkFormat:2384ctx.data — opens if (!(rule.field in data)) return null, then reads data[rule.field], so an omitted field is not judged
json_schemacheckJsonSchema(rule, ctx.data, …)checkJsonSchema:2451ctx.data — same field in data guard, then data[rule.field]
state_machinecheckStateMachine(rule, ctx.mode, ctx.data, ctx.previous, ctx)checkStateMachine:2209update leg: same field in data guard, then from = previous[rule.field], to = data[rule.field]. Insert leg: data[rule.field] against rule.initialStates, no prior row.
conditionalcheckConditional(rule, ctx)checkConditional:2499its when on ctx.merged (record: ctx.merged, previous: ctx.previous), then evaluateRule(branch, ctx) re-dispatches the nested rule through the same switch with the same ctx — so a nested format still reads the payload

All six agree with the reading the card predicted; no row had to be written against it.

Six rows is still the complete set.ValidationRuleSchema (packages/spec/src/data/validation.zod.ts:351-359) is a discriminatedUnion over exactly ScriptValidationSchema, StateMachineValidationSchema, FormatValidationSchema, CrossFieldValidationSchema, JSONValidationSchema, ConditionalValidationSchema — the six z.literal types at :179, :194, :211, :293, :314, :545. No seventh type, so the "There is no other type" sentence under the table stands untouched.

Ratchet and size readings

Both readings the published-skills contract asks for, lines and tokens (ceil(utf8 bytes / 4), the ratchet's own unit):

ReadingBeforeAfterDelta
Whole filerules/validation.md — lines3423420
Whole filerules/validation.md — tokens24992601+102
Whole packageskills/**, all 46 .md — lines13599135990
Whole packageskills/**, all 46 .md — tokens152000152102+102
Whole package, the 11 SKILL.md alone — lines / tokens6835 / 792396835 / 792390 / 0

The SKILL.md sum is unmoved because the edited file is a rules/ file, not a SKILL.md; the all-.md row is the reading that actually moves and is reported beside it rather than instead of it.

Ceiling untouched. The gate's own line, after the change:

✓ check-skills-token-ratchet: skills/objectstack-data/rules/validation.md is 2601 tokens (ceiling 3109; headroom 508).
✓ check-skills-token-ratchet: 36 authored bundle file(s) within their ceilings; 11 generator-owned file(s) measured, not ratcheted.

+102 of the 610 tokens of headroom, leaving 508. No ceiling edited, no lines bought — so nothing is owed to the "delete content to pay the ratchet" rule.

The sibling line ratchet was run to confirm it does not cover this path, and it does not — its population is .claude/** plus the two repo-root instruction files:

✓ check-skill-line-ratchet: AGENTS.md is 1157 lines (ceiling 1162; headroom 5).
✓ check-skill-line-ratchet: declared cross-file moves: 1, total ceilings down 1 line.

Gates

Family re-derived after the commit from the real changeset — node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack — which named 20 families for this path; the dispatch list named those 20 plus check:skill-docs. The union of 21 was run. Verification run head: 09802409, tree clean, diff exactly one file (8 insertions, 8 deletions).

Each exit code was captured before any pipe; each line below is the gate's own verdict text.

GateVerdict line
check-ci-filter-parityOK: all 135 declared cross-package glob(s) (95 unique) are covered by \core` or `crosspkg`, every `crosspkg` entry still covers one, and the `test` job's `if:` still names both filters.`
check-closing-keyword-paritycheck-closing-keyword-parity: OK (3 parsers agree on all 9 keywords and both measured separators; sweep found 5 file(s) carrying the grammar across 8180 tracked file(s), all registered).
check-comment-mask-corpus✓ comment-mask corpus sweep [scripts/js-comment-mask.mjs]: 5833 files, 0 disagree, 0 unparseable, 42.4s (comparator self-test: 12 cases pass).
check-cross-package-test-inputs (node)OK: 25 package(s) read outside themselves, all declared, and turbo.json hashes every declared glob.
check-shard-attestation✓ check-shard-attestation: 2 aggregate gate(s) count 3 declared leg(s) across 3 attesting job(s).
check-skills-token-ratchet✓ check-skills-token-ratchet: 36 authored bundle file(s) within their ceilings; 11 generator-owned file(s) measured, not ratcheted.
check-test-completenessNOT MEASURED, in the gate's own words — see below
check:doc-formula-expressions✓ check:doc-formula-expressions (spec TSDoc, #6763): 9 @example(s) judged clean across 1137 packages/spec/src files — rls-predicate=8, hook-record-condition=1, record-formula=0; 0 exempt.
check:skill-docs✅ Skill docs in sync
check:agent-test-spelling✓ check-agent-test-spelling: 0 violations — 432 file(s) · 5850 bare \--` token(s) · 1390 launcher-rooted run(s) · 9 separator(s) JUDGED · 5 vitest-backed script name(s) derived from 81 manifest(s)`
check:corpus-claim-driftcheck-corpus-claim-drift: OK, no new claim sites beside a pinned spelling.
check:cross-package-test-inputs (pnpm)All 117 self-test cases passed. / OK: 25 package(s) read outside themselves, all declared, and turbo.json hashes every declared glob.
check:doc-authoring✓ doc authoring guard: 46 published skill files clean — no internal issue-id references.
check:nul-bytescheck-nul-bytes: OK (scanned 8173 text file(s) -- 8173 tracked, 0 untracked-not-ignored; skipped 7 binary; no raw ASCII control bytes).
check:pm-governed-merges✓ check-governed-merges --self-test: 245 assertions (…) / live: the real generator declared 9 output(s) and certified this tree — the enumeration in the middle is elided here for length only
check:refd-timer-probeOK check-refd-timer-probe: 5828 source file(s) swept; the process-global timer probe is read in packages/qa/refd-timer-testkit/src/index.ts and nowhere else.
check:role-wordcheck-role-word: OK, no new occurrences of the reserved word.
check:skill-compatibility✓ check-skill-compatibility-version: 11 SKILL.md file(s) reconciled against 79 workspace packages
check:skill-frame-sync✓ check-skill-frame-sync: 2 copies of the decision frame are structurally isomorphic across 2 files
check:skill-identifier-livenesscheck-skill-identifier-liveness OK — Leg 1: 465 citation(s) over 46 published file(s) checked against 94464 implementation word tokens (3 ledgered exemption(s)); Leg 2: 8 registered exhaustive section(s), 0 ledgered gap(s).
check:watch-hint-literal✓ check-watch-hint-literal: 48 declaration(s) across 4 rostered name(s) … no unrostered spelling of the idiom in the tree.

20 green, 1 NOT MEASURED.check-test-completeness exited 3, which is that gate's prerequisite code, not a finding's 1. Its own text:

check-test-completeness: PREREQUISITE NOT MET — this gate grades a saved `turbo run test` log, and no log was named.
⚠ Arrived here from the gate family `scripts/pm/dispatch-gates.mjs` derives?
That list names this script with NO argument, which is this branch. There is no
local log to hand it, so the local reading for this gate is NOT MEASURED.
⛔ It is not a red, and there is nothing here to fix.

check:doc-formula-expressions first exited 3 the same way (PREREQUISITE NOT MET — the workspace package @objectstack/formula is not built, then the same for @objectstack/lint). That one was fixable locally: pnpm exec turbo run build --filter=@objectstack/formula and --filter=@objectstack/lint, after which it was re-run and produced the real green quoted above. It is reported as measured; check-test-completeness is not, because nothing local can produce the log it grades.

Heavy runs went through scripts/pm/os-verify-lock.sh (slot issue-15011): the 21-gate sweep held the lock 75s, waited 0s.

Scope and landing

Governed surface (skills/**) — opened as a draft, no reviewers requested, auto-merge not armed, ready not flipped; the dispatching seat reviews in-seat and requests the approvers, and the landing is the maintainer's.

skip-changeset: this diff publishes nothing from any package — it changes one Markdown file inside the published skills catalog, which ships as documentation rather than as a released package artifact. Same reading the recent skills PRs on this path used.


Generated by Claude Code

…against
The rule-type table in skills/objectstack-data/rules/validation.md said what
each type is for and when it fails, but never which record the predicate is
evaluated on -- and the answer is not uniform across the six. An author who
generalises "validations[] holds invariants" reaches for `format` to guard
stored data and silently gets a write gate instead.
Adds one column, "Judged against", each cell measured from evaluateRule's
dispatch in packages/objectql/src/validation/rule-validator.ts:
- script / cross_field -> ctx.merged, the prior row overlaid with the write
- format / json_schema -> ctx.data, the write payload, behind a
`field in data` guard, so an omitted field is
never judged
- state_machine -> ctx.data value against ctx.previous, same guard;
the insert leg checks initialStates instead
- conditional -> its `when` on ctx.merged, then the nested rule
re-dispatched through the same switch
Table only: no prose, heading, example or tool-choice changes. Net lines 0.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019RfFHiRCSs3JXLK4cwcfox
@os-zhuang
os-zhuang marked this pull request as ready for review September 4, 2026 03:39
@os-zhuang
os-zhuang added this pull request to the merge queueSep 4, 2026
Merged via the queue into main with commit 5c58423Sep 4, 2026
36 checks passed
@os-zhuang
os-zhuang deleted the claude/issue-15011-validation-table-judged-record branch September 4, 2026 04:06
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentationsize/sskip-changesetPR has no user-facing published change; bypasses the changeset gate

Projects

None yet

2 participants

@os-zhuang@claude
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

docs(skills): state which record each validation rule type is judged against - #15046

Merged
os-zhuang merged 1 commit into
mainfrom
claude/issue-15011-validation-table-judged-record
Sep 4, 2026
Merged

docs(skills): state which record each validation rule type is judged against#15046
os-zhuang merged 1 commit into
mainfrom
claude/issue-15011-validation-table-judged-record

Conversation

@claude

@claudeclaudeBot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Fixes#15011

The rule-type table under "Available Rule Types" in skills/objectstack-data/rules/validation.md said what each type is for and when it fails, but never which record the predicate is evaluated on — and the answer is not uniform across the six. An author who reads "use a script rule for an invariant" and reasonably generalises it to "validations[] holds invariants" reaches for format to enforce a stored-data invariant and gets a write gate instead: no error, no signal, and legacy rows never checked.

One column added, Judged against, one short cell per row. Table only — no new prose section, no new heading, no example block, no change to the tool-choice paragraph at the head of Script Validation (merged at c454640a), no second file. Net 0 lines; the column is added to the eight existing table lines.

Before

| Type | Purpose | When Validation Fails |
|:-----|:--------|:---------------------|
| `script` | CEL predicate over the record | When predicate evaluates to `true` |
| `state_machine` | Legal state transitions | When transition not allowed |
| `format` | Regex or built-in format | When format doesn't match |
| `cross_field` | CEL predicate comparing fields | When predicate evaluates to `true` |
| `json_schema` | Validate JSON field | When JSON doesn't match schema |
| `conditional` | Apply nested rule when a predicate holds | When nested rule fails |

After

| Type | Purpose | When Validation Fails | Judged against |
|:-----|:--------|:---------------------|:---------------|
| `script` | CEL predicate over the record | When predicate evaluates to `true` | Merged record — prior row plus this write |
| `state_machine` | Legal state transitions | When transition not allowed | Written value vs the prior row's, only when the write sets the field (insert: `initialStates`) |
| `format` | Regex or built-in format | When format doesn't match | Write payload only — an omitted field is never judged |
| `cross_field` | CEL predicate comparing fields | When predicate evaluates to `true` | Merged record — prior row plus this write |
| `json_schema` | Validate JSON field | When JSON doesn't match schema | Write payload only — an omitted field is never judged |
| `conditional` | Apply nested rule when a predicate holds | When nested rule fails | Its `when` on the merged record; the nested rule as its own type |

Engine evidence, per row

Every cell is measured on this branch from packages/objectql/src/validation/rule-validator.ts, not copied from the card. The context the dispatch hands out is built at :2000-2012:

const previous = mode === 'update' && priorRecord ? materializeDeclaredFields({ ...priorRecord }, fields) : priorRecord;
const merged = { ...(previous ?? {}), ...data }; // type annotation elided: see the note below
if (groundTruth) materializeDeclaredFields(merged, fields);
const ctx: RuleContext = { data, merged, previous, mode, ... };

The one type annotation elided above is the plain record-map type; it is dropped only because a tag-shaped fragment does not survive this platform's body sanitizer. RuleContext's own docblock (:271-275) states the split independently: "data is the raw incoming write (a PATCH on update); merged overlays it on the prior record … Field-scoped rules (state_machine, format, json_schema) key off data to decide whether the write actually touched their field."

evaluateRule's switch is at :2177-2191:

RowDispatch, evaluateRuleCheckerRecord handed to it
scriptcheckPredicate(rule, ctx.merged, ctx.previous, …)checkPredicate:2332ctx.merged — the prior row overlaid with the write. Bound as CEL record, with previous alongside.
cross_fieldsame case as script, same callcheckPredicate:2332ctx.merged, identically
formatcheckFormat(rule, ctx.data, …)checkFormat:2384ctx.data — opens if (!(rule.field in data)) return null, then reads data[rule.field], so an omitted field is not judged
json_schemacheckJsonSchema(rule, ctx.data, …)checkJsonSchema:2451ctx.data — same field in data guard, then data[rule.field]
state_machinecheckStateMachine(rule, ctx.mode, ctx.data, ctx.previous, ctx)checkStateMachine:2209update leg: same field in data guard, then from = previous[rule.field], to = data[rule.field]. Insert leg: data[rule.field] against rule.initialStates, no prior row.
conditionalcheckConditional(rule, ctx)checkConditional:2499its when on ctx.merged (record: ctx.merged, previous: ctx.previous), then evaluateRule(branch, ctx) re-dispatches the nested rule through the same switch with the same ctx — so a nested format still reads the payload

All six agree with the reading the card predicted; no row had to be written against it.

Six rows is still the complete set.ValidationRuleSchema (packages/spec/src/data/validation.zod.ts:351-359) is a discriminatedUnion over exactly ScriptValidationSchema, StateMachineValidationSchema, FormatValidationSchema, CrossFieldValidationSchema, JSONValidationSchema, ConditionalValidationSchema — the six z.literal types at :179, :194, :211, :293, :314, :545. No seventh type, so the "There is no other type" sentence under the table stands untouched.

Ratchet and size readings

Both readings the published-skills contract asks for, lines and tokens (ceil(utf8 bytes / 4), the ratchet's own unit):

ReadingBeforeAfterDelta
Whole filerules/validation.md — lines3423420
Whole filerules/validation.md — tokens24992601+102
Whole packageskills/**, all 46 .md — lines13599135990
Whole packageskills/**, all 46 .md — tokens152000152102+102
Whole package, the 11 SKILL.md alone — lines / tokens6835 / 792396835 / 792390 / 0

The SKILL.md sum is unmoved because the edited file is a rules/ file, not a SKILL.md; the all-.md row is the reading that actually moves and is reported beside it rather than instead of it.

Ceiling untouched. The gate's own line, after the change:

✓ check-skills-token-ratchet: skills/objectstack-data/rules/validation.md is 2601 tokens (ceiling 3109; headroom 508).
✓ check-skills-token-ratchet: 36 authored bundle file(s) within their ceilings; 11 generator-owned file(s) measured, not ratcheted.

+102 of the 610 tokens of headroom, leaving 508. No ceiling edited, no lines bought — so nothing is owed to the "delete content to pay the ratchet" rule.

The sibling line ratchet was run to confirm it does not cover this path, and it does not — its population is .claude/** plus the two repo-root instruction files:

✓ check-skill-line-ratchet: AGENTS.md is 1157 lines (ceiling 1162; headroom 5).
✓ check-skill-line-ratchet: declared cross-file moves: 1, total ceilings down 1 line.

Gates

Family re-derived after the commit from the real changeset — node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack — which named 20 families for this path; the dispatch list named those 20 plus check:skill-docs. The union of 21 was run. Verification run head: 09802409, tree clean, diff exactly one file (8 insertions, 8 deletions).

Each exit code was captured before any pipe; each line below is the gate's own verdict text.

GateVerdict line
check-ci-filter-parityOK: all 135 declared cross-package glob(s) (95 unique) are covered by \core` or `crosspkg`, every `crosspkg` entry still covers one, and the `test` job's `if:` still names both filters.`
check-closing-keyword-paritycheck-closing-keyword-parity: OK (3 parsers agree on all 9 keywords and both measured separators; sweep found 5 file(s) carrying the grammar across 8180 tracked file(s), all registered).
check-comment-mask-corpus✓ comment-mask corpus sweep [scripts/js-comment-mask.mjs]: 5833 files, 0 disagree, 0 unparseable, 42.4s (comparator self-test: 12 cases pass).
check-cross-package-test-inputs (node)OK: 25 package(s) read outside themselves, all declared, and turbo.json hashes every declared glob.
check-shard-attestation✓ check-shard-attestation: 2 aggregate gate(s) count 3 declared leg(s) across 3 attesting job(s).
check-skills-token-ratchet✓ check-skills-token-ratchet: 36 authored bundle file(s) within their ceilings; 11 generator-owned file(s) measured, not ratcheted.
check-test-completenessNOT MEASURED, in the gate's own words — see below
check:doc-formula-expressions✓ check:doc-formula-expressions (spec TSDoc, #6763): 9 @example(s) judged clean across 1137 packages/spec/src files — rls-predicate=8, hook-record-condition=1, record-formula=0; 0 exempt.
check:skill-docs✅ Skill docs in sync
check:agent-test-spelling✓ check-agent-test-spelling: 0 violations — 432 file(s) · 5850 bare \--` token(s) · 1390 launcher-rooted run(s) · 9 separator(s) JUDGED · 5 vitest-backed script name(s) derived from 81 manifest(s)`
check:corpus-claim-driftcheck-corpus-claim-drift: OK, no new claim sites beside a pinned spelling.
check:cross-package-test-inputs (pnpm)All 117 self-test cases passed. / OK: 25 package(s) read outside themselves, all declared, and turbo.json hashes every declared glob.
check:doc-authoring✓ doc authoring guard: 46 published skill files clean — no internal issue-id references.
check:nul-bytescheck-nul-bytes: OK (scanned 8173 text file(s) -- 8173 tracked, 0 untracked-not-ignored; skipped 7 binary; no raw ASCII control bytes).
check:pm-governed-merges✓ check-governed-merges --self-test: 245 assertions (…) / live: the real generator declared 9 output(s) and certified this tree — the enumeration in the middle is elided here for length only
check:refd-timer-probeOK check-refd-timer-probe: 5828 source file(s) swept; the process-global timer probe is read in packages/qa/refd-timer-testkit/src/index.ts and nowhere else.
check:role-wordcheck-role-word: OK, no new occurrences of the reserved word.
check:skill-compatibility✓ check-skill-compatibility-version: 11 SKILL.md file(s) reconciled against 79 workspace packages
check:skill-frame-sync✓ check-skill-frame-sync: 2 copies of the decision frame are structurally isomorphic across 2 files
check:skill-identifier-livenesscheck-skill-identifier-liveness OK — Leg 1: 465 citation(s) over 46 published file(s) checked against 94464 implementation word tokens (3 ledgered exemption(s)); Leg 2: 8 registered exhaustive section(s), 0 ledgered gap(s).
check:watch-hint-literal✓ check-watch-hint-literal: 48 declaration(s) across 4 rostered name(s) … no unrostered spelling of the idiom in the tree.

20 green, 1 NOT MEASURED.check-test-completeness exited 3, which is that gate's prerequisite code, not a finding's 1. Its own text:

check-test-completeness: PREREQUISITE NOT MET — this gate grades a saved `turbo run test` log, and no log was named.
⚠ Arrived here from the gate family `scripts/pm/dispatch-gates.mjs` derives?
That list names this script with NO argument, which is this branch. There is no
local log to hand it, so the local reading for this gate is NOT MEASURED.
⛔ It is not a red, and there is nothing here to fix.

check:doc-formula-expressions first exited 3 the same way (PREREQUISITE NOT MET — the workspace package @objectstack/formula is not built, then the same for @objectstack/lint). That one was fixable locally: pnpm exec turbo run build --filter=@objectstack/formula and --filter=@objectstack/lint, after which it was re-run and produced the real green quoted above. It is reported as measured; check-test-completeness is not, because nothing local can produce the log it grades.

Heavy runs went through scripts/pm/os-verify-lock.sh (slot issue-15011): the 21-gate sweep held the lock 75s, waited 0s.

Scope and landing

Governed surface (skills/**) — opened as a draft, no reviewers requested, auto-merge not armed, ready not flipped; the dispatching seat reviews in-seat and requests the approvers, and the landing is the maintainer's.

skip-changeset: this diff publishes nothing from any package — it changes one Markdown file inside the published skills catalog, which ships as documentation rather than as a released package artifact. Same reading the recent skills PRs on this path used.


Generated by Claude Code

…against
The rule-type table in skills/objectstack-data/rules/validation.md said what
each type is for and when it fails, but never which record the predicate is
evaluated on -- and the answer is not uniform across the six. An author who
generalises "validations[] holds invariants" reaches for `format` to guard
stored data and silently gets a write gate instead.
Adds one column, "Judged against", each cell measured from evaluateRule's
dispatch in packages/objectql/src/validation/rule-validator.ts:
- script / cross_field -> ctx.merged, the prior row overlaid with the write
- format / json_schema -> ctx.data, the write payload, behind a
`field in data` guard, so an omitted field is
never judged
- state_machine -> ctx.data value against ctx.previous, same guard;
the insert leg checks initialStates instead
- conditional -> its `when` on ctx.merged, then the nested rule
re-dispatched through the same switch
Table only: no prose, heading, example or tool-choice changes. Net lines 0.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019RfFHiRCSs3JXLK4cwcfox
@os-zhuang
os-zhuang marked this pull request as ready for review September 4, 2026 03:39
@os-zhuang
os-zhuang added this pull request to the merge queueSep 4, 2026
Merged via the queue into main with commit 5c58423Sep 4, 2026
36 checks passed
@os-zhuang
os-zhuang deleted the claude/issue-15011-validation-table-judged-record branch September 4, 2026 04:06
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentationsize/sskip-changesetPR has no user-facing published change; bypasses the changeset gate

Projects

None yet

2 participants

@os-zhuang@claude
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length \u003e 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

docs(skills): state which record each validation rule type is judged against - #15046

Merged
os-zhuang merged 1 commit into
mainfrom
claude/issue-15011-validation-table-judged-record
Sep 4, 2026
Merged

docs(skills): state which record each validation rule type is judged against#15046
os-zhuang merged 1 commit into
mainfrom
claude/issue-15011-validation-table-judged-record

Conversation

@claude

@claudeclaudeBot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Fixes#15011

The rule-type table under "Available Rule Types" in skills/objectstack-data/rules/validation.md said what each type is for and when it fails, but never which record the predicate is evaluated on — and the answer is not uniform across the six. An author who reads "use a script rule for an invariant" and reasonably generalises it to "validations[] holds invariants" reaches for format to enforce a stored-data invariant and gets a write gate instead: no error, no signal, and legacy rows never checked.

One column added, Judged against, one short cell per row. Table only — no new prose section, no new heading, no example block, no change to the tool-choice paragraph at the head of Script Validation (merged at c454640a), no second file. Net 0 lines; the column is added to the eight existing table lines.

Before

| Type | Purpose | When Validation Fails |
|:-----|:--------|:---------------------|
| `script` | CEL predicate over the record | When predicate evaluates to `true` |
| `state_machine` | Legal state transitions | When transition not allowed |
| `format` | Regex or built-in format | When format doesn't match |
| `cross_field` | CEL predicate comparing fields | When predicate evaluates to `true` |
| `json_schema` | Validate JSON field | When JSON doesn't match schema |
| `conditional` | Apply nested rule when a predicate holds | When nested rule fails |

After

| Type | Purpose | When Validation Fails | Judged against |
|:-----|:--------|:---------------------|:---------------|
| `script` | CEL predicate over the record | When predicate evaluates to `true` | Merged record — prior row plus this write |
| `state_machine` | Legal state transitions | When transition not allowed | Written value vs the prior row's, only when the write sets the field (insert: `initialStates`) |
| `format` | Regex or built-in format | When format doesn't match | Write payload only — an omitted field is never judged |
| `cross_field` | CEL predicate comparing fields | When predicate evaluates to `true` | Merged record — prior row plus this write |
| `json_schema` | Validate JSON field | When JSON doesn't match schema | Write payload only — an omitted field is never judged |
| `conditional` | Apply nested rule when a predicate holds | When nested rule fails | Its `when` on the merged record; the nested rule as its own type |

Engine evidence, per row

Every cell is measured on this branch from packages/objectql/src/validation/rule-validator.ts, not copied from the card. The context the dispatch hands out is built at :2000-2012:

const previous = mode === 'update' && priorRecord ? materializeDeclaredFields({ ...priorRecord }, fields) : priorRecord;
const merged = { ...(previous ?? {}), ...data }; // type annotation elided: see the note below
if (groundTruth) materializeDeclaredFields(merged, fields);
const ctx: RuleContext = { data, merged, previous, mode, ... };

The one type annotation elided above is the plain record-map type; it is dropped only because a tag-shaped fragment does not survive this platform's body sanitizer. RuleContext's own docblock (:271-275) states the split independently: "data is the raw incoming write (a PATCH on update); merged overlays it on the prior record … Field-scoped rules (state_machine, format, json_schema) key off data to decide whether the write actually touched their field."

evaluateRule's switch is at :2177-2191:

RowDispatch, evaluateRuleCheckerRecord handed to it
scriptcheckPredicate(rule, ctx.merged, ctx.previous, …)checkPredicate:2332ctx.merged — the prior row overlaid with the write. Bound as CEL record, with previous alongside.
cross_fieldsame case as script, same callcheckPredicate:2332ctx.merged, identically
formatcheckFormat(rule, ctx.data, …)checkFormat:2384ctx.data — opens if (!(rule.field in data)) return null, then reads data[rule.field], so an omitted field is not judged
json_schemacheckJsonSchema(rule, ctx.data, …)checkJsonSchema:2451ctx.data — same field in data guard, then data[rule.field]
state_machinecheckStateMachine(rule, ctx.mode, ctx.data, ctx.previous, ctx)checkStateMachine:2209update leg: same field in data guard, then from = previous[rule.field], to = data[rule.field]. Insert leg: data[rule.field] against rule.initialStates, no prior row.
conditionalcheckConditional(rule, ctx)checkConditional:2499its when on ctx.merged (record: ctx.merged, previous: ctx.previous), then evaluateRule(branch, ctx) re-dispatches the nested rule through the same switch with the same ctx — so a nested format still reads the payload

All six agree with the reading the card predicted; no row had to be written against it.

Six rows is still the complete set.ValidationRuleSchema (packages/spec/src/data/validation.zod.ts:351-359) is a discriminatedUnion over exactly ScriptValidationSchema, StateMachineValidationSchema, FormatValidationSchema, CrossFieldValidationSchema, JSONValidationSchema, ConditionalValidationSchema — the six z.literal types at :179, :194, :211, :293, :314, :545. No seventh type, so the "There is no other type" sentence under the table stands untouched.

Ratchet and size readings

Both readings the published-skills contract asks for, lines and tokens (ceil(utf8 bytes / 4), the ratchet's own unit):

ReadingBeforeAfterDelta
Whole filerules/validation.md — lines3423420
Whole filerules/validation.md — tokens24992601+102
Whole packageskills/**, all 46 .md — lines13599135990
Whole packageskills/**, all 46 .md — tokens152000152102+102
Whole package, the 11 SKILL.md alone — lines / tokens6835 / 792396835 / 792390 / 0

The SKILL.md sum is unmoved because the edited file is a rules/ file, not a SKILL.md; the all-.md row is the reading that actually moves and is reported beside it rather than instead of it.

Ceiling untouched. The gate's own line, after the change:

✓ check-skills-token-ratchet: skills/objectstack-data/rules/validation.md is 2601 tokens (ceiling 3109; headroom 508).
✓ check-skills-token-ratchet: 36 authored bundle file(s) within their ceilings; 11 generator-owned file(s) measured, not ratcheted.

+102 of the 610 tokens of headroom, leaving 508. No ceiling edited, no lines bought — so nothing is owed to the "delete content to pay the ratchet" rule.

The sibling line ratchet was run to confirm it does not cover this path, and it does not — its population is .claude/** plus the two repo-root instruction files:

✓ check-skill-line-ratchet: AGENTS.md is 1157 lines (ceiling 1162; headroom 5).
✓ check-skill-line-ratchet: declared cross-file moves: 1, total ceilings down 1 line.

Gates

Family re-derived after the commit from the real changeset — node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack — which named 20 families for this path; the dispatch list named those 20 plus check:skill-docs. The union of 21 was run. Verification run head: 09802409, tree clean, diff exactly one file (8 insertions, 8 deletions).

Each exit code was captured before any pipe; each line below is the gate's own verdict text.

GateVerdict line
check-ci-filter-parityOK: all 135 declared cross-package glob(s) (95 unique) are covered by \core` or `crosspkg`, every `crosspkg` entry still covers one, and the `test` job's `if:` still names both filters.`
check-closing-keyword-paritycheck-closing-keyword-parity: OK (3 parsers agree on all 9 keywords and both measured separators; sweep found 5 file(s) carrying the grammar across 8180 tracked file(s), all registered).
check-comment-mask-corpus✓ comment-mask corpus sweep [scripts/js-comment-mask.mjs]: 5833 files, 0 disagree, 0 unparseable, 42.4s (comparator self-test: 12 cases pass).
check-cross-package-test-inputs (node)OK: 25 package(s) read outside themselves, all declared, and turbo.json hashes every declared glob.
check-shard-attestation✓ check-shard-attestation: 2 aggregate gate(s) count 3 declared leg(s) across 3 attesting job(s).
check-skills-token-ratchet✓ check-skills-token-ratchet: 36 authored bundle file(s) within their ceilings; 11 generator-owned file(s) measured, not ratcheted.
check-test-completenessNOT MEASURED, in the gate's own words — see below
check:doc-formula-expressions✓ check:doc-formula-expressions (spec TSDoc, #6763): 9 @example(s) judged clean across 1137 packages/spec/src files — rls-predicate=8, hook-record-condition=1, record-formula=0; 0 exempt.
check:skill-docs✅ Skill docs in sync
check:agent-test-spelling✓ check-agent-test-spelling: 0 violations — 432 file(s) · 5850 bare \--` token(s) · 1390 launcher-rooted run(s) · 9 separator(s) JUDGED · 5 vitest-backed script name(s) derived from 81 manifest(s)`
check:corpus-claim-driftcheck-corpus-claim-drift: OK, no new claim sites beside a pinned spelling.
check:cross-package-test-inputs (pnpm)All 117 self-test cases passed. / OK: 25 package(s) read outside themselves, all declared, and turbo.json hashes every declared glob.
check:doc-authoring✓ doc authoring guard: 46 published skill files clean — no internal issue-id references.
check:nul-bytescheck-nul-bytes: OK (scanned 8173 text file(s) -- 8173 tracked, 0 untracked-not-ignored; skipped 7 binary; no raw ASCII control bytes).
check:pm-governed-merges✓ check-governed-merges --self-test: 245 assertions (…) / live: the real generator declared 9 output(s) and certified this tree — the enumeration in the middle is elided here for length only
check:refd-timer-probeOK check-refd-timer-probe: 5828 source file(s) swept; the process-global timer probe is read in packages/qa/refd-timer-testkit/src/index.ts and nowhere else.
check:role-wordcheck-role-word: OK, no new occurrences of the reserved word.
check:skill-compatibility✓ check-skill-compatibility-version: 11 SKILL.md file(s) reconciled against 79 workspace packages
check:skill-frame-sync✓ check-skill-frame-sync: 2 copies of the decision frame are structurally isomorphic across 2 files
check:skill-identifier-livenesscheck-skill-identifier-liveness OK — Leg 1: 465 citation(s) over 46 published file(s) checked against 94464 implementation word tokens (3 ledgered exemption(s)); Leg 2: 8 registered exhaustive section(s), 0 ledgered gap(s).
check:watch-hint-literal✓ check-watch-hint-literal: 48 declaration(s) across 4 rostered name(s) … no unrostered spelling of the idiom in the tree.

20 green, 1 NOT MEASURED.check-test-completeness exited 3, which is that gate's prerequisite code, not a finding's 1. Its own text:

check-test-completeness: PREREQUISITE NOT MET — this gate grades a saved `turbo run test` log, and no log was named.
⚠ Arrived here from the gate family `scripts/pm/dispatch-gates.mjs` derives?
That list names this script with NO argument, which is this branch. There is no
local log to hand it, so the local reading for this gate is NOT MEASURED.
⛔ It is not a red, and there is nothing here to fix.

check:doc-formula-expressions first exited 3 the same way (PREREQUISITE NOT MET — the workspace package @objectstack/formula is not built, then the same for @objectstack/lint). That one was fixable locally: pnpm exec turbo run build --filter=@objectstack/formula and --filter=@objectstack/lint, after which it was re-run and produced the real green quoted above. It is reported as measured; check-test-completeness is not, because nothing local can produce the log it grades.

Heavy runs went through scripts/pm/os-verify-lock.sh (slot issue-15011): the 21-gate sweep held the lock 75s, waited 0s.

Scope and landing

Governed surface (skills/**) — opened as a draft, no reviewers requested, auto-merge not armed, ready not flipped; the dispatching seat reviews in-seat and requests the approvers, and the landing is the maintainer's.

skip-changeset: this diff publishes nothing from any package — it changes one Markdown file inside the published skills catalog, which ships as documentation rather than as a released package artifact. Same reading the recent skills PRs on this path used.


Generated by Claude Code

…against
The rule-type table in skills/objectstack-data/rules/validation.md said what
each type is for and when it fails, but never which record the predicate is
evaluated on -- and the answer is not uniform across the six. An author who
generalises "validations[] holds invariants" reaches for `format` to guard
stored data and silently gets a write gate instead.
Adds one column, "Judged against", each cell measured from evaluateRule's
dispatch in packages/objectql/src/validation/rule-validator.ts:
- script / cross_field -> ctx.merged, the prior row overlaid with the write
- format / json_schema -> ctx.data, the write payload, behind a
`field in data` guard, so an omitted field is
never judged
- state_machine -> ctx.data value against ctx.previous, same guard;
the insert leg checks initialStates instead
- conditional -> its `when` on ctx.merged, then the nested rule
re-dispatched through the same switch
Table only: no prose, heading, example or tool-choice changes. Net lines 0.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019RfFHiRCSs3JXLK4cwcfox
@os-zhuang
os-zhuang marked this pull request as ready for review September 4, 2026 03:39
@os-zhuang
os-zhuang added this pull request to the merge queueSep 4, 2026
Merged via the queue into main with commit 5c58423Sep 4, 2026
36 checks passed
@os-zhuang
os-zhuang deleted the claude/issue-15011-validation-table-judged-record branch September 4, 2026 04:06
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentationsize/sskip-changesetPR has no user-facing published change; bypasses the changeset gate

Projects

None yet

2 participants

@os-zhuang@claude
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

docs(skills): state which record each validation rule type is judged against - #15046

Merged
os-zhuang merged 1 commit into
mainfrom
claude/issue-15011-validation-table-judged-record
Sep 4, 2026
Merged

docs(skills): state which record each validation rule type is judged against#15046
os-zhuang merged 1 commit into
mainfrom
claude/issue-15011-validation-table-judged-record

Conversation

@claude

@claudeclaudeBot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Fixes#15011

The rule-type table under "Available Rule Types" in skills/objectstack-data/rules/validation.md said what each type is for and when it fails, but never which record the predicate is evaluated on — and the answer is not uniform across the six. An author who reads "use a script rule for an invariant" and reasonably generalises it to "validations[] holds invariants" reaches for format to enforce a stored-data invariant and gets a write gate instead: no error, no signal, and legacy rows never checked.

One column added, Judged against, one short cell per row. Table only — no new prose section, no new heading, no example block, no change to the tool-choice paragraph at the head of Script Validation (merged at c454640a), no second file. Net 0 lines; the column is added to the eight existing table lines.

Before

| Type | Purpose | When Validation Fails |
|:-----|:--------|:---------------------|
| `script` | CEL predicate over the record | When predicate evaluates to `true` |
| `state_machine` | Legal state transitions | When transition not allowed |
| `format` | Regex or built-in format | When format doesn't match |
| `cross_field` | CEL predicate comparing fields | When predicate evaluates to `true` |
| `json_schema` | Validate JSON field | When JSON doesn't match schema |
| `conditional` | Apply nested rule when a predicate holds | When nested rule fails |

After

| Type | Purpose | When Validation Fails | Judged against |
|:-----|:--------|:---------------------|:---------------|
| `script` | CEL predicate over the record | When predicate evaluates to `true` | Merged record — prior row plus this write |
| `state_machine` | Legal state transitions | When transition not allowed | Written value vs the prior row's, only when the write sets the field (insert: `initialStates`) |
| `format` | Regex or built-in format | When format doesn't match | Write payload only — an omitted field is never judged |
| `cross_field` | CEL predicate comparing fields | When predicate evaluates to `true` | Merged record — prior row plus this write |
| `json_schema` | Validate JSON field | When JSON doesn't match schema | Write payload only — an omitted field is never judged |
| `conditional` | Apply nested rule when a predicate holds | When nested rule fails | Its `when` on the merged record; the nested rule as its own type |

Engine evidence, per row

Every cell is measured on this branch from packages/objectql/src/validation/rule-validator.ts, not copied from the card. The context the dispatch hands out is built at :2000-2012:

const previous = mode === 'update' && priorRecord ? materializeDeclaredFields({ ...priorRecord }, fields) : priorRecord;
const merged = { ...(previous ?? {}), ...data }; // type annotation elided: see the note below
if (groundTruth) materializeDeclaredFields(merged, fields);
const ctx: RuleContext = { data, merged, previous, mode, ... };

The one type annotation elided above is the plain record-map type; it is dropped only because a tag-shaped fragment does not survive this platform's body sanitizer. RuleContext's own docblock (:271-275) states the split independently: "data is the raw incoming write (a PATCH on update); merged overlays it on the prior record … Field-scoped rules (state_machine, format, json_schema) key off data to decide whether the write actually touched their field."

evaluateRule's switch is at :2177-2191:

RowDispatch, evaluateRuleCheckerRecord handed to it
scriptcheckPredicate(rule, ctx.merged, ctx.previous, …)checkPredicate:2332ctx.merged — the prior row overlaid with the write. Bound as CEL record, with previous alongside.
cross_fieldsame case as script, same callcheckPredicate:2332ctx.merged, identically
formatcheckFormat(rule, ctx.data, …)checkFormat:2384ctx.data — opens if (!(rule.field in data)) return null, then reads data[rule.field], so an omitted field is not judged
json_schemacheckJsonSchema(rule, ctx.data, …)checkJsonSchema:2451ctx.data — same field in data guard, then data[rule.field]
state_machinecheckStateMachine(rule, ctx.mode, ctx.data, ctx.previous, ctx)checkStateMachine:2209update leg: same field in data guard, then from = previous[rule.field], to = data[rule.field]. Insert leg: data[rule.field] against rule.initialStates, no prior row.
conditionalcheckConditional(rule, ctx)checkConditional:2499its when on ctx.merged (record: ctx.merged, previous: ctx.previous), then evaluateRule(branch, ctx) re-dispatches the nested rule through the same switch with the same ctx — so a nested format still reads the payload

All six agree with the reading the card predicted; no row had to be written against it.

Six rows is still the complete set.ValidationRuleSchema (packages/spec/src/data/validation.zod.ts:351-359) is a discriminatedUnion over exactly ScriptValidationSchema, StateMachineValidationSchema, FormatValidationSchema, CrossFieldValidationSchema, JSONValidationSchema, ConditionalValidationSchema — the six z.literal types at :179, :194, :211, :293, :314, :545. No seventh type, so the "There is no other type" sentence under the table stands untouched.

Ratchet and size readings

Both readings the published-skills contract asks for, lines and tokens (ceil(utf8 bytes / 4), the ratchet's own unit):

ReadingBeforeAfterDelta
Whole filerules/validation.md — lines3423420
Whole filerules/validation.md — tokens24992601+102
Whole packageskills/**, all 46 .md — lines13599135990
Whole packageskills/**, all 46 .md — tokens152000152102+102
Whole package, the 11 SKILL.md alone — lines / tokens6835 / 792396835 / 792390 / 0

The SKILL.md sum is unmoved because the edited file is a rules/ file, not a SKILL.md; the all-.md row is the reading that actually moves and is reported beside it rather than instead of it.

Ceiling untouched. The gate's own line, after the change:

✓ check-skills-token-ratchet: skills/objectstack-data/rules/validation.md is 2601 tokens (ceiling 3109; headroom 508).
✓ check-skills-token-ratchet: 36 authored bundle file(s) within their ceilings; 11 generator-owned file(s) measured, not ratcheted.

+102 of the 610 tokens of headroom, leaving 508. No ceiling edited, no lines bought — so nothing is owed to the "delete content to pay the ratchet" rule.

The sibling line ratchet was run to confirm it does not cover this path, and it does not — its population is .claude/** plus the two repo-root instruction files:

✓ check-skill-line-ratchet: AGENTS.md is 1157 lines (ceiling 1162; headroom 5).
✓ check-skill-line-ratchet: declared cross-file moves: 1, total ceilings down 1 line.

Gates

Family re-derived after the commit from the real changeset — node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack — which named 20 families for this path; the dispatch list named those 20 plus check:skill-docs. The union of 21 was run. Verification run head: 09802409, tree clean, diff exactly one file (8 insertions, 8 deletions).

Each exit code was captured before any pipe; each line below is the gate's own verdict text.

GateVerdict line
check-ci-filter-parityOK: all 135 declared cross-package glob(s) (95 unique) are covered by \core` or `crosspkg`, every `crosspkg` entry still covers one, and the `test` job's `if:` still names both filters.`
check-closing-keyword-paritycheck-closing-keyword-parity: OK (3 parsers agree on all 9 keywords and both measured separators; sweep found 5 file(s) carrying the grammar across 8180 tracked file(s), all registered).
check-comment-mask-corpus✓ comment-mask corpus sweep [scripts/js-comment-mask.mjs]: 5833 files, 0 disagree, 0 unparseable, 42.4s (comparator self-test: 12 cases pass).
check-cross-package-test-inputs (node)OK: 25 package(s) read outside themselves, all declared, and turbo.json hashes every declared glob.
check-shard-attestation✓ check-shard-attestation: 2 aggregate gate(s) count 3 declared leg(s) across 3 attesting job(s).
check-skills-token-ratchet✓ check-skills-token-ratchet: 36 authored bundle file(s) within their ceilings; 11 generator-owned file(s) measured, not ratcheted.
check-test-completenessNOT MEASURED, in the gate's own words — see below
check:doc-formula-expressions✓ check:doc-formula-expressions (spec TSDoc, #6763): 9 @example(s) judged clean across 1137 packages/spec/src files — rls-predicate=8, hook-record-condition=1, record-formula=0; 0 exempt.
check:skill-docs✅ Skill docs in sync
check:agent-test-spelling✓ check-agent-test-spelling: 0 violations — 432 file(s) · 5850 bare \--` token(s) · 1390 launcher-rooted run(s) · 9 separator(s) JUDGED · 5 vitest-backed script name(s) derived from 81 manifest(s)`
check:corpus-claim-driftcheck-corpus-claim-drift: OK, no new claim sites beside a pinned spelling.
check:cross-package-test-inputs (pnpm)All 117 self-test cases passed. / OK: 25 package(s) read outside themselves, all declared, and turbo.json hashes every declared glob.
check:doc-authoring✓ doc authoring guard: 46 published skill files clean — no internal issue-id references.
check:nul-bytescheck-nul-bytes: OK (scanned 8173 text file(s) -- 8173 tracked, 0 untracked-not-ignored; skipped 7 binary; no raw ASCII control bytes).
check:pm-governed-merges✓ check-governed-merges --self-test: 245 assertions (…) / live: the real generator declared 9 output(s) and certified this tree — the enumeration in the middle is elided here for length only
check:refd-timer-probeOK check-refd-timer-probe: 5828 source file(s) swept; the process-global timer probe is read in packages/qa/refd-timer-testkit/src/index.ts and nowhere else.
check:role-wordcheck-role-word: OK, no new occurrences of the reserved word.
check:skill-compatibility✓ check-skill-compatibility-version: 11 SKILL.md file(s) reconciled against 79 workspace packages
check:skill-frame-sync✓ check-skill-frame-sync: 2 copies of the decision frame are structurally isomorphic across 2 files
check:skill-identifier-livenesscheck-skill-identifier-liveness OK — Leg 1: 465 citation(s) over 46 published file(s) checked against 94464 implementation word tokens (3 ledgered exemption(s)); Leg 2: 8 registered exhaustive section(s), 0 ledgered gap(s).
check:watch-hint-literal✓ check-watch-hint-literal: 48 declaration(s) across 4 rostered name(s) … no unrostered spelling of the idiom in the tree.

20 green, 1 NOT MEASURED.check-test-completeness exited 3, which is that gate's prerequisite code, not a finding's 1. Its own text:

check-test-completeness: PREREQUISITE NOT MET — this gate grades a saved `turbo run test` log, and no log was named.
⚠ Arrived here from the gate family `scripts/pm/dispatch-gates.mjs` derives?
That list names this script with NO argument, which is this branch. There is no
local log to hand it, so the local reading for this gate is NOT MEASURED.
⛔ It is not a red, and there is nothing here to fix.

check:doc-formula-expressions first exited 3 the same way (PREREQUISITE NOT MET — the workspace package @objectstack/formula is not built, then the same for @objectstack/lint). That one was fixable locally: pnpm exec turbo run build --filter=@objectstack/formula and --filter=@objectstack/lint, after which it was re-run and produced the real green quoted above. It is reported as measured; check-test-completeness is not, because nothing local can produce the log it grades.

Heavy runs went through scripts/pm/os-verify-lock.sh (slot issue-15011): the 21-gate sweep held the lock 75s, waited 0s.

Scope and landing

Governed surface (skills/**) — opened as a draft, no reviewers requested, auto-merge not armed, ready not flipped; the dispatching seat reviews in-seat and requests the approvers, and the landing is the maintainer's.

skip-changeset: this diff publishes nothing from any package — it changes one Markdown file inside the published skills catalog, which ships as documentation rather than as a released package artifact. Same reading the recent skills PRs on this path used.


Generated by Claude Code

…against
The rule-type table in skills/objectstack-data/rules/validation.md said what
each type is for and when it fails, but never which record the predicate is
evaluated on -- and the answer is not uniform across the six. An author who
generalises "validations[] holds invariants" reaches for `format` to guard
stored data and silently gets a write gate instead.
Adds one column, "Judged against", each cell measured from evaluateRule's
dispatch in packages/objectql/src/validation/rule-validator.ts:
- script / cross_field -> ctx.merged, the prior row overlaid with the write
- format / json_schema -> ctx.data, the write payload, behind a
`field in data` guard, so an omitted field is
never judged
- state_machine -> ctx.data value against ctx.previous, same guard;
the insert leg checks initialStates instead
- conditional -> its `when` on ctx.merged, then the nested rule
re-dispatched through the same switch
Table only: no prose, heading, example or tool-choice changes. Net lines 0.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019RfFHiRCSs3JXLK4cwcfox
@os-zhuang
os-zhuang marked this pull request as ready for review September 4, 2026 03:39
@os-zhuang
os-zhuang added this pull request to the merge queueSep 4, 2026
Merged via the queue into main with commit 5c58423Sep 4, 2026
36 checks passed
@os-zhuang
os-zhuang deleted the claude/issue-15011-validation-table-judged-record branch September 4, 2026 04:06
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentationsize/sskip-changesetPR has no user-facing published change; bypasses the changeset gate

Projects

None yet

2 participants

@os-zhuang@claude
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

docs(skills): state which record each validation rule type is judged against - #15046

Merged
os-zhuang merged 1 commit into
mainfrom
claude/issue-15011-validation-table-judged-record
Sep 4, 2026
Merged

docs(skills): state which record each validation rule type is judged against#15046
os-zhuang merged 1 commit into
mainfrom
claude/issue-15011-validation-table-judged-record

Conversation

@claude

@claudeclaudeBot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Fixes#15011

The rule-type table under "Available Rule Types" in skills/objectstack-data/rules/validation.md said what each type is for and when it fails, but never which record the predicate is evaluated on — and the answer is not uniform across the six. An author who reads "use a script rule for an invariant" and reasonably generalises it to "validations[] holds invariants" reaches for format to enforce a stored-data invariant and gets a write gate instead: no error, no signal, and legacy rows never checked.

One column added, Judged against, one short cell per row. Table only — no new prose section, no new heading, no example block, no change to the tool-choice paragraph at the head of Script Validation (merged at c454640a), no second file. Net 0 lines; the column is added to the eight existing table lines.

Before

| Type | Purpose | When Validation Fails |
|:-----|:--------|:---------------------|
| `script` | CEL predicate over the record | When predicate evaluates to `true` |
| `state_machine` | Legal state transitions | When transition not allowed |
| `format` | Regex or built-in format | When format doesn't match |
| `cross_field` | CEL predicate comparing fields | When predicate evaluates to `true` |
| `json_schema` | Validate JSON field | When JSON doesn't match schema |
| `conditional` | Apply nested rule when a predicate holds | When nested rule fails |

After

| Type | Purpose | When Validation Fails | Judged against |
|:-----|:--------|:---------------------|:---------------|
| `script` | CEL predicate over the record | When predicate evaluates to `true` | Merged record — prior row plus this write |
| `state_machine` | Legal state transitions | When transition not allowed | Written value vs the prior row's, only when the write sets the field (insert: `initialStates`) |
| `format` | Regex or built-in format | When format doesn't match | Write payload only — an omitted field is never judged |
| `cross_field` | CEL predicate comparing fields | When predicate evaluates to `true` | Merged record — prior row plus this write |
| `json_schema` | Validate JSON field | When JSON doesn't match schema | Write payload only — an omitted field is never judged |
| `conditional` | Apply nested rule when a predicate holds | When nested rule fails | Its `when` on the merged record; the nested rule as its own type |

Engine evidence, per row

Every cell is measured on this branch from packages/objectql/src/validation/rule-validator.ts, not copied from the card. The context the dispatch hands out is built at :2000-2012:

const previous = mode === 'update' && priorRecord ? materializeDeclaredFields({ ...priorRecord }, fields) : priorRecord;
const merged = { ...(previous ?? {}), ...data }; // type annotation elided: see the note below
if (groundTruth) materializeDeclaredFields(merged, fields);
const ctx: RuleContext = { data, merged, previous, mode, ... };

The one type annotation elided above is the plain record-map type; it is dropped only because a tag-shaped fragment does not survive this platform's body sanitizer. RuleContext's own docblock (:271-275) states the split independently: "data is the raw incoming write (a PATCH on update); merged overlays it on the prior record … Field-scoped rules (state_machine, format, json_schema) key off data to decide whether the write actually touched their field."

evaluateRule's switch is at :2177-2191:

RowDispatch, evaluateRuleCheckerRecord handed to it
scriptcheckPredicate(rule, ctx.merged, ctx.previous, …)checkPredicate:2332ctx.merged — the prior row overlaid with the write. Bound as CEL record, with previous alongside.
cross_fieldsame case as script, same callcheckPredicate:2332ctx.merged, identically
formatcheckFormat(rule, ctx.data, …)checkFormat:2384ctx.data — opens if (!(rule.field in data)) return null, then reads data[rule.field], so an omitted field is not judged
json_schemacheckJsonSchema(rule, ctx.data, …)checkJsonSchema:2451ctx.data — same field in data guard, then data[rule.field]
state_machinecheckStateMachine(rule, ctx.mode, ctx.data, ctx.previous, ctx)checkStateMachine:2209update leg: same field in data guard, then from = previous[rule.field], to = data[rule.field]. Insert leg: data[rule.field] against rule.initialStates, no prior row.
conditionalcheckConditional(rule, ctx)checkConditional:2499its when on ctx.merged (record: ctx.merged, previous: ctx.previous), then evaluateRule(branch, ctx) re-dispatches the nested rule through the same switch with the same ctx — so a nested format still reads the payload

All six agree with the reading the card predicted; no row had to be written against it.

Six rows is still the complete set.ValidationRuleSchema (packages/spec/src/data/validation.zod.ts:351-359) is a discriminatedUnion over exactly ScriptValidationSchema, StateMachineValidationSchema, FormatValidationSchema, CrossFieldValidationSchema, JSONValidationSchema, ConditionalValidationSchema — the six z.literal types at :179, :194, :211, :293, :314, :545. No seventh type, so the "There is no other type" sentence under the table stands untouched.

Ratchet and size readings

Both readings the published-skills contract asks for, lines and tokens (ceil(utf8 bytes / 4), the ratchet's own unit):

ReadingBeforeAfterDelta
Whole filerules/validation.md — lines3423420
Whole filerules/validation.md — tokens24992601+102
Whole packageskills/**, all 46 .md — lines13599135990
Whole packageskills/**, all 46 .md — tokens152000152102+102
Whole package, the 11 SKILL.md alone — lines / tokens6835 / 792396835 / 792390 / 0

The SKILL.md sum is unmoved because the edited file is a rules/ file, not a SKILL.md; the all-.md row is the reading that actually moves and is reported beside it rather than instead of it.

Ceiling untouched. The gate's own line, after the change:

✓ check-skills-token-ratchet: skills/objectstack-data/rules/validation.md is 2601 tokens (ceiling 3109; headroom 508).
✓ check-skills-token-ratchet: 36 authored bundle file(s) within their ceilings; 11 generator-owned file(s) measured, not ratcheted.

+102 of the 610 tokens of headroom, leaving 508. No ceiling edited, no lines bought — so nothing is owed to the "delete content to pay the ratchet" rule.

The sibling line ratchet was run to confirm it does not cover this path, and it does not — its population is .claude/** plus the two repo-root instruction files:

✓ check-skill-line-ratchet: AGENTS.md is 1157 lines (ceiling 1162; headroom 5).
✓ check-skill-line-ratchet: declared cross-file moves: 1, total ceilings down 1 line.

Gates

Family re-derived after the commit from the real changeset — node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack — which named 20 families for this path; the dispatch list named those 20 plus check:skill-docs. The union of 21 was run. Verification run head: 09802409, tree clean, diff exactly one file (8 insertions, 8 deletions).

Each exit code was captured before any pipe; each line below is the gate's own verdict text.

GateVerdict line
check-ci-filter-parityOK: all 135 declared cross-package glob(s) (95 unique) are covered by \core` or `crosspkg`, every `crosspkg` entry still covers one, and the `test` job's `if:` still names both filters.`
check-closing-keyword-paritycheck-closing-keyword-parity: OK (3 parsers agree on all 9 keywords and both measured separators; sweep found 5 file(s) carrying the grammar across 8180 tracked file(s), all registered).
check-comment-mask-corpus✓ comment-mask corpus sweep [scripts/js-comment-mask.mjs]: 5833 files, 0 disagree, 0 unparseable, 42.4s (comparator self-test: 12 cases pass).
check-cross-package-test-inputs (node)OK: 25 package(s) read outside themselves, all declared, and turbo.json hashes every declared glob.
check-shard-attestation✓ check-shard-attestation: 2 aggregate gate(s) count 3 declared leg(s) across 3 attesting job(s).
check-skills-token-ratchet✓ check-skills-token-ratchet: 36 authored bundle file(s) within their ceilings; 11 generator-owned file(s) measured, not ratcheted.
check-test-completenessNOT MEASURED, in the gate's own words — see below
check:doc-formula-expressions✓ check:doc-formula-expressions (spec TSDoc, #6763): 9 @example(s) judged clean across 1137 packages/spec/src files — rls-predicate=8, hook-record-condition=1, record-formula=0; 0 exempt.
check:skill-docs✅ Skill docs in sync
check:agent-test-spelling✓ check-agent-test-spelling: 0 violations — 432 file(s) · 5850 bare \--` token(s) · 1390 launcher-rooted run(s) · 9 separator(s) JUDGED · 5 vitest-backed script name(s) derived from 81 manifest(s)`
check:corpus-claim-driftcheck-corpus-claim-drift: OK, no new claim sites beside a pinned spelling.
check:cross-package-test-inputs (pnpm)All 117 self-test cases passed. / OK: 25 package(s) read outside themselves, all declared, and turbo.json hashes every declared glob.
check:doc-authoring✓ doc authoring guard: 46 published skill files clean — no internal issue-id references.
check:nul-bytescheck-nul-bytes: OK (scanned 8173 text file(s) -- 8173 tracked, 0 untracked-not-ignored; skipped 7 binary; no raw ASCII control bytes).
check:pm-governed-merges✓ check-governed-merges --self-test: 245 assertions (…) / live: the real generator declared 9 output(s) and certified this tree — the enumeration in the middle is elided here for length only
check:refd-timer-probeOK check-refd-timer-probe: 5828 source file(s) swept; the process-global timer probe is read in packages/qa/refd-timer-testkit/src/index.ts and nowhere else.
check:role-wordcheck-role-word: OK, no new occurrences of the reserved word.
check:skill-compatibility✓ check-skill-compatibility-version: 11 SKILL.md file(s) reconciled against 79 workspace packages
check:skill-frame-sync✓ check-skill-frame-sync: 2 copies of the decision frame are structurally isomorphic across 2 files
check:skill-identifier-livenesscheck-skill-identifier-liveness OK — Leg 1: 465 citation(s) over 46 published file(s) checked against 94464 implementation word tokens (3 ledgered exemption(s)); Leg 2: 8 registered exhaustive section(s), 0 ledgered gap(s).
check:watch-hint-literal✓ check-watch-hint-literal: 48 declaration(s) across 4 rostered name(s) … no unrostered spelling of the idiom in the tree.

20 green, 1 NOT MEASURED.check-test-completeness exited 3, which is that gate's prerequisite code, not a finding's 1. Its own text:

check-test-completeness: PREREQUISITE NOT MET — this gate grades a saved `turbo run test` log, and no log was named.
⚠ Arrived here from the gate family `scripts/pm/dispatch-gates.mjs` derives?
That list names this script with NO argument, which is this branch. There is no
local log to hand it, so the local reading for this gate is NOT MEASURED.
⛔ It is not a red, and there is nothing here to fix.

check:doc-formula-expressions first exited 3 the same way (PREREQUISITE NOT MET — the workspace package @objectstack/formula is not built, then the same for @objectstack/lint). That one was fixable locally: pnpm exec turbo run build --filter=@objectstack/formula and --filter=@objectstack/lint, after which it was re-run and produced the real green quoted above. It is reported as measured; check-test-completeness is not, because nothing local can produce the log it grades.

Heavy runs went through scripts/pm/os-verify-lock.sh (slot issue-15011): the 21-gate sweep held the lock 75s, waited 0s.

Scope and landing

Governed surface (skills/**) — opened as a draft, no reviewers requested, auto-merge not armed, ready not flipped; the dispatching seat reviews in-seat and requests the approvers, and the landing is the maintainer's.

skip-changeset: this diff publishes nothing from any package — it changes one Markdown file inside the published skills catalog, which ships as documentation rather than as a released package artifact. Same reading the recent skills PRs on this path used.


Generated by Claude Code

…against
The rule-type table in skills/objectstack-data/rules/validation.md said what
each type is for and when it fails, but never which record the predicate is
evaluated on -- and the answer is not uniform across the six. An author who
generalises "validations[] holds invariants" reaches for `format` to guard
stored data and silently gets a write gate instead.
Adds one column, "Judged against", each cell measured from evaluateRule's
dispatch in packages/objectql/src/validation/rule-validator.ts:
- script / cross_field -> ctx.merged, the prior row overlaid with the write
- format / json_schema -> ctx.data, the write payload, behind a
`field in data` guard, so an omitted field is
never judged
- state_machine -> ctx.data value against ctx.previous, same guard;
the insert leg checks initialStates instead
- conditional -> its `when` on ctx.merged, then the nested rule
re-dispatched through the same switch
Table only: no prose, heading, example or tool-choice changes. Net lines 0.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019RfFHiRCSs3JXLK4cwcfox
@os-zhuang
os-zhuang marked this pull request as ready for review September 4, 2026 03:39
@os-zhuang
os-zhuang added this pull request to the merge queueSep 4, 2026
Merged via the queue into main with commit 5c58423Sep 4, 2026
36 checks passed
@os-zhuang
os-zhuang deleted the claude/issue-15011-validation-table-judged-record branch September 4, 2026 04:06
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentationsize/sskip-changesetPR has no user-facing published change; bypasses the changeset gate

Projects

None yet

2 participants

@os-zhuang@claude
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

docs(skills): state which record each validation rule type is judged against - #15046

Merged
os-zhuang merged 1 commit into
mainfrom
claude/issue-15011-validation-table-judged-record
Sep 4, 2026
Merged

docs(skills): state which record each validation rule type is judged against#15046
os-zhuang merged 1 commit into
mainfrom
claude/issue-15011-validation-table-judged-record

Conversation

@claude

@claudeclaudeBot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Fixes#15011

The rule-type table under "Available Rule Types" in skills/objectstack-data/rules/validation.md said what each type is for and when it fails, but never which record the predicate is evaluated on — and the answer is not uniform across the six. An author who reads "use a script rule for an invariant" and reasonably generalises it to "validations[] holds invariants" reaches for format to enforce a stored-data invariant and gets a write gate instead: no error, no signal, and legacy rows never checked.

One column added, Judged against, one short cell per row. Table only — no new prose section, no new heading, no example block, no change to the tool-choice paragraph at the head of Script Validation (merged at c454640a), no second file. Net 0 lines; the column is added to the eight existing table lines.

Before

| Type | Purpose | When Validation Fails |
|:-----|:--------|:---------------------|
| `script` | CEL predicate over the record | When predicate evaluates to `true` |
| `state_machine` | Legal state transitions | When transition not allowed |
| `format` | Regex or built-in format | When format doesn't match |
| `cross_field` | CEL predicate comparing fields | When predicate evaluates to `true` |
| `json_schema` | Validate JSON field | When JSON doesn't match schema |
| `conditional` | Apply nested rule when a predicate holds | When nested rule fails |

After

| Type | Purpose | When Validation Fails | Judged against |
|:-----|:--------|:---------------------|:---------------|
| `script` | CEL predicate over the record | When predicate evaluates to `true` | Merged record — prior row plus this write |
| `state_machine` | Legal state transitions | When transition not allowed | Written value vs the prior row's, only when the write sets the field (insert: `initialStates`) |
| `format` | Regex or built-in format | When format doesn't match | Write payload only — an omitted field is never judged |
| `cross_field` | CEL predicate comparing fields | When predicate evaluates to `true` | Merged record — prior row plus this write |
| `json_schema` | Validate JSON field | When JSON doesn't match schema | Write payload only — an omitted field is never judged |
| `conditional` | Apply nested rule when a predicate holds | When nested rule fails | Its `when` on the merged record; the nested rule as its own type |

Engine evidence, per row

Every cell is measured on this branch from packages/objectql/src/validation/rule-validator.ts, not copied from the card. The context the dispatch hands out is built at :2000-2012:

const previous = mode === 'update' && priorRecord ? materializeDeclaredFields({ ...priorRecord }, fields) : priorRecord;
const merged = { ...(previous ?? {}), ...data }; // type annotation elided: see the note below
if (groundTruth) materializeDeclaredFields(merged, fields);
const ctx: RuleContext = { data, merged, previous, mode, ... };

The one type annotation elided above is the plain record-map type; it is dropped only because a tag-shaped fragment does not survive this platform's body sanitizer. RuleContext's own docblock (:271-275) states the split independently: "data is the raw incoming write (a PATCH on update); merged overlays it on the prior record … Field-scoped rules (state_machine, format, json_schema) key off data to decide whether the write actually touched their field."

evaluateRule's switch is at :2177-2191:

RowDispatch, evaluateRuleCheckerRecord handed to it
scriptcheckPredicate(rule, ctx.merged, ctx.previous, …)checkPredicate:2332ctx.merged — the prior row overlaid with the write. Bound as CEL record, with previous alongside.
cross_fieldsame case as script, same callcheckPredicate:2332ctx.merged, identically
formatcheckFormat(rule, ctx.data, …)checkFormat:2384ctx.data — opens if (!(rule.field in data)) return null, then reads data[rule.field], so an omitted field is not judged
json_schemacheckJsonSchema(rule, ctx.data, …)checkJsonSchema:2451ctx.data — same field in data guard, then data[rule.field]
state_machinecheckStateMachine(rule, ctx.mode, ctx.data, ctx.previous, ctx)checkStateMachine:2209update leg: same field in data guard, then from = previous[rule.field], to = data[rule.field]. Insert leg: data[rule.field] against rule.initialStates, no prior row.
conditionalcheckConditional(rule, ctx)checkConditional:2499its when on ctx.merged (record: ctx.merged, previous: ctx.previous), then evaluateRule(branch, ctx) re-dispatches the nested rule through the same switch with the same ctx — so a nested format still reads the payload

All six agree with the reading the card predicted; no row had to be written against it.

Six rows is still the complete set.ValidationRuleSchema (packages/spec/src/data/validation.zod.ts:351-359) is a discriminatedUnion over exactly ScriptValidationSchema, StateMachineValidationSchema, FormatValidationSchema, CrossFieldValidationSchema, JSONValidationSchema, ConditionalValidationSchema — the six z.literal types at :179, :194, :211, :293, :314, :545. No seventh type, so the "There is no other type" sentence under the table stands untouched.

Ratchet and size readings

Both readings the published-skills contract asks for, lines and tokens (ceil(utf8 bytes / 4), the ratchet's own unit):

ReadingBeforeAfterDelta
Whole filerules/validation.md — lines3423420
Whole filerules/validation.md — tokens24992601+102
Whole packageskills/**, all 46 .md — lines13599135990
Whole packageskills/**, all 46 .md — tokens152000152102+102
Whole package, the 11 SKILL.md alone — lines / tokens6835 / 792396835 / 792390 / 0

The SKILL.md sum is unmoved because the edited file is a rules/ file, not a SKILL.md; the all-.md row is the reading that actually moves and is reported beside it rather than instead of it.

Ceiling untouched. The gate's own line, after the change:

✓ check-skills-token-ratchet: skills/objectstack-data/rules/validation.md is 2601 tokens (ceiling 3109; headroom 508).
✓ check-skills-token-ratchet: 36 authored bundle file(s) within their ceilings; 11 generator-owned file(s) measured, not ratcheted.

+102 of the 610 tokens of headroom, leaving 508. No ceiling edited, no lines bought — so nothing is owed to the "delete content to pay the ratchet" rule.

The sibling line ratchet was run to confirm it does not cover this path, and it does not — its population is .claude/** plus the two repo-root instruction files:

✓ check-skill-line-ratchet: AGENTS.md is 1157 lines (ceiling 1162; headroom 5).
✓ check-skill-line-ratchet: declared cross-file moves: 1, total ceilings down 1 line.

Gates

Family re-derived after the commit from the real changeset — node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack — which named 20 families for this path; the dispatch list named those 20 plus check:skill-docs. The union of 21 was run. Verification run head: 09802409, tree clean, diff exactly one file (8 insertions, 8 deletions).

Each exit code was captured before any pipe; each line below is the gate's own verdict text.

GateVerdict line
check-ci-filter-parityOK: all 135 declared cross-package glob(s) (95 unique) are covered by \core` or `crosspkg`, every `crosspkg` entry still covers one, and the `test` job's `if:` still names both filters.`
check-closing-keyword-paritycheck-closing-keyword-parity: OK (3 parsers agree on all 9 keywords and both measured separators; sweep found 5 file(s) carrying the grammar across 8180 tracked file(s), all registered).
check-comment-mask-corpus✓ comment-mask corpus sweep [scripts/js-comment-mask.mjs]: 5833 files, 0 disagree, 0 unparseable, 42.4s (comparator self-test: 12 cases pass).
check-cross-package-test-inputs (node)OK: 25 package(s) read outside themselves, all declared, and turbo.json hashes every declared glob.
check-shard-attestation✓ check-shard-attestation: 2 aggregate gate(s) count 3 declared leg(s) across 3 attesting job(s).
check-skills-token-ratchet✓ check-skills-token-ratchet: 36 authored bundle file(s) within their ceilings; 11 generator-owned file(s) measured, not ratcheted.
check-test-completenessNOT MEASURED, in the gate's own words — see below
check:doc-formula-expressions✓ check:doc-formula-expressions (spec TSDoc, #6763): 9 @example(s) judged clean across 1137 packages/spec/src files — rls-predicate=8, hook-record-condition=1, record-formula=0; 0 exempt.
check:skill-docs✅ Skill docs in sync
check:agent-test-spelling✓ check-agent-test-spelling: 0 violations — 432 file(s) · 5850 bare \--` token(s) · 1390 launcher-rooted run(s) · 9 separator(s) JUDGED · 5 vitest-backed script name(s) derived from 81 manifest(s)`
check:corpus-claim-driftcheck-corpus-claim-drift: OK, no new claim sites beside a pinned spelling.
check:cross-package-test-inputs (pnpm)All 117 self-test cases passed. / OK: 25 package(s) read outside themselves, all declared, and turbo.json hashes every declared glob.
check:doc-authoring✓ doc authoring guard: 46 published skill files clean — no internal issue-id references.
check:nul-bytescheck-nul-bytes: OK (scanned 8173 text file(s) -- 8173 tracked, 0 untracked-not-ignored; skipped 7 binary; no raw ASCII control bytes).
check:pm-governed-merges✓ check-governed-merges --self-test: 245 assertions (…) / live: the real generator declared 9 output(s) and certified this tree — the enumeration in the middle is elided here for length only
check:refd-timer-probeOK check-refd-timer-probe: 5828 source file(s) swept; the process-global timer probe is read in packages/qa/refd-timer-testkit/src/index.ts and nowhere else.
check:role-wordcheck-role-word: OK, no new occurrences of the reserved word.
check:skill-compatibility✓ check-skill-compatibility-version: 11 SKILL.md file(s) reconciled against 79 workspace packages
check:skill-frame-sync✓ check-skill-frame-sync: 2 copies of the decision frame are structurally isomorphic across 2 files
check:skill-identifier-livenesscheck-skill-identifier-liveness OK — Leg 1: 465 citation(s) over 46 published file(s) checked against 94464 implementation word tokens (3 ledgered exemption(s)); Leg 2: 8 registered exhaustive section(s), 0 ledgered gap(s).
check:watch-hint-literal✓ check-watch-hint-literal: 48 declaration(s) across 4 rostered name(s) … no unrostered spelling of the idiom in the tree.

20 green, 1 NOT MEASURED.check-test-completeness exited 3, which is that gate's prerequisite code, not a finding's 1. Its own text:

check-test-completeness: PREREQUISITE NOT MET — this gate grades a saved `turbo run test` log, and no log was named.
⚠ Arrived here from the gate family `scripts/pm/dispatch-gates.mjs` derives?
That list names this script with NO argument, which is this branch. There is no
local log to hand it, so the local reading for this gate is NOT MEASURED.
⛔ It is not a red, and there is nothing here to fix.

check:doc-formula-expressions first exited 3 the same way (PREREQUISITE NOT MET — the workspace package @objectstack/formula is not built, then the same for @objectstack/lint). That one was fixable locally: pnpm exec turbo run build --filter=@objectstack/formula and --filter=@objectstack/lint, after which it was re-run and produced the real green quoted above. It is reported as measured; check-test-completeness is not, because nothing local can produce the log it grades.

Heavy runs went through scripts/pm/os-verify-lock.sh (slot issue-15011): the 21-gate sweep held the lock 75s, waited 0s.

Scope and landing

Governed surface (skills/**) — opened as a draft, no reviewers requested, auto-merge not armed, ready not flipped; the dispatching seat reviews in-seat and requests the approvers, and the landing is the maintainer's.

skip-changeset: this diff publishes nothing from any package — it changes one Markdown file inside the published skills catalog, which ships as documentation rather than as a released package artifact. Same reading the recent skills PRs on this path used.


Generated by Claude Code

…against
The rule-type table in skills/objectstack-data/rules/validation.md said what
each type is for and when it fails, but never which record the predicate is
evaluated on -- and the answer is not uniform across the six. An author who
generalises "validations[] holds invariants" reaches for `format` to guard
stored data and silently gets a write gate instead.
Adds one column, "Judged against", each cell measured from evaluateRule's
dispatch in packages/objectql/src/validation/rule-validator.ts:
- script / cross_field -> ctx.merged, the prior row overlaid with the write
- format / json_schema -> ctx.data, the write payload, behind a
`field in data` guard, so an omitted field is
never judged
- state_machine -> ctx.data value against ctx.previous, same guard;
the insert leg checks initialStates instead
- conditional -> its `when` on ctx.merged, then the nested rule
re-dispatched through the same switch
Table only: no prose, heading, example or tool-choice changes. Net lines 0.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019RfFHiRCSs3JXLK4cwcfox
@os-zhuang
os-zhuang marked this pull request as ready for review September 4, 2026 03:39
@os-zhuang
os-zhuang added this pull request to the merge queueSep 4, 2026
Merged via the queue into main with commit 5c58423Sep 4, 2026
36 checks passed
@os-zhuang
os-zhuang deleted the claude/issue-15011-validation-table-judged-record branch September 4, 2026 04:06
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentationsize/sskip-changesetPR has no user-facing published change; bypasses the changeset gate

Projects

None yet

2 participants

@os-zhuang@claude
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

docs(skills): state which record each validation rule type is judged against - #15046

Merged
os-zhuang merged 1 commit into
mainfrom
claude/issue-15011-validation-table-judged-record
Sep 4, 2026
Merged

docs(skills): state which record each validation rule type is judged against#15046
os-zhuang merged 1 commit into
mainfrom
claude/issue-15011-validation-table-judged-record

Conversation

@claude

@claudeclaudeBot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Fixes#15011

The rule-type table under "Available Rule Types" in skills/objectstack-data/rules/validation.md said what each type is for and when it fails, but never which record the predicate is evaluated on — and the answer is not uniform across the six. An author who reads "use a script rule for an invariant" and reasonably generalises it to "validations[] holds invariants" reaches for format to enforce a stored-data invariant and gets a write gate instead: no error, no signal, and legacy rows never checked.

One column added, Judged against, one short cell per row. Table only — no new prose section, no new heading, no example block, no change to the tool-choice paragraph at the head of Script Validation (merged at c454640a), no second file. Net 0 lines; the column is added to the eight existing table lines.

Before

| Type | Purpose | When Validation Fails |
|:-----|:--------|:---------------------|
| `script` | CEL predicate over the record | When predicate evaluates to `true` |
| `state_machine` | Legal state transitions | When transition not allowed |
| `format` | Regex or built-in format | When format doesn't match |
| `cross_field` | CEL predicate comparing fields | When predicate evaluates to `true` |
| `json_schema` | Validate JSON field | When JSON doesn't match schema |
| `conditional` | Apply nested rule when a predicate holds | When nested rule fails |

After

| Type | Purpose | When Validation Fails | Judged against |
|:-----|:--------|:---------------------|:---------------|
| `script` | CEL predicate over the record | When predicate evaluates to `true` | Merged record — prior row plus this write |
| `state_machine` | Legal state transitions | When transition not allowed | Written value vs the prior row's, only when the write sets the field (insert: `initialStates`) |
| `format` | Regex or built-in format | When format doesn't match | Write payload only — an omitted field is never judged |
| `cross_field` | CEL predicate comparing fields | When predicate evaluates to `true` | Merged record — prior row plus this write |
| `json_schema` | Validate JSON field | When JSON doesn't match schema | Write payload only — an omitted field is never judged |
| `conditional` | Apply nested rule when a predicate holds | When nested rule fails | Its `when` on the merged record; the nested rule as its own type |

Engine evidence, per row

Every cell is measured on this branch from packages/objectql/src/validation/rule-validator.ts, not copied from the card. The context the dispatch hands out is built at :2000-2012:

const previous = mode === 'update' && priorRecord ? materializeDeclaredFields({ ...priorRecord }, fields) : priorRecord;
const merged = { ...(previous ?? {}), ...data }; // type annotation elided: see the note below
if (groundTruth) materializeDeclaredFields(merged, fields);
const ctx: RuleContext = { data, merged, previous, mode, ... };

The one type annotation elided above is the plain record-map type; it is dropped only because a tag-shaped fragment does not survive this platform's body sanitizer. RuleContext's own docblock (:271-275) states the split independently: "data is the raw incoming write (a PATCH on update); merged overlays it on the prior record … Field-scoped rules (state_machine, format, json_schema) key off data to decide whether the write actually touched their field."

evaluateRule's switch is at :2177-2191:

RowDispatch, evaluateRuleCheckerRecord handed to it
scriptcheckPredicate(rule, ctx.merged, ctx.previous, …)checkPredicate:2332ctx.merged — the prior row overlaid with the write. Bound as CEL record, with previous alongside.
cross_fieldsame case as script, same callcheckPredicate:2332ctx.merged, identically
formatcheckFormat(rule, ctx.data, …)checkFormat:2384ctx.data — opens if (!(rule.field in data)) return null, then reads data[rule.field], so an omitted field is not judged
json_schemacheckJsonSchema(rule, ctx.data, …)checkJsonSchema:2451ctx.data — same field in data guard, then data[rule.field]
state_machinecheckStateMachine(rule, ctx.mode, ctx.data, ctx.previous, ctx)checkStateMachine:2209update leg: same field in data guard, then from = previous[rule.field], to = data[rule.field]. Insert leg: data[rule.field] against rule.initialStates, no prior row.
conditionalcheckConditional(rule, ctx)checkConditional:2499its when on ctx.merged (record: ctx.merged, previous: ctx.previous), then evaluateRule(branch, ctx) re-dispatches the nested rule through the same switch with the same ctx — so a nested format still reads the payload

All six agree with the reading the card predicted; no row had to be written against it.

Six rows is still the complete set.ValidationRuleSchema (packages/spec/src/data/validation.zod.ts:351-359) is a discriminatedUnion over exactly ScriptValidationSchema, StateMachineValidationSchema, FormatValidationSchema, CrossFieldValidationSchema, JSONValidationSchema, ConditionalValidationSchema — the six z.literal types at :179, :194, :211, :293, :314, :545. No seventh type, so the "There is no other type" sentence under the table stands untouched.

Ratchet and size readings

Both readings the published-skills contract asks for, lines and tokens (ceil(utf8 bytes / 4), the ratchet's own unit):

ReadingBeforeAfterDelta
Whole filerules/validation.md — lines3423420
Whole filerules/validation.md — tokens24992601+102
Whole packageskills/**, all 46 .md — lines13599135990
Whole packageskills/**, all 46 .md — tokens152000152102+102
Whole package, the 11 SKILL.md alone — lines / tokens6835 / 792396835 / 792390 / 0

The SKILL.md sum is unmoved because the edited file is a rules/ file, not a SKILL.md; the all-.md row is the reading that actually moves and is reported beside it rather than instead of it.

Ceiling untouched. The gate's own line, after the change:

✓ check-skills-token-ratchet: skills/objectstack-data/rules/validation.md is 2601 tokens (ceiling 3109; headroom 508).
✓ check-skills-token-ratchet: 36 authored bundle file(s) within their ceilings; 11 generator-owned file(s) measured, not ratcheted.

+102 of the 610 tokens of headroom, leaving 508. No ceiling edited, no lines bought — so nothing is owed to the "delete content to pay the ratchet" rule.

The sibling line ratchet was run to confirm it does not cover this path, and it does not — its population is .claude/** plus the two repo-root instruction files:

✓ check-skill-line-ratchet: AGENTS.md is 1157 lines (ceiling 1162; headroom 5).
✓ check-skill-line-ratchet: declared cross-file moves: 1, total ceilings down 1 line.

Gates

Family re-derived after the commit from the real changeset — node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack — which named 20 families for this path; the dispatch list named those 20 plus check:skill-docs. The union of 21 was run. Verification run head: 09802409, tree clean, diff exactly one file (8 insertions, 8 deletions).

Each exit code was captured before any pipe; each line below is the gate's own verdict text.

GateVerdict line
check-ci-filter-parityOK: all 135 declared cross-package glob(s) (95 unique) are covered by \core` or `crosspkg`, every `crosspkg` entry still covers one, and the `test` job's `if:` still names both filters.`
check-closing-keyword-paritycheck-closing-keyword-parity: OK (3 parsers agree on all 9 keywords and both measured separators; sweep found 5 file(s) carrying the grammar across 8180 tracked file(s), all registered).
check-comment-mask-corpus✓ comment-mask corpus sweep [scripts/js-comment-mask.mjs]: 5833 files, 0 disagree, 0 unparseable, 42.4s (comparator self-test: 12 cases pass).
check-cross-package-test-inputs (node)OK: 25 package(s) read outside themselves, all declared, and turbo.json hashes every declared glob.
check-shard-attestation✓ check-shard-attestation: 2 aggregate gate(s) count 3 declared leg(s) across 3 attesting job(s).
check-skills-token-ratchet✓ check-skills-token-ratchet: 36 authored bundle file(s) within their ceilings; 11 generator-owned file(s) measured, not ratcheted.
check-test-completenessNOT MEASURED, in the gate's own words — see below
check:doc-formula-expressions✓ check:doc-formula-expressions (spec TSDoc, #6763): 9 @example(s) judged clean across 1137 packages/spec/src files — rls-predicate=8, hook-record-condition=1, record-formula=0; 0 exempt.
check:skill-docs✅ Skill docs in sync
check:agent-test-spelling✓ check-agent-test-spelling: 0 violations — 432 file(s) · 5850 bare \--` token(s) · 1390 launcher-rooted run(s) · 9 separator(s) JUDGED · 5 vitest-backed script name(s) derived from 81 manifest(s)`
check:corpus-claim-driftcheck-corpus-claim-drift: OK, no new claim sites beside a pinned spelling.
check:cross-package-test-inputs (pnpm)All 117 self-test cases passed. / OK: 25 package(s) read outside themselves, all declared, and turbo.json hashes every declared glob.
check:doc-authoring✓ doc authoring guard: 46 published skill files clean — no internal issue-id references.
check:nul-bytescheck-nul-bytes: OK (scanned 8173 text file(s) -- 8173 tracked, 0 untracked-not-ignored; skipped 7 binary; no raw ASCII control bytes).
check:pm-governed-merges✓ check-governed-merges --self-test: 245 assertions (…) / live: the real generator declared 9 output(s) and certified this tree — the enumeration in the middle is elided here for length only
check:refd-timer-probeOK check-refd-timer-probe: 5828 source file(s) swept; the process-global timer probe is read in packages/qa/refd-timer-testkit/src/index.ts and nowhere else.
check:role-wordcheck-role-word: OK, no new occurrences of the reserved word.
check:skill-compatibility✓ check-skill-compatibility-version: 11 SKILL.md file(s) reconciled against 79 workspace packages
check:skill-frame-sync✓ check-skill-frame-sync: 2 copies of the decision frame are structurally isomorphic across 2 files
check:skill-identifier-livenesscheck-skill-identifier-liveness OK — Leg 1: 465 citation(s) over 46 published file(s) checked against 94464 implementation word tokens (3 ledgered exemption(s)); Leg 2: 8 registered exhaustive section(s), 0 ledgered gap(s).
check:watch-hint-literal✓ check-watch-hint-literal: 48 declaration(s) across 4 rostered name(s) … no unrostered spelling of the idiom in the tree.

20 green, 1 NOT MEASURED.check-test-completeness exited 3, which is that gate's prerequisite code, not a finding's 1. Its own text:

check-test-completeness: PREREQUISITE NOT MET — this gate grades a saved `turbo run test` log, and no log was named.
⚠ Arrived here from the gate family `scripts/pm/dispatch-gates.mjs` derives?
That list names this script with NO argument, which is this branch. There is no
local log to hand it, so the local reading for this gate is NOT MEASURED.
⛔ It is not a red, and there is nothing here to fix.

check:doc-formula-expressions first exited 3 the same way (PREREQUISITE NOT MET — the workspace package @objectstack/formula is not built, then the same for @objectstack/lint). That one was fixable locally: pnpm exec turbo run build --filter=@objectstack/formula and --filter=@objectstack/lint, after which it was re-run and produced the real green quoted above. It is reported as measured; check-test-completeness is not, because nothing local can produce the log it grades.

Heavy runs went through scripts/pm/os-verify-lock.sh (slot issue-15011): the 21-gate sweep held the lock 75s, waited 0s.

Scope and landing

Governed surface (skills/**) — opened as a draft, no reviewers requested, auto-merge not armed, ready not flipped; the dispatching seat reviews in-seat and requests the approvers, and the landing is the maintainer's.

skip-changeset: this diff publishes nothing from any package — it changes one Markdown file inside the published skills catalog, which ships as documentation rather than as a released package artifact. Same reading the recent skills PRs on this path used.


Generated by Claude Code

…against
The rule-type table in skills/objectstack-data/rules/validation.md said what
each type is for and when it fails, but never which record the predicate is
evaluated on -- and the answer is not uniform across the six. An author who
generalises "validations[] holds invariants" reaches for `format` to guard
stored data and silently gets a write gate instead.
Adds one column, "Judged against", each cell measured from evaluateRule's
dispatch in packages/objectql/src/validation/rule-validator.ts:
- script / cross_field -> ctx.merged, the prior row overlaid with the write
- format / json_schema -> ctx.data, the write payload, behind a
`field in data` guard, so an omitted field is
never judged
- state_machine -> ctx.data value against ctx.previous, same guard;
the insert leg checks initialStates instead
- conditional -> its `when` on ctx.merged, then the nested rule
re-dispatched through the same switch
Table only: no prose, heading, example or tool-choice changes. Net lines 0.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019RfFHiRCSs3JXLK4cwcfox
@os-zhuang
os-zhuang marked this pull request as ready for review September 4, 2026 03:39
@os-zhuang
os-zhuang added this pull request to the merge queueSep 4, 2026
Merged via the queue into main with commit 5c58423Sep 4, 2026
36 checks passed
@os-zhuang
os-zhuang deleted the claude/issue-15011-validation-table-judged-record branch September 4, 2026 04:06
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentationsize/sskip-changesetPR has no user-facing published change; bypasses the changeset gate

Projects

None yet

2 participants

@os-zhuang@claude