Skip to content

App Studio 改版(4-3):服务端拒绝没有软件包的新建(只留四类豁免,原地保存照旧);先实测元数据接口存流程能当场注册,再下线自动化接口的新建 #38174

Backlog

Description

@objectstack-fleet

repo:objectstack#3 · os-tesla · session_01L9qibzywxH36FPH6ayWMUe

Filing gate: ③ · Source: topic #37424 (ruling 7184753035, question 2 answered A, the maintainer's 「同意」 of 2026-11-26T06:44Z; ADR-0084 #amendment-2026-11-26-org, section from line 470, "A create with no package asks for one, and the kernel refuses it"; the writer census in #37453 comment 7184476778). Phase order as ruled: this kernel PR is last, in the same phase as the UI ask, with no flag. That the move door lands before it comes from the takeover plan (#37424 comment 7216856007). Sub-issue of #37424 (phase 4).
Grade: area:package · Feature · p2 · evidence: read on origin/main 815e882 and rechecked at 33a0d4f: of the cited files only mcp-authoring.ts moved (two comment edits), and its cited lines are corrected below. The rest are unchanged since 7e4df28. The kernel accepts a package-less create: #37453 measured it at a46efa8 as W1 (PUT /meta/flow, /meta/object and /meta/dataset all 200), and the code path is unchanged (lines below). The area is package, not the topic's ux, because every file this card edits is the package zone's server half: the save door and its refusals in packages/metadata-protocol, the automation definition doors in packages/runtime, os meta register in packages/cli, and a migration entry in packages/spec. #37468 was triaged area:package · domain:server for the same door family. No ui/ file changes here.
Reader: a seat card thread (seat repo:objectstack#3).

None closes the package-less create.

维护者速读

  • 用户能看到什么变化:任何入口(接口、命令行、自动化接口)要新建一个不属于任何软件包的配置时,服务端直接拒绝,并列出可以写进去的软件包。已经存在的散落项照常可以原地保存。只有四类写入照旧:系统自带内容上的定制、外部数据源导入、迁移、平台自己的注册。
  • 为什么:界面先问软件包、移入入口先上线,这张卡最后把服务端的口子关上,以后不再产生新的散落项。
  • 需要你做的:开工前不需要你裁,你 11 月 28 日已经答了 Q-a、Q-b、Q-d、Q-g。Q-g 选的「下线自动化接口的新建」有个前提要先实测:通用的元数据接口存流程时,是否同样当场注册、立即能跑、报同样的错。实测不过,施工就停,先回来问你。Q-d 的答案要更正架构决定记录里你 11 月 26 日写的「共享规则等绑定到所属对象的定制包」那句,这条更正和其他标注都由你合并。这张卡是破坏性收紧,合并前要合约审查。

Ruled (not reopened)

Measured on main

The kernel's create path today

  1. ProtocolSaveFacet.saveMetaItemUnaudited (packages/metadata-protocol/src/protocol-save.ts:345).
    • D1 (2108–2180) judges only a named package: intent === 'runtime-only' && request.packageId != null && !host.isWritablePackage(...) (2171–2174).
    • The comment at 2129–2131: "A null packageId is still accepted here (legacy org-overlay destination); ADR-0070 D5 retires it once the surfaces always resolve a base and the orphan migration has run."
  2. What already tells a create from an in-place save.
    • namedNoPackage (813).
    • packagelessAddress (815–820; protocol-environment-rows.ts:181–205 returns { packageId, candidates, unbound }).
    • The draft address with followedBase (938–975).
    • artifactBacked / intent (2102–2106).
    • So a create is: no package named, intent runtime-only, no stored candidate, and no package-less row active or draft. Every other package-less save is in place, or it customizes a holder (ADR-0150 D4), and it is unchanged.
  3. Refusal text that still prescribes package-less.
    • protocol-package-scope.ts:113–115 ("…or with no package.") and 128–133 ("…or save the TYPE without naming a package.");
    • packages/cli/src/commands/meta/register.ts:26–28 ("or omit --package …");
    • the docs page content/docs/api/metadata-api.mdx, which teaches a package-less save.
  4. A precedent shape for the refusal. The MCP draft door refuses a save naming no package and names the writable packages: packages/runtime/src/domains/mcp-authoring.ts:109, 934–935, and packageRequiredMessage at 1459.

The four exemptions, as main carries them

  1. W3, kernel-item overlays. packagelessOverlayWriteRefusal (protocol-save.ts:515–547). An overlay is intent override-artifact (2104–2106), so a create-only close never reaches it. Pin it with a control test. Decisions Q-b answered C: a create in a system app does not count, and is refused.
  2. W4, external import. packages/services/service-datasource/src/plugin.ts:321–334 (writeFace at 329). It is server-stated, and no wire body is read into it (packages/spec/src/api/protocol.zod.ts:1313).
  3. W12, binding-preserving migrations. source: 'migrate-stored': migrateStoredMetadata (protocol-save.ts:2591) and flow-credential-migration.ts:222–229. source is not on the wire (protocol.zod.ts:1182–1189). Both re-save stored rows. The close exempts request.source !== undefined by name.
  4. W13, platform registration. MetadataManager.register(…, { origin: 'platform' }) (packages/metadata/src/metadata-manager.ts:1340) writes the metadata service's own store. The close does not reach it. The census in Acceptance checks the other register() callers.

Writers the close starts refusing (from #37453, re-read)

  1. W1: /meta/:type/:name PUT, publish and draft, naming no package, for a new name.
  2. W2: the automation definition doors. registerAndSaveFlow (packages/runtime/src/domains/automation.ts:2779), called by POST /api/v1/automation (4335; ledger route-ledger.ts:605, automation.create) and PUT /api/v1/automation/:name (5448; ledger 668). "No package, because no caller here holds one" (2737). flowWriteRefusal already rewrites the protocol's remedy (automation door: a flow name two packages hold answers 409 with "on the REST door add ?package=", but /automation reads no ?package=, so a caller who follows the remedy gets the same 409 again #23501, 2749–2756). Their consumers are tests and QA steps: 7 dogfood files, runtime door tests, 17 QA checklist items, 7 hotcrm test files, and 3 docs pages (decisions Q-g). automation.create has callers in SDK tests only. No UI, CLI or skill uses either door. The clone (4738) lands in a package already (Flow clone door → "new similar": the copy lands in a writable target package, by default the paired <base>.custom, never package-less #28149). What these doors become is decisions Q-g.
  3. W11: os meta register. It already takes --package (register.ts:260–268, cli: os meta delete declares no --package, so the reset door's 409 RESOURCE_CONFLICT remedy (name one package) cannot be sent from the CLI, and os meta register cannot name the package a save writes into #23350), required only for --mode draft (116–119; 38–40). A publish-mode run naming none sends no package (328).
  4. W5–W10: the UI writers, closed in the UI by App Studio 改版(4-1):没有软件包的新建先问——选一个或新建一个;设置的权限集和岗位也先问;系统应用里的共享视图和报表拒绝并指路 #38149. This card is their backstop.
  5. AI drafts (cloud). No card of this phase changes that interface. This close refuses them only once cloud runs a framework release that carries it.

Organization-authored sharing rules, queues and assignment rules (the write path traced; decisions Q-d)

  1. Code-only metadata types. packages/spec/src/kernel/metadata-plugin.zod.ts:1324 (sharing_rule), 1334 (queue) and 1341 (assignment_rule) are all allowRuntimeCreate: false, allowEnvironmentOverlay: false. The comment at 1325–1333 says "A runtime sys_metadata item is neither, so the type is code-only." Migration 18.sharing-rule-runtime-create-withdrawn records the shipped tightening. So no .custom binding is possible through the metadata door.
  2. The organization's own are data rows (regime C: ADR-0131 D6 note at 549; ADR-0142 D1 270–283 and D5 469).
    • Setup opens object pages (sharing-plugin.ts:748, 750, 752).
    • Writes go through the data door with rule-hooks.ts, queue-hooks.ts and assignment-rule-hooks.ts, through POST /api/v1/sharing/rules, and through the clone dialog (SharingRuleCloneDialog.tsx:121).
    • sys_queue has no owning object (sys-queue.object.ts:8–10). sys_assignment_rule has no package column. sys_sharing_rule.package_id is "Nothing reads it yet and no writer stamps it" for an organization's own rule (291–292, the comment's claim).
    • So the close never meets these rows.

What

  1. The close, in saveMetaItemUnaudited, beside D1.
    • What it refuses. A save that names no package, has intent runtime-only, finds no stored candidate and no package-less row (item 2), and is not exempt. It is refused before anything is written.
    • The answer. 422, code: 'WRITABLE_PACKAGE_REQUIRED' (D1's code; a sibling code only with a stated reason), docs: 'docs/adr/0070-package-first-authoring.md'. Its sentence names the type and name, and lists the writable packages it may name, capped, as packageRequiredMessage does.
    • Exempt by name.
      • W4: writeFace === 'external-import';
      • W12: source !== undefined;
      • W3: intent override-artifact.
    • No other exemption: Q-a was answered A and Q-b C, so neither adds a type or a case.
    • W13 is off this path, and a comment says so. No flag and no environment switch.
  2. Refusal text. Rewrite protocol-package-scope.ts:113–115 and 128–133 so no sentence prescribes saving with no package. Rewrite the D1 comment at protocol-save.ts:2129–2131. Rewrite the package-less passage of content/docs/api/metadata-api.mdx.
  3. Automation definition doors, per decisions Q-g (answered C).
    • First, before any write, measure the premise. PUT /api/v1/meta/flow/NAME?package=PKG must register the flow in the same boot, arm it at once, and give the same registration refusals as POST /automation: graph, node config, start node and notify channel. packaged-flow-write-door-parity and managed-content-sealed already compare the doors on refusals. If the premise fails, stop with no PR and ask the maintainer through the seat (the decision named A as the better answer then).

    • Retire POST /api/v1/automation. Remove:

      • its ledger row (route-ledger.ts:605) and its mount;
      • the SDK automation.create (packages/client/src/index.ts:6409);
      • the spec contract entry createFlow (packages/spec/src/api/automation-api.zod.ts:1011–1016) and CreateFlowRequestSchema / CreateFlowResponseSchema (127–146), then regenerate the five baselines (packages/spec/{api-surface,authorable-surface,export-origins,declaration-map,json-schema.manifest}/api.json);
      • the docs: the CreateFlowRequest section of content/docs/references/api/automation-api.mdx (from 170), content/docs/api/plugin-endpoints.mdx:54, and content/docs/automation/flows.mdx (about 2814).

      Every test that drives the route moves to /meta with a package, or is replaced by name (AGENTS.md).

    • PUT /automation/:name updates existing flows only. It takes over POST's overwrite of a name the engine already holds (automation.ts:4330–4331). A new name is refused, relaying PUT /api/v1/meta/flow/NAME?package=PKG through flowWriteRefusal, and the engine registration is undone as for any refused save.

    • Update the 2737 docblock.

  4. os meta register. The flag stays optional, because in-place saves stay open.
    • The kernel's refusal is printed as sent.
    • Rewrite the flag's description (register.ts:263–268): required for a new item.
    • Rewrite the empty-value refusal (26–28).
    • Add a test: a new item without --package exits non-zero with the server's sentence.
  5. Q-d (answered A). Add a note in sys-sharing-rule.object.ts and the PR: the close does not reach these rows (items 14–15).
  6. ADR-0084 amendment (Tier H). Add a dated note under #amendment-2026-11-26-org (line 475), recording what the answers change:
  7. ADR-0070 marks (Tier H).
  8. Changeset and declarations.
    • Packages: @objectstack/metadata-protocol, @objectstack/runtime, @objectstack/cli, @objectstack/client, @objectstack/spec.
    • minor, Clause-②: no (narrowing), Metadata-protocol: narrowed, the BREAKING banner and its ADR-0087 disposition.
    • A semantic migration entry in packages/spec/src/migrations/entries/semantic/ on the precedent of 18.sharing-rule-runtime-create-withdrawn.ts:
      • FROM: PUT /api/v1/meta/TYPE/NAME naming no package, for a name no package holds, answered 200 and stored a loose row (and POST /automation created a package-less flow).
      • TO: 422 WRITABLE_PACKAGE_REQUIRED naming the writable packages. Add ?package=PKG or --package PKG, or in Studio choose a package. Existing loose rows save in place.
    • The PR body carries the Skills-docs: line (.claude/skills/pm-dispatch/SKILL.md:316) for the narrowing arm.

Test fixtures and follow-ups

Acceptance

Activity

  1. added
    enhancement
    priority:p2
    pm:blocked
    on Nov 28, 2026
  2. objectstack-fleet commented on Nov 28, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU

    Follow-up filed · 2026-11-28T05:16Z: objectstack-ai/hotcrm#2841 carries the HotCRM half of Q-g C (seven verify tests move from POST /automation to PUT /meta/flow/NAME?package=PKG), Blocked-by: objectstack-ai/objectstack#38174. What 3's measurement of the PUT door decides whether that card waits for a release or returns to its queue at once; please state the reading on this card when What 3 runs.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:packageenhancementpm:blockedpriority:p2

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions