Skip to content

emrg: renderer shell test — waitFor the Edit form name prefill (fix flaky taskUpdate test) - #1038

Merged
argszero merged 1 commit into
masterfrom
feature/fix-flaky-edit-prefill
Aug 27, 2026
Merged

emrg: renderer shell test — waitFor the Edit form name prefill (fix flaky taskUpdate test)#1038
argszero merged 1 commit into
masterfrom
feature/fix-flaky-edit-prefill

Conversation

@argszero

Copy link
Copy Markdown
Owner

Summary

The renderer test 任务行「Edit」→ 表单预填 + name 只读 → 保存 → taskUpdate in emrg/gui/renderer/src/components/Shell.test.tsx was intermittently flaky — it caused a false-red on master CI after #1035.

Root cause

The test asserted name.value === "evo" immediately after waitFor(task-form-dialog). But TaskFormDialog populates the name field via a useEffect (vanilla openTaskForm semantics) that runs after the dialog mounts. Reading name.value before the effect runs returns an empty string. The #1035 polling test (which uses vi.useFakeTimers() + advanceTimersByTime) occasionally shifts timing such that this race surfaces.

This is the same class of timing bug fixed in #1031 (DialogHost rename prefill).

Fix

Wrap the prefill assertion in waitFor so the effect has populated the field before reading it:

awaitwaitFor(()=>expect(name.value).toBe("evo"));

Verification

  • emrg/gui/renderernpm run typecheck — clean
  • emrg/gui/renderernpx vitest run — 442/442 pass (no test count change; this is a robustness fix)
  • emrg/gui/renderernpx vitest run src/components/Shell.test.tsx — 24/24 pass

@argszero
argszeroforce-pushed the feature/fix-flaky-edit-prefill branch from 3fa39e0 to 186e007CompareAugust 27, 2026 04:01
@argszero

Copy link
Copy Markdown
OwnerAuthor

Rebased this PR onto the current master (after #1035 and #1036 merged) so it applies cleanly. The change is isolated to Shell.test.tsx: the Edit test read name.value immediately after the task-form dialog appeared, but TaskFormDialog populates name via a useEffect that runs after mount. Under the #1035 polling test's fake-timer timing this occasionally read the prefill late, causing a false-red master CI. The fix wraps the assertion in waitFor — the same pattern as #1031. Renderer count stays 445 (no test added, robustness-only). CI green, MERGEABLE/CLEAN.

…laky taskUpdate test)
The '任务行 Edit' test read name.value immediately after the dialog appeared,
but TaskFormDialog populates the name via a useEffect that runs after mount.
Under #1035's fake-timer polling test timing, this could read the prefill
late and flake (false-red master CI). Wrap the prefill assertion in waitFor
(identical to the #1031 DialogHost rename fix).
@argszero
argszeroforce-pushed the feature/fix-flaky-edit-prefill branch from 186e007 to 89d9e0dCompareAugust 27, 2026 04:14
@argszero

Copy link
Copy Markdown
OwnerAuthor

Rebased again after #1037 merged (the fork base predated it, so its Agent.md still showed GUI 89 — would have silently reverted the boot-contract count). Rebased onto master d3e87af: the diff is now a clean single-file change to Shell.test.tsx (the waitFor-prefill fix, +4/-1); Agent.md GUI stays 92 (boot-contract preserved) and renderer stays 445. Doc-count guard 4/4, Shell test 24/24, renderer 445/445. CI 33038788769 green (test + test-windows), MERGEABLE/CLEAN.

@argszeroargszero left a comment

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle 122224. Rebased onto master d3e87af, single-file change to Shell.test.tsx (waitFor the Edit form prefill, +4/-1), Agent.md GUI stays 92 / renderer stays 445, doc-count guard 4/4 passes locally, CI 33038788769 green (test + test-windows), MERGEABLE/CLEAN. Robustness-only fix, correct waitFor pattern.

@argszeroargszero left a comment

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle 123632. Re-verified head 89d9e0d unchanged (2nd consecutive approval, no ❌ in between). Single-file fix to Shell.test.tsx wrapping the task-form-name prefill assertion in waitFor (correct pattern mirroring #1031; TaskFormDialog populates name via a post-mount useEffect). CI 33038788769 green (test + test-windows), MERGEABLE/CLEAN. Robustness-only, no test count change.

@argszeroargszero left a comment

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle 124605. 3rd consecutive approval (122224→123632→124605, no ❌ in between). Re-verified head 89d9e0d unchanged, CI 33038788769 green (test + test-windows), MERGEABLE/CLEAN. Single-file robustness fix (waitFor the useEffect-populated Edit prefill), correct pattern mirroring #1031. Merge gate satisfied — proceeding to merge.

@argszero
argszero merged commit c8d3595 into masterAug 27, 2026
2 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@argszero