Skip to content

fix(console): re-ticking a dashboard card's Apply restores the shipped filter binding - #37162

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-37031-dashboard-binding-recheck-persists
Nov 25, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-37031-dashboard-binding-recheck-persists

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

repo:objectstack#7 · os-alice · session_011y7As5bdhV5T4N9vpjmZzH

Fixes #37031

Clause-②: no
Metadata-protocol: none
Skills-docs: none — no authoring surface changes; a console panel restores a value the package already ships

维护者速读

  • 管理员在仪表盘页内编辑(以及 Studio 的仪表盘编辑器)里,把某张卡片「跟着顶部筛选」的勾选取消再重新勾上并保存后,这张卡片会恢复应用原本设定的筛选字段,不再卡在「不跟随」的状态;其他卡片和保存方式不变。
  • 属于仪表盘页内编辑这条线,替调整已安装应用仪表盘的管理员解决「取消了就再也改不回来」的问题。
  • 若判断错了,最坏情况是重新勾选后卡片按筛选自己的字段过滤(即本次修改前的行为);改动只在界面一侧,直接撤回本次合并即可恢复原状。
  • 无

What changes

  • DashboardWidgetInspector (the card panel Studio and the in-page edit state share): re-ticking Apply on a filter row now writes the binding the dashboard as its package ships it gives that card, when that binding re-targets the filter to a field (a string). Where the shipped card opts out too (false), binds nothing, or is not in the shipped document, the entry is dropped as before. Unticking still writes false. A new exported helper shippedFilterBinding reads it.
  • MetadataInspectorProps gains an optional shipped prop: the item as its package ships it (the layered read's code). It is a React prop of an internal module of @object-ui/app-shell (not in its exports), not metadata.
  • openDashboardForEdit returns shipped from the same layered read it opens the document from (the pair's read, or the base's when the pair does not hold the item yet); the edit state keeps it and DashboardEditPanel hands it to the card panel. No extra request.
  • Studio's editor (ResourceEditPage) hands its scoped inspector shipped from the layered read it already keeps. Same defect class through the same panel, one line, pinned in that page's existing inspector harness.

Read first, by risk:

  1. DashboardWidgetInspector.tsx, the Apply checkbox's onCommit and shippedFilterBinding: what a re-tick writes.
  2. DashboardInPageEditor.tsx, openDashboardForEdit: which layered read shipped comes from.
  3. ResourceEditPage.tsx, shippedLayerOf and the InspectorComponent props.

Why

Measured, not the card's mechanism. The overlay is not merged key by key: a save into com.example.showcase.custom stores the whole dashboard document (ADR-0146, whole-document override). On main re-ticking deleted filterBindings.dateRange, which binds the card to the filter's own field, issued_on. kpi_new_accounts reads the account dataset, which has no issued_on, so the PUT staged the draft (200) and the publish was refused (422 INVALID_METADATA, rule dashboard-filter-field-unknown: "inherits dashboard filter dateRange(issued_on), but object showcase_account ... has no field issued_on"). The editor then discards its draft, so the served dashboard keeps dateRange: false. The value to restore is the package's own re-target (signed_on), which only the shipped layer carries once the overlay holds false. The server's merge contract is unchanged.

Tests

New and updated pins (app-shell, run from ui/ root)

pnpm --dir ui exec vitest run --maxWorkers=2 over the four files below at 4e94d7d45cb: Test Files 4 passed (4), Tests 67 passed (67); lock VERDICT command-exit 0.

  • DashboardWidgetInspector.test.tsx, new describe "re-ticking Apply restores the shipped binding": unticking writes { dateRange: false, region: 'sales_region' }; re-ticking an opt-out writes { dateRange: 'signed_on', region: 'sales_region' }; control: a shipped false, no shipped binding, or a shipped card with another id drops the entry ({ region: 'sales_region' }). The existing "re-ticking removes the entry" case (no shipped) stays as a second control.
  • DashboardInPageEditor.test.ts: openDashboardForEdit returns shipped (the code layer) for a writable package, for a base opened before the pair holds the item, for a pair holding a customization (one layered read, at the pair), and null when nothing ships.
  • DashboardView.inPageEdit-36372.test.tsx: through the real DashboardView, the card panel is handed the code layer of an installed app's customized dashboard.
  • ResourceEditPage.inspectorReadOnlyReason-29079.test.tsx: the page hands a registered scoped inspector the layered read's code, and null when nothing ships.
Ablation at head 4e94d7d (fix committed first; mutation landed on disk, then restored)

node scripts/ablation-replace.mjs replaced setBinding(apply ? shippedFilterBinding(shipped, widget.id, def.name) : false) with setBinding(apply ? undefined : false) (the main behaviour). Anchor 1 to 0, blob 574a32e50efa to 812b69365391. Predicted: only the re-tick case goes red; the untick case and the controls stay green. Observed: 1 failed, 21 passed, the failure being "re-ticking an opt-out restores the field the shipped dashboard binds". Restore: blob equals HEAD 574a32e50efa, git diff HEAD empty. No build step: the suite imports the inspector from source.

Type check and lint
  • pnpm --filter @object-ui/app-shell run type-check (both programs, tsconfig.json and tsconfig.test.json) at 4e94d7d45cb, after building the @object-ui/app-shell^... closure: lock VERDICT command-exit 0.
  • eslint --no-inline-config over the eight changed TS/TSX files: 3 errors, all in ResourceEditPage.tsx and all react-hooks/static-components on lines that carry an inline disable on main; the same command over origin/main's copy of that file reports the same 3 errors. The diff adds none. The repo-wide run is CI's.

Acceptance notes

  • The Reset link under a re-targeted field still clears the entry to the filter's own field, as on main; on kpi_new_accounts that is a field the dataset lacks, and the publish refuses it with the rule above, saying what to do. Whether Reset should mean "the shipped binding" is a product question, not this card's.
  • A re-target the author wrote in the overlay (not shipped), then unticked and re-ticked, comes back as the shipped binding (or the default), not as the overlay's field: the panel keeps no memory of an earlier value.
  • The card says the re-check publish answered 200; replaying the editor's PUT body over REST on a fresh showcase it answered 422 as above (the PUT itself answered 200).

Verification

Two-minute check: pnpm --dir ui exec vitest run packages/app-shell/src/views/metadata-admin/inspectors/DashboardWidgetInspector.test.tsx and expect 22 passed. In the app: OS_PORT=3000 pnpm dev, open the Revenue Pulse dashboard, Edit, select "Accounts Signed", untick Date's Apply, Save; Edit again, tick it, Save. Expect a "Dashboard saved" toast, and the Date row showing "Customer Since" after a reload.

Browser check on showcase at head 4e94d7d (console built from that head)

Fresh showcase (objectstack dev --ui --seed-admin, own port, own DB), Chromium driven by Playwright, as admin@objectos.ai, on /_console/apps/com.example.showcase/dashboard/showcase_revenue_pulse:

  1. GET before: kpi_new_accounts.filterBindings = {"dateRange":"signed_on","region":"sales_region"}.
  2. Edit, select the card, Date's Apply checked at open; untick, Save. PUT ?mode=draft&package=com.example.showcase.custom 200 with body filterBindings {"dateRange":false,"region":"sales_region"}; publish 200; toast "Dashboard saved". GET after: {"dateRange":false,"region":"sales_region"}.
  3. Edit again, Apply unchecked at open; tick, Save. PUT 200 with body filterBindings {"dateRange":"signed_on","region":"sales_region"}; publish 200 (seq 4); toast "Dashboard saved". GET after: {"dateRange":"signed_on","region":"sales_region"}.
  4. Reload: GET {"dateRange":"signed_on","region":"sales_region"}; reopened edit state shows Date's Apply checked with the field "Customer Since" (the signed_on label). Discarded.

Control (before the fix: REST replay of main's re-tick body; the server is unchanged by this diff): after the untick, a PUT with filterBindings {"region":"sales_region"} answered 200 and its publish 422 dashboard-filter-field-unknown; GET stayed {"dateRange":false,...}.

Local gates at 4e94d7d45cb: dispatch-gates --commands --repo objectstack-ai/objectstack derives 39 families for this diff; all 39 exited 0 (pnpm --dir ui exec vitest run scripts/: 172 files passed, 2 skipped). dispatch-gates --ran with exit codes: 39 derived, 39 run, 0 NOT-MEASURED (a derived zero). pnpm --dir ui check:new-line-citations: 0 new citations. The test:repo project, the type-check lanes and the repo-wide lint are CI's.

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic. (Not touched.)
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes. (Changed files: no new errors, see Tests; 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.)
  • 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

…d filter binding

Unticking Apply writes the card's opt-out; ticking it again dropped the
entry, which binds the card to the filter's own field instead of the field
the app ships. The save stores the whole document, so the shipped re-target
was lost and the publish could be refused. The card panel now restores the
binding the shipped layer (the layered read's code) gives the card, and
drops the entry only where nothing is shipped. The in-page edit state and
Studio's editor hand the panel that layer.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011y7As5bdhV5T4N9vpjmZzH
@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 25, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-alice · session_011y7As5bdhV5T4N9vpjmZzH

席位核对 — REWORK · head 4e94d7d

L1 review of #37162 against #37031, read at 2026-11-25T01:18Z from the PR's committed tree (base 1f3e9f68e70, one commit).

Must-fix

  1. ResourceEditPage.tsx: the new shippedLayerOf helper is wedged between holdsNoLayer's JSDoc and holdsNoLayer itself. At head the file reads, lines 422-442: the /** Whether a layered answer this page already read holds no layer at all ... only logs the same 404. */ block, then the new /** The item as its package ships it ... */ block, then function shippedLayerOf, then a bare function holdsNoLayer. So holdsNoLayer loses its documentation (the objectui#11799 reason it exists) and shippedLayerOf now carries two stacked docblocks, the first describing a different function. Move shippedLayerOf (with its own docblock) above holdsNoLayer's docblock or below holdsNoLayer, so each function sits directly under its own comment. Mechanical; no test change.

Checklist

  • Shape: draft, base main, first content line Fixes #37031 (line 1 is the seat signature). l1-face.mjs --pr 37162: shape, first-line, relation, keywords-other-cards, releases-path, changeset, empty-changeset, nul-suspects, declarations, skills-docs all ok. Fixes is right: the card's expected result (re-tick restores signed_on and it persists) is what this diff delivers.
  • Premise corrected by the dev, acknowledged here: the card's mechanism is wrong. It said the overlay merges key by key and the re-check publish answered 200. The dev measured that a save stores the whole document and that main's re-tick body ({region} with no dateRange) binds the card to issued_on, which the account dataset lacks, so the publish answers 422 dashboard-filter-field-unknown and the opt-out stays. That reading (REST replay control) and the after-fix readings (PUT {dateRange:'signed_on',region:'sales_region'} 200, publish 200, GET signed_on, still signed_on after reload) are in the PR body's Why and Verification. The fix is on the producer side and leaves the server's merge contract alone, which fits Prime Directive Add comprehensive test suite for Zod schema validation #12.
  • Diff vs card: DashboardWidgetInspector re-tick writes shippedFilterBinding(shipped, widget.id, def.name): a string binding from the shipped widget with the same id, otherwise undefined (the entry is dropped, as on main). Untick still writes false. openDashboardForEdit takes shipped from the same layered read it opens doc from, including the base fallback, so no extra request. The read is pinned for package, base fallback, pair-holds-customization and nothing-shipped.
  • Scope, the Studio extension: in scope. ResourceEditPage mounts the same DashboardWidgetInspector through MetadataInspectorProps. Without the one-line shipped= prop, Studio's dashboard editor would keep exactly the defect this PR fixes in the in-page editor. It meets all four conditions: same defect class, mechanical, no other claim, same gate family (app-shell vitest). The PR body names it and it is pinned in the page's existing inspector harness (code handed over / null control). The file surface stays within the claim (ui/packages/app-shell/src/**, .changeset/**).
  • Changeset: @object-ui/app-shell patch, Clause-②: no, Metadata-protocol: none. I read it sentence by sentence against the diff. Each sentence holds: the opt-out writes {NAME: false}; re-tick on main dropped the entry and bound the filter's own field; the whole-document save led to 422 dashboard-filter-field-unknown; the fix restores the code layer's string binding, else drops; the edit state reads shipped from its existing layered read; Studio passes it from the read it already keeps; no new strings. The Metadata-protocol none holds: a React prop on an internal module, not metadata.
  • Contract review: not owed. The diff touches no packages/spec/**, declares no Clause-②: yes, no (narrowing), and no governed path.
  • Tests: the dev's evidence is real commands with their output (4 files / 67 passed at 4e94d7d45cb). The ablation reverting the re-tick to undefined gave 1 red ("re-ticking an opt-out restores the field the shipped dashboard binds") and 21 green, as predicted, so the pin can fail. The controls (shipped false, no shipped binding, different widget id) pin the fallback.
  • eslint claim, verified: ResourceEditPage.tsx carries 3 inline eslint-disable-next-line react-hooks/static-components lines (3726, 3859, 3883) at base 1f3e9f68e70, at origin/main and at head alike. The 3 errors under --no-inline-config are those same pre-existing suppressions. The diff adds none.
  • CI at 4e94d7d: all green, read from check-runs: 38 success, 13 expected skip, 0 unexpected skip, 0 failed, 0 pending. l1-face floor: Lint & Repo Gates success, TypeScript Type Check success; mergeable_state clean.
  • Non-blocking: shippedLayerOf re-implements recordOf from DashboardInPageEditor.tsx. Sharing one helper is optional.
  • Out of scope: recorded in the PR's Acceptance notes, not filed: Reset clears to the filter's own field; a re-target that exists only in the overlay comes back as the shipped binding after untick and re-tick. Both are product questions, not defects of this card.

Next: the same dev, a patch round for must-fix 1, then a fresh L1 on the new head.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-alice · session_011y7As5bdhV5T4N9vpjmZzH

席位核对 — ACCEPT · head 0b0d4b4

Delta L1 against REWORK 7149430001 (head 4e94d7d45cb), read at 2026-11-25T02:40Z from the committed tree.

Delta

  • Must-fix 1, resolved. In 0b0d4b4bf07, shippedLayerOf and its own docblock now sit above holdsNoLayer's docblock (head lines 422-444). Each function is now directly under its own comment. The commit only moves lines (9+/9-), with no change in behaviour.
  • The merge did not disturb the fix. d3bc18e0378 merges origin/main at 95734fef75e cleanly. I took the PR's delta against the merged main (95734fef75e..0b0d4b4bf07) and compared its added and removed lines with the original delta (1f3e9f68e70..4e94d7d45cb). They are identical, line for line. Same 10 files, 233+/15-. On main, the merge brought only a 4+/2- change to ResourceEditPage.tsx, outside the inspector mount and the layered read. The shipped={shippedLayerOf(layered)} prop is intact. The 3 pre-existing inline react-hooks/static-components disables are still in place.
  • Non-blocking, not taken. The dev kept recordOf private to its own module rather than share it. Accepted.

Checklist (carried from 7149430001; re-read where the head moved)

  • l1-face.mjs --pr 37162 at 0b0d4b4bf0: CLEAN, 13 items read, none flagged. The PR is a draft against main, with Fixes #37031 as the first content line and no closing keyword on any other card. The changeset is present and not empty. The declarations read Clause-②: no and Metadata-protocol: none. Skills-docs and dogfood are not owed.
  • CI at 0b0d4b4bf07: 38 success, 13 expected skip, 0 unexpected skip, 0 failed, 0 pending. The floor checks Lint & Repo Gates and TypeScript Type Check both passed. mergeable_state is clean. This also covers check:type-check-debt and the ui scripts/ vitest, which the dev could not measure locally.
  • Unchanged from the first round:
    • The fix matches the card's expected result.
    • The dev's correction of the card's premise is acknowledged: a save stores the whole document, and the publish was refused with 422 dashboard-filter-field-unknown.
    • The Studio ResourceEditPage extension is in scope: same panel, same defect class, mechanical, pinned.
    • The changeset holds when read sentence by sentence.
    • The ablation turned 1 test red, as predicted.
  • Contract review is not owed. The PR touches no packages/spec/**, declares no Clause-②: yes and no (narrowing), and changes no governed path.

Accepted deviation

  • The PR body's local readings (tests, ablation, type-check, gates, browser check) still cite 4e94d7d45cb. They carry over to this head because the head's delta against main is line-identical to the delta they measured, apart from the docblock move. CI at this head is the gate evidence. Before landing, the body should gain one line recording that carry-over.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-alice · session_011y7As5bdhV5T4N9vpjmZzH

Landing — seat arms #37162

  • Seat record: ## 席位核对 — ACCEPT 7151032782, at head 0b0d4b4bf079faae9ed571edb6125a5d7795f149 (after REWORK 7149430001). No open must-fix.
  • Head readings: 0b0d4b4bf07 is a clean merge of main at 95734fef75e plus a docblock-only move in ResourceEditPage.tsx. The PR's delta against main is line-identical to the one measured at 4e94d7d45cb, so the PR body's test, ablation, type-check, gate and browser readings carry over.
  • CI at this head: 38 success, 13 skipped, 0 failed.
  • check-governed-merges: not governed, 248 lines. landing-k: CAN'T ANSWER (ui-only, no Test Core shard ran). K read by hand from 95734fef75e: K = 6; locale and shared-budget legs clear.
  • Not a narrowing (Clause-②: no, Metadata-protocol: none).
  • Fixes Dashboard edit: re-checking a widget's 「跟着顶部筛选」 binding and saving does not persist; the overlay keeps dateRange:false, so an author cannot undo the opt-out #37031.

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

2 participants