Repository navigation
fix: await connector record persistence before asserting in WebKit test (build fix for vscode-engineering#3992) - #338170
Merged
Joaquín Ruales (jruales) merged 1 commit intoSep 27, 2026
Conversation
Replace the timer-based wait with a deterministic wait on onDidChange until the connector record is persisted, fixing a flaky assertion race against SHA-256 record-ID computation. Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused test-only change correctly eliminates the asynchronous persistence race.
Review effort: Balanced
Findings: None
What changed in this PR
Replaces a timing-dependent test delay with deterministic event-based synchronization.
Changes:
- Waits until the connector record is observable before asserting.
- Preserves existing persistence and install-state assertions.
| File | Description |
|---|---|
src/vs/workbench/contrib/chat/test/browser/aiCustomization/customizationMarketplaceInstallService.test.ts |
Synchronizes the connector persistence test with onDidChange. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Paul (pwang347)
approved these changes
Sep 27, 2026
Paul (pwang347)
marked this pull request as ready for review
September 27, 2026 03:51
TylerLeonhardt
approved these changes
Sep 27, 2026
Joaquín Ruales (jruales)
approved these changes
Sep 27, 2026
Joaquín Ruales (jruales)
merged commit Sep 27, 2026
c61fa34
into
microsoft:main
36 of 38 checks passed
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Build failure
The macOS WebKit browser unit test suite failed on a single assertion in
CustomizationMarketplaceInstallService:The browser exited cleanly (code 0); the runner returned 1 solely for this assertion.
Root cause
The test (
records a connector that was already connected outside this workbench) marks a connector as connected, fires the change event, then waits onlyawait timeout(0)before asserting that a record was persisted.The listener registered in
updateEnablement()responds by callingvoid this.synchronizeConnectedConnectorRecords(). That method computes the record id viacreateConnectorRecord(), which awaitscreateInstallationRecordId(...)— an asynccrypto.subtle.digest('SHA-256', ...)— before callingrecordStore.upsert(). A single macrotask (timeout(0)) does not guarantee that the digest promise has resolved and the upsert has run, so on slower/async digest completion the recorded-resource list is still empty when the assertion runs.getInstallState()can returninstalleddirectly from the connector's connection status without a stored record, which is why the state assertion passed whilerecordedwas empty. This is a test synchronization defect, not a product regression.How the fix works
Instead of a fixed timer, the test now waits deterministically for the persistence to complete using the same pattern already established throughout this file (
Event.toPromise(Event.filter(service.onDidChange, ...))):recordStore.upsert()triggersrecordStore.onDidChange, which fires the service'sonDidChange. The test therefore proceeds only once the connector record is actually persisted, regardless of how long the SHA-256 digest takes. Both original assertions (recorded resources and installed state) are preserved unchanged.Rollback evaluation
Recommendation: Do not roll back. Public culprit: not confirmed (strong suspect: the commit that introduced the timer-based assertion and async persistence path, #337649, but not verified by reproduction or bisect). Rationale: only one CI assertion is affected and no product data loss is established; a bounded, forward test-synchronization fix is far lower risk than reverting a broad feature with runtime integration. Owners to consult:
@pwang347.Validation
Change is a focused edit to a single test. Repository dependencies were not installed in this environment, so
npm-based typecheck/test runs could not be executed here. The edit usesEvent/Event.toPromise/Event.filter, all already imported and used repeatedly in this file, and preserves the existing assertions. Recommended local validation: run this suite under WebKit, e.g.npm run test-browser-no-install -- --build --browser webkitfiltered toCustomizationMarketplaceInstallService.Risk
Low. Test-only change; no production code touched. The deterministic wait matches the file's existing idiom and cannot mask a real failure because it still requires the record to be persisted before asserting.
Recommended reviewer
Recommended owner:
@pwang347Fixes microsoft/vscode-engineering#3992