Repository navigation
Commit e74ec56
fix(rest,runtime,metadata-protocol)!: /published, REST /state, _drafts and the event-door absence body answer a disabled package's item as the by-name read does (#24247)
Part of #24210 (the second half: it closes `/published` on both
transports, REST `/meta/object/NAME/state/FIELD`, `GET /meta/_drafts` on
both transports, and the event and diff doors' absence body). Non-object
`?layers=true` and `/layers` stay on the card for after #23050 slice 13b
lands (they sit in G4, which is in flight), so #24210 remains open.
Clause-②: no (narrowing) (owes one `CONTRACT_REVIEW_TIER` review before
the queue)
Implements triage 6239967422 (absence for a non-object type;
`OBJECT_PACKAGE_DISABLED` for an object; no new or generalised code) and
the seat's ruling 6241893667 (Q1 A door side, Q2, item 6) under claim
6243792589, dispatched by the `domain:engine` seat 1
(`session_01JtSQQ3EWsbNPzyYMug1tXy`), plus the first half's ACCEPT
6243458372 open question A (the event and diff doors' absence is
byte-identical with the plain read).
## What changed
Since PR #24223 the by-name read answers a disabled package's non-object
item as absent, as the list omits it. Four more doors still read past
that answer. Each now asks the same disabled-owner question and takes
the exit a missing name takes.
1. **`GET /meta/_drafts`, both transports: the producer.** `listDrafts`
(`packages/metadata-protocol/src/protocol.ts`) omits every draft whose
row `packageId` names a disabled package, by the shared predicate
`isItemOfDisabledPackage` (`package` never hidden). Neither door is
edited. The package batch doors (`publish-drafts`, `discard-drafts`, the
batch closure) read the repository's own `listDrafts`, not this method,
so a disabled package's drafts still publish and discard (pinned as a
resolution reader).
2. **REST G6, `/history`, `/audit`, `/diff`: the absence body.**
`eventDoorRefusal` (the class member) and the `/diff` branch catch
`fetchCurrentMetaDocument`'s withheld-item throw and answer it through
`sendMetaItemAbsent`, recognised by `thrownAnswerIsBareNotFound`, the
same predicate the plain read's catch asks. The answer is now the plain
read's nested body,
`{"error":{"code":"RESOURCE_NOT_FOUND","message":"Metadata item not
found or access denied."}}`, instead of the flat
`{"error":"…","code":"RESOURCE_NOT_FOUND"}`. `fetchCurrentMetaDocument`
is not edited. A deleted item keeps its answer.
3. **REST G7, `GET /meta/object/:name/state/:field`.** Before reading
the schema, the door asks the engine registry's
`isObjectPackageDisabled(name)`. For such an object it reads the
protocol's by-name read, whose `404 OBJECT_PACKAGE_DISABLED` the door's
own catch renders, byte for byte what `GET /meta/object/:name` answers.
The schema is never read for that name. This is the dispatcher twin's
`disabledObjectAnswer` shape. It closes the interim transport split the
first half named.
4. **REST G8, `GET /meta/:type/:name/published`, every type but `object`
and `package`.** Before either exit (the stored published row, or the
code/package snapshot), the door reads the plain read's kept protection
envelope `packageId` and asks the engine registry's `isPackageDisabled`.
A disabled owner takes the missing name's exits: no overlay, no
snapshot, `404 NOT_FOUND`. The registry is reached through
`wiredEngineOrLoud`, so a failed engine is a loud `503`, and a host with
no engine withholds nothing. Objects keep the layered read's own
refusal.
5. **Dispatcher `/published` twin**
(`packages/runtime/src/domains/meta.ts`): the same question through
`deps.getObjectQL` and `isServiceItemOfDisabledPackage`. A disabled
owner answers the missing name's `404 RESOURCE_NOT_FOUND` "Not found". A
throw of that plain read is the item read's answer (`errorFromThrown(e,
404)`).
The producer `getMetaItemLayered` is not touched (ruling Q1 A: it keeps
serving its resolution reader, the security catalog echo). There is no
new public method, spec key, error code or enforcement change.
## Mechanism hypotheses (measured before any edit)
- **H1, `/published`'s owner: half falsified.** On a live `pnpm dev:crm
--fresh`, the layered envelope of a runtime-saved item carries **no**
`packageId`, and its `effective` carries no `_packageId`. The stored
row's `package_id` is grafted only by the plain read (`readMetaItem`).
So the owner comes from the plain read's kept envelope `packageId` (the
field the first half's echo fix reads, and the one the protocol's
predicate asks of the resolved item), asked of the registry's
`isPackageDisabled`. A REST door has no registry predicate of its own,
so G8 reads the `objectQLProvider` slot (see Acceptance notes).
- **H2, `_drafts`: holds.** `repo.listDrafts` rows carry `packageId`.
The protocol method has exactly two callers, the two `_drafts` doors.
The three batch doors call the repository directly. So the producer
filters, and neither door is edited.
- **H3, REST `/state`: holds.** The G7 handler reads
`ql.registry.getObject` directly. The dispatcher's
`disabledObjectAnswer` shape ports as-is, and no schema is read for the
name.
- **H4, the absence body: holds.** `sendMetaItemAbsent` is reachable
from `eventDoorRefusal` and the `/diff` branch. The deleted item keeps
its answer on all three doors (pinned and measured).
## Doors, measured over HTTP
**REST:** `pnpm dev:crm -- --fresh` on a real socket. Before is
`origin/main` `2bcd406a2` (full build); after is `d78cc5fd` (the fix
commit; later commits change only tests, changesets and a ledger).
**Dispatcher:** the real store (`SqliteWasmDriver`) and the real
protocol (`ObjectQLPlugin`) under `createHonoApp`, driven through its
fetch handler (scratch harness, not committed). Writable package
`app.probe-24210b` holds dashboard `probe_dash` (saved twice), page
`probe_page`, app `probe_app` (saved twice), object `probe_gadget` and a
draft `probe_draft_dash`. Control package `app.control-24210b` holds the
same shapes. `probe_gone` was saved and deleted.
| Request, package disabled | REST before | REST after | Dispatcher
before | Dispatcher after |
|---|---|---|---|---|
| `/meta/dashboard/probe_dash/history`, `/audit`, `/diff`;
`/meta/app/probe_app/history`, `/diff` | 404 `RESOURCE_NOT_FOUND`, flat
body | **404, the plain read's nested body** | not a dispatcher route |
n/a |
| `/meta/dashboard/probe_gone/history`, `/diff` (deleted) | 200 events;
200 empty diff | unchanged | n/a | n/a |
| `/meta/dashboard/probe_dash/published`,
`/meta/page/probe_page/published`, `/meta/app/probe_app/published` |
200, served | **404 `NOT_FOUND`**, = missing name | 200, served | **404
`RESOURCE_NOT_FOUND`**, = missing name |
| `/meta/object/probe_gadget/published` | 404 `OBJECT_PACKAGE_DISABLED`
| unchanged | (closed by PR #24223) | unchanged |
| `/meta/object/probe_gadget/state/status?from=open` | 200, served |
**404 `OBJECT_PACKAGE_DISABLED`**, = `GET /meta/object/probe_gadget` |
(closed by PR #24223) | unchanged |
| `GET /meta/_drafts` | lists `probe_draft_dash` | **omits it**;
`ctrl_draft_dash` listed | lists it | **omits it**; control listed |
| `GET /meta/_drafts?packageId=app.probe-24210b` | lists it |
**`{"drafts":[]}`** | lists it | **`{"drafts":[]}`** |
| control: `ctrl_dash` `/history`, `/diff`, `/published`;
`ctrl_page/published`; `ctrl_gadget/state/status` | 200 | 200 | 200 |
200 |
Byte equality on REST, compared over status, headers (minus date,
request id, timing) and body: the disabled `probe_dash` by-name read,
its `/history`, `/audit` and `/diff`, and `probe_app`'s `/history` and
`/diff` all equal `GET /meta/dashboard/no_such_dash_x`. The three
disabled `/published` reads equal `GET
/meta/dashboard/no_such_dash_x/published`. On the dispatcher, both
disabled `/published` reads answer
`{"success":false,"error":{"code":"RESOURCE_NOT_FOUND","message":"Not
found","httpStatus":404}}`, the missing name's bytes. Enabled readings
after equal enabled readings before on both transports, after
normalising timestamps, hashes and actor ids. Re-enabling restores every
row on both transports.
## Callers of `GET /meta/_drafts` (objectui at the pinned
`.objectui-sha` `5e15928b`, read-only clone)
| Call site | Reads | After, for a disabled package |
|---|---|---|
| `PackagesPage.tsx` package sheet (`_drafts?packageId=`) | counts
pending drafts and shows the Publish / Discard section | the section is
hidden while the package is disabled. The `publish-drafts` /
`discard-drafts` doors themselves still act on those drafts; re-enable
and the section returns |
| `usePendingDrafts`, `HomePage`, `DraftChangesPanel`,
`usePublishAllDrafts` | the pending-changes list | the disabled
package's drafts are not listed. The by-name draft read already answered
them `404 NO_DRAFT` (first half) |
| `ObjectHooksPanel`, `PackageOwdOverviewPanel`, `StudioDesignSurface`
(`listDrafts({ packageId, type })`) | draft-only objects and hooks of
one package | none for a disabled package, as its list read already
omits its objects |
No caller must tell "disabled" from "missing".
## Pins
- `packages/objectql/src/package-disable-enforcement.test.ts`, the #7557
table: two API-reader rows (`listDrafts()`, `listDrafts({ packageId })`,
which must stop), one resolution-reader row (the repository's
`listDrafts`, which the batch doors read and must keep serving), and the
control (the healthy package's two drafts still listed). The re-enable
case walks the same rows.
- `packages/rest/src/meta-disabled-package-doors.test.ts` (new), on the
real protocol and a real `SchemaRegistry`: `/published` on both exits
served, then equal to the missing name (status and body), then served
again after re-enable, with a control package and `getPublished` never
asked for a withheld item; `/state` served, then refused `404
OBJECT_PACKAGE_DISABLED` byte-equal to `GET /meta/object/:name`,
`getObject` never asked the name, a control and a missing name, then
served again; the slot outage case (a rejecting provider answers `503
SERVICE_UNAVAILABLE`, an absent one serves).
- `packages/rest/src/meta-alternate-door-read-gates.test.ts`: the
withheld gated dashboard and app now assert the event and diff doors'
body is the plain read's own, byte for byte, and the deleted-item case
asserts its `/diff` body is unchanged.
- `packages/runtime/src/domains/meta-disabled-package-doors.test.ts`:
the dispatcher `/published` of a non-object item on both exits (served,
then byte-equal to the missing name with neither store asked, then
served again), and a control.
- `packages/rest/src/objectql-slot-consumer-census.test.ts`: the census
counts the fourth consumer, `/published`, which passes its decidable
test through `wiredEngineOrLoud`, and §3 cites its outage pin.
- Pin sweep: `git grep` of the absence sentence, `_drafts` /
`listDrafts`, `/published`, `disablePackage` / `isPackageDisabled`
across every test. No other pin asserts the old answers. The suites of
every touched package plus `http-conformance` were run (below).
## Verification
**Rework (merge-queue removal, `CI_FAILURE`), head `ff82c7a1bf`:**
merged `origin/main` `cbfa5e4335` as `07b1e218a5` (a merge commit).
#23050 slice 13b (`646303eae`) had dropped `thrownAnswerIsBareNotFound`
from `rest-server.ts`'s imports, and the event and diff doors here read
it (TS2304 at `rest-server.ts` 3646 and 6419). It is re-imported from
`./error-response.js`, the only source edit, reproduced red without it.
At `ff82c7a1bf`: full `pnpm build` 76/76 and `@objectstack/rest` build
exit 0; `rest`, `runtime` and `metadata-protocol` typecheck exit 0;
suites `rest` 295 / 6034, `runtime` 413 / 6413, `metadata-protocol` 244
/ 20641, the #7557 pin 15/15; `dispatch-gates` 78 derived, 78 run, all
exit 0, `--ran` 0 NOT-MEASURED, 0 UNRUN. The readings below are the
previous head's.
Head `98dd4f8141`, after merging `origin/main` (`7715d049e`, a merge
commit; no rebase, no force-push) with a full `pnpm build` (76/76).
- **Suites** (at `0268f810`; the one later commit changes only the new
REST test's `find` double and the engine-double ledger, and its file was
re-run at `98dd4f8141`, 3/3): `@objectstack/rest` 295 files, 6032 passed
(326 skipped); `@objectstack/runtime` 412 / 6313 (19 skipped);
`@objectstack/objectql` 437 / 8244; `@objectstack/metadata-protocol` 244
files (3 skipped) / 20641; `@objectstack/http-conformance` 14 / 150.
- **Typecheck scripts**, each package's own `typecheck` (`tsc --noEmit`,
plus `check:test-typecheck` where the script carries it), each exit 0 at
`98dd4f8141`: `metadata-protocol`, `objectql`, `runtime`, `rest`.
- **Gates:** `node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` (no paths) derived 78 commands at
`98dd4f8141`, all exit 0 (unshallowed clone). `--ran` says: "78 derived,
78 run, 0 NOT-MEASURED, 0 UNRUN". At the previous head two families went
red on the new test's double, `check:engine-double-contract` (an
unrecorded pinned double) and `check:objectql-double-limit` (a
limit-blind `find`). Both are fixed in `98dd4f8141`.
- **Ablations**, one per changed behaviour, each through
`scripts/ablation-replace.mjs` with the restore proven `blob == HEAD`:
- (a) `listDrafts`' predicate replaced by an always-true marker.
`metadata-protocol` was rebuilt, and `ablation-dist-preflight` found the
marker in `dist/`. The two `_drafts` API rows and the control went red
(2 failed / 13 passed). After the restore and rebuild, `--absent` gave a
dist reading of PASS (its tree reading exited 3 only on the untracked
scratch harness, since removed), and the run was 15/15.
- (b) `eventDoorRefusal`'s fork disabled: only the withheld-item case
went red (1 / 427). (c) The `/diff` fork disabled: the same case only (1
/ 427).
- (d) REST `/state`'s disabled check: only the `/state` case (1 / 2).
(e) REST `/published`'s withheld verdict: only the `/published` case (1
/ 2).
- (f) The dispatcher `/published` check: only its case (1 / 9).
- (g) REST `/published` reading the slot with a swallowing `.catch`:
only the outage case (1 / 3).
## Acceptance notes
- **File surface.** REST edits sit in G6 (the `/history`, `/audit` and
`/diff` handlers' calls), G7, G8 and the class member
`eventDoorRefusal`. Nothing in G4, G5 or the class head.
`meta-collection-routes.ts` is not edited, and neither is the
dispatcher's `_drafts` (the producer carries it).
- **Outside the claim's list:**
`scripts/engine-double-contract.pinned.json` gains three rows for the
new test file's pinned double. That is `check:engine-double-contract`'s
own prescription (`--write`) for new pinned coverage, a mechanical
ledger entry with no source change.
- **A fourth `objectQLProvider` consumer.** G8 reads the engine
registry, which no REST `/meta` door read before. It goes through
`wiredEngineOrLoud`, and the census pin is updated to count it.
- **Dispatcher transport** was measured through `createHonoApp`'s fetch
handler (`app.request`), the `packages/qa/http-conformance` shape, not
over a socket. The scratch harness sat untracked under
`packages/qa/http-conformance` and was removed before the gates ran.
- **Ungated types' event and diff doors** (`page`, `flow`, `report`, …)
still serve a disabled package's item's events and diff. No per-caller
gate exists there to bypass, as the first half's record (③.7) named.
This half does not change them.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01Y9zBTp9ePwgEEJXeqyLG4N)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 21b945c commit e74ec56
12 files changed
Lines changed: 530 additions & 22 deletions
File tree
- .changeset
- packages
- metadata-protocol/src
- objectql/src
- rest/src
- runtime/src/domains
- scripts
| 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 | + | |
| 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 | + | |
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25531 | 25531 | | |
25532 | 25532 | | |
25533 | 25533 | | |
| 25534 | + | |
| 25535 | + | |
| 25536 | + | |
| 25537 | + | |
| 25538 | + | |
| 25539 | + | |
| 25540 | + | |
| 25541 | + | |
25534 | 25542 | | |
25535 | 25543 | | |
25536 | 25544 | | |
| |||
25558 | 25566 | | |
25559 | 25567 | | |
25560 | 25568 | | |
| 25569 | + | |
| 25570 | + | |
25561 | 25571 | | |
25562 | | - | |
| 25572 | + | |
25563 | 25573 | | |
25564 | 25574 | | |
25565 | 25575 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
396 | 396 | | |
397 | 397 | | |
398 | 398 | | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
399 | 422 | | |
400 | 423 | | |
401 | 424 | | |
| |||
587 | 610 | | |
588 | 611 | | |
589 | 612 | | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
590 | 618 | | |
591 | 619 | | |
592 | 620 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1016 | 1016 | | |
1017 | 1017 | | |
1018 | 1018 | | |
| 1019 | + | |
| 1020 | + | |
1019 | 1021 | | |
1020 | 1022 | | |
1021 | 1023 | | |
| |||
1040 | 1042 | | |
1041 | 1043 | | |
1042 | 1044 | | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
1043 | 1053 | | |
1044 | 1054 | | |
1045 | 1055 | | |
| 1056 | + | |
1046 | 1057 | | |
1047 | 1058 | | |
1048 | 1059 | | |
| |||
0 commit comments