Skip to content

test(app-shell): the hooks panel's AI-draft discard case waits out the AI label instead of reading it once - #38887

Merged
objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-urndkx
Dec 1, 2026
Merged

objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-urndkx

Conversation

@huangyiirene

Copy link
Copy Markdown
Collaborator

Requested by Irene · project thread

Fixes #38877

What changes

ui/packages/app-shell/src/views/studio-design/ObjectHooksPanel.aiDraftNotice-36660.test.tsx, case
"discard with nothing unsaved asks nothing, drops that one hook's draft at its package, and the live hook is back":
the last check, a synchronous expect(screen.queryByText('Guard (AI)')).toBeNull(), becomes
await waitFor(() => expect(screen.queryAllByText('Guard (AI)')).toHaveLength(0), { timeout: 8000 }).
This is the same wait the sibling case ("discard over an unsaved edit, confirmed") already uses. Test only:
no product code changes, and no changeset.

Why

The 4-hourly full run on 6d163f41 (run 46603840101,
Test UI (11/16)) failed this case at line 170: Found multiple elements with the text: Guard (AI). The two elements
CI printed are a 12px span and the open hook's header div.

No commit in the card's range causes it.

The race. After the discard, discardAiDraft clears the AI mark and bumps the list nonce. The list re-read then
setListeds the published row, and that commit draws the list row as "Guard". The open hook is re-buffered by the
install effect (useEffect on [selected, hooks, refusedHooks] in objectHooksBuffer.ts), which runs one commit later.
findAllByText('Guard') resolves on the first commit. I logged the DOM at that point on three runs, and every run showed
the same thing:

'Guard'      -> <span class="min-w-0 flex-1 truncate font-medium">Guard</span>
'Guard (AI)' -> <span class="min-w-0 flex-1 truncate text-[12px] font-medium">Guard (AI)</span>
                <div class="mt-1 truncate text-sm font-medium" title="Guard (AI)">Guard (AI)</div>
notice present: false

These are exactly the two elements in the CI failure. The next line, waitFor on the notice, passes on its first check,
so the case passed only when that wait's closing setTimeout(0) drain let React's scheduler (setImmediate) flush the
effect first. On a loaded runner the timer can come first.

Forced. I preloaded a module into the vitest workers (NODE_OPTIONS=--import) that delays setImmediate by 30 ms,
so React's scheduled work lands after a setTimeout(0), the order a loaded runner can give:

forced normal
before (main) 1 failed, 6 passed: the same Found multiple elements … Guard (AI) at line 170 7 passed
after (this PR) 7 passed 7 passed (3 runs)

The one-commit gap between the list and the buffer is a passing frame the user never acts in, so the product stays
as it is.

Verification

  • The file, normal: 7/7, three runs.
  • The file under the forced ordering: 7/7 (main: 1 failed, the CI error).
  • eslint on the file: exit 0.
  • Commit trailer check (pre-push): passed.

Clause-②: no
Metadata-protocol: none

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. (none added)
  • 3. No formatter ran; pnpm lint passes. (eslint on the touched file)
  • 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. (test only: publishes nothing)
  • 6. packages/spec touched: its generated artifacts are regenerated and committed. (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

…e AI label instead of reading it once

After the discard, the list row turns to the live label one React commit
before the open hook is re-buffered by its install effect. The case read
"Guard (AI)" synchronously right after the notice wait, so it passed only
when that wait's drain happened to let the effect land first; on a loaded
runner it did not. The check is now a waitFor, as in the sibling case.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J8VVAnxMUbgzuoQZg8tcJP
@huangyiirene huangyiirene self-assigned this Dec 1, 2026
@objectstack-fleet objectstack-fleet Bot added the skip-changeset PR has no user-facing published change; bypasses the changeset gate label Dec 1, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor

repo:objectstack@huangyiirene · huangyiirene · session_01J8VVAmaT5PwLmXgonaxjYG

维护者速读

  • 改了什么:一个 UI 测试(Hooks 面板「丢弃 AI 草稿」用例)的最后一句断言改为等待 AI 标签消失,而不是只读一次;与相邻用例同样的等待。不改产品代码。
  • 为什么改:卡 4-hourly full run: red on main (CI) #38877(p0),main 的全量测试在该用例偶发红:列表先重绘、打开的 hook 晚一帧才重装,同步断言撞上这一帧。
  • 风险与回滚:仅测试 +3/-1;撤回本 PR 即恢复。
  • 先看:ObjectHooksPanel.aiDraftNotice-36660.test.tsx 第 170 行附近。
  • 两分钟验证:本 head 上 CI 全绿(Check Changeset 的旧失败已被加 skip-changeset 后的同名运行取代)。
  • 需要你做的:无。非 governed,4 行,按 Tier S 由座位落地。

席位意见:同意落地。

席位核对

ACCEPT · repo:objectstack@huangyiirene · PR #38887 @ 1535cef300 (card #38877, claim 7306613268). Checked against GitHub, not the reports.

  • 形态 Shape: draft, base main, Fixes #38877. One file, ui/packages/app-shell/src/views/studio-design/ObjectHooksPanel.aiDraftNotice-36660.test.tsx, +3/-1, in the claimed surface: the final synchronous queryByText('Guard (AI)') absence check becomes a waitFor on queryAllByText('Guard (AI)') having length 0, the wait its sibling case already uses. No product code.
  • 前提实测 Premise: run 46603840101 Test UI (11/16) failed this case at line 170 with "Found multiple elements with the text: Guard (AI)". The thread's reading clears fix(app-shell): a Studio item page drops its draft marks when the item is published outside the tab #38860 (ResourceEditPage.tsx is not in the test's 209-module import graph) and places the race in the one-commit gap between the list re-read and the open hook's re-install effect, logged on three runs.
  • 门禁 check-runs: on this head 37 success, 22 expected skip, 0 pending (pr-state.mjs). l1-face.mjs flags one failure, Check Changeset run 142534422460 (09:28Z); after skip-changeset was added, the same-named run 142536956044 (09:30Z) is skipped by the job's own label condition and is the newest run of that name. mergeable_state clean; the branch is 0 commits behind main.
  • L1 sentence read: the one changed assertion still asserts the final absence of the draft label; it only stops reading it on the intermediate commit. Clean.
  • 接受的偏差 Accepted deviations: none.
  • 范围外去向 Out of scope: os-support-ai's released claim (7307348083) keeps a backup branch claude/issue-38877-hooks-ai-draft-discard @ 1bca1bde with no PR; nothing to fold in.
  • 落地条款 Landing: no contract review owed (Clause-②: no, Metadata-protocol: none, test only). check-governed-merges.mjs --pr 38887: NOT governed, 4 lines ≤ 3000. Tier S: the seat lands it with label-write --land.

@objectstack-fleet

Copy link
Copy Markdown
Contributor

repo:objectstack@huangyiirene · huangyiirene · session_01J8VVAmaT5PwLmXgonaxjYG

2026-12-01T10:00Z · Landing · PR #38887 @ 1535cef300 (ACCEPT 7307519023)

Probe Reading
check-governed-merges.mjs --pr 38887 NOT governed (0 of 1 path), 4 changed lines ≤ 3000
landing-k.mjs --pr 38887 not read (a ui test-only diff runs no Test Core shard); git reads the branch 0 commits behind main, under 15
pr-state.mjs --pr 38887 37 success, 22 expected skip, 0 pending; the 09:28Z Check Changeset failure superseded by its skipped same-name run after skip-changeset; mergeable_state clean

State change: ready for review + auto-merge (Tier S, seat landing). Card #38877 (p0) closes on merge via Fixes #38877.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/xs skip-changeset PR has no user-facing published change; bypasses the changeset gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4-hourly full run: red on main (CI)

2 participants