Repository navigation
fix(plugin-dashboard): leave a tile out when the server refuses its data to the viewer - #27065
Merged
Merged
Conversation
…ata to the viewer Outside design mode, a dataset tile whose query the server refuses as a read refusal is dropped from the dashboard layout, so the viewer sees no permission-error tile and the other tiles reflow. Design mode keeps the no-access state so the author can still select the tile. Claude-Session: https://claude.ai/code/session_01JQwxbacRXrqkMrm5LGBGYE Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbacRXrqkMrm5LGBGYE Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
Author
席位核对ACCEPT · 席位意见:只有服务器真的以 403 拒绝读取时,查看者才看不到那块磁贴,前端不做任何猜测;设计模式和可编辑网格照旧显示无权限状态。spec 说明另立 #27068 交给 spec 车道。
|
This was referenced Oct 28, 2026
This was referenced Oct 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Warren · project thread
Refs #26971 (item 1: a viewer who cannot read a tile's data does not see a permission-error tile)
Clause-②: no
Metadata-protocol: none
维护者速读
ui/packages/plugin-dashboard/src/DashboardRenderer.tsx(refusedTiles 状态与 renderWidget 中的 return null)、DatasetWidget.tsx(onForbidden 回调)、新测试文件。pnpm --dir ui exec vitest run packages/plugin-dashboard/src/__tests__/DashboardRenderer.refusedTile-26971.test.tsx,预期 3 个用例全部通过。What changes
DatasetWidgettakes an optionalonForbiddencallback and calls it when its query is refused as a read refusal (classifyLoadError(e) === 'forbidden'). It still draws the objectui#10899 no-access state itself, so any host that keeps the tile on screen is unchanged.DatasetWidgetis not exported from the package entry.DashboardRendererrecords each refused tile (keyed by the tile key and the dataset it names) and, outside design mode, renders nothing for it: no Card frame, no title. The desktop layout is span-flow (array order is visual order) and the mobile layout is two stacks, so the remaining tiles reflow with no gap.DashboardGridLayout(react-grid-layout, explicit x/y) is not changed and keeps the no-access state; the console'sDashboardViewrendersDashboardRenderer.@object-ui/plugin-dashboardpatch.Why
A viewer holding only some permission sets saw one dashboard tile answer "You don't have permission to view the data behind this widget" among tiles that answered, and the app had no key to hide that one tile. Triage routed the card to target 2 (a read-aware default, no new widget key); the seat chose "leave the tile out" because the quiet cell already exists since objectui#10899.
Tests
New
__tests__/DashboardRenderer.refusedTile-26971.test.tsx, two table tiles, one whose dataset query rejects with the refusal shape (httpStatus: 403,code: 'PERMISSION_DENIED'):dashboard-preview-widget-quota_attainment) and shows the no-access state.DatasetWidget.forbiddenState-10899.test.tsxstays green (it pins the widget-level state, which stays).Ablation (head 52ed283)
node scripts/ablation-replace.mjsdeleted the line that returns null for a refused tile outside design mode (anchor hit once, blob changed). The view-mode case went red ("drops the refused tile, frame and title included, and keeps the readable one"), both controls stayed green (1 failed / 2 passed). The tool restored the file: blob equals HEAD,git diff HEADempty. The test imports the renderer by relative path, so no dist leg applies.Acceptance notes
objectkey, nodataset) are not pre-filtered by the viewer's read permission in this PR (the dispatch's optionalDashboardViewpre-filter was not built).packages/spec/src/ui/dashboard.zod.tsbesiderequiresObject, which the seat files as a spec-lane card.Verification
Local gates (head 52ed283, base cb8988e)
pnpm --workspace-concurrency=2 --filter '@object-ui/plugin-dashboard^...' buildunder the lock: VERDICT command-exit 0.node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack: 34 commands, all exit 0 (includingnode scripts/check-sdui-manifest.mjs);--ranreconciliation: 34 derived, 34 run, 0 NOT-MEASURED, 0 UNRUN.pnpm --filter @object-ui/plugin-dashboard run type-check: exit 0.pnpm --dir ui run type-check:scripts: exit 0.pnpm exec eslinton the three changed source files: exit 0.pnpm check:changeset-fixed: exit 0.pnpm --dir ui run check:new-line-citations: 0 new citations, exit 0.pnpm --dir ui exec vitest run packages/plugin-dashboard/under the lock: 190 test files passed, 1858 tests passed, 6 skipped.Human Minimum
packages/specholds no runtime logic. (not touched)pnpm lintpasses (eslint on the changed files; the repo scan is CI's).main, one pull request.packages/spectouched: n/a.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
https://claude.ai/code/session_01JQwxbacRXrqkMrm5LGBGYE
Generated by Claude Code