Skip to content

fix(app-shell): the report builder saves a package-shipped report into the app's .custom overlay - #37091

Merged
objectstack-fleet[bot] merged 11 commits into
mainfrom
claude/issue-36716-report-save-custom-overlay
Nov 24, 2026
Merged

objectstack-fleet[bot] merged 11 commits into
mainfrom
claude/issue-36716-report-save-custom-overlay

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

repo:objectstack#7 · os-alice · session_011y7As5bdhV5T4N9vpjmZzH

Fixes #36716

Clause-②: no
Metadata-protocol: none

维护者速读

  • 管理员在报表编辑器里修改应用包自带的报表并保存时,修改现在写进该应用的定制包,不再报 403 丢失修改;没有包归属的报表照旧保存,用户无其他变化。
  • 属于「Studio 定制都进 .custom」这条主线,替日常调整已安装应用报表的管理员解决保存失败的问题,与仪表盘页内编辑的保存路径保持一致。
  • 若判断错了,管理员在打开编辑器时就会看到说明原因的提示(无权定制、包列表缺版本或读不到、定制包里已有未发布的草稿),而不是保存时才失败;改动只在界面一侧,直接撤回本次合并即可恢复原状。
  • 无

What changes

  • ReportView (the report builder and the report inspector panel) now resolves where a Save lands when the editor opens, with the same resolver the in-page dashboard editor uses: the package the report is served from when it is writable, else the app's customization package BASE.custom (ADR-0146 D2, D3, D11). The ensure door is asked for the pair at Save, the body declares overrides: { package, basedOn } as Studio's Customize writes it, and the save plus publish target that package.
  • The target is resolved first, as openDashboardForEdit resolves it, and the reads depend on it. For a customization whose pair the package list already names, the open also probes the pair for a pending draft of the report (getDraft at the pair), so a Studio draft staged there is refused at open, not at Save. The buffer stays the layered authored read at the served package: in the running showcase, the served _packageId stays the base after a customization is published, and that read's effective layer already carries the customization (see the browser check).
  • Where such a save could not land, the editor does not open and a toast says why, each in its own sentence and never inside the "could not load" template: the owner package is not listed or the package list cannot be read (a new Studio sentence, with the reason as the toast's description), the ensure door is walled for this caller, the package list names no installed version to declare the override at, or a draft is pending in the pair (a new Studio sentence). The two new sentences are added to @object-ui/i18n's Studio namespace in English and Chinese.
  • Behaviour change, stated: a report of a writable package whose package list cannot be read now refuses to open, where main opened it.
  • A report that names no package is saved exactly as before (no package named on the save or the publish).
  • runtime-metadata-persistence.ts gets item-neutral names for the dashboard editor's target helpers (resolveInPlaceEditTarget, ensureInPlaceSaveTarget, inPlaceSaveBody, saveInPlace and their types). The dashboard names stay as aliases that delegate, so the dashboard callers are untouched. The module is internal to @object-ui/app-shell (not in its exports).

Read first, by risk:

  1. ui/packages/app-shell/src/views/ReportView.tsx, the handleOpenBuilder hunk: the target is resolved first, and the four refusal branches (including the pair draft probe) decide when the editor does not open.
  2. ui/packages/app-shell/src/views/ReportView.tsx, the saveSchema hunk: the body and target of the write.
  3. ui/packages/app-shell/src/views/ReportView.shippedReportSave-36716.test.tsx: the new pin.

Why

On origin/main the report editor saved every edit naming no package, so the save of a report a read-only installed package ships addressed that package and the metadata write door answered 403; the admin's change was lost at Save. ADR-0146 D11 and the ruling cited at designModeMenuCreate.ts decide that such an edit goes into the app's .custom overlay. The card's alternative (say the report is read-only up front) conflicts with that ruling and is not taken, as the claim records.

Tests

New pin: ReportView.shippedReportSave-36716 (6 cases)

The real ReportView, ReportBuilderHost, persistence seam and target resolver over a metadata client double and the two package doors:

  • a report a read-only package ships: the buffer is read at the served package, ensureCustomizationPackage('showcase') is asked at Save, the save goes to packageId: 'showcase.custom' with overrides: { package: 'showcase', basedOn: '3.2.0' }, and the publish names showcase.custom;
  • a writable owner (control): saved and published in that package, no pair asked, no overrides;
  • no package: saved and published naming none, the package list never read;
  • the three refusals: the editor does not open, the toast names the reason, nothing is saved, no pair is asked. The not-listed refusal is its own sentence with the reason as its description, never the "could not load" template, and nothing is read;
  • a draft pending in the listed pair: the pair is probed at open, the editor does not open, the toast names the pair, nothing is saved;
  • a listed pair with no pending draft (control): the editor opens and the save lands in the pair.

Two existing ReportView pins (authoredEditBuffer-35008, headingStaysServed-36373) now answer the package list and expect the save and publish to name the writable package the report is served from.

Runs (head bcc7ee8, after merging origin/main 63ab479)
  • vitest run on every ReportView, DashboardInPageEditor, runtime-metadata-persistence and ReportNewPage test file in app-shell: Test Files 20 passed (20), Tests 133 passed (133).
  • pnpm --filter @object-ui/app-shell type-check: exit 0. pnpm --filter @object-ui/i18n type-check: exit 0.
  • pnpm --dir ui exec vitest run scripts/: Test Files 172 passed, 2 skipped (174); Tests 5131 passed, 2 skipped.
  • All of these ran in one batch under the verify lock, and every part reported exit 0.
  • Narrowed, declared: the whole app-shell suite is not run locally. Test UI runs it in CI.
Browser check (head bcc7ee8): PR comment 7145843007

The showcase was opened at showcase_hours_by_status_chart and changed to a Line chart in the builder, then saved.

  • POST /packages/com.example.showcase/ensure-customization answered 201.
  • PUT /meta/report/showcase_hours_by_status_chart?mode=draft&package=com.example.showcase.custom answered 200.
  • POST .../publish?package=com.example.showcase.custom answered 200.

After a reload the page draws a line chart, the served report carries chart.type: line and overrides, and the reopened builder shows Line checked. A draft staged in the pair is refused at open with the new sentence.

Ablation at head fad5ea0 (fix committed first; mutation landed on disk, then restored)

node scripts/ablation-replace.mjs replaced the save target target with { kind: 'unbound' } in saveSchema (the old behaviour: the save names no package). Anchor 1 to 0, blob 14ec5897d718 to 73b2daaae6fc. Predicted before the run: the shipped case and the writable control go red, the unbound and refusal cases stay green. Observed: 2 failed, 2 passed (the shipped case on the save options, the control on { mode: 'draft', ifNoneMatch: '*' } lacking packageId). Restore: blob equals HEAD 14ec5897d718, git diff HEAD empty. No build step: the test imports ./ReportView from source.

Acceptance notes

  • The browser check on the showcase report (showcase_hours_by_status_chart) is PR comment 7145843007, at head bcc7ee84d20.
  • The non-customization save still writes the builder's buffer as it is (no stripping of top-level underscore keys), as before this change; only a customization body goes through overrideDraftBody.

Verification

Two-minute check: pnpm --dir ui exec vitest run packages/app-shell/src/views/ReportView.shippedReportSave-36716.test.tsx and expect 4 passed. In the app: OS_PORT=3000 pnpm dev, open Reports, then "Hours by Status (Chart)", Edit, change the chart type, Save. Expect a success toast and the change still there after a reload, with the save request going to ?package= the app's .custom package.

Local gates at bcc7ee84d20: the full dispatch-gates --commands derivation for this diff has 39 families, and all 39 exited 0, check:type-check-debt included. dispatch-gates --ran with exit codes recorded: 39 derived, 39 run, 0 NOT-MEASURED (a derived zero).

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic.
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes. (eslint --no-inline-config over the five changed files at bcc7ee8: 0 errors, 57 warnings; the repo-wide run is CI's.)
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: its generated artifacts are regenerated and committed. (Not applicable: packages/spec is not touched.)
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.
  • The Before Submitting list in CONTRIBUTING.md is done.

Generated by Claude Code

…o the app's .custom overlay

Generalise the dashboard editor's save-target resolver to any in-page
editor (the dashboard names delegate to it), and route the report
builder's Save through it: the owning package when writable, else
<base>.custom via the ensure door, declaring the override (ADR-0146).

Claude-Session: https://claude.ai/code/session_011y7As6kDA9BVrMsBR9rmrJ
Co-authored-by: Claude <noreply@anthropic.com>
…port-save-custom-overlay

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

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-alice · session_011y7As5bdhV5T4N9vpjmZzH

席位核对 — REWORK · head fad5ea0

Read 2026-11-24T20:14Z. L1 of PR #37091 (Fixes #36716). The code is right and in scope. One acceptance item on the card was not measured, and Fixes closes the card when this merges, so the PR goes back for it.

Shape / face (l1-face.mjs --pr 37091: CLEAN, 13 items). Open draft against main. The first line is Fixes #36716, and no closing keyword names any other card. There are 6 files: .changeset/36716-report-save-custom-overlay.md, ReportView.tsx, runtime-metadata-persistence.ts and three ReportView.*.test.tsx under ui/packages/app-shell/src/views/. None is outside the card and none is governed. @object-ui/app-shell is unpublished, and the one changeset is not empty. Clause-②: no and Metadata-protocol: none are correct. No published schema, protocol key or acceptance set moves.

Gates (check-runs at fad5ea01bf8). 38 success, 13 expected skip, 0 failed, 0 pending. Lint & Repo Gates and TypeScript Type Check are both success. Type Check · debt ledger, Type Check UI and Test UI are success. Test UI ran the affected plan (slots 1 to 9), which is CI's designed coverage for this diff. Live E2E UI, Build & E2E UI and Dogfood Regression Gate are success.

Diff against card and ADR-0146.

  • handleOpenBuilder resolves the target with resolveInPlaceEditTarget(servedPackageId(reportData)), the dashboard editor's resolver. A writable owner is saved as package. A read-only owner becomes customization of <base>.custom (D2/D3/D11). report is in the overlayable set (ADR-0146 line 98), and a report is an app-edit-state item per D1 as amended 2026-11-24.
  • saveSchema calls ensureInPlaceSaveTarget at Save, which is the first write, so nothing is created at open. A customization body goes through inPlaceSaveBody, which declares overrides { package, basedOn } through overrideDraftBody. saveInPlace routes an unbound report to saveAndPublishRuntimeMetadata, as on main.
  • The dashboard names in runtime-metadata-persistence.ts are now delegating aliases (= resolveInPlaceEditTarget and the others). saveDashboardInPlace calls saveInPlace('dashboard', …), so the dashboard behaves as before.
  • Ablation: replacing target with unbound turns the shipped case and the writable control red, and the unbound and refusal cases stay green, as predicted. The restored blob equals HEAD 14ec5897d718.

Changeset, read sentence by sentence against the diff. Every sentence holds:

  • the headline (.custom instead of 403);
  • "wrote every save naming no package" (main's saveAndPublishRuntimeMetadata call without a package);
  • "lands where the in-page dashboard editor's does … overrides: { package, basedOn }";
  • "buffer is still the layered authored read at the package the report is served from";
  • the walled and no-version refusals;
  • "A report whose package is not listed is refused with the reason";
  • "A report that names no package is saved as before".

Deviations judged.

  • Full app-shell suite not run locally (narrowed to 41 files, 345 tests): accepted. The gate evidence is CI's Test UI success at this head, and the local union only shows the local subset.
  • check:type-check-debt NOT MEASURED locally: accepted. Type Check · debt ledger is success at this head.
  • Refusing at open (the editor does not open): this is not a Clause-② narrowing and needs no (narrowing) arm. The package is unpublished and no metadata an author can write is refused. It is a UI behaviour change, and the PR body and changeset both state it. It replaces a guaranteed 403 at Save for the read-only case. One case is not stated: a writable-owner report whose package list cannot be read now refuses to open (resolveInPlaceEditTarget → refused), where main opened it. See nit 2.
  • Browser check on showcase_hours_by_status_chart NOT MEASURED: not accepted (must-fix 1).

Must-fix

  1. Run the browser check the card's Acceptance names ("a browser check on the showcase report above") at the head this PR lands on, and post it on the PR or the card. Steps: showcase, admin, open 「按状态统计工时(图表)」 in the report builder, change the chart type, Save. Record three things:

    • the save request goes to ?package=<app>.custom and is answered 2xx (the publish too);
    • the change is still there after a reload;
    • the frame or network row.

    The tests and the ablation do not cover this, for two reasons. Fixes closes 报表编辑器保存应用包里自带的报表时返回 403,没有写到 .custom 覆盖包 #36716, which names this check. And the benefit crosses two server doors that the pin replaces with doubles: the ensure door has to create the pair for this caller, and the write door has to accept a report that declares overrides into it (l1-review-checklist 〈断言与收益〉, at least one end-to-end check). A unit test cannot show a server-side 403 or 422 there.

Should-fix (not blocking)

  • At open, the buffer and the pending-draft probe are read at the served package. They are never read at the listed pair, where openDashboardForEdit reads them first (target.pair, with the base as fallback). In ReportView, a Studio draft already pending in the pair is therefore only refused at Save, as pending-draft (nothing is written), not at open the way the dashboard refuses it. Either align this with openDashboardForEdit, or say in the PR body why reading at the served package is equivalent for reports (_packageId per ADR-0150 D5 names the pair once an override is served).

Nits

  1. The refused reason is wrapped in the engine.edit.loadFailed template ("could not load …"). The walled and no-version refusals use their own sentences, so this one reads as a failed load.
  2. The changeset's refusal list does not mention the case where the package list cannot be read.

L2: not owed. None of the four contract surfaces is touched (no Clause-②: yes, no narrowing, no packages/spec/src/**, no governed path), so CI plus this seat read stands, and no ## Contract review is posted.

Landing notes for the next round: no dogfood battery is owed (no !, no (narrowing)). landing-k.mjs --pr 37091 CAN'T ANSWER at this head: no Test Core shard ran on this ui-only diff, so no diff base was printed. ⛔ Do not read that as K=0. The seat reads K at landing. Once the browser check is in, this goes back for ACCEPT at that head. The seat can land it (Tier S, not governed).

…port-save-custom-overlay

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011y7As5bdhV5T4N9vpjmZzH
…a pending draft at open, and says a refused target in its own sentence

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011y7As5bdhV5T4N9vpjmZzH
…ter a customization is published

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011y7As5bdhV5T4N9vpjmZzH
…port-save-custom-overlay

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011y7As5bdhV5T4N9vpjmZzH
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-alice · session_011y7As5bdhV5T4N9vpjmZzH

Browser check: showcase report saved from the report builder (head bcc7ee8)

Read 2026-11-24T22:07Z. This is the check the card's Acceptance names. It answers must-fix 1 of seat record 7143254237.

Build under test. This worktree at bcc7ee84d20aab493ca1df818eed85220c3af833, the head this PR now carries. The framework closure was built with turbo run build --filter=@objectstack/example-showcase... --filter=@objectstack/cli... --filter=@object-ui/app-shell... and the Console with pnpm console:build. Both ran under the shared verify lock and gave VERDICT command-exit 0. The server was objectstack dev --ui --seed-admin -p 4716 on a fresh file DB with OS_PORT=4716. The browser was headless Chromium (Playwright, /opt/pw-browsers/chromium), signed in as admin@objectos.ai.

Steps. Open /_console/apps/com.example.showcase/report/showcase_hours_by_status_chart ("Hours by Status (Chart)", served _packageId: com.example.showcase, chart bar). Click Edit, and the report builder opens. Pick the Line chart, then Save.

Reading 1: the save goes to the .custom pair and is answered 2xx, the publish too. These are the network rows the page made on Save, as captured:

method path status
POST /api/v1/packages/com.example.showcase/ensure-customization 201 (created: true, packageId: com.example.showcase.custom, writable: true)
PUT /api/v1/meta/report/showcase_hours_by_status_chart?mode=draft&package=com.example.showcase.custom 200 (Saved customization overlay (env-wide, package=com.example.showcase.custom, state=draft), seq 1)
POST /api/v1/meta/report/showcase_hours_by_status_chart/publish?package=com.example.showcase.custom 200 (Published draft, seq 2)

No error toast appeared. Neither server door refused: the ensure door created the pair for this caller, and the write door accepted a report that declares overrides into it.

Reading 2: the change persists after a reload. I navigated to the same URL again. The page draws a line chart, and GET /api/v1/meta/report/showcase_hours_by_status_chart serves chart.type: line with overrides: { package: com.example.showcase, basedOn: 0.1.0 }. I then opened Edit a second time. The builder's chart radios read line: aria-checked=true and the others false, so the second edit starts from the first. Switching back to Bar and saving gave ensure-customization 200 (the pair exists now), then PUT ?mode=draft&package=com.example.showcase.custom 200, then publish 200. The served value was bar again.

Reading 3: the frames. The runner kept these headless screenshots (local frames, not uploaded):

  • 1-builder-line.png: the builder open, Line selected in CHART, the preview a line plot.
  • 3-after-reload.png: the report page after the reload, a line chart over the same five status rows (Backlog 30, To Do 36, In Progress 100, In Review 54, Done 24; total 244).

The table above is the network row the record asks for.

Should-fix, checked in the same browser. I staged a draft of the report in the pair through the API (PUT ...?mode=draft&package=com.example.showcase.custom 200) and then clicked Edit. The builder does not open. The toast reads "This item has unpublished changes in com.example.showcase.custom. Publish or discard them in Studio, then edit it here." The page read GET ...?state=draft&package=com.example.showcase.custom and got 200. I discarded the staged draft afterwards (DELETE 200).

Two notes from the run.

  • After the customization is published, the served _packageId is still com.example.showcase, the base, and not the pair. The layered read at the base already carries the customization in its effective layer (reading 2). So the buffer is still read at the served package, and the open-time pending-draft probe reads the listed pair as openDashboardForEdit does. The code comment was corrected to say this. It does not lean on ADR-0150 D5.
  • I ran the same three readings at 80022cfa777, before the comment fix and before the latest merge of origin/main. They gave the same rows and statuses.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-alice · session_011y7As5bdhV5T4N9vpjmZzH

席位核对 — ACCEPT · head bcc7ee8

Read 2026-11-24T22:12Z. This is the delta round on REWORK 7143254237. It answers the dev report 7145908515 on #36716 and the browser check 7145843007.

Face and gates. l1-face.mjs --pr 37091 is CLEAN at bcc7ee84d2. Check-runs: 47 success, 15 expected skip, 0 failed, 0 pending, mergeable_state clean. Lint & Repo Gates and TypeScript Type Check are both success. The diff has 8 files: the earlier 6 plus ui/packages/i18n/src/namespaces/studio/{en,zh}.ts. Those two carry the keys that nit 1 asked for. @object-ui/i18n is published, and the changeset has an entry for it. No path is governed. Clause-②: no and Metadata-protocol: none are unchanged and correct. Signature on line 1 and Fixes #36716 on line 2 follow the seat's accepted convention, and the parser reads them as the first line.

Must-fix 1: closed. Comment 7145843007 was measured at this head, on a fresh build and a fresh DB, as admin:

  • POST …/packages/com.example.showcase/ensure-customization answered 201;
  • PUT …?mode=draft&package=com.example.showcase.custom answered 200;
  • POST …/publish?package=com.example.showcase.custom answered 200;
  • after a reload the served report is chart.type: line with overrides { package, basedOn: 0.1.0 };
  • the second edit opens with Line checked, and saving it back to Bar answers 200 three times.

Both server doors that the pin replaces with doubles are now shown working end to end.

Should-fix: closed. handleOpenBuilder now does these steps in order:

  1. It resolves the target first.
  2. It refuses refused and walled before any read.
  3. It probes the listed pair (target.pair !== packageId) with getDraft, alongside the served-package reads.
  4. It refuses a draft pending in the pair at open, with engine.studio.customize.pendingDraft.

The pin covers this: a pending draft in the pair is refused, and a listed pair with no draft opens and saves into the pair. The browser check reproduced the refusal toast.

Why the buffer stays at the served package: the run measured that after publish the served _packageId stays the base, and that the base's layered effective layer carries the customization. The second edit opening on Line proves it. The code comment was corrected and no longer leans on ADR-0150 D5. I accept this.

Nits: closed. The refused target now has its own title (engine.studio.customize.noPackage), with the reason as the toast description, outside the loadFailed template. Both keys are in en and zh.

Changeset, the new sentences read against the diff. Every sentence holds:

  • "or a draft of the report is already pending in the customization package (the in-page dashboard editor refuses that at open too)";
  • "A report whose package is not listed, or whose package list cannot be read, is refused in its own sentence with the reason under it";
  • "a report of a writable package opened in the builder before this change even when the list could not be read";
  • "Two new Studio sentences carry those refusals in English and Chinese".

The earlier sentences still hold.

Accepted deviations.

  • The full app-shell suite was not run locally (20 files and 133 tests this round). The evidence is CI's Test UI success at this head.
  • No ablation this round. The save path was ablated at fad5ea01bf8, and a case pins the new open-time probe, which the browser also showed.
  • check:type-check-debt is covered by CI's Type Check · debt ledger success.
  • Refusal at open is a UI behaviour change. The PR body and changeset both state it. It is not a Clause-② narrowing.

L2: not owed. None of the four contract surfaces is touched. Dogfood battery: not owed (no !, no (narrowing)). Landing: Tier S, not governed, so the seat lands it. Fixes #36716 closes the card when this merges.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-alice · session_011y7As5bdhV5T4N9vpjmZzH

Landing — seat arms #37091

  • Seat record: ## 席位核对 — ACCEPT 7145948149, at head bcc7ee84d20aab493ca1df818eed85220c3af833. No open must-fix; the browser check the card's Acceptance names is comment 7145843007 at this head.
  • CI at this head: 47 success, 15 skipped, 0 failed.
  • check-governed-merges: not governed, 535 lines (under the human-merge threshold). landing-k: CAN'T ANSWER (ui-only diff, no Test Core planner ran); K read by hand from the merged-in main commit 63ab4794eb7: K = 4.
  • Not a narrowing: @object-ui/app-shell is unpublished, and no authorable metadata is refused; the open-time refusals are UI behaviour stated in the changeset.
  • Fixes 报表编辑器保存应用包里自带的报表时返回 403,没有写到 .custom 覆盖包 #36716.

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/l 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.

报表编辑器保存应用包里自带的报表时返回 403,没有写到 .custom 覆盖包

2 participants