Repository navigation
feat(runtime): POST /packages/:id/move-in moves a selection of loose items into a package, each through the save door - #38185
Conversation
…mas (#38150) Claude-Session: https://claude.ai/code/session_01L9qibyHmxFV4bTFZ5BKnUz Co-authored-by: Claude <noreply@anthropic.com>
…od (#38150) Claude-Session: https://claude.ai/code/session_01L9qibyHmxFV4bTFZ5BKnUz Co-authored-by: Claude <noreply@anthropic.com>
…undo; the move door's dogfood (#38150) Claude-Session: https://claude.ai/code/session_01L9qibyHmxFV4bTFZ5BKnUz Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibyHmxFV4bTFZ5BKnUz Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 4 package(s): 55 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 21 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 187 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # 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
|
…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>
|
Check Changeset is red on 56df8b4 because of one line. The five new The fix is Generated by Claude Code |
…supported (#38150) Claude-Session: https://claude.ai/code/session_01L9qibyHmxFV4bTFZ5BKnUz Co-authored-by: Claude <noreply@anthropic.com>
…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>
|
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>
…prose (#38150) Claude-Session: https://claude.ai/code/session_01L9qibyHmxFV4bTFZ5BKnUz Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#3 · os-tesla · session_01L9qibwsYQqi3TBx2SFE978 Contract reviewServed-tier: PR #38185 (PR-A1 of card #38150), net diff against 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
② Semver level
③ Boundary flags
④ Design judgmentHits files.
Implementing files, tried against the brief's breaks. M1 (must-fix) — the door writes capability-gated types for a caller who lacks the capability. 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 (
S1 (should-fix) — the answer is not true when the undo fails. S2 (should-fix) — a thrown fault reaches the wire as a refusal with the thrower's own code and text. 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; S4 (should-fix) — The other breaks tried, and what the code answers:
Nits (no effect on correctness or the contract):
M1 and M2 are must-fix; S1 to S4 each earn a delta review of their fix. Implemented-by: VERDICT: FAIL |
|
repo:objectstack#3 · os-tesla · session_01L9qibwsYQqi3TBx2SFE978 L1-b, the seat's L1 thread for zone o3-studio · 2026-11-28T08:49Z 席位核对 — L1 REWORK @
|
…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
|
repo:objectstack#3 · os-tesla · session_01L9qibwsYQqi3TBx2SFE978 Contract reviewServed-tier: Delta review of PR #38185 on the head that answers the FAIL record on The delta splits in two. The dev's own work is three linear commits, Check-runs on the head: 74 runs, all completed: 62 success, 12 skipped, 0 failed, none pending. ① Derived judgments
② Semver levelUnchanged and still right: ③ Boundary flags
④ Design judgmentM1: closed. 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 S1: closed. S2: closed. S3: closed. Each delete names the version phase 0 read ( 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 No must-fix, no should-fix. Nits (no effect on correctness or the contract):
Implemented-by: VERDICT: PASS |
|
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 @
|
|
repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU Landing · 2026-11-28T11:53Z · zone
|
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-orphansand the Studio~orgentry, 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/apiMoveIntoPackage* schemas enter theapiauthorable-surface shard (23 keys); no metadata key an author writes is addedSkills-docs: none — no skill under
skills/**teachesadopt-orphansor loose items; this door is an admin operation whose console entry lands in PR-A2, and theobjectstack-platformpassage on package-less Setup rows covers overlays of shipped items, which this door refusesNOT_LOOSE维护者速读
What changes
Route.
POST /api/v1/packages/:id/move-in(packages/runtime/src/domains/packages.ts, mounted indispatcher-plugin.ts, ledger row inroute-ledger.ts).{ items: [{ type, name, member? }], dryRun? }, parsed withMoveIntoPackageRequestSchema(strict). A body it refuses answers 400, naming the member, and nothing moves. The query set is closed and empty.requireManageMetadata, the wall, the knowledge-source gate on the target, the no-query refusal,requireWritablePackage./metawrite of that type before anything is read or written:metaTypeWriteRefusal(403PERMISSION_DENIEDfor adatasourcewithoutmanage_platform_settingsand aknowledge_sourcewithoutmanage_knowledge_sources). A selected knowledge source is also admitted for its new author as its/metasave admits one (authoredKnowledgeSourceRefusal, read off the stored body; its own status and code).VALIDATION_ERROR. A refused move answers 422. The first refusal's code is inerror.code, anderror.detailsholds the whole answer (outcome: 'refused'and every item's refusal), so the card's "answers422 WRITABLE_PACKAGE_REQUIRED" holds and a caller can read every refusal. A move or a dry run answers 200 withMoveIntoPackageResponseSchemaasdata. 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 andParsedtypes. 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.tsgainspackages_move_in_unsupportedin four locales.Protocol (
packages/metadata-protocol/src/protocol-package-move-in.ts, a new facet;protocol.tsdelegates to it; the facet reaches the delete door through the host's existingfacade.deleteMetaItem).would_moveis 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..custompair item and an overlay of a shipped item are refusedNOT_LOOSE.uninstalledNamedBaseRefusal(A1) andisWritablePackage.objectNamespacePrefixViolation(A2),objectNamespaceObjectNameClash(child K),classifyObjectContributionwithoverlayPackageMismatchError(owner), andjudgeExtensionFieldSuffix(__c).collectReferenceHitsoverREFERENCE_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 refusedREFERENCE_LEFT_BEHINDwithreferences.dropStorage: false, so the table and its records stay;parentVersionnames the version phase 0 read, so a save that lands in between answers409 METADATA_CONFLICTinstead 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.publishPackageDraftsdefers 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.operation: 'apply', with a message naming the move). All of it runs in oneengine.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.publishPackageDraftsfilters them (clientFacingFailureCode,clientFacingFailureText); one with no code of its own isMOVE_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, neverrefused.ensureOverlayIndex()runs before the transaction, as inpublishPackageDrafts(measured below).environmentAddress→qualifiedAddress, and for a tool, skill, agent or object-less action it givesaiFaceNamebefore and after.reassignOrphanedMetadatais not touched.SDK.
client.packages.moveIn(id, request)(packages/client/src/index.ts). It resolves the answer formovedandwould_move; a refusal, a refused dry run included, rejects with the first item's code ascodeand the whole answer asdetails.Changeset.
38150-move-into-package-door.md:@objectstack/specat minor (claim amendment: the new schemas enter theapiauthorable-surface shard); metadata-protocol, runtime and client at patch.System-context register (
content/docs/permissions/system-context.mdx). The route's threeisSystemreads (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_BEHINDandMOVE_FAILEDare registered under@objectstack/metadata-protocolinerror-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.com.probe.ghostanswers422 WRITABLE_PACKAGE_REQUIRED.probe_widgetinto namespacezetaanswers422 NAMESPACE_PREFIX.GET /automation/zeta/probe_loose_flowandGET /meta/dataset/probe_env_ds?callerPackage=com.probe.zetaanswer 200.zeta_custom,NAMESPACE_CONFLICT), owner (OBJECT_OVERLAY_PACKAGE_MISMATCH), and__c(VALIDATION_ERROR). The permission-set owner judge (VALIDATION_ERROR) gets one too..custompair item and a served overlay are refusedNOT_LOOSE.dryRunanswerswould_move, writes nothing, and leaves the flow served loose:_env/NAMEanswers 200 andzeta/NAMEdoes not, read again after the engine has followed every signal.manage_metadatato its holder (/auth/me/permissions).manage_metadatais refused 403PERMISSION_DENIED; a member holding onlymanage_metadata(a loose fixture set) is refused 403PERMISSION_DENIEDnamingmanage_platform_settingsfor adatasourceandmanage_knowledge_sourcesfor aknowledge_source; the admin moving a loose knowledge source on this stack, which runs no knowledge service, is refused 503SERVICE_UNAVAILABLEby the author admission. Each asserts the row stays loose._envaddress is measured.VALIDATION_ERROR.packages/spec/src/api/package-lifecycle.test.ts: two newdescribeblocks 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 passesparentVersionfrom the stored checksum, and the delete door's 409 becomes the item'sMETADATA_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 isMOVE_FAILEDwith its declared sentence; a store fault answers 500INTERNAL_ERRORwithout 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(moveInhitsPOST …/move-inwith the body, and a 422 rejects withcode,httpStatusand the whole answer indetails), andreturn-type-precision.test.ts(moveInreturnsMoveIntoPackageResponse).Acceptance notes
_envaddress, measured on this door. After a move,GET /automation/_env/probe_loose_flowanswers409 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.candidatesholds that one package. The bare name andzeta/probe_loose_flowanswer 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".deleteMetaItemfollowed bysaveMetaItemof an object into a package, insideengine.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.ensureOverlayIndex()now runs first, aspublishPackageDraftsdoes.zetawhile its object stays loose saves (measured). The set rule covers the ADR-0150 package-scoped types only.VALIDATION_ERROR, which the save door itself answers as 400. Each item's own code is kept inerror.details.refused.Verification
Two minutes:
Expected: 20 passed.
Read first, by risk:
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.protocol-package-move-in.ts, the set rule: reversingcollectReferenceHitsoverREFERENCE_SITES.byTarget.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 indetails.protocol-package-move-in.ts,restoreAfterRollback,replayRestoredand 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 fullpnpm exec turbo run build --filter='./packages/**' --filter='@objectstack/dogfood^...'with declarations (83 tasks).packages/metadata-protocolfull 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/runtimefull suite: 660 files, 13962 passed;--project repo: 1519 passed.packages/client: 829 passed.packages/specsrc/apiandsrc/system: 5016 passed.pnpm --filter @objectstack/spec check:generatedexit 0 aftergen:docs.@objectstack/metadata-protocol,@objectstack/runtime(tsc --noEmit).scripts/ablation-replace.mjs, each restored blob == HEAD:replayRestoredmade a no-op: the dogfood suite stays 20 passed (the host kernel's registry heal, see Acceptance notes);protocol-package-move-in.test.ts3 failed (rollback replay, fault replay, undo replay).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, specsrc/api+src/system5017,check:generatedandcheck:system-context-censusexit 0, dogfood 20 passed, runtimetsc --noEmitexit 0.ensureOverlayIndex, the 422 branch) touch code this round did not change.dispatch-gates --ranat 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