Skip to content

feat(runtime): POST /packages/:id/move-in moves a selection of loose items into a package, each through the save door - #38185

Merged
objectstack-fleet[bot] merged 16 commits into
mainfrom
claude/project-thread-j4n4b0
Nov 28, 2026
Merged

objectstack-fleet[bot] merged 16 commits into
mainfrom
claude/project-thread-j4n4b0

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

repo:objectstack#3 · os-tesla · session_01L9qibyHmxFV4bTFZ5BKnUz

Requested by Tesla · project thread

Part of #38150. This is PR-A1 of three, by the seat's claim (comment 7234216673): the server door. PR-A2 (the console's "Loose" filter, selection bar, picker and Setup → Packages banner) follows once #38149 merges, and PR-B (the retirement of adopt-orphans and the Studio ~org entry, the PR that carries #37468 to done) follows after both. A1 and B ship in the same release.

Clause-②: yes (widening)
Metadata-protocol: added — the five new @objectstack/spec/api MoveIntoPackage* schemas enter the api authorable-surface shard (23 keys); no metadata key an author writes is added
Skills-docs: none — no skill under skills/** teaches adopt-orphans or loose items; this door is an admin operation whose console entry lands in PR-A2, and the objectstack-platform passage on package-less Setup rows covers overlays of shipped items, which this door refuses NOT_LOOSE

维护者速读

  • 用户能看到什么变化:用户暂时看不到变化。服务端新增一个「移入软件包」接口,可以按勾选把一个、几个或全部散落项移进某个软件包;控制台的入口在下一个合并请求里做。
  • 为什么做:属于 App Studio 改版专题,代替原来「一次全收」的收编散落项接口。它关掉旧接口实测出的三个缺陷:能收编进没安装的软件包、对象没有前缀也能收进去、流程和数据集要重启才换地址。
  • 出错会怎样:整批要么全部移入,要么全部退回原处(存储和运行中的服务都退回),被拒时逐项说明原因;退回本身失败时答 500 并点名没退回的项。新接口没有调用方,有问题可以直接撤回,旧接口原样保留。
  • 要你做什么:无。

What changes

Route. POST /api/v1/packages/:id/move-in (packages/runtime/src/domains/packages.ts, mounted in dispatcher-plugin.ts, ledger row in route-ledger.ts).

  • The body is { items: [{ type, name, member? }], dryRun? }, parsed with MoveIntoPackageRequestSchema (strict). A body it refuses answers 400, naming the member, and nothing moves. The query set is closed and empty.
  • Gates are the package write doors': requireManageMetadata, the wall, the knowledge-source gate on the target, the no-query refusal, requireWritablePackage.
  • Each selected item's type is judged as a /meta write of that type before anything is read or written: metaTypeWriteRefusal (403 PERMISSION_DENIED for a datasource without manage_platform_settings and a knowledge_source without manage_knowledge_sources). A selected knowledge source is also admitted for its new author as its /meta save admits one (authoredKnowledgeSourceRefusal, read off the stored body; its own status and code).
  • A body the schema refuses answers 400 VALIDATION_ERROR. A refused move answers 422. The first refusal's code is in error.code, and error.details holds the whole answer (outcome: 'refused' and every item's refusal), so the card's "answers 422 WRITABLE_PACKAGE_REQUIRED" holds and a caller can read every refusal. A move or a dry run answers 200 with MoveIntoPackageResponseSchema as data. A failure that is not a refusal answers a 500 fault (see Protocol).

Spec (packages/spec/src/api/package-lifecycle.zod.ts). New: MoveIntoPackageItemSchema, MoveIntoPackageRequestSchema, MoveIntoPackageMovedItemSchema, MoveIntoPackageRefusedItemSchema, MoveIntoPackageResponseSchema, and their input and Parsed types. The five baselines (api-surface, authorable-surface, declaration-map, export-origins, json-schema.manifest), the reference docs and the strictness-ledger counts are regenerated. operation-message.ts gains packages_move_in_unsupported in four locales.

Protocol (packages/metadata-protocol/src/protocol-package-move-in.ts, a new facet; protocol.ts delegates to it; the facet reaches the delete door through the host's existing facade.deleteMetaItem).

  • Phase 0, judge and write nothing. A dry run answers here and calls no door: the doors' side effects in the running process (the mutation projector, the mutation signal, the registry write-through) are not covered by a store rollback. So would_move is phase 0's judgement, and a save-door judge that runs only on the real move can still refuse an item a dry run passed.
    • Only an item bound to no package is loose. A .custom pair item and an overlay of a shipped item are refused NOT_LOOSE.
    • The target is checked with the save door's own predicates: uninstalledNamedBaseRefusal (A1) and isWritablePackage.
    • An object is checked with the save door's object judges: objectNamespacePrefixViolation (A2), objectNamespaceObjectNameClash (child K), classifyObjectContribution with overlayPackageMismatchError (owner), and judgeExtensionFieldSuffix (__c).
    • The set rule (ADR-0150 D3 (a)) reads each moved body with collectReferenceHits over REFERENCE_SITES, reversed. A bare name of a package-scoped type that names a loose item the selection leaves behind, and that no package in the target's reach holds (resolveCallerPackageAddress), is refused REFERENCE_LEFT_BEHIND with references.
  • Phase 1, objects. Each object goes out through the delete door (dropStorage: false, so the table and its records stay; parentVersion names the version phase 0 read, so a save that lands in between answers 409 METADATA_CONFLICT instead of being lost) and into the target through the save door. This runs outside the transaction (measured below): the object's save syncs its storage, and that DDL waits forever on the lock a SQLite transaction holds. publishPackageDrafts defers the same DDL past its transaction for the same reason. A later refusal undoes the objects, newest first: the target row is deleted, the loose row is put back (intent: 'runtime-only'), and the registry, the mutation projector and the mutation signal are run again at the package-less address.
  • Phase 2, everything else. Each other item goes through the same delete and save doors, and the package commit is recorded (operation: 'apply', with a message naming the move). All of it runs in one engine.transaction(). Any refusal rolls it back, and for every step the rollback removed the process is put back too: the registry is written through at the package-less address, and the projector and the signal run at the target's address as deleted and at the package-less one as restored. On an engine that cannot roll back (engineCanRollBack), each step is undone instead, as phase 1's objects are.
  • What a stopped move answers. A door's refusal (a 4xx) is the item's refusal, its code and sentence filtered as publishPackageDrafts filters them (clientFacingFailureCode, clientFacingFailureText); one with no code of its own is MOVE_FAILED. A failure that is not a refusal, and a failed package commit, answer a 500 fault, every item loose as before. An undo that fails answers a 500 naming each item that did not go back, never refused.
  • ensureOverlayIndex() runs before the transaction, as in publishPackageDrafts (measured below).
  • The answer lists each moved item's states. For a package-scoped type it also gives environmentAddress → qualifiedAddress, and for a tool, skill, agent or object-less action it gives aiFaceName before and after.
  • The 2,250-line save method is not split, and reassignOrphanedMetadata is not touched.

SDK. client.packages.moveIn(id, request) (packages/client/src/index.ts). It resolves the answer for moved and would_move; a refusal, a refused dry run included, rejects with the first item's code as code and the whole answer as details.

Changeset. 38150-move-into-package-door.md: @objectstack/spec at minor (claim amendment: the new schemas enter the api authorable-surface shard); metadata-protocol, runtime and client at patch.

System-context register (content/docs/permissions/system-context.mdx). The route's three isSystem reads (the engine's own call skips the per-item type gate and the knowledge-source author admission) are owned by rows 46 and 55, whose text now names the move-in door, and the generated register is rewritten.

Error codes. NOT_LOOSE, REFERENCE_LEFT_BEHIND and MOVE_FAILED are registered under @objectstack/metadata-protocol in error-code-ledger.zod.ts.

Tests

  • packages/qa/dogfood/test/package-move-in.dogfood.test.ts, new, 20 tests. It runs on a CRM stack through this route and parses every payload with the response schema. The loose rows are a fixture: inserted with the system context and served by a second boot on the same database file, so the tests stay green once package-less creates close.
    • packages: adopt-orphans skips the save door's judges — it adopts into an uninstalled package id, leaves an unprefixed object unsaveable (422 NAMESPACE_PREFIX), and moves flows and datasets only after a restart #37468's three regressions:
      • A1: a move into com.probe.ghost answers 422 WRITABLE_PACKAGE_REQUIRED.
      • A2: probe_widget into namespace zeta answers 422 NAMESPACE_PREFIX.
      • A3: right after a move, GET /automation/zeta/probe_loose_flow and GET /meta/dataset/probe_env_ds?callerPackage=com.probe.zeta answer 200.
    • The set test: a report alone is refused, naming its loose dataset; the report, the dataset, the dataset's object and a flow move together.
    • One test per object judge: child K (zeta_custom, NAMESPACE_CONFLICT), owner (OBJECT_OVERLAY_PACKAGE_MISMATCH), and __c (VALIDATION_ERROR). The permission-set owner judge (VALIDATION_ERROR) gets one too.
    • A .custom pair item and a served overlay are refused NOT_LOOSE.
    • Whole or nothing: an object moved before a refused permission set is put back loose and served again.
    • dryRun answers would_move, writes nothing, and leaves the flow served loose: _env/NAME answers 200 and zeta/NAME does not, read again after the engine has followed every signal.
    • A refused move puts the process back: a flow moved inside the rolled-back transaction answers the same way, and a loose permission set moved before the refusal still grants manage_metadata to its holder (/auth/me/permissions).
    • The type gate: a member without manage_metadata is refused 403 PERMISSION_DENIED; a member holding only manage_metadata (a loose fixture set) is refused 403 PERMISSION_DENIED naming manage_platform_settings for a datasource and manage_knowledge_sources for a knowledge_source; the admin moving a loose knowledge source on this stack, which runs no knowledge service, is refused 503 SERVICE_UNAVAILABLE by the author admission. Each asserts the row stays loose.
    • The _env address is measured.
    • A body the schema refuses answers 400 VALIDATION_ERROR.
    • Every refusal test asserts that the stored rows are unchanged.
  • packages/spec/src/api/package-lifecycle.test.ts: two new describe blocks for the request and response schemas. They cover accepted and refused shapes, and the answers are captured from the dogfood run.
  • packages/metadata-protocol/src/protocol-package-move-in.test.ts, new, 7 tests on a stub host, for what a booted stack cannot stage on request: a dry run calls no door, projector or signal; each delete passes parentVersion from the stored checksum, and the delete door's 409 becomes the item's METADATA_CONFLICT; after a rollback every touched item is written back through the registry at the package-less address and the projector and signal run deleted-at-target then restored-loose; a 4xx with no code is MOVE_FAILED with its declared sentence; a store fault answers 500 INTERNAL_ERROR without its raw text; a failed package commit is a fault of the commit; a failed undo answers 500 naming the item.
  • packages/client/src/packages-lifecycle.test.ts (moveIn hits POST …/move-in with the body, and a 422 rejects with code, httpStatus and the whole answer in details), and return-type-precision.test.ts (moveIn returns MoveIntoPackageResponse).

Acceptance notes

  • Set test, against the card's wording. The card says "a flow alone, when it reads a loose dataset". No flow property references a dataset: the derived reference index lists the dataset's referrers as dashboard, object, report, translation and view. So a report stands in for the flow.
  • The _env address, measured on this door. After a move, GET /automation/_env/probe_loose_flow answers 409 RESOURCE_CONFLICT: "is not held by the environment, which the address names exactly (ADR-0150 D5): it is held by package "com.probe.zeta". Address it by its holder." details.candidates holds that one package. The bare name and zeta/probe_loose_flow answer 200, and the bare read serves _packageId: com.probe.zeta. The automation engine follows the save's change event asynchronously: one run read 200 on the first request after the move, so the test waits for the 409. The confirm text in PR-A2 says what was measured here, not the old door's "stops resolving at the next boot".
  • Objects outside the transaction, measured. On a file-backed SQLite stack, deleteMetaItem followed by saveMetaItem of an object into a package, inside engine.transaction(), never answered: the delete took 13 ms and the save was still pending at 8 s. The same pair outside the transaction answered in about 200 ms. A flow inside the transaction answered in about 200 ms.
  • Index setup before the transaction, measured. When a fresh boot's first metadata write was a move, the transaction never answered. Once a save had run outside a transaction, the same move answered in about 170 ms. ensureOverlayIndex() now runs first, as publishPackageDrafts does.
  • A dataset that reads a loose object is allowed. Objects are not package-scoped, so a dataset moved into zeta while its object stays loose saves (measured). The set rule covers the ADR-0150 package-scoped types only.
  • The host kernel heals the registry on its own. The dogfood stack is a host kernel, where the registry write-through also runs the hydrator, so the dogfood process-state tests stay green with the projector and signal replay removed (measured, ablation below). The stub-host tests are what pin the replay itself.
  • Status of a whole refusal. The card asked for 422. The answer is 422 with the save door's code for the first refusal, including VALIDATION_ERROR, which the save door itself answers as 400. Each item's own code is kept in error.details.refused.

Verification

Two minutes:

pnpm --filter @objectstack/metadata-protocol --filter @objectstack/runtime build
cd packages/qa/dogfood && npx vitest run test/package-move-in.dogfood.test.ts

Expected: 20 passed.

Read first, by risk:

  1. protocol-package-move-in.ts, the phase 1, phase 2 and undo blocks: the object half of the "whole or nothing" promise is an undo, not a rollback.
  2. protocol-package-move-in.ts, the set rule: reversing collectReferenceHits over REFERENCE_SITES.byTarget.
  3. domains/packages.ts, the move-in block: the per-item type gate and the knowledge-source author admission, and the 422 envelope that carries the whole answer in details.
  4. protocol-package-move-in.ts, restoreAfterRollback, replayRestored and the catch block: what a stopped move answers and what it puts back.
Local readings at 0d0078f (rework round 1, main f19350b merged)
  • package-move-in.dogfood.test.ts: 20 passed, after a full pnpm exec turbo run build --filter='./packages/**' --filter='@objectstack/dogfood^...' with declarations (83 tasks).
  • packages/metadata-protocol full suite: 23610 passed, 2 failed at 61d7ebc (the projector and signal call-site censuses, now 9 each with the move-in replays); both files 27 passed at 7ab2d91. protocol-package-move-in.test.ts: 7 passed.
  • packages/runtime full suite: 660 files, 13962 passed; --project repo: 1519 passed. packages/client: 829 passed. packages/spec src/api and src/system: 5016 passed. pnpm --filter @objectstack/spec check:generated exit 0 after gen:docs.
  • Typecheck exit 0: @objectstack/metadata-protocol, @objectstack/runtime (tsc --noEmit).
  • Ablations through scripts/ablation-replace.mjs, each restored blob == HEAD:
    • The route's per-item type gate disabled: 2 dogfood tests failed (the datasource and knowledge-source 403s), 18 passed.
    • replayRestored made a no-op: the dogfood suite stays 20 passed (the host kernel's registry heal, see Acceptance notes); protocol-package-move-in.test.ts 3 failed (rollback replay, fault replay, undo replay).
  • After merging main f19350b (one conflict: main moved the duplicate door's knowledge-service lookup into resolveKnowledgeServiceForSave; the move-in admission now uses it too), at 0d0078f with a full declarations build: metadata-protocol 23628 passed, runtime 13965 passed, client 829, spec src/api + src/system 5017, check:generated and check:system-context-census exit 0, dogfood 20 passed, runtime tsc --noEmit exit 0.
  • Round-0 ablations (set rule, ensureOverlayIndex, the 422 branch) touch code this round did not change.
  • dispatch-gates --ran at 0d0078f: 124 derived, 124 run, every exit 0, 0 NOT-MEASURED. CI at 7ab2d91 was red on two lint gates (check:system-context-census, check:test-source-alias); 23ca501 fixed both. CI at 0d0078f: 60 success, 10 skipped, 0 failed; mergeable clean.

Generated by Claude Code

@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 4 package(s): @objectstack/client, @objectstack/metadata-protocol, @objectstack/runtime, @objectstack/spec, touching 90 documentable anchor(s). ⚠️ 5 changed file(s) yielded no anchor (packages/spec/api-surface/api.json, packages/spec/authorable-surface/api.json, packages/spec/declaration-map/api.json, …), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

55 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json e2a0e90025059d066dff4b067a8b70d23bca2680.

⛔ 21 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see
  • 5 changed file(s) yielded no anchor (packages/spec/api-surface/api.json, packages/spec/authorable-surface/api.json, packages/spec/declaration-map/api.json, …) — pages documenting those are invisible to this run
  • 1 cross-cutting symbol(s) contributed no route anchor: responseSchema (7 routes)
  • 7 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 69 of 253 client-bound route-ledger rows — the other 184 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 184: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 125 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 187 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json e2a0e90025059d066dff4b067a8b70d23bca2680 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 7cde5584a37f01dc2d21af54148972d36bd5e7d5 — the merge of head 0d0078fc5cc74d45e21ecdead14fcfb0598d72f4 into base e2a0e90025059d066dff4b067a8b70d23bca2680, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 7cde5584a37f01dc2d21af54148972d36bd5e7d5 && git checkout 7cde5584a37f01dc2d21af54148972d36bd5e7d5
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin e2a0e90025059d066dff4b067a8b70d23bca2680 0d0078fc5cc74d45e21ecdead14fcfb0598d72f4 && git checkout -B drift-repro e2a0e90025059d066dff4b067a8b70d23bca2680 && git merge --no-ff 0d0078fc5cc74d45e21ecdead14fcfb0598d72f4

node scripts/docs-audit/affected-docs.mjs --json e2a0e90025059d066dff4b067a8b70d23bca2680

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs e2a0e90025059d066dff4b067a8b70d23bca2680 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@github-actions github-actions Bot added documentation Improvements or additions to documentation protocol:system tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 28, 2026
…edger census reads 158 rows (#38150)

The move door reaches deleteMetaItem through the host facade, its class
stub carries no docblock (the facet's header is its contract), and the
retiring door's docblock folds its namespace-prefix paragraph into a line
that names its replacement.

Claude-Session: https://claude.ai/code/session_01L9qibyHmxFV4bTFZ5BKnUz
Co-authored-by: Claude <noreply@anthropic.com>
…ledger (#38150)

NOT_LOOSE, REFERENCE_LEFT_BEHIND and MOVE_FAILED are stamped by
moveIntoPackage and reach the wire in error.code and error.details.refused,
so they join @objectstack/metadata-protocol's ledger row, as the dispatcher
error-code vocabulary guard directs. The reference pages are regenerated.

Claude-Session: https://claude.ai/code/session_01L9qibyHmxFV4bTFZ5BKnUz
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Check Changeset is red on 56df8b4 because of one line. The five new MoveIntoPackage* schemas move packages/spec/authorable-surface/api.json by 23 keys, and the changeset still declares Metadata-protocol: none.

The fix is Metadata-protocol: added with @objectstack/spec at minor. Seat 3 accepted that amendment at 06:19Z. The edit is waiting on the maintainer's word in the card thread before it is pushed. The other red runs on 7fa55cf and a976ac3 are cancelled lanes from superseded heads.


Generated by Claude Code

…m amendment (#38150)

The five MoveIntoPackage* schemas enter the api authorable-surface shard
(23 keys), which Check Changeset reads as an added metadata-protocol change.

Claude-Session: https://claude.ai/code/session_01L9qibyHmxFV4bTFZ5BKnUz
Co-authored-by: Claude <noreply@anthropic.com>
…the member that puts the row; both write censuses record it (#38150)

undoLanded now calls applyRegistryWriteThrough right after its repo.put,
so the stored-row write census reads the write and its route in one
member. The write-through caller census counts ten sites, traced.

Claude-Session: https://claude.ai/code/session_01L9qibyHmxFV4bTFZ5BKnUz
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Type Check · workspace is red on 650b2b0 because of the runner, not this diff. The runner received a shutdown signal mid-job (job 140905040116), and the connector-slack and hono typechecks exited 137. No error TS line is in the log. The lane needs a re-run, which this session cannot trigger.


Generated by Claude Code

…the registry-question producers (#38150)

It re-saves stored loose rows, bodies unchanged, into one package: body-only.

Claude-Session: https://claude.ai/code/session_01L9qibyHmxFV4bTFZ5BKnUz
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibwsYQqi3TBx2SFE978

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 3777fbcfe0ffefa186a20219258ddf415cdc0987
Local-runs: none
Scope: packages/spec/src/api/package-lifecycle.zod.ts, packages/spec/src/api/error-code-ledger.zod.ts, packages/spec/src/system/operation-message.ts + packages/metadata-protocol/src/protocol-package-move-in.ts, packages/metadata-protocol/src/protocol.ts, packages/metadata-protocol/src/registry-question.ts, packages/runtime/src/domains/packages.ts, packages/runtime/src/dispatcher-plugin.ts, packages/runtime/src/route-ledger.ts, packages/client/src/index.ts
Security-touching: yes
Rule-change-verified: none

PR #38185 (PR-A1 of card #38150), net diff against main, 29 files. Inputs read: the card body and its three comments (claim 7234216673, amendment 7235221791, os-dev-report 7236694275), the PR body, the diff, and the check-runs on this head. Nothing was built or run; every finding below is from reading the head tree, and each says which code it rests on. packages/qa/dogfood/test/package-move-in.dogfood.test.ts and the spec and client tests were read as evidence only. The rest of the diff (tests, generated baselines, reference docs, the changeset prose) is the lane seat's ACCEPT at TIER_DEFAULT.

Check-runs on the head: 70 runs, all completed: 60 success, 10 skipped, 0 failed, none pending. Among the successes: Check Changeset, Dogfood Regression Gate, Type Check (workspace, source gates, consumer gates, debt ledger, UI), Test Core 1 to 10, Lint and Repo Gates, Governed Surface Queue Guard, Spec property liveness, Build Docs. Skipped: Queue verdict, Borrowed queue verdict, Lint UI, UI Published Artifacts, Temporal Conformance, Dogfood Verify CLI, the sharded Dogfood matrix placeholder, Packed-tarball smoke, 18.x upgrade harness, Schedule gate.

① Derived judgments

  • MoveIntoPackageItemSchema, MoveIntoPackageRequestSchema (both .strict(), items min 1, dryRun optional): right. The route parses the body with the request schema and answers 400 on a miss; the spec test pins empty selection, unknown key, missing name and a smuggled packageId.
  • MoveIntoPackageMovedItemSchema, MoveIntoPackageRefusedItemSchema, MoveIntoPackageResponseSchema (response .strict(), outcome a closed enum of three): right as shapes. Two of their sentences are not true of the code, see M2, S1 and N3.
  • Error codes NOT_LOOSE, REFERENCE_LEFT_BEHIND, MOVE_FAILED under @objectstack/metadata-protocol: right, each is emitted by protocol-package-move-in.ts and nowhere else. WRITABLE_PACKAGE_REQUIRED, NAMESPACE_PREFIX, NAMESPACE_CONFLICT, OBJECT_OVERLAY_PACKAGE_MISMATCH, ITEM_LOCKED and METADATA_CONFLICT were already ledgered under the same owner; VALIDATION_ERROR is a standard code. Wrong in one respect: the door can also put an unledgered code on the wire, see S2.
  • packages_move_in_unsupported in four locales: right; it is the key catalogNotImplemented is called with, and the census test moves 37 to 38.
  • Route POST /packages/:id/move-in, its mount and its ledger row (disposition: 'sdk', packages.moveIn, both schemas named, census 157 to 158): right. The row's note misstates the transaction, see N1.
  • Client packages.moveIn(id, request) returning MoveIntoPackageResponse: the method and its wire shape are right; its jsdoc is wrong about how a refusal arrives, see S4.
  • Protocol method moveIntoPackage and the registry-question.ts producer row (saveMetaItem, 1 call, body-only): right, the facet has exactly one host.saveMetaItem call site.
  • Refusal status: the route answers 422 for every refusal with the first item's code in error.code, including VALIDATION_ERROR, which the save door answers 400. Accepted: the card asks for 422, errors.zod.ts already derives VALIDATION_ERROR for an unlisted 4xx, and each item keeps its own code in error.details.refused.

② Semver level

Clause-②: yes (widening) holds: the diff only adds (five schemas and their types, three ledger codes, one message key, one route, one SDK method, one protocol method) and removes or narrows nothing; adopt-orphans is untouched. Metadata-protocol: added with @objectstack/spec at minor matches the claim amendment 7235221791 and the moved authorable-surface/api.json shard; Check Changeset is green on the head. @objectstack/metadata-protocol, @objectstack/runtime and @objectstack/client at patch follow the amendment and the precedent it cites; a new public SDK method at patch is the seat's ruled grade, not re-ruled here.

③ Boundary flags

  • The os-dev-report carries open_questions: [], security_findings: none, out_of_scope_findings: []. security_findings: none does not hold, see M1.
  • PR body, "a report stands in for the flow" in the set test: accepted. REFERENCE_SITES is the reader, and the card's wording was an example, not a ruled fixture.
  • PR body, "a dataset that reads a loose object is allowed": accepted. Objects are not a package-scoped type, and the ruling names ADR-0150 D3 (a) only.
  • PR body, objects outside the transaction and ensureOverlayIndex() first: accepted as measured facts and as the shape publishPackageDrafts takes; what follows from them is judged in ④.
  • PR body says protocol-host.ts gains deleteMetaItem. No such file is in the diff; the facet calls host.facade.deleteMetaItem. The body's account is not the tree; no finding on the tree.
  • Who may call the route, as the brief asks: a caller holding manage_metadata (or the engine's own call), not walled (refuseWalledCatalogPackageWrite), holding manage_knowledge_sources only when the TARGET package already holds a knowledge source, with an empty query and a target isWritablePackage accepts. The protocol then refuses an uninstalled target. Whether such a caller can move an item it could not otherwise write: yes, see M1.
  • SQL push-down: phase 0 reads every sys_metadata row with where: {} and filters package-less rows in the application, on every call including each dry run. No reason is given in the diff. See N2.
  • For the seat, not a finding on this head: the package commit records every moved item existedBefore: false. By the revert door's own rule a revert of the move commit removes the items from the package; it does not put them back loose. PR-A2's confirm text or PR-B should say so, see N4.

④ Design judgment

Hits files.

packages/spec/src/api/package-lifecycle.zod.ts, against ruling 7184753035 question 3 and its first consumer (the route, then PR-A2's confirm step). The selection shape, the per-item refusal with its own code, references for the set rule and the address fields answer the ruling. Three sentences are not true of the implementation: "dryRun: true answers the same judgement and writes nothing" (M2, N3), "refused: at least one item is refused, so nothing moved" (M2, S1), and environmentAddress "present for a type addressed by package" (absent when the target declares no namespace, N6).

packages/spec/src/api/error-code-ledger.zod.ts: the three rows are placed and worded correctly, each with its 422. MOVE_FAILED is described as "a refusal the save or delete door threw without a code of its own"; in the code it is also what a store fault with no string code becomes (S2).

packages/spec/src/system/operation-message.ts: holds; one key, four locales, used by the route.

Implementing files, tried against the brief's breaks.

M1 (must-fix) — the door writes capability-gated types for a caller who lacks the capability. domains/packages.ts asks refuseKnowledgeSourcePackageWrite about the target package only (packageId: id, reach drafts and items). The items the door actually deletes and saves are the selection, and nothing judges their types. META_TYPE_WRITE_CAPABILITIES (packages/rest/src/meta-item-read-gate.ts) gates every /meta write of knowledge_source on manage_knowledge_sources and of datasource on manage_platform_settings, and the /meta save also asks authoredKnowledgeSourceRefusal; all of these are asked at the transports, none inside protocol.saveMetaItem or deleteMetaItem. So a caller holding manage_metadata alone can select a loose knowledge source or a loose datasource and have the door remove it and create it again under the package, with the caller as actor, as long as the target holds no knowledge source yet. The gate's own docblock states the rule this breaks: where a package door does to a knowledge source what a /meta write would, it asks the capability that write asks. For a datasource the delete door's awaited projector also evicts and rebuilds the live pool (datasource-admin-plugin.ts, applyMetadataDoorWrite). The old door has the same gap; the card's "gates as adopt-orphans has them" does not license carrying it onto a new public route that takes a named selection. Fix shape: judge each selected item's type with metaTypeWriteRefusal (and the knowledge-source author admission) before the protocol call, refuse whole, and pin 403 with code and status for both types and for a caller without manage_metadata. No test in the diff asserts any 403 on this route.

M2 (must-fix) — "writes nothing" and "nothing moved" hold for the store, not for the running process. Phase 2 and every dry run call the real delete and save doors inside the transaction. Those doors run two things no rollback reaches: the awaited mutation projector (runMutationProjector) and the mutation signal (emitMetadataMutation, protocol-diff-delete-load.ts and the save door). After the rollback restoreRegistry calls applyRegistryWriteThrough only, and undoLanded does the same; neither re-runs the projector nor raises the signal at the restored address. By reading:

  • permission and position (plugin-security/src/security-catalog-echo.ts): the delete drops the loose echo slot and the save registers an echo stamped _packageId of the target. On an environment kernel applyRegistryWriteThrough returns before the hydrator, so the echo is the only copy the catalog reads. After a dry run the catalog serves the set as the target's; after a refusal that falls between a set's delete and its save (the dogfood permission-set owner case is exactly that) the set has no echo, which that module documents as "grants nothing" until it is saved again or the kernel restarts.
  • datasource: a refusal after the delete and before the save leaves the metadata slot unregistered and the pool evicted, with the row restored underneath.
  • flow: the automation plugin queues a re-read on each signal (service-automation/src/plugin.ts, syncMutatedFlows). The last signal is raised before the rollback and none follows it, so which state the engine arms depends on whether its read lands before or after restoreRegistry. The dry-run test cannot tell: it asserts GET /automation/probe_dry_flow is 200, which is true under either holder.
    The dogfood stack is a host kernel, where the registry heal covers the first case, so the suite is green without proving the claim. Fix shape: after a rollback or an undo, re-run the projector and raise the signal for every touched item at its restored address (or keep both out of a transaction that will not commit), and pin it: after a dry run and after a refused move, _env/NAME still answers 200 and NAMESPACE/NAME does not, and a loose permission set still resolves.

S1 (should-fix) — the answer is not true when the undo fails. undoLanded catches every failure, logs it with console.error, and the door still answers outcome: 'refused', moved: [], which the route words as "Nothing was moved". The log line itself says the item "may now be stored in neither place, or in the target, although the answer says nothing moved". This is the object half on every engine, not only on one that cannot roll back. The inner catch around the target-side deleteMetaItem also reads every failure as "the save never wrote it"; a delete refused for another reason leaves the target row stored, the loose row is then put back beside it, and nothing is logged. publishPackageDrafts has the same log-only habit, but there it is confined to engines without rollback and the published schema does not promise the opposite. Fix shape: carry the items the undo could not restore into the answer (or answer 500), and tell a missing target row apart from a failed delete.

S2 (should-fix) — a thrown fault reaches the wire as a refusal with the thrower's own code and text. refusalOf copies any string err.code and err.message; the route promotes the first one to error.code at 422 and repeats the message. buildApiError does not filter by the ledger, so a driver or store fault mid-phase answers 422 with a code such as the driver's own in error.code and its raw text in error.message and error.details.refused. publishPackageDrafts closed exactly this with clientFacingFailureCode and clientFacingFailureText. A failure of recordPackageCommit is also blamed on items[0], because current is cleared by then. Fix shape: filter code and text as the publish door does, answer a non-refusal fault as a fault, and pin MOVE_FAILED with code and status; no test reaches it today.

S3 (should-fix) — a write between phase 0 and the item's delete is lost. Bodies are read once in phase 0, outside any transaction; moveItem deletes with no parentVersion (last write wins) and saves the phase-0 body. A save of a selected loose item that lands in between is removed by the delete and the stale body is what the package receives, with no conflict. Phase 1 widens the window: objects run one by one outside the transaction, each with DDL. Fix shape: pass the row's version from the snapshot as parentVersion to the delete door so the race answers METADATA_CONFLICT, or re-read each row inside the write.

S4 (should-fix) — packages/client/src/index.ts jsdoc says the answer's outcome is "moved, or refused with every refused item's own code". The route answers a refusal as HTTP 422 and the client's fetch throws on a non-2xx, so moveIn never returns outcome: 'refused'; the refusal is a thrown error whose details is the answer. This holds for a refused dry run too. The first consumer is PR-A2's confirm step, which must catch. Fix the sentence, and have the client test show the thrown shape.

The other breaks tried, and what the code answers:

  • A failure mid-phase 2 on an engine that rolls back: the store is restored, the registry is healed for the non-object items, and phase 1's objects are undone newest first. Real for the store; see M2 for the rest. The dogfood "whole or nothing" case pins the object coming back loose and served.
  • A failure mid-phase 1: landed holds the half-moved object, the undo's target-side delete finds nothing, and the loose row is put back. Holds.
  • A process stop between phase 1 and phase 2, or during the undo: the objects stay in the target, the rest stay loose, and no commit records it. Nothing journals the object half. Each row is individually valid and a second call completes the rest (the object is then NOT_LOOSE and must be dropped from the selection). Inherent in an undo; named here so nobody reads the door as crash-atomic. N4.
  • A partial selection across objects and non-objects: a dataset or view may move while its object stays loose and the reverse; neither is refused, by the D3 (a) reading above. Holds as ruled.
  • An item that is not loose: a row bound to any package (a .custom pair item among them) is not in looseRows and is refused NOT_LOOSE; a package-less row over a shipped item is refused by isArtifactBacked. Both pinned with code and 422.
  • The target: uninstalled is refused by uninstalledNamedBaseRefusal (pinned, 422 WRITABLE_PACKAGE_REQUIRED); a code or platform package is refused by the route's requireWritablePackage before the body is parsed; a disabled package and a .custom pair as target are whatever the save and delete doors answer per item, which is the ruled design. None of the last three is pinned on this route (N5).
  • Addressing: environmentAddress, qualifiedAddress and aiFaceName are derived, not measured per item, and agree with the measured 409 on _env/NAME. A stored reference that spells _env/NAME in an item left behind is not judged by the set rule and stops resolving; the ruling asks for D3 (a) only.
  • The set rule: collectReferenceHits over REFERENCE_SITES.byTarget filtered by the moved item's type, against active loose rows of package-scoped types outside the selection, minus names a package in the target's reach holds. Holds; the ablation the dev reports matches the code path.

Nits (no effect on correctness or the contract):

  • N1: the route-ledger.ts note says every item goes through both doors "inside one transaction"; objects do not.
  • N2: phase 0's where: {} read of all of sys_metadata with bodies; the package-less filter and the selected names could be pushed down. Inherited from the old door, no reason stated. Follow-up card.
  • N3: a dry run judges an object by four phase-0 judges, never by the save door, so would_move can be followed by a real refusal of a stored object the full save refuses. The facet header says so; the schema's "the same judgement" does not.
  • N4: revert of the move commit removes the moved items rather than un-moving them, and a stop between phases leaves moved objects with no commit. Follow-up for PR-A2's confirm text or PR-B.
  • N5: tests do not assert the code on the 400 answer, and do not pin a read-only, disabled or .custom target on this route.
  • N6: environmentAddress and qualifiedAddress are omitted when the target declares no namespace; a draft's references are not set-judged when the item also has an active row; a bundled item's other members stay loose when one member moves.

M1 and M2 are must-fix; S1 to S4 each earn a delta review of their fix.

Implemented-by: claude/project-thread-j4n4b0
Reviewed-by: session_01L9qibwsYQqi3TBx2SFE978

VERDICT: FAIL

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibwsYQqi3TBx2SFE978

L1-b, the seat's L1 thread for zone o3-studio · 2026-11-28T08:49Z

席位核对 — L1 REWORK @ 3777fbcfe0ffefa186a20219258ddf415cdc0987

Verdict: REWORK (round 1). The at-tier contract review 7236830081 is FAIL on this head (tier verified on the reviewer's transcript): M1, M2 must-fix; S1–S4 should-fix. Each is spelled out there with its fix shape; this comment does not restate them. The L1 items below are in addition.

Owed this round

  1. M1, M2, S1, S2, S3, S4 of record 7236830081. M1 was confirmed at packages/runtime/src/domains/packages.ts lines 4076–4094: the move-in block asks refuseKnowledgeSourcePackageWrite about the target id only, and nothing judges the selected items' types against META_TYPE_WRITE_CAPABILITIES (datasource → manage_platform_settings, knowledge_source → manage_knowledge_sources).
  2. Refusal tests assert code and status (ADR-0112). Add 403 pins for M1 (a caller without manage_knowledge_sources selecting a loose knowledge source, one without manage_platform_settings selecting a datasource, one without manage_metadata). Add the code on the 400 schema-refusal answer (N5), and a MOVE_FAILED pin for S2.
  3. Changeset and schema prose follow the fix. At this head the changeset's "Whole or nothing: … Nothing is written" and "dryRun: true … writes nothing" are not true of the running process (M2), and "nothing moved" is not true when the undo fails (S1). Rewrite them to what the fixed code does. The same goes for the schema describes the record names (N3) and the route-ledger.ts note (N1).
  4. Body prose. The body says protocol-host.ts gains deleteMetaItem, but no such file is in the diff (the facet calls host.facade.deleteMetaItem). Correct the sentence.

Read at this head (stands)

  • Shape (l1-face.mjs --pr 38185): draft, base main, Part of #38150 (PR-A1 of three, by claim 7234216673), no closing keyword, no release path, every published package touched has a changeset entry, Skills-docs: none — … now on the body (the seat's patch).
  • Checks: 60 success, 10 expected skip, 0 failed, 0 pending. Lint & Repo Gates and TypeScript Type Check are success.
  • Accepted as measured: objects outside the transaction and ensureOverlayIndex() first (the dev's deadlock readings and ablations), the report standing in for the flow in the set test, and 422 for a whole refusal with each item's code in details.refused.

For the seat

  • Security-touching: yes in the record (M1). Whether to add the security label is the seat's call.
  • Nits N2 (phase 0 reads all of sys_metadata with no push-down, inherited) and N4 (a revert of the move commit removes the items instead of putting them back loose, and there is no journal across phases). Both go to the filing gate, or N4 can go to PR-A2's confirm text and PR-B.
  • Part of #38150: pm:dispatched stays on the card at landing (rule B). Read K before enqueue: the branch was 26 behind main at this read.

Next: the fixed head goes to the same reviewer for a delta L2 on M1–M2 and S1–S4, and to this thread for the L1 delta.

…ype, calls no door on a dry run, and puts the process back when a move stops (#38150)

- Each selected item's type is judged as a write of that type before
  anything is read or written (403 with its code), and a selected
  knowledge source is admitted for its new author as its save admits one.
- A dry run answers the judgement made before any door runs and calls no
  door.
- After a rollback or an undo, the registry, the mutation projector and the
  mutation signal run again at both addresses, so a refused move leaves
  every item served loose, as before.
- An undo that fails answers a 500 naming the items that did not go back.
  A failure that is not a refusal, or a failed package commit, answers a
  500 fault; a door's refusal keeps its code and sentence, filtered as the
  publish door filters them, and one with no code is MOVE_FAILED.
- Each delete names the version the judgement read, so a save in between
  answers METADATA_CONFLICT.
- client.packages.moveIn documents and tests that a refusal rejects with
  the code and the whole answer in details.

Claude-Session: https://claude.ai/code/session_01L9qibyHmxFV4bTFZ5BKnUz
Co-authored-by: Claude <noreply@anthropic.com>
…move-in door's two replays (#38150)

Claude-Session: https://claude.ai/code/session_01L9qibyHmxFV4bTFZ5BKnUz
Co-authored-by: Claude <noreply@anthropic.com>
…caller reads are owned in the system-context register; the projector census pays the lint load at collection (#38150)

The per-item type gate and the knowledge-source author admission on the
move-in door are named by the rows that own their bypass (46 and 55), and
the register is regenerated. The projector call-site test, edited here,
imports @objectstack/lint at module top as its sibling emit test does.

Claude-Session: https://claude.ai/code/session_01L9qibyHmxFV4bTFZ5BKnUz
Co-authored-by: Claude <noreply@anthropic.com>
…into claude/project-thread-j4n4b0

# Conflicts:
#	packages/runtime/src/domains/packages.ts
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibwsYQqi3TBx2SFE978

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 0d0078fc5cc74d45e21ecdead14fcfb0598d72f4
Local-runs: none
Scope: packages/spec/src/api/package-lifecycle.zod.ts, packages/spec/src/api/error-code-ledger.zod.ts, packages/spec/src/system/operation-message.ts + packages/metadata-protocol/src/protocol-package-move-in.ts, packages/metadata-protocol/src/protocol.ts, packages/metadata-protocol/src/registry-question.ts, packages/runtime/src/domains/packages.ts, packages/runtime/src/dispatcher-plugin.ts, packages/runtime/src/route-ledger.ts, packages/client/src/index.ts
Security-touching: yes
Rule-change-verified: none

Delta review of PR #38185 on the head that answers the FAIL record on 3777fbcfe0ffefa186a20219258ddf415cdc0987 (PR comment 7236830081). Read: the delta 3777fbcf..0d0078fc, claim amendment 2 (7238710652), the PR body as it stands, and the check-runs on this head. Nothing was built or run.

The delta splits in two. The dev's own work is three linear commits, 61d7ebc5, 7ab2d914 and 23ca5017 (14 files). The head itself is a merge of main f19350b4 (392 files), judged only for its conflict resolution. There is one conflict, in packages/runtime/src/domains/packages.ts: the move-in author admission now resolves the knowledge service through resolveKnowledgeServiceForSave(deps, _context), the helper main introduced and the /meta save in domains/meta.ts uses with the same arguments. The resolution is right. Of the other scope files the merge touches only packages/client/src/index.ts, in an unrelated i18n comment.

Check-runs on the head: 74 runs, all completed: 62 success, 12 skipped, 0 failed, none pending. mergeable_state reads clean now. The unstable reading at 11:41Z was runs still in progress; which ones cannot be told after the fact, and none ended red. Skipped: Queue verdict, Borrowed queue verdict, Check PR Size, Auto Label, Lint UI, UI Published Artifacts, Temporal Conformance, Dogfood Verify CLI, the sharded Dogfood matrix placeholder, Packed-tarball smoke, 18.x upgrade harness, Schedule gate.

① Derived judgments

  • No schema member, error code, message key, route or SDK signature is added or removed by the delta. The delta changes sentences in package-lifecycle.zod.ts (the request doc, dryRun, environmentAddress, outcome, the response describe), the client jsdoc, the ledger note and the changeset prose, and the regenerated reference page follows.
  • New answers on the route, each right: 403 PERMISSION_DENIED (standard code) for a selected datasource or knowledge_source whose capability the caller lacks; the knowledge-source author admission's own status and code; 503 SERVICE_UNAVAILABLE when a selected knowledge source cannot be read or no knowledge service is mounted; 500 for a fault or an incomplete undo, with a code kept only when the catalogue holds it.
  • dryRun now answers phase 0 alone. Right, and the schema, the client jsdoc, the ledger note and the changeset all say so in the same words.

② Semver level

Unchanged and still right: Clause-②: yes (widening), Metadata-protocol: added, @objectstack/spec minor, the other three patch. The delta publishes nothing new; Check Changeset is green on the head. Amendment 2 adds file surface only (the system-context doc page, two call-site census tests, one test import), each forced by a census gate, and none of it is in the reviewed scope.

③ Boundary flags

  • For the seat: the claim (7234216673) ruled that "a dry run takes the same path and always rolls back". The dev answered M2 by making a dry run phase 0 only, which the first record offered as one of two fix shapes. The published text was changed to match, so the contract is honest; the seat's ruling is what moved, and the seat accepts or re-rules it. Its cost is N7.
  • The os-dev account of the fixes was read as data and checked against the tree; every claim in it holds.
  • SQL push-down: unchanged, N2 of the first record stands as a follow-up.
  • Environment kernel: the replay was judged by reading, since the dogfood stack is a host kernel. After a rollback restoreAfterRollback runs outside the transaction, once the store is restored; replayRestored runs the projector as deleted at the target's address and then as the restored state at the package-less address. The security echo and the datasource projector both re-read the store at the address they are handed, so the target slot is dropped and the loose slot registered whatever the registry holds. The flow sync re-reads on the signal raised after the restore, and its queue is serial, so the last read is of the restored state. Holds on both kernels by reading.

④ Design judgment

M1: closed. domains/packages.ts asks metaTypeWriteRefusal('POST', item.type, caller) for every selected item before the protocol is resolved, and authoredKnowledgeSourceRefusal for every selected knowledge source, read off its stored body, before the protocol call. The type fold is the one the protocol uses (canonicalMetaType is canonicalMetaUrlType). Dogfood pins 403 PERMISSION_DENIED with status and code for a caller without manage_metadata, for a datasource and for a knowledge_source, and 503 SERVICE_UNAVAILABLE for the admission; each asserts the stored row unchanged.

M2: closed. A dry run returns after phase 0 and calls no door; the facet unit test asserts no delete, save, commit, write-through, projector or signal. After a rollback every step the transaction removed gets the registry write-through, the projector and the signal at both addresses, including a step whose delete ran and whose save threw. After an undo the same replay runs at the package-less address. Dogfood pins that after a dry run and after a refused move the flow answers at _env/NAME and not at NAMESPACE/NAME, and stays so, and that a loose permission set moved before a refusal still grants.

S1: closed. undoLanded returns the steps it could not undo, and the door then throws a 500 fault naming them instead of answering refused. The target-side delete is no longer wrapped in its own catch: a failure stops that step before the loose row is put back. The delete door answers a success with nothing removed when no row is bound to the target, so a step whose save never wrote is still undone. Pinned in the facet test.

S2: closed. refusalOf filters code and text with clientFacingFailureCode and clientFacingFailureText; a throw that declares no client refusal is a 500 fault, never an item's refusal; a failed commit is named as the commit's. Pinned: MOVE_FAILED, the 500 with INTERNAL_ERROR and no driver text, and the commit case.

S3: closed. Each delete names the version phase 0 read (receiptVersion of the row's checksum), and a write in between is refused METADATA_CONFLICT. Pinned in the facet test. A row stored with no checksum is still last write wins, N8.

S4: closed. The client jsdoc says a refusal, a refused dry run included, is thrown with the first item's code and the whole answer in details; the client test shows the thrown shape with code, status and details.

No must-fix, no should-fix.

Nits (no effect on correctness or the contract):

  • N7: phase 0 asks the object judges and the set rule only. The permission-set owner judge the card's item 9 lists is a pure function and is not asked there, so a dry run answers would_move for a set the real move refuses (cleanly, whole or nothing). The published text names exactly which judges a dry run runs. Follow-up, with the seat's word on the dry-run ruling above.
  • N8: the version pin needs a stored checksum; a row without one (the dogfood fixture rows among them) moves unpinned.
  • N9: the author admission reads the served item, so a knowledge source stored as a draft only is not admitted before its draft row is re-saved; the caller still needs manage_knowledge_sources. The admission's own refusal (status and code from authoredKnowledgeSourceRefusal) is pinned only through the no-service 503.
  • From the first record: N1 is fixed in the ledger note, N3 is answered by the new dry-run text, the 400 answer now asserts its code, and the namespace half of N6 is worded in the schema. N2, N4, the rest of N5 (a read-only, disabled or .custom target is not pinned on this route) and the rest of N6 stand as follow-ups.

Implemented-by: claude/project-thread-j4n4b0
Reviewed-by: session_01L9qibwsYQqi3TBx2SFE978

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibwsYQqi3TBx2SFE978

L1-b, the seat's L1 thread for zone o3-studio · 2026-11-28T11:48Z

席位核对 — L1 delta ACCEPT @ 0d0078fc5cc74d45e21ecdead14fcfb0598d72f4

Verdict: ACCEPT, answering REWORK 7236842082 at 3777fbcf. The L2 delta at CONTRACT_REVIEW_TIER is PASS (7238780160): M1, M2 and S1–S4 are closed, with no new must-fix or should-fix.

Read at this head

  • Shape (l1-face.mjs --pr 38185, CLEAN): draft, base main, Part of #38150 (PR-A1 of three, so Part of is right), 33 files, +1918/−29, no release path. The changeset covers all four published packages, and the declarations are unchanged: Clause-②: yes (widening), Metadata-protocol: added. The Skills-docs: none line is still true, because no skill teaches adopt-orphans or loose items.
  • The delta, split. The dev's own work is 61d7ebc5, 7ab2d914 and 23ca5017 (14 files). The head is a merge of main f19350b4 with one conflict, resolved through resolveKnowledgeServiceForSave, which is the helper the /meta save uses.
  • Claim against the surface. Amendment 2 (7238710652) covers every path the delta adds: content/docs/permissions/system-context.mdx, the two call-site census tests, and the @objectstack/lint import. No breach.
  • Census tests are not weakened. Both counts go from 7 to 9, and each comment names the two new call sites (replayRestored: once at the target's address as deleted, once at the package-less address as restored). A count that follows real new sites is a re-point, not a loosening.
  • Rejection tests assert code and status (ADR-0112).
    • The new 403s (no manage_metadata, a datasource, a knowledge_source) assert status 403, PERMISSION_DENIED and the capability named in the message, and that the stored row is unchanged.
    • The 503 for the knowledge-source admission asserts SERVICE_UNAVAILABLE.
    • Each refused move goes through refusedAnswer, which asserts 422, error.code equal to the first refusal's code, and outcome: 'refused' with moved: [].
    • The 400 now asserts VALIDATION_ERROR.
    • The facet test pins METADATA_CONFLICT, MOVE_FAILED, the 500 with INTERNAL_ERROR and no driver text, the commit fault, and the undo that fails.
    • My REWORK extras are all met.
  • Changeset, schema and doc sentences, read in person. The "nothing is written" prose on a refusal is gone everywhere. It now says what had moved is moved back, with the registry and signal replayed at both addresses. A dry run is described as phase 0 alone, calling no door. That reading matches the code, and the changeset, package-lifecycle.zod.ts, the client jsdoc, the route-ledger note and the regenerated reference page all say it in the same words. The two system-context rows (~46, ~55) name the move-in door's capability asks truly.
  • PR body. The wrong protocol-host.ts sentence is gone, and the local readings are pinned to 0d0078fc.
  • Checks: 62 success, 12 expected skip, 0 failed, 0 pending. Lint & Repo Gates and TypeScript Type Check are success. mergeable_state is clean now. The earlier unstable was runs still in progress; none ended red.

For the seat to rule

  • The dry-run ruling moved. The claim (7234216673) said "a dry run takes the same path and always rolls back". The dev answered M2 with the other fix shape the first L2 record offered: a dry run is phase 0 only. The published text says so honestly. The seat accepts this or re-rules it. Its cost is N7: a dry run does not ask the permission-set owner judge, so it can answer would_move for a set the real move refuses, cleanly and whole.
  • Follow-ups to the filing gate, not owed by this PR:
    • N7, with the ruling above.
    • N2, SQL push-down.
    • N4.
    • The rest of N5: a read-only, disabled or .custom target is not pinned on this route.
    • The rest of N6.
    • N8: a row without a checksum moves unpinned.
    • N9: the admission's own refusal is pinned only through the 503.

Before landing

No governed path, and the diff is under 3000 lines, so Tier H is not owed. The seat lands it on this ACCEPT at this head, once it has given its word on the dry-run ruling.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU

Landing · 2026-11-28T11:53Z · zone o3-studio (seat card thread, #38150 PR-A1)
Head-sha: 0d0078fc5cc74d45e21ecdead14fcfb0598d72f4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation protocol:system size/xl tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants