Commit 6b7d709
fix(cli):
* fix(cli): `os validate` lowers inline handlers before its parse, so the hook write-set family judges handler-authored hooks there too
Every rule in the `hook-body-*` / `hook-api-update-readonly-*` family opens
on `body.language === 'js'`. `os validate` parsed the normalized stack
without lowering, so a hook authored as `handler: async (ctx) => { … }`
carried no body there and the family returned before reading anything:
`os validate` passed (exit 0, no finding) a stack `os build` refuses with
`hook-api-update-readonly-field`. The body-authored control fired on every
door, so the silence was the door, not the rule.
`validate.ts` now runs the same `lowerCallables` call `compile.ts` runs at
its step 2b — after the two pre-parse unknown-key lints, which keep reading
`normalized`, and before the parse, which reads `lowering.lowered` — and
hands the registry `parsed: result.data` as before. `lowerCallables` never
mutates its input, so the `normalized` tier, the stats and the structural
advisories are unchanged; the text face prints no new step.
The e2e pin's `os validate` leg flips from a measured "not lowered" reading
to a red-first intake leg, with the body-authored control unchanged beside
it and a negative control proving a handler-authored hook the family has
nothing to say about still passes. `lowerCallables` moves from the parity
pin's BUILD_ONLY_GATES to SHARED_NON_REGISTRY_GATES; the intake ledgers in
the two rule modules and the hook-bodies doc record the door as reached.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015QE8qk46e5CHJxyQEUjbf8
* changeset: `objectstack validate` lowers inline handlers before its parse (cli minor, lint minor)
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015QE8qk46e5CHJxyQEUjbf8
* fix(cli): declare and pin the widening limb — `os validate` now accepts an inline action `target` callable, as `os build` always did
The contract review on #16544 found the change is not a pure narrowing.
`ActionSchema.target` is a string and `normalizeStackInput` never touches
function values, so before this branch a plain-object config with
`actions: [{ name, label, target: async (ctx) => { … } }]` was refused by
`os validate` at the parse (`invalid_type` at `actions.0.target`, exit 1)
while `os build`, which lowers before it parses, accepted it. The same
`lowerCallables` pass now lowers it here too, so `os validate` accepts it —
an accepted-set relaxation on a published command, measured through the real
CLI on both sides (BASE validate exit 1 with two `invalid_type` issues; HEAD
validate exit 0; build exit 0 on both) and now declared in the changeset,
in the `validate.ts` comment, and pinned beside the hook legs in the e2e
file with a build-parity leg next to it.
Also: the stale twin sentence in `build-json-undeclared-key-parity.e2e.test.ts`
("validate lowers no handlers") is corrected, and the `validate.ts` comment
now says what "mirrors `compile.ts`" is exact about (lower-before-parse) and
what protects the key lints' input on both doors (non-mutation, not order).
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015QE8qk46e5CHJxyQEUjbf8
* fix(cli): declare and pin the third widening limb — a nameless `functions` array entry, which the same pass names `anon_fn`
The re-review enumerated every callable slot `lowerCallables` rewrites and
found one more accepted-set relaxation on `os validate`: the `functions`
ARRAY form requires `name`, and `normalizeStackInput` never touches
`functions`, so `functions: [{ handler: async (ctx) => { … } }]` failed the
`functions` union at the un-lowered parse (exit 1) while `lowerBody` names
it `anon_fn` before `os build`'s parse. Measured through the real CLI on
both sides: BASE validate exit 1 `invalid_union@functions`; HEAD validate
exit 0 `valid=true`; build exit 0. Declared in the changeset's widening
bullet and the `validate.ts` comment, pinned as a third INTAKE leg in the
fourth `describe`. No code change; the `functions` map forms and
`hooks[*].handler` are not limbs.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015QE8qk46e5CHJxyQEUjbf8
---------
Co-authored-by: Claude <noreply@anthropic.com>os validate lowers inline handlers before its parse, so the hook write-set family judges handler-authored hooks there too (#16727)1 parent 73053ed commit 6b7d709
9 files changed
Lines changed: 258 additions & 32 deletions
File tree
- .changeset
- content/docs/automation
- packages
- cli
- src/commands
- test
- lint/src
Lines changed: 20 additions & 0 deletions
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
268 | 268 | | |
269 | 269 | | |
270 | 270 | | |
271 | | - | |
| 271 | + | |
272 | 272 | | |
273 | 273 | | |
274 | 274 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
856 | 856 | | |
857 | 857 | | |
858 | 858 | | |
859 | | - | |
| 859 | + | |
| 860 | + | |
860 | 861 | | |
861 | 862 | | |
862 | 863 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
204 | 205 | | |
205 | 206 | | |
206 | 207 | | |
207 | | - | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
208 | 264 | | |
209 | 265 | | |
210 | 266 | | |
| |||
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
47 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| |||
0 commit comments