Repository navigation
Commit d34aa58
Fixes #21059
Clause-②: no
## What this changes
The layered door (`GET /api/v1/meta/:type/:name/layers`) reports three
layers: the code layer, the stored layer and the effective layer. The
spec's layer 1 says the code layer is null "when no artifact ships this
item (it exists only as an overlay)". The method's own #5707 / #5840
rule says a layer is asserted only from a read that happened.
For a name no package ships, the code layer was null only until a
hydration had put the stored row into the registry's bare slot. After
that, the code layer was the stored body, and the lock and provenance
flags were derived from it. Below the artifact lookup, the code layer's
fallback reads the bare slot. The fallback is there for items registered
at runtime with no package, and hydrated rows land in the same slot.
`getMetaItemLayered`'s code-layer fallback now ignores a registry answer
that carries the tenant mark. The hydrator already writes that mark on
every stored row it registers (ADR-0010 tenant provenance, read through
`isTenantAuthored` from `@objectstack/metadata-core`). No new mark is
added. The same rule covers the alias retry.
- **Unshipped name:** the code layer is null before and after hydration.
- **Stored body with package-provenance stamps under an unshipped
name:** this follows triage's ruling, which the maintainer can overturn.
A stamp is not an artifact read, so the code layer is null. The
lock-state resolver gets no code layer for the item, and its flags are
the same before and after hydration.
- **Shipped name:** unchanged. The artifact lookup answers before the
fallback is reached.
- **Item registered at runtime with no package:** unchanged. It carries
no tenant mark and keeps its code layer.
The effective-layer binding from #21002 and `isShippedFlowName` are not
edited. The stored rows are not changed.
## Measured: the layered door, showcase composition on a database file
The first boot reads the door with the rows stored and none of them
hydrated. The second boot is cold, on the same file, after the boot
hydration. Every reading answered 200.
| Name class | Before the fix: before hydration | Before the fix: after
hydration | After the fix: before hydration | After the fix: after
hydration |
|:--|:--|:--|:--|:--|
| Unshipped, stored row | code layer null; no provenance flag | **code
layer = stored body**; provenance flag `org` | code layer null; no
provenance flag | **code layer null**; no provenance flag |
| Unshipped, stored body with package-provenance stamps | code layer
null; provenance flag `package`, package flag = showcase | **code layer
= stored body**; provenance flag `org`, package flag = showcase | code
layer null; provenance flag `package`, package flag = showcase | **code
layer null**; provenance flag `package`, package flag = showcase |
| Shipped, with a stored row (control) | code layer = loader body;
`package` | code layer = loader body; `package` | same | same |
| Registered at runtime, no package (control) | code layer = registered
body | code layer = registered body | same | same |
| Unshipped, on the deprecated layers flag of the by-name door | not
read | code layer = stored body | not read | code layer null |
For every unshipped and runtime reading, lock is `none`, the item is
editable and deletable, and it is not resettable. The shipped name is
resettable.
The table was taken before the fix on a build of `origin/main`
`e952cff578`, where the dist carried no fix marker. It was taken after
the fix at `4a5639294d`. It was taken again at the merged head
`317eca662e`, where all 9 readings were identical to the post-fix run.
## Tests
-
`packages/metadata-protocol/src/protocol.layered-code-unshipped-name.test.ts`
(new, 7 cases). It covers the boot hydration and the read-side
hydration, the package-scoped read, the plural spelling, the stamped
corner (with and without a package binding), a non-flow type (view), and
both controls.
-
`packages/qa/dogfood/test/flow-unshipped-name-layered-code.dogfood.test.ts`
(new, 6 cases). It boots the showcase twice on one database file. It
covers the layered door and the deprecated layers flag, the stamped
corner's flags across hydration, and both controls.
- `@objectstack/metadata-protocol` full suite: 198 files passed and 3
skipped (201); 2962 tests passed and 19 skipped. Typecheck exit 0, and
the new pin is in the program (`--listFiles` count 1). Dogfood `tsc
--noEmit` exit 0, with the new pin in its program.
- Consumers of the layered read, which import this package (a downstream
direction), all green: objectql 3 files, 29 tests; rest 11 files, 173
tests; runtime 1 file, 10 tests; plugin-security 5 files, 134 tests.
Dogfood, 9 files, 53 tests, at the merged head: the new pin, the #21002
layered and published-door pins, permission projection, two doors,
multi-package artifact, and the two object-extension meta reads.
**Ablation.** The fix was committed first.
`scripts/ablation-replace.mjs` replaced the tenant-mark test with an
always-false call; the anchor went from 1 hit to 0 and the replacement
from 0 hits to 1.
- Unit pin, which resolves source: 5 failed (every subject case) and 2
passed (both controls). The restore left the blob equal to `HEAD` and
`git diff HEAD` empty.
- Dogfood pin, which resolves `dist/`: the package was rebuilt, and
`ablation-dist-preflight --absent` found the guard absent from all 24
built files. 3 failed (the subject cases) and 3 passed (the hydration
check and both controls). After the restore leg, the blob equals `HEAD`.
The package was rebuilt, the preflight found the guard present, and the
tree was clean.
- Two attempts were not measurements. A first unit attempt used a
replacement that was a substring of the anchor, so the tool refused it
and restored before any test ran. A first dogfood attempt used a
mutation the declaration build rejects. Its JS reached `dist/`, so
`dist/` was rebuilt from the restored source before the next run.
## Gates
`node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack
--commands` at `317eca662e` derived 74 commands, and all 74 were run
with their exit codes recorded before any pipe. `--ran` reports 74
derived, 74 run, 0 NOT-MEASURED and 0 UNRUN. Two first-pass results were
reruns, not failures. `check:dual-build-cjs-loads` exited 3
(PREREQUISITE NOT MET: 8 packages outside this diff had no `dist/`); it
exited 0 after they were built. `check:query-options-erasure` crashed
reading a temporary measurement file that was removed while it ran; it
exited 0 on the rerun. `pnpm lint` (the whole repository, `eslint .
--no-inline-config`) exited 0 with no findings at `317eca662e`.
## Acceptance notes
- **The stamped corner's flags now come from the stored layer, on both
sides of the hydration.** The lock source line, code layer first and
then the stored layer, is unchanged and outside this card's surface.
Whether a stored body's own provenance stamps should decide the flags
for a name no package ships is left to triage.
- **The rule applies to every type, not only `flow`.** The boot `object`
limb writes the same tenant mark, so an object no package owns also has
a null code layer after hydration. The unit pin covers flow and view.
Objects are not pinned separately; the objectql and rest layered-read
suites above are green.
- **A sibling with the same lookup shape is not edited.**
`readCodeLayerForCarryForward` uses the artifact lookup, then the
registry's bare slot. It is called only when no stored row exists for
the save's scope. This is a source reading, not measured.
- `scripts/engine-double-contract.pinned.json` gains one generated row
(`--write`) for the new unit pin's `findOne` double. That double is
copied from the pinned one in
`protocol.flow-layered-shipped-name.test.ts`.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01VvcEokUG1tvVxkceYfR5XB)_
---------
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 327391c commit d34aa58
5 files changed
Lines changed: 660 additions & 2 deletions
File tree
- .changeset
- packages
- metadata-protocol/src
- qa/dogfood/test
- scripts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 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 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 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 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
0 commit comments