Repository navigation
Commit c5915b2
fix(lint)!: os build and the object save door refuse a validations[] rule whose predicate reads parent (#25052)
Closes #24957
Clause-②: no (narrowing: a `validations[]` rule that reads `parent` is
refused at `os build` and the object save door; it ships now under the
amended 「甲」, #6015 `6303865025`)
Metadata-protocol: narrowed
## What changes
A `validations[]` rule's predicates (a `script` / `cross_field` rule's
`condition`, a `conditional` rule's `when`, and the same slots on the
rules nested in its `then` / `otherwise`) are evaluated by ObjectQL in
`ruleScope(record, previous)`, which binds no `parent`. Such a predicate
faults (`Unknown variable: parent`) on every write it judges and fails
closed. The 18.x verdict shipped at `warning` (PR #24763, `8cfe1f94cb`).
This PR ships the refusal half, re-timed to 18.x as a BREAKING minor.
- `packages/lint/src/validate-expressions.ts`:
`validationRuleParentIssue`'s finding is pushed at `error` instead of
`warning`. The message drops "This is a warning today; `os build` and
the object save door will refuse it from 19.0." The docblock's "Why a
warning, and when it becomes a refusal" section becomes "Why an error".
The location, rule id, prescription and the field-rule controls are
unchanged.
- The object save door runs the same pass (`runStackExpressionPasses`),
so the door's verdict moves from advisory to error with no door code
change. A publish-mode object save now answers `422 INVALID_METADATA`.
- Changeset `.changeset/24957-validation-rule-parent-error.md`:
`@objectstack/lint` `minor`, BREAKING banner, `Clause-②: no (narrowing
…)`, ADR-0087 marker `not-required (no-migration-prescription)` (shape
of the `bb4f5cc005` precedent).
## The gate on #24684 (withdrawal condition)
#24684 closed `completed` through PR #24731 (`576d0f3733`). It landed
route B: three lifecycle hooks on `showcase_invoice_line`. It made no
objectql, lint or spec change. On `origin/main` `3b3830ca22`,
`checkPredicate` / `checkConditional` still call `ruleScope(record,
previous)` (`rule-validator.ts` lines 4511 / 4695), and `ruleScope` adds
no `parent`. So `parent` is still unbound for `validations[]`, and the
withdrawal condition does not hold.
## Tests
-
`packages/lint/src/validate-expressions.validation-rule-parent.test.ts`:
every severity assertion now reads `error`. `os validate` / `os build`
carry the finding as their only error. The door finding is in `errors`,
not `advisories`, and the door/build parity is unchanged. New: the
message promises no later release, and an `active: false` rule or an
update-only rule is refused too (the rule is judged as written).
Controls unchanged: `parent` on a field's own `readonlyWhen` /
`requiredWhen`, `record` / `previous` reads, `record.parent_code`.
-
`packages/metadata-protocol/src/protocol.runtime-authoring-gate.test.ts`,
new block `(#24957)` through the real `saveMetaItem`: (a) an active save
is refused `422 INVALID_METADATA` with the build's located finding, and
nothing lands; (b) a draft save still succeeds, and its promotion and a
package draft publish are refused; (c) control: `parent` on
`readonlyWhen`, and a `record` rule, save and land.
- Reverse verification, through `dist/`: `scripts/ablation-replace.mjs`
put the severity back to `warning` with a marker, then rebuilt lint.
`ablation-dist-preflight` found the marker in 4 built files. The door
block went red, 3 failed (a, b, b-package) and 1 passed (c control).
After the restore (blob equal to HEAD, `git diff HEAD` empty), lint was
rebuilt, preflight `--absent` passed, and the block was green, 4 of 4.
- `pnpm --filter @objectstack/lint test`: 153 files, 7045 tests passed.
`pnpm --filter @objectstack/lint typecheck`: exit 0. `pnpm --filter
@objectstack/metadata-protocol typecheck`: exit 0.
`protocol.runtime-authoring-gate.test.ts` in full: 179 passed (before
the package-publish leg was added; the `-t 24957` run after it passed 4
of 4).
- Dispatch-gates at head `66e0df6213`: 66 derived, 63 run, 3 NOT
MEASURED (`check:dual-build-cjs-loads`, `check:lean-entry-closure`,
`check:type-check-debt`; each exited 3, prerequisite not met: a
full-workspace build). Those are declared to CI.
## Producers measured
- In-repo, at `3b3830ca22`: 0 `validations[]` predicates read `parent`
across `examples/`, `packages/create-objectstack`, `skills/` and package
objects. The 10 files under `examples` / `packages/create-objectstack` /
`skills` that author `validations:` were grepped for `parent`. Control
leg: the same grep finds the field-rule reads
(`examples/app-showcase/src/data/objects/invoice.object.ts`, 3
`readonlyWhen` hits), so it does reach the corpus. Nothing to fix.
- HotCRM: NOT MEASURED, because no checkout is in this container.
## Acceptance notes
- **Release text (route B, seat decision 2026-10-22).** This PR no
longer touches the pending `.changeset/24720-validation-rule-parent.md`.
That file is restored byte-identical to `main`, so
`check:empty-changeset` is green. Instead, this PR's own
`.changeset/24957-validation-rule-parent-error.md` says it supersedes
the 24720 entry's "Nothing new is refused in 18.x" sentence and its 19.0
plan, so a CHANGELOG reader can tell which entry is current.
- Open PR #24947 also edits `validate-expressions.ts`, in different
hunks (imports, `StackExpressionOptions` docs, the bulk `confirmText`
pass). There is no textual overlap with the verdict lines.
- The claim's file surface did not name the metadata-protocol door
block. It is declared here.
- Unchanged and out of scope: `current_user` / `input` / `os` /
`trigger` in a `validations[]` condition (the family the card notes for
triage).
---
_Generated by [Claude
Code](https://claude.ai/code/session_01D6F9axfoPzR7t8G1J7Ytzz)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent c4b49c3 commit c5915b2
4 files changed
Lines changed: 212 additions & 37 deletions
File tree
- .changeset
- packages
- lint/src
- metadata-protocol/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1715 | 1715 | | |
1716 | 1716 | | |
1717 | 1717 | | |
1718 | | - | |
| 1718 | + | |
1719 | 1719 | | |
1720 | 1720 | | |
1721 | | - | |
| 1721 | + | |
1722 | 1722 | | |
1723 | 1723 | | |
1724 | 1724 | | |
| |||
1734 | 1734 | | |
1735 | 1735 | | |
1736 | 1736 | | |
1737 | | - | |
| 1737 | + | |
1738 | 1738 | | |
1739 | 1739 | | |
1740 | | - | |
1741 | | - | |
1742 | | - | |
1743 | | - | |
1744 | | - | |
1745 | | - | |
1746 | | - | |
1747 | | - | |
| 1740 | + | |
| 1741 | + | |
| 1742 | + | |
| 1743 | + | |
| 1744 | + | |
| 1745 | + | |
| 1746 | + | |
| 1747 | + | |
1748 | 1748 | | |
1749 | 1749 | | |
1750 | 1750 | | |
| |||
1772 | 1772 | | |
1773 | 1773 | | |
1774 | 1774 | | |
1775 | | - | |
1776 | | - | |
| 1775 | + | |
1777 | 1776 | | |
1778 | 1777 | | |
1779 | 1778 | | |
| |||
2931 | 2930 | | |
2932 | 2931 | | |
2933 | 2932 | | |
2934 | | - | |
2935 | | - | |
| 2933 | + | |
| 2934 | + | |
2936 | 2935 | | |
2937 | 2936 | | |
2938 | 2937 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
82 | | - | |
| 81 | + | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
| 86 | + | |
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
| 98 | + | |
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | | - | |
105 | | - | |
106 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
107 | 122 | | |
108 | 123 | | |
109 | 124 | | |
| |||
112 | 127 | | |
113 | 128 | | |
114 | 129 | | |
115 | | - | |
| 130 | + | |
116 | 131 | | |
117 | 132 | | |
118 | 133 | | |
| |||
131 | 146 | | |
132 | 147 | | |
133 | 148 | | |
134 | | - | |
| 149 | + | |
135 | 150 | | |
136 | 151 | | |
137 | 152 | | |
| |||
148 | 163 | | |
149 | 164 | | |
150 | 165 | | |
151 | | - | |
| 166 | + | |
152 | 167 | | |
153 | 168 | | |
154 | 169 | | |
| |||
175 | 190 | | |
176 | 191 | | |
177 | 192 | | |
178 | | - | |
| 193 | + | |
179 | 194 | | |
180 | 195 | | |
181 | 196 | | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
187 | 203 | | |
188 | 204 | | |
189 | 205 | | |
190 | 206 | | |
191 | | - | |
| 207 | + | |
192 | 208 | | |
193 | 209 | | |
194 | 210 | | |
| |||
0 commit comments