Skip to content

fix(app-shell): a validation rule guard the publish refuses holds the Studio autosave (#27644) - #28027

Merged
objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/project-thread-aewbdy
Oct 30, 2026
Merged

objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/project-thread-aewbdy

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Bill · project thread

Fixes #27644

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:Studio 数据页的「校验规则」标签保留草稿读回的服务端判定,每条规则的条件带上自己的判定路径(validations.N.condition),发布会拒收的条件就挡住自动保存。
  • 为什么改:之前判定被丢掉,空值比较这类发布拒收的规则照样显示没问题并自动保存(PUT 200),直到点发布才被拒。
  • 风险与回滚:只动控制台三个文件;每次自动保存后多一次草稿读取。回滚即还原本 PR,不涉及数据或元数据形状。
  • 先看:StudioDesignSurface.tsx 的 DataPillar 加载和 doSave 两处、ConditionBuilder.tsx 行模式的 hold 计数、ObjectValidationsPanel.tsx 的 ruleIndex。
  • 两分钟验证:pnpm --dir ui exec vitest run packages/app-shell/src/views/studio-design/DataPillar.validationVerdictHold-27644.test.tsx,预期 6 个用例全绿。
  • 需要你做的:无,席位落地。

What changes

The panel's verdict count already rides #27629's per-rule kept verdicts, so the hold also survives leaving the tab, and the held line names the rule.

Why

A guard the publish refuses (an ordering compare on a nullable field, record.amount > 100) read clean in the Validations tab and autosaved until Publish refused it. Measured on this branch before the fix: the stored refused guard round-trips as a ROW, so the raw-editor half alone would not hold the card's own shape (ablation 2 below).

Tests

  • New DataPillar.validationVerdictHold-27644.test.tsx, pinned the way PermissionMatrixEditor.serverVerdictHold-27482.test.tsx is: a fake door decides the refusal and serves it in the draft read's _diagnostics; the CEL engine is stubbed to pass every guard, so every hold is the served verdict's. (a) stored refused draft: another edit to the rule is held, no PUT, the message stays; (b) the card flow: the refused guard saves once, its re-read holds the next edit; (c) editing the guard away releases, the save goes out and its clean re-read clears the message; (d) typed back to the judged text before the autosave fires: held again; (e) leaving the tab keeps the hold; control: the rule beside it shows none of it.
  • New ConditionBuilder.serverHold-27644.test.tsx: the row builder shows and reports the served error, editing the row away reports 0, and without verdictPath nothing is read.

Acceptance notes

  • Not reproduced live. The pre-fix behaviour (reads "Valid CEL", PUT 200 until Publish) was not reproduced against a running stack; the ablations below are the before-state evidence.
  • An envelope-form guard is not held. serverHoldAt compares the judged body's value at the path with the text on screen, and a guard stored as an expression envelope (dialect + source) reads as an object there, so it never matches. No producer of envelope-form validation guards was found (none in examples/); the Studio writes a plain string unless the prior value was an envelope. Left as is, not filed.
  • One extra draft read per autosave in the Data pillar, as the Permission matrix already does after each package-door save.
  • StudioDesignSurface.tsx hunks: the shared import block (one name added) and DataPillar only; disjoint from feat(studio): the list-view panel switches between an object's list views, a drafted one included #27988's InterfacesPillar hunks.

Verification

All readings on this branch, against objectstack-ai/objectstack. The final head is 479a7575: this card's six files over origin/main 066ff51e, which already carries #27988.

New tests and ablations
  • pnpm --dir ui exec vitest run packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.serverHold-27644.test.tsx packages/app-shell/src/views/studio-design/DataPillar.validationVerdictHold-27644.test.tsx: Test Files 2 passed, Tests 9 passed.
  • Ablation 1, the served verdict dropped (DraftVerdictContext.Provider value={objVerdict} to value={undefined}, through scripts/ablation-replace.mjs, anchor 1 to 0): DataPillar (a) to (e) fail, the control passes (5 failed, 1 passed). Restored: blob equals HEAD, git diff HEAD empty.
  • Ablation 2, the row builder's count dropped (raw ? celErrors : held.length to raw ? celErrors : 0): both row-builder cases fail, and so do DataPillar (a) and (e), the cases that open the stored refused guard (4 failed, 5 passed). This is the measurement that the stored guard opens as a row. Restored the same way.
Package checks on the final head
  • pnpm --filter @object-ui/app-shell type-check (both tsc projects; tsconfig.test.json compiles the tests): exit 0.
  • 169 test files around the change (ObjectValidationsPanel*, DataPillar*, StudioDesignSurface*, ConditionBuilder*, CelPredicateField*, the serverVerdict* suites), including both new ones: Test Files 169 passed, Tests 1234 passed.
  • eslint on the five changed ui/ files: 0 errors (the warnings are on lines this PR does not touch).
  • pnpm check:new-line-citations: 0 new citations.
  • Narrowed, declared: the whole packages/app-shell/ suite (about 1950 files) was not completed locally; a run passed an hour on the shared box before the second origin/main merge, and was stopped. Test UI in CI runs it.
Derived gates

node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack: 34 commands, the same list at every head. At 23227677 all 34 exit 0, including node scripts/check-sdui-manifest.mjs. The re-run on the final head is reported in the os-dev report on the card.


Generated by Claude Code

@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 Oct 30, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#4 · os-bill · session_01Utp6CbDAucNyQ4UtzCJKyh

席位核对

ACCEPT · head 479a7575ddedf39f610a8fb71f8ace2f63e1b659 · 2026-10-30T09:23Z

  • Shape: draft → main, Fixes #27644. Clause-②: no and Metadata-protocol: none. No new export and no i18n key. The changeset is patch on @object-ui/app-shell.
  • Serial: the blocker lint: a validation rule's expression finding carries the key path validations.N.condition, not prose, so the draft read can address it (#27482 layer 1 of 2) #27643 is closed. The head already contains feat(studio): the list-view panel switches between an object's list views, a drafted one included #27988 (its hunks are in InterfacesPillar), and its delta against origin/main is this card's 6 files.
  • Change, read (6 files, +465/−11):
    • DataPillar keeps the draft read's served _diagnostics and the body they judged. Its fallback is editedItemDiagnostics over the layered read.
    • After each save, DataPillar re-reads the draft through readDraftForSave, which swallows its own error. A sequence ref drops a stale re-read, and every load resets the verdict.
    • Only the Validations tab gets DraftVerdictContext / DraftVerdictBodyContext.
    • ObjectValidationsPanel passes verdictPath = validations.N.<guard> (condition, or when for a conditional rule), where N is the index in the raw draft.validations.
      • readRules keeps object identity, so indexOf(sel) holds.
      • An unsaved rule gets -1, so it has no path and no hold.
      • A reorder can only fail open, because the hold needs the guard to still show the judged text.
    • ConditionBuilder forwards the path to CelPredicateField in raw mode. In row mode, which mounts no CEL editor, it calls the same useServerHoldAt, shows the served messages and counts them as blocking.
    • The reuse is fix(app-shell): a server error at an RLS clause's path holds the permission-set autosave #27612's helpers. draftVerdict.ts and CelPredicateField.tsx are untouched, and there is no second hold and no client copy of the publish rule.
  • Evidence (report 6519253669):
    • The new tests pass 9/9. Ablation 1 (verdict dropped) turns 5 red. Ablation 2 (row-mode count dropped) turns 4 red. Both restore cleanly.
    • On the final head: type-check passes, and 169 related files with 1234 tests pass. Derived gates: 34/34 exit 0, --ran reconciled with 0 unmeasured.
    • The full app-shell run was stopped locally and left to CI's Test UI, which passed 16/16.
  • Deviations, accepted:
    • One name was added to StudioDesignSurface's shared import block.
    • The PR attribution block links the card thread, and the body order follows os-dev.
    • The bug was not reproduced live.
    • Noted and not carded: an envelope-form condition (dialect plus source) is not held.
  • Cost, noted: each autosave now makes one extra draft GET.
  • Gates (check-runs on the head): 44 success, 11 skipped, 0 failure, including Test UI 16/16, Lint UI and Live E2E UI. mergeable_state is clean. NOT governed, 476 changed lines.
  • Landing: non-governed and all green, so the seat lands it with pr_ready and automerge_enable.

Generated by Claude Code

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 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: the Validations tab holds the autosave on a served CEL verdict at the rule's own path, as the RLS arm does (#27482 layer 2 of 2)

1 participant