Repository navigation
fix(ci): remove the shared root causes of flaky Windows CI #7107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9e93f72
fix(test-teardown): settle un-awaited background work before removing…
190c35b
fix(responses): serialize snapshot follow-up scheduling with shutdown
043f4ee
fix(config): track the config-dir ACL harden as background work
679d0f9
fix(cli): reject occupied auxiliary ports before private startup work
6605bf2
fix(tray): retain timed-out probes until asynchronous reaping
6b1f744
fix(config): preserve Windows ACL memo across repeated reads
1d6d35c
test: bound child exit and pipe waits in slow-spawn cases
0fa474d
fix(ci): share one transpiler cache per shard; widen the DPAPI PowerS…
b01d757
test(desktop-egress): give each proxy variable one spelling on Windows
18895e5
fix(test-teardown): never remove or exit under live tracked work; add…
lidge-jun File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| import type { OcxConfig } from "../types"; | ||
| import { AuxiliaryListenerBindError } from "../server/ports"; | ||
| import { createServer } from "node:net"; | ||
|
|
||
| /** | ||
| * Reject impossible auxiliary binds before startup creates private state. On Windows | ||
| * that publication requires several synchronous ACL subprocesses. This is only an | ||
| * early rejection: startServer still owns the actual bind and transactional rollback | ||
| * if another process takes the port between this probe and startup. | ||
| */ | ||
| export async function assertAuxiliaryListenerPortsAvailable(config: OcxConfig): Promise<void> { | ||
| const loopback = config.unauthenticatedLoopbackListener; | ||
| const management = config.runtimeRole === "hub" ? config.hub?.managementIngress : undefined; | ||
| const targets = [ | ||
| { listener: "unauthenticatedLoopbackListener", port: loopback?.enabled ? loopback.port : undefined }, | ||
| { listener: "hub.managementIngress", port: management?.enabled ? management.port : undefined }, | ||
| ] as const; | ||
| // Each probe releases its socket, so two listeners configured for one port would both | ||
| // pass and startup would still fail on the second bind. Reject the collision directly. | ||
| if (targets[0].port !== undefined && targets[0].port === targets[1].port) { | ||
| throw new AuxiliaryListenerBindError( | ||
| "hub.managementIngress", targets[1].port, "127.0.0.1", | ||
| new Error("port is also configured for unauthenticatedLoopbackListener"), | ||
| ); | ||
| } | ||
| for (const { listener, port } of targets) { | ||
| // The port-less companion shares the public bind; it has no independent target. | ||
| if (port === undefined) continue; | ||
| await new Promise<void>((resolve, reject) => { | ||
| const probe = createServer(socket => socket.destroy()); | ||
| const fail = (cause: unknown) => reject(new AuxiliaryListenerBindError(listener, port, "127.0.0.1", cause)); | ||
| probe.once("error", fail); | ||
| probe.once("listening", () => probe.close(error => error ? fail(error) : resolve())); | ||
| try { probe.listen({ port, host: "127.0.0.1" }); } catch (error) { fail(error); } | ||
| }); | ||
| } | ||
| } | ||
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| /** | ||
| * Fire-and-forget work the process started and nobody awaits. | ||
| * | ||
| * A lazy quota prime or a startup reconcile is deliberately left running behind a | ||
| * request so the request never waits on it. The work still owns files: the pool | ||
| * prime holds the native-main claim database open across ACL hardening and a WHAM | ||
| * read. Whoever later removes the directory those files live in has to wait for the | ||
| * owner. Without a handle on the work there was nothing to wait for: test teardown | ||
| * spun a synchronous retry loop, which blocks the very event loop the owner needs to | ||
| * reach its `finally` and close the file. On Windows every overlap became a 15 s EBUSY. | ||
| * | ||
| * Registering costs one Set entry per in-flight task and changes nothing about how | ||
| * the work runs. Settling is opt-in: test teardown calls it; requests never do. | ||
| */ | ||
|
|
||
| interface BackgroundWork { | ||
| readonly label: string; | ||
| readonly settled: Promise<void>; | ||
| } | ||
|
|
||
| const inFlight = new Set<BackgroundWork>(); | ||
|
|
||
| /** Record `work` until it settles and return it unchanged. Rejections stay the caller's. */ | ||
| export function trackBackgroundWork<T>(label: string, work: Promise<T>): Promise<T> { | ||
| const entry: BackgroundWork = { | ||
| label, | ||
| settled: work.then(() => { inFlight.delete(entry); }, () => { inFlight.delete(entry); }), | ||
| }; | ||
| inFlight.add(entry); | ||
| return work; | ||
| } | ||
|
|
||
| /** Labels of work still running, for diagnostics. */ | ||
| export function pendingBackgroundWork(): string[] { | ||
| return [...inFlight].map(entry => entry.label); | ||
| } | ||
|
|
||
| export interface BackgroundWorkSettlement { | ||
| readonly settled: boolean; | ||
| readonly pending: string[]; | ||
| } | ||
|
|
||
| /** | ||
| * Wait until no tracked work is in flight, including work started by work that was | ||
| * already running. A bounded wait reports what is still running instead of throwing, | ||
| * so the caller decides whether that is fatal. | ||
| */ | ||
| export async function settleBackgroundWork(options: { timeoutMs?: number } = {}): Promise<BackgroundWorkSettlement> { | ||
| const deadline = options.timeoutMs === undefined ? Infinity : Date.now() + options.timeoutMs; | ||
| while (inFlight.size > 0) { | ||
| const remaining = deadline - Date.now(); | ||
| if (remaining <= 0) break; | ||
| const batch = Promise.all([...inFlight].map(entry => entry.settled)).then(() => false); | ||
| if (remaining === Infinity) { | ||
| await batch; | ||
| continue; | ||
| } | ||
| let timer: ReturnType<typeof setTimeout> | undefined; | ||
| const expired = new Promise<boolean>(resolve => { timer = setTimeout(() => resolve(true), remaining); }); | ||
| const timedOut = await Promise.race([batch, expired]); | ||
| clearTimeout(timer); | ||
| if (timedOut) break; | ||
| } | ||
| return { settled: inFlight.size === 0, pending: pendingBackgroundWork() }; | ||
| } |
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.