fix(runtime): /meta/:type/:name/published resolves from the published store, not the code snapshot - #8254
Conversation
…ed store, not the code snapshot An item published at runtime — authored as an ADR-0027 draft and promoted via `POST /packages/:id/publish-drafts` — answered 404 on this route while the ordinary read `GET /meta/:type/:name` served it. The route and the publish path shared no store: the write flips the artifact's `sys_metadata` row `state:'draft' → 'active'` (that route's own comment notes it has "no metadata service dependency"), and the read resolved only through `metadataService.getPublished`, which reads the `publishedDefinition` key `MetadataManager.publishPackage` writes into its own in-memory registry. ADR-0027 (E)(5) defines sealing a publish as exactly that `draft → active` flip, `SysMetadataRepository` names `'active'` "the published, live overlay", and ADR-0033 §2 — the ADR this route cites — routes every authoring write into that same ADR-0027 draft. The `active` overlay row is therefore authoritative for "what is published", and the route now consults it first. Read through `getMetaItemLayered`, whose overlay layer is a strict `state:'active'` lookup reported separately from the code layer: a draft is never served, and a null overlay falls through to the untouched `getPublished` path so a code-published item answers the same bytes it always did. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011Q72AE6sKzpP8Z4o1RM7xy
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
📓 Docs Drift CheckThis PR changes 1 package(s): 20 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
⛔ 2 release-owned page(s) also reference the affected code. These are read-only:
|
…ispatch contract `check:engine-double-contract` flagged this file's fake engine on BOTH write verbs: its `update()` and `delete()` accepted calls the real `ObjectQL` engine would refuse, and a double looser than the producer is how #4434 shipped a dead route with its suite green. Both verbs now open with the producer's own predicate — `assertEngineUpdateDispatch(data, options)` / `assertEngineDeleteDispatch(options)` — imported from `@objectstack/metadata-core`, where they have lived since #5619, rather than from `@objectstack/objectql` (which re-exports them but depends on this side of the graph, so the import would close a cycle turbo rejects). No baseline entry: the pin applies cleanly here. No production code changed — the five cases still pass, and reverting the `/published` fix still turns the two runtime-published cases red, so the suite remains load-bearing under the stricter double. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011Q72AE6sKzpP8Z4o1RM7xy
Fixes #8031
Opened by the PM on the dev agent's behalf. The cloud dev container cannot reach the GitHub API (403 on every call —
GitHub access is not enabled for this session); it can onlygit push. The branch, the commit, the tests and the changeset are entirely the dev's work.What this is
GET /meta/:type/:name/publishedanswered 404 for an item published at runtime — authored as an ADR-0027 draft and promoted viaPOST /packages/:id/publish-drafts— while the ordinary readGET /meta/:type/:nameserved it. The route and the publish path shared no store: the write flips the artifact'ssys_metadatarowstate: 'draft' → 'active', while the route resolved from the code/package snapshot, which a runtime publish never touches.Full rationale is in the changeset (
.changeset/published-route-reads-published-store.md) — it is the dev's own text and the authoritative description of the change.Shape
packages/runtime/src/domains/meta.ts— +49packages/runtime/src/domains/meta-published-runtime-publish.test.ts— +315 (new)Additive only: 413 insertions, 0 deletions.
Review status
Draft pending my own review of the source diff and CI convergence. I am reviewing against this diff and
origin/main, ⛔ not against a self-reported summary — the dev's structured report is stranded in its container by the same 403, so the diff and the changeset are the primary artifacts here.Generated by Claude Code