Skip to content

fix(studio): open system-scope packages read-only, with Customize - #29591

Merged
objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-gfp8hi
Nov 2, 2026
Merged

objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-gfp8hi

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Steedos · project thread

Fixes #29567

Clause-②: no
Metadata-protocol: none

The two lines are copied from the claim (comment 6586202344).

维护者速读

  • 改了什么:Studio 打开系统级(scope 为 system/cloud)的包时,按服务端的判定读成只读:顶栏包名旁出现「只读」锁标,条目头部出现「自定义」,修改存进该包配对的 .custom 定制包,和代码启动的包一样。包切换器的下拉列表照旧不列系统包。
  • 为什么改:包列表的解析为切换器把系统包过滤掉了,Studio 的写入判定只查切换器的条目,查不到就当成「没有判定」而放开编辑;作者改完保存才被 403 NOT_OVERRIDABLE 拒绝,而服务端其实接受把它定制进配对包(ensure-customization 回 201)。
  • 风险与回滚:只改 app-shell 两个文件的判定读取(切换器查不到时改读列表行上服务端的 writable),不加文案、不动服务端、不动下拉列表。回滚即撤销本 PR。
  • 先看:StudioDesignSurface.tsx 里写入判定的 effect(切换器无条目时读 listedPackageEntry);PackageSwitcher 的 current 回退到新 prop openEntry;新测试 StudioDesignSurface.kernelReadOnly-29567.test.tsx。
  • 两分钟验证:pnpm --dir ui exec vitest run packages/app-shell/src/views/studio-design/StudioDesignSurface.kernelReadOnly-29567.test.tsx,预期 4 个用例全过(换回 main 的 StudioDesignSurface.tsx 时其中 3 个转红)。
  • 需要你做的:无,席位落地。

What changes

  • packages-io.ts: new listedPackageEntry(manifests, id). A PkgEntry for any package the list names, read from the listed row (parseListedPackageManifests), the server's writable verdict included. Unlike parsePackages it answers for a kernel package (manifest scope system / cloud), which the switcher's list still leaves out. parsePackages is unchanged.
  • StudioDesignSurface.tsx, the surface's write gate. When the switcher's entries do not carry the open package, the gate now reads listedPackageEntry instead of settling on "no verdict". A system package therefore reads writable: false: the surface is read-only, the base facts (listed version, listed pair) are read, and the customization prop is built, so Customize runs the existing ensure path. pkgWritable stays "still asking" until that answer lands, so the surface never opens editable first. An id the list does not name still ends in "package not found", as before.
  • PackageSwitcher (same file). New prop openEntry, the surface's entry for the open package. The trigger's current falls back to it once the list has answered, so the chip shows the package's name and the read-only lock. The menu is unchanged: kernel packages stay out of it, and "Manage package" still reads only the list's own entry.
  • No new strings, no server change.

Tests

  • New StudioDesignSurface.kernelReadOnly-29567.test.tsx. The real StudioDesignSurface and metadata client over a fetch stub that lists com.objectstack.plugin-auth (scope system, namespace sys, writable: false) beside a writable package. Pins: the chip names the package and shows studio-pkg-readonly, and the menu still does not offer it; Customize is offered on its dashboard and the first edit POSTs ensure-customization (201) and writes the pair's draft declaring the override at the listed version; a system package the door refuses (its manifest states no version, so the pair's ^major range cannot be declared) shows Customize disabled with the noVersion reason and never asks the door; CONTROL, a writable package opens with no chip and no Customize.
  • packages-io.writableVerdict.test.ts: one case. listedPackageEntry answers a system row with the server's writable: false and its namespace while parsePackages still leaves it out, and answers null for an id the list does not name.
  • Red on main: StudioDesignSurface.tsx restored to 208d3e2e (git restore --source): 3 of the 4 new cases red (chip, Customize, door-refused), CONTROL green. Restored with git checkout HEAD --, git diff HEAD empty.
  • Ablation of the chip fallback (scripts/ablation-replace.mjs, const current = listedCurrent ?? (…openEntry…) replaced by listedCurrent, anchor 1 to 0): the two cases asserting the chip go red, the Customize case stays green (it reads the gate, not the chip). Restored: blob equals HEAD, git diff HEAD empty.

Acceptance notes

  • Kernel packages stay out of the switcher's menu on purpose: the claim fixed the verdict, not which packages are offered. An open one is reached by URL (the card's measurement path) or from a link.
  • A system package's pair is listed without its base. Once a pair exists (com.objectstack.plugin-auth.custom), foldCustomizationPairs cannot fold it under a base the list leaves out, so the pair shows as its own row; opening it lands on the base through the existing pair URL redirect (customizationPairBaseOf; read in code, not measured). Noted, not changed.
  • Shared sys namespace. Measured on a fresh pnpm dev:crm at this head: 18 of the 25 listed packages are scope system with namespace sys (plugin-auth, plugin-security, audit, rest.api, service-automation, service.settings and others). POST /api/v1/packages/com.objectstack.plugin-auth/ensure-customization answered 201 (sys_custom, ^3); after it, the same door for com.objectstack.plugin-security and com.objectstack.audit answered 422 NAMESPACE_CONFLICT ("its namespace 'sys_custom' is already owned by package 'com.objectstack.plugin-auth.custom'"). So only the first sys package can get a pair. The console cannot read that answer before asking (it is the registry's namespace owners), so such a package shows Customize and the refusal arrives at the first save, in the door's own sentence. Whether more than one system package should be customizable is outside this card and goes to the seat as a finding; the code is left as it is.
  • The listed-manifest fallback for a server that predates writable (scope !== 'project') is unchanged, and it reads a scope-system row as writable; every current server serves the verdict on every row.

Verification

All on head f933fef (base 208d3e2), in worktree objectstack-issue-29567.

Tests
  • pnpm --dir ui exec vitest run --maxWorkers=2 over the 2 touched test files: 2 files, 11 tests passed.
  • The same over every app-shell test naming StudioDesignSurface or packages-io (git grep -l), in five batches: 210 files passed, 1409 tests passed. Narrowed: CI's Test UI runs the rest of app-shell.
  • pnpm --dir ui exec vitest run scripts/: 170 files passed, 2 skipped; 4972 tests passed.
  • pnpm --filter @object-ui/app-shell run type-check (tsc --noEmit and tsc -p tsconfig.test.json): exit 0.
  • pnpm exec eslint over the four touched ui files: exit 0, 0 errors (46 warnings, all on lines this PR does not touch).
Gates
  • node scripts/pm/dispatch-gates.mjs --commands: 34 derived families. All 34 ran and exited 0, including check-sdui-manifest.mjs and its --self-test, check-changeset-no-major, check-adr-0087-registration, check-closing-keyword-parity, check-empty-changeset and check:published-files.
  • dispatch-gates --ran: 34 derived, 34 run, 0 NOT-MEASURED, 0 UNRUN.
  • pnpm --dir ui check:new-line-citations: 0 new citations.
  • Dogfood battery: n/a, because there is no ! in the title and no (narrowing) arm.

Generated by Claude Code

The surface's write gate fell back to no verdict for a package the switcher's
list leaves out; it now reads the listed row's server verdict, and the chip
reads the surface's entry when the list does not carry the open package.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jV3kBe3QqeCq1aYvu8
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 2, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#1 · zhuangjianguo · session_01QsR2jUJ19MstFvFhjgiYTu

席位核对 · ACCEPT · 2026-11-02T20:43Z

Head-sha: f933fef752bfd1118f35904dd25c20317eea4554

  • Shape:
    • The PR is a draft against main. The first card line is Fixes #29567, under claim 6586202344.
    • 5 files, +364 / −20: packages-io.ts (+19, the new listedPackageEntry), StudioDesignSurface.tsx (+53 / −19), the new StudioDesignSurface.kernelReadOnly-29567.test.tsx, one case in packages-io.writableVerdict.test.ts and a changeset. That is the claimed surface. check-governed-merges --pr 29591: not governed, 384 changed lines, under the human-merge threshold.
    • Clause-②: no and Metadata-protocol: none start their lines in the body and the changeset, as claimed. listedPackageEntry is a new export of an app-shell internal module, not a package entry; no string, prop on a public component, or wire shape is new. The changeset is patch.
  • Read in the diff:
    • parsePackages is unchanged, so the switcher still offers no kernel package. listedPackageEntry builds a PkgEntry from the listed row, with the server's writable verdict and the declared namespace (else the id-derived one).
    • The surface's verdict effect now runs one settle(entry) for both sources. When the switcher's list has no entry, it waits for the listed manifests and settles on listedPackageEntry. pkgWritable stays "still asking" until that answer lands, so no write affordance flashes. Read-only base facts (version, listed pair) and the Customize path then follow exactly as for a code-booted base.
    • PackageSwitcher's trigger falls back to the surface's openEntry only once its own list has answered, so its three trigger states are unchanged. Manage still keys on the listed row (listedCurrent), so a kernel package gets no Manage entry.
  • Pins changed: none. The new surface test and the packages-io case pin the change.
  • Gates (check-runs on this head): 44 success, 11 skipped, 0 failed or pending. mergeable_state is clean.
  • Tests (dev):
    • New surface test, 4 cases, over the real surface with a fetch stub and a system base (namespace sys, writable: false). (a) The chip says read-only and Customize is enabled on a dashboard; the first edit POSTs ensure-customization. (b) A system base the door refuses (no manifest version, 409 base_version_not_semver) shows Customize disabled with its reason. With main's StudioDesignSurface.tsx, 3 of 4 go red and the CONTROL stays green; the chip-fallback ablation reds the two chip cases.
    • 210-file sweep, 1409 tests; ui scripts/ green; app-shell type-check 0; eslint 0 errors; derived gates 34 of 34, 0 NOT-MEASURED. Merges clean with origin/main d3175d59.
  • NOT MEASURED: the seat ran no live session. The dev measured the server door live on dev:crm (below), but the Studio surface only in jsdom.
  • Findings: filed as Customization pairs: every system package shares namespace sys, so only the first can get a .custom pair (422 NAMESPACE_CONFLICT on the rest) #29594 (class b, domain:server). 18 of 25 listed packages are scope system with namespace sys. The first ensure-customization (plugin-auth) answers 201 with sys_custom. Every later one (plugin-security, audit) answers 422 NAMESPACE_CONFLICT, and the console cannot read that before offering Customize. So after this PR, Customize on a second system package fails at the first save, where before it was not offered at all. The card names this a product call. The server owns the verdict, so the console follow-up waits on Customization pairs: every system package shares namespace sys, so only the first can get a .custom pair (422 NAMESPACE_CONFLICT on the rest) #29594. Noted only: a system base's .custom pair lists as its own switcher row, since the fold needs the base in the list.
  • Serial: none open.
  • Landing: ordinary queue landing, pr_ready then automerge_enable. Fixes #29567 closes the card on merge.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 2, 2026 20:46
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge November 2, 2026 20:46
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 2, 2026
Merged via the queue into main with commit 0ab4a09 Nov 2, 2026
56 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-gfp8hi branch November 2, 2026 21:10
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 size/m 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.

Studio: a system-scope package opens as editable, with no read-only chip and no Customize, because parsePackages drops system and cloud packages

1 participant