Repository navigation
Commit 7fbfef4
test(objectql): pin the environment overlay of a packaged item for the five overlay-enabled types (#22363)
Part of #22340
Clause-②: no
This is stage S1 of #22340, claimed in the amendment comment 6069745527.
It pins the environment overlay of the five overlay-enabled metadata
types under the flag's current name, `allowOrgOverride`, and changes
tests only. The rename is stage S2 and is not in this PR. #22340 stays
open.
## What this adds
This PR adds one new test file,
`packages/objectql/src/environment-overlay-five-types.test.ts`. It runs
on the real `ObjectQL` engine and `SchemaRegistry` and the real
`ObjectStackProtocolImplementation`, on both topologies: an environment
kernel (`environmentId` set) and a host-config kernel (none). The
harness follows `engine-security-catalog-package-door.test.ts`. No
source file changes.
Each of `view`, `dashboard`, `report`, `translation` and
`email_template` gets three checks, and the first two run on both
topologies:
1. **Write.** `saveMetaItem` over the packaged item is accepted
(`success: true`) and stores exactly one `sys_metadata` row. That row
names no organization (`organization_id` is NULL), and the item's read
then serves the body that was written.
2. **Read of a stored overlay.** An environment-wide row goes straight
into the store, with no write door in front of it, and `getMetaItem`
serves it. As a control, the same read serves the package's item before
the row exists.
3. **Wire.** `getMetaTypes` advertises `allowOrgOverride: true` with
`overrideSource: 'registry'` for the type. The `OS_METADATA_WRITABLE`
hatch is cleared for every case, so it cannot stand in for the registry.
One more case pins the identity: the registry types whose flag is `true`
are exactly these five. The file writes the five out instead of reading
them from the registry, so a type that leaves the flag fails its own
cases by name.
No `organizationId` reaches any call, and the protocol has no
organization of its own. When #15206 S3 to S5 delete the
per-organization path, these cases still stand.
There are 26 cases: 1 identity case, 20 write and read cases (5 types, 2
topologies, 2 legs) and 5 wire cases.
## Measured on `origin/main` (`1cb0edb82`) before writing
- All five environment-wide overlays are accepted on both topologies
today. No stop condition fired: none of the five is refused, and none
needs an `organizationId`.
- Four of the packaged items come in through the manifest's own stack
collections (`views`, `dashboards`, `reports`, `emailTemplates`), the
seam that stamps package provenance. `translation` has no such
collection (see Acceptance notes). Its packaged item is registered
through the registry's package seam, `registerItem(type, item, 'name',
packageId)`, which is the entry `isArtifactBacked` reads.
- The single-item read, `getMetaItem`, serves a stored active row
without consulting the flag or `supportsOverlay` (see Acceptance notes).
## Pins that already exist, not repeated here
| type | already pinned elsewhere | added here |
|---|---|---|
| view | dispatcher PUT (`runtime/src/meta-field-overlay-lock.test.ts`);
package-door verdict
(`metadata-protocol/src/protocol.packaged-base-refusal.test.ts`);
repository write
(`metadata-protocol/src/sys-metadata-repository.package-writability.test.ts`);
wire flag on a mock engine
(`objectql/src/protocol-meta-types-rich.test.ts`) | the stored row's
organization, the served body, the wire flag on the real engine |
| dashboard | dispatcher PUT
(`runtime/src/meta-field-overlay-lock.test.ts`) | all three checks on
the protocol |
| report | none | all three checks |
| translation | none | all three checks |
| email_template | the save over a packaged template on both topologies
(the control in
`objectql/src/engine-security-catalog-package-door.test.ts`) | the
stored row's organization, the served body, the wire flag |
Each existing pin reads one layer of one type, and none of them reads
the stored row's organization, the served body and the wire flag
together. The `email_template` save is the one overlap. Here it is only
the first step of a round trip that goes on to read those three things.
**No dispatcher case in `packages/runtime`.** For an environment-wide
write (a `manage_metadata` session with no active organization), the
dispatcher reads the flag nowhere:
- `metaWriteCapabilityVerdict` admits `manage_metadata` before it reads
the flag.
- `organizationIdForMetaWrite` returns `undefined` before it reads the
flag.
Both read the flag only for a session with an active organization, which
is the per-organization path. The dispatcher hands this same request to
`saveMetaItem`, and the existing view and dashboard dispatcher pins
already cover that transport.
## Reverse verification (ablation)
- **Mutation.** `report`'s flag was flipped to `false` in
`DEFAULT_METADATA_TYPE_REGISTRY`
(`packages/spec/src/kernel/metadata-plugin.zod.ts`) through
`scripts/ablation-replace.mjs`. Its evidence: anchor x1 → x0,
replacement x0 → x1, blob `47f68e76cb5c` → `01bfde907a81`.
- **Rebuild.** `@objectstack/spec` was rebuilt, because the test and
`metadata-protocol`'s dist both import the registry from spec's `dist/`.
`scripts/ablation-dist-preflight.mjs` found the marker in 4 built files:
`dist/kernel/index.js`, `dist/kernel/index.mjs`,
`dist/browser/kernel/index.js` and `dist/browser/kernel/index.mjs`.
- **Prediction, written before the run.** 4 red and 22 green. The red
cases would be the identity, `report`'s write on both topologies and
`report`'s wire flag. `report`'s two read cases would stay green,
because the read consults no flag.
- **Result.** **4 failed | 22 passed (26)**, and the four were exactly
the predicted ones:
- identity: received
`["dashboard","email_template","translation","view"]`;
- write, on both topologies: received `{ refused: { code:
'NOT_OVERRIDABLE', status: 403 } }`;
- wire: received `allowOrgOverride: false`, `overrideSource:
'registry'`.
- **Restore.** The tool restored the file with `git checkout HEAD --`:
the blob equals HEAD's (`47f68e76cb5c`) and `git diff HEAD` is empty.
Spec was rebuilt, and `ablation-dist-preflight --absent` passed: the
marker is absent from all 232 built files and the whole tree is clean.
The re-run passed **26 of 26**.
## Verification (head `db89d66f0`)
- **New file.** `pnpm --filter @objectstack/objectql exec vitest run
--project local src/environment-overlay-five-types.test.ts`: 26 passed.
- **Package suite.** `pnpm --filter @objectstack/objectql exec vitest
run --project local --maxWorkers=2`: 388 files and 7633 tests passed.
- **Typecheck.** `pnpm --filter @objectstack/objectql run typecheck`
(tsc plus the test-layer program) is OK. The new file has no ledger
entry in `test-typecheck-debt.json`, so it compiles with zero errors.
- **Gates.** `dispatch-gates --commands` was re-derived from the
branch's change set and gave the same 56 commands as the dispatch. 55
exit 0. `check:dual-build-cjs-loads` exits 3, PREREQUISITE NOT MET: it
needs every workspace package built. It is NOT MEASURED here, and CI
builds the workspace. The `--ran` verdict reads: `✓ dispatch-gates
--ran: 56 derived famil(ies) accounted for — 55 run, 1 NOT-MEASURED (1
DERIVED from a recorded exit 3).`
- **Lint, narrowed to the one file.** `eslint --no-inline-config
--format json` reports 1 file with 0 errors and 0 warnings. The file is
in eslint's own population: `--print-config` returns a config with 5
rules for it. Type-aware linting is not enabled (no
`parserOptions.project`, no typed rules), so adding this file cannot
change another file's result.
- **Runtime or integration tiers.** Not touched.
## Changeset
There is no changeset, because this diff publishes nothing:
- objectql's `tsconfig.json` excludes `**/*.test.ts` from the build.
- After `pnpm --filter @objectstack/objectql run build`, the file's
fixture strings appear 0 times in every path of `files[]` (`dist`,
`README.md`, `CHANGELOG.md`). As a positive control,
`registerMetadataCollections` appears in 6 files under `dist`.
The repo's opt-out for a diff that publishes nothing is the
`skip-changeset` label, and it is applied.
## Acceptance notes
- **No in-repo producer puts a packaged `translation` into the
`SchemaRegistry`.** This is a reading of four seams at `1cb0edb82`, not
a boot measurement:
- `METADATA_ARRAY_KEYS` (`objectql/src/engine.ts`) has no `translations`
collection.
- The artifact door's `ARTIFACT_FIELD_TO_TYPE`
(`metadata/src/plugin.ts`) has none either.
- The filesystem scanner (`MetadataPlugin._loadFromFileSystem` with its
`packageId` option) stamps `_packageId`, but it registers into
`MetadataManager`'s own map.
- `ObjectQLPlugin.loadMetadataFromService` copies only `object`, `view`,
`app`, `flow` and `hook` into the `SchemaRegistry`.
So in today's composition, `isArtifactBacked` is false for every
`translation`. An environment-wide translation write is then admitted by
`allowRuntimeCreate`, not by the flag. The `translation` cases here pin
the protocol's verdict for a packaged translation if one is ever
registered. Today the flag's live effect on `translation` is the
per-organization path and the Studio wire gate. This is noted for
#22340's S2 contract review and not filed.
- **The single-item read keys on neither the flag nor
`supportsOverlay`.** `getMetaItem` serves a stored active row unless
`declinesStoredRow` holds, which covers shipped flows and code-defined
datasources only. `supportsOverlay` has one protocol reader,
`mergesOverlayAtRead`, and only the delete door
(`refusePackagedBaseRemoval`) calls it. So stage 0's reading, "the read
keys on `supportsOverlay`", does not hold for this read. What holds, and
what the ablation shows, is that the read consults no flag. This is
noted for #22340 S2 and not filed.
- **Cross-lane.** The file sits in a `domain:engine` package. The lane
was told in the cross-lane declaration on #6367 (comment 6069783273).
---
_Generated by [Claude
Code](https://claude.ai/code/session_01DhTqaEHqPVSVnAkjG3jywn)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent 6a53564 commit 7fbfef4
1 file changed
Lines changed: 359 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 | + | |
| 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 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
0 commit comments