Repository navigation
Commit fb3c6b4
test(cli): hold field-level and action-param object references in agreement on the per-package leg (#18213)
Fixes #18204
Part of #14122 — the ADR-0130 tracker stays open; nothing here is a
closing keyword for it.
## Headline: the reported defect does not reproduce on `main` — the
missing thing was the pin
The card reports that `os build`'s per-package author-time leg refuses
an action param's
record-picker `reference` into a dependency's object while the composed
pass accepts it, and
while ADR-0130 R1 accepts the field-level equivalent. Measured on this
tree, both levels agree
and have since #16611: the per-package leg resolves the sibling's object
at the field level AND
at the action-param level, and still refuses a name no package of the
artifact provides.
What DOES reproduce the card, exactly, is the published
`@objectstack/cli@17.4.0` that the
downstream repro builds against. Read out of that installed tarball:
```js
// node_modules/@objectstack/cli/dist/commands/compile.js (17.4.0, as installed downstream)
function packageBodyAsStack(body) {
return { ...body, manifest: body }; // no resolution context at all
}
```
and its `@objectstack/lint@17.4.0` carries neither
`artifactProvidedObjectNames` nor the field
`reference` site. That is the whole asymmetry the card saw: at that
release the action-param
site is judged against one package's own objects (refused), while the
field site is not judged
at all (so it looks accepted). Both halves moved in #16611. The
downstream fix is a pin bump,
not a change here.
So this PR changes no behaviour. It adds the pin the card asks for —
"the refusal must move,
not disappear, and a fixture must prove it" — at the level the card is
about.
## Measurements
All on `examples/app-multi-package` (a real two-package artifact: module
`orders` depends on
app `core`, which owns `crm_account`), through the real `objectstack
build`:
| fixture | reading |
| --- | --- |
| unmodified example | exit 0 |
| module action param `reference: 'crm_account'` (app package's object)
| exit 0 — the per-package leg ran and reported nothing |
| the same param pointed at `crm_contract` (no package provides it) |
exit 1, `object-reference-unknown` at
`objects[0].actions[0].params[0].reference` |
The example edits were a throwaway probe and are not in this diff
(restored; `git diff HEAD`
empty).
## What the two new pins hold
- `packages/cli/src/utils/artifact-packages.test.ts` (new, queue tier) —
the real
`artifactPackages` + `packageBodyAsStack` + the real rule. One equality
carries four
verdicts: `crm_account` absent at BOTH levels (resolved through
`packages[]`), the two
dangling names present at BOTH levels (the refusal moved, it did not
disappear). A CONTROL
leg with no context reports all four, so the pin can fail.
- `packages/cli/test/build-multi-package-artifact.e2e.test.ts` — the
existing end-to-end case
for the same seam gains the action-param level, so the same four
verdicts are also read
through the real command.
Why both: the lint-side rule test runs against a local REPLICA of
`packageBodyAsStack`'s output
and stays green if the CLI stops producing that shape; the end-to-end
file carries the `.e2e`
name, so `OS_TEST_TIERS` puts it in the NIGHTLY population and the merge
queue never runs it.
The new file is the queue-tier half.
### Ablation — the pins fail when the wiring is removed
Mutating `packageBodyAsStack` back to the 17.4.0 shape (`{ ...body,
manifest: body }`), on-disk
mutation proved by text counts (removed-text 1 to 0, injected-text 1)
and by blob hash
(`febc6ad4` to `9b4019eb`):
```
ABLATION unit exit=1
ABLATION e2e exit=1
```
both failing with the same diff — the two `crm_account` /
`probe_account` paths appearing,
including `objects[0].actions[0].params[0].reference`, which IS the
card's symptom reproduced
on this tree. Restored from `HEAD`: `git diff HEAD` empty, blob back to
`febc6ad4`.
## Tests and gates
- `pnpm --filter @objectstack/cli exec vitest run --project unit` — 207
files, 2962 tests, all
pass (the new file included).
- `OS_TEST_TIERS=nightly ... --project integration
build-multi-package-artifact` — 7 pass. Run
because the diff touches an integration-layer file.
- `pnpm --filter @objectstack/cli typecheck` — exit 0.
- `pnpm lint` (`eslint . --no-inline-config`, repo-wide, not narrowed) —
exit 0 over 6754 files
at `1a4624be8`.
- `node scripts/pm/dispatch-gates.mjs --commands` derived 57 families;
55 run green, 2 recorded
exit 3 (PREREQUISITE NOT MET — `check:dual-build-cjs-loads` and
`check:i18n-coverage` both
need a full-tree build; this worktree built only the CLI closure).
Reconciled with `--ran`:
57 derived, 57 accounted, 0 UNRUN. One further self-test,
`check-plugin-teardown-shape
--self-test`, exits 1 on this container because the clone is shallow and
it cannot reach its
pinned fixture commit — its tree-judging leg passes.
## Changeset
`skip-changeset`, measured rather than assumed: `packages/cli` publishes
`files: ["dist",
"README.md", "CHANGELOG.md"]`, the diff is two test files, and neither
name appears anywhere
under `packages/cli/dist` after a build, while the positive control
(`packageBodyAsStack`)
does. Nothing published moves. The dispatch asked for a `patch` entry
describing what the
per-package pass now accepts; that sentence would be false — it has
accepted it since #16611,
whose own changeset carried it.
## Clause 2
The claim on the card declares `Clause-2: yes` on the expectation that
the fix widens the
acceptance set. The measurement falsifies that premise for this PR: the
accept-set is
byte-identical before and after. `needs:contract-review` is attached
anyway, per the claim, so
the contract seat can re-grade rather than have the label quietly
dropped by the executor.
## Acceptance notes
Observed while measuring, not filed and not fixed here:
- `compile.ts` holds two adjacent variables for the same noun —
`artifactPackageEntries` (the
raw `packages[]`, which is the resolution context the rule reads) and
`packageEntries` (the
`{ index, id, body }` view). `packageBodyAsStack`'s second parameter is
typed `unknown`, so
passing the wrong one type-checks and silently restores exactly this
refusal. The end-to-end
and queue-tier pins above now catch it; the type does not. Carrier:
whoever next refactors
that block.
- `objectExtensions[].fields[].reference` is a third level with a third
verdict — not judged at
all, deliberately and documented in `validate-object-references.ts`,
whose header names the
cross-artifact case as its own card. Reported per the dispatch's ruling
2 rather than widened
into.
- `os validate` runs the union pass only, so it has no per-package leg
to disagree with;
`os lint`'s per-package leg passes the same raw `packages[]` this one
does; `os dev` spawns
`compile`. No fourth verdict found.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01T3YsvpK1PvYf9n1YUhYP6W)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent 8c657f7 commit fb3c6b4
2 files changed
Lines changed: 202 additions & 11 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 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
146 | | - | |
147 | | - | |
| 146 | + | |
| 147 | + | |
148 | 148 | | |
149 | 149 | | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
150 | 166 | | |
151 | 167 | | |
152 | 168 | | |
153 | 169 | | |
154 | | - | |
| 170 | + | |
155 | 171 | | |
156 | 172 | | |
157 | 173 | | |
| |||
160 | 176 | | |
161 | 177 | | |
162 | 178 | | |
163 | | - | |
164 | | - | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
165 | 182 | | |
166 | 183 | | |
167 | 184 | | |
| |||
185 | 202 | | |
186 | 203 | | |
187 | 204 | | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
188 | 215 | | |
189 | 216 | | |
190 | 217 | | |
| |||
289 | 316 | | |
290 | 317 | | |
291 | 318 | | |
292 | | - | |
| 319 | + | |
293 | 320 | | |
294 | 321 | | |
295 | 322 | | |
| |||
301 | 328 | | |
302 | 329 | | |
303 | 330 | | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
309 | 354 | | |
310 | 355 | | |
311 | 356 | | |
| |||
0 commit comments