Repository navigation
feat(app-shell): show a disable refused for a dependent validation rule whole on the Setup packages page - #31016
Merged
Conversation
…rule whole on the Setup packages page A 409 PACKAGE_DISABLE_RESTRICTED_BY_VALIDATION_RULE from the disable door is drawn under a heading in the reader's language with the server's whole sentence (package · object · rule and the remedy), no longer cut to its first sentence. The disable confirm dialog says such a rule can still refuse the disable, since the served disableable verdict does not read dependent rules. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibwxPsNfCDtuhas4VDr
… labels Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibwxPsNfCDtuhas4VDr
…awing Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibwxPsNfCDtuhas4VDr
…he module-disable suite Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibwxPsNfCDtuhas4VDr
Contributor
Author
|
domain:ui#3 · os-tesla · session_01L9qibxW6qraU2Z3mwupUGp Contract reviewServed-tier: ① Derived judgments
② Semver level
③ Boundary flags
Implemented-by: VERDICT: PASS |
Contributor
Author
|
domain:ui#3 · os-tesla · session_01L9qibxW6qraU2Z3mwupUGp 维护者速读
席位核对 — ACCEPT · head 0b6d41b
|
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 Tesla · project thread
Fixes #31003
Clause-②: yes (widening)
Metadata-protocol: none
维护者速读
PACKAGE_DISABLE_RESTRICTED_BY_VALIDATION_RULE拒绝时,页面先用管理员的语言显示一句标题(为什么不能停用、先停用或修改规则),再完整显示服务端原话(包 · 对象 · 规则,以及补救办法),不再只露第一句、把补救藏在「更多」后面。停用确认框里多一行,说明有规则依赖这个包时停用可能会被拒绝。PackagesPage.tsx里run()的 catch(按错误码加 heading)和消息框的渲染分支;确认框里新增的pkg-detail-disable-may-refuse一行;测试文件末尾新的 describe。pnpm --dir ui exec vitest run packages/app-shell/src/views/metadata-admin/PackagesPage.moduleDisable-28118.test.tsx,预期 15 passed,其中 en、zh 两条 409 用例都看到标题和完整原话。What changes
ui/packages/app-shell/src/views/metadata-admin/PackagesPage.tsx(package detail sheet):PACKAGE_DISABLE_RESTRICTED_BY_VALIDATION_RULE(read off the thrown error witherrorCodeIs, whichapiJsonalready fills from the ADR-0112 envelope), the message box draws a heading in the reader's language (engine.packages.detail.disableRestricted), and under it the server's whole message as sent. The server's message names every blocking rule as package · object · rule and then the remedy. Before,RefusalMessagecut it to its first sentence, so the remedy was behind "More". Every other refusal is drawn as before (RefusalMessage).engine.packages.detail.disableMayBeRefused) saying the disable is refused while an active validation rule reads a field this package adds, and the refusal names each rule. Offering Disable still follows the serveddisableableverdict alone. Nothing is computed in the client.ui/packages/i18n/src/namespaces/studio/{en,zh}.ts: the two new keys. They are in the lazystudionamespace, not the eageri18n-locale-enpack, so no ceiling moves.What the server serves (measured on
origin/main8ae0ab9b,packages/runtime/src/domains/packages.ts)PATCH /packages/:id/disableanswersdeps.error(disableDependentRulesMessage(...), 409, { code }). On the wire that is{ success: false, error: { code, message } }, with noerror.details. The JSDoc on the constantPACKAGE_DISABLE_RESTRICTED_BY_VALIDATION_RULEsays a machine-readable shape for the triples would be a spec contract first. The page therefore shows the message and does not parse it.disableableisisDisableablePackage(a writable base, or a module of an installed app). It does not readreadDisableDependentRules. Pre-computing it per row would need that server read on everyGET /packagesrow (a fold of every object per package) and a change in what the field means. That is outside this card's fence (packages/**), so the page shows the refusal when the disable is attempted.Tests
PackagesPage.moduleDisable-28118.test.tsxgets a new top-level describe,a disable the server refuses for a dependent validation rule (objectstack#31003), in the existing module-disable harness. Its wire stub gains an optional per-door answer. The describe has 5 cases:WRITABLE_PACKAGE_REQUIRED, two sentences) keeps the first-sentence drawing with "More" and no heading;PATCH …/disable, success line, no refusal drawn).The suite also gains module-top warm imports of
@objectstack/formulaand@objectstack/lint, whichcheck:test-source-aliasasks of an edited test whose reach loads them lazily.Acceptance notes
error.details), which is apackages/speccontract and not opened here.run()meets it. Today only the disable door answers it on this sheet. The install door also answers it forenableOnInstall: false, but that door belongs to the import flow and is not touched here.Verification
Head
0b6d41bd, treeobjectstack-ai/objectstack.Tests
pnpm --dir ui exec vitest run packages/app-shell/src/views/metadata-admin/PackagesPage.moduleDisable-28118.test.tsx: Tests 15 passed (15), 10 existing and 5 new.PackagesPage.*.test.tsx(18 files) on the first head: 17 passed, plus 1 failure in the new zh case (the test clicked the English label), fixed in the next commit. The file is green since then.pnpm --dir ui exec vitest run packages/i18n/src/__tests__/studio-namespace.test.ts: 18 passed (en ⊆ zh, placeholder parity).node scripts/ablation-replace.mjs, anchor{msg.kind === 'err' && msg.heading ? (→… && false ? (): the en and zh 409 cases fail (2 failed, 13 passed). Restored to a blob equal to HEAD, andgit diff HEADis empty.Derived gates: 36 of 36 run
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderived 36 lines. All 36 were run with stdin redirected from /dev/null, and--ranreports36 derived famil(ies) accounted for — 36 run, 0 NOT-MEASURED. On the first pass, 34 exited 0 and 2 exited 1:pnpm check:test-source-alias: the edited suite reaches lazy@objectstack/formulaand@objectstack/lintimports. Fixed with the warm imports. Exit 0 on0b6d41bd.pnpm --dir ui exec vitest run scripts/: 7 failures incheck-doc-snippet-types.test.tsandspec-symbol-ledger-plugin-detail-7265.test.ts. Both read@objectstack/specdeclarations, and this worktree's spec was built withOS_SKIP_DTS=1. Afterenv -u OS_SKIP_DTS pnpm --filter @objectstack/spec build, the full run on0b6d41bdgives Test Files 170 passed and 2 skipped; Tests 4991 passed and 2 skipped;VERDICT command-exit 0.Also run beyond the derivation, all exit 0:
pnpm --dir ui check:i18n-keys,check:i18n-drift,check:i18n-dead-keys(neither new key is listed),check:new-line-citations(0 new),pnpm check:undeclared-dep-imports.node scripts/check-sdui-manifest.mjsis among the derived 36.Not run locally
pnpm --filter @object-ui/app-shell run type-checkis NOT MEASURED. This worktree's@object-ui/*packages have no.d.ts, so the run reports about 1,700 missing-module errors (TS2307 and TS7006), and none of them is on a line this diff adds. Type Check UI runs it.Generated by Claude Code