Skip to content

test(vscode): wait for file watchers to arm before mutating E2E fixtures - #134

Merged
fi3ework merged 2 commits into
mainfrom
fix/e2e-watcher-readiness
Nov 9, 2026
Merged

fi3ework merged 2 commits into
mainfrom
fix/e2e-watcher-readiness

Conversation

@fi3ework

@fi3ework fi3ework commented Nov 9, 2026

Copy link
Copy Markdown
Member

Summary

Workspace discover suite > Extension should discover workspaces and projects is flaky on Linux in rstack-ecosystem-ci. Adding a workspace folder, or changing configFileGlobPattern, makes detection reinstall its file watchers. The suite renames watched configs about 150 ms later. vscode.FileSystemWatcher has no ready signal, and on Linux the watcher can take several hundred ms to start reporting events. Renames that land before then produce no events, detection never re-runs, and the assertion times out after 20 s.

The suite now checks that the watcher reports events before it changes any fixture files:

 await updateWorkspaceFolders(+workspace-2)        // or config.update('configFileGlobPattern', …)
 await waitFor(tree shows workspace-2)
+await waitForWatcherArmed(<a watched config>)
+  loop: rewrite file with identical content
+        until detection's watcher event count moves (≤500 ms per try, 15 s total)
 await fs.rename(rstest.config.ts → foo.config.ts)
  • DetectionService counts watcher events (monotonic, E2E only), exposed as RstackExtensionExports.getDetectionWatcherEventCount(), next to setDependencyPollIntervalForTest.
  • The probe runs at the two spots in workspace.test.ts that mutate files right after a watcher reinstall. No other E2E suite does this.
  • The probe rewrites the file with unchanged content, so detection's output does not change. The suite uses no fixed sleep.

Evidence

Diagnostic run in rstack-ecosystem-ci with watcher logging (same commit, one red and two green). The only difference is the time between the watcher reinstall and the rename:

run watchers installed → rename delete events after rename
❌ red 492 ms none for 20 s
✅ green 695 ms after 76 ms
✅ green 686 ms after 80 ms
  • Before: main (7f3ccbf) in rstest-ecosystem-ci from-commit runs: 6 failed / 1 passed, each failure being
    [e2e-fail] Workspace discover suite Extension should discover workspaces and projects: AssertionError [ERR_ASSERTION].
  • After: this branch in rstest-ecosystem-ci-selected (suite rstack-editor): 5/5 passed, 0 [e2e-fail].
    These runs used 8174c04. The final commit only stops resetting the counter when watchers are reinstalled, and the probe already compares against its own baseline.
  • pnpm lint passes; pnpm test:unit 420/420; rstest E2E slice passes on macOS and in a linux/arm64 container.

Merge Danger

Door: two-way

Test-only behavior, plus one counter increment in the watcher event handler.

Blast Radius: E2E

RstackExtensionExports gains one E2E-only method. Users see no change.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T04:54:03.196810Z 70ed806 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@fi3ework
fi3ework merged commit 98b2744 into main Nov 9, 2026
3 checks passed
@fi3ework
fi3ework deleted the fix/e2e-watcher-readiness branch November 9, 2026 05:05
Sign up for free to 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