mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-03 07:18:03 +01:00
test: eight flaky-test repairs and five failure diagnostics from the 2026-11-01 flaky pass (GSTA-240)
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
83ae96e086
commit
fbbec20967
20 files changed
+164
-29
No files matched your search
@@ -5,8 +5,10 @@
|
||||
* the real home before and after each free shard, and names the shard's files
|
||||
* when one of those entries changed. It watches only these surfaces; it is not
|
||||
* a universal write-containment check. Live agent-session logs that a
|
||||
* concurrently running host keeps writing are excluded, and directory mtimes
|
||||
* are ignored, so only file, link and directory-set changes count.
|
||||
* concurrently running host keeps writing are excluded, as is the one lane log
|
||||
* `gstack-evidence run` tees this run's own output into (its exact path, from
|
||||
* GSTACK_EVIDENCE_LOG). Directory mtimes are ignored, so only file, link and
|
||||
* directory-set changes count.
|
||||
*
|
||||
* A shard that runs alone owns its window, so its guard names its files.
|
||||
* Concurrent shards share one HOME and cannot tell whose write a change was, so
|
||||
@@ -104,6 +106,7 @@ export type FreeHomeGuardFactory = (files: string[], env: NodeJS.ProcessEnv, sta
|
||||
/** Take the baseline now; verify() returns null or the failure to report. */
|
||||
export function guardFreeHome(files: string[], env: NodeJS.ProcessEnv = process.env, scope: FreeHomeScope = { kind: 'shard' }): FreeHomeGuard {
|
||||
const home = freeHomeDir(env);
|
||||
const ownLog = env.GSTACK_EVIDENCE_LOG && path.isAbsolute(env.GSTACK_EVIDENCE_LOG) ? path.relative(home, env.GSTACK_EVIDENCE_LOG) : null;
|
||||
const unreadable = (error: unknown) => `real home surfaces could not be snapshotted (${(error as NodeJS.ErrnoException).code ?? 'error'}); shard files: ${files.join(', ')}`;
|
||||
let before: FreeHomeSnapshot | undefined;
|
||||
let baselineError: string | undefined;
|
||||
@@ -112,7 +115,7 @@ export function guardFreeHome(files: string[], env: NodeJS.ProcessEnv = process.
|
||||
verify() {
|
||||
if (!before) return baselineError!;
|
||||
try {
|
||||
const changed = diffFreeHome(before, snapshotFreeHome(home));
|
||||
const changed = diffFreeHome(before, snapshotFreeHome(home)).filter(entry => entry !== ownLog);
|
||||
return changed.length ? formatFreeHomeChange(changed, files, scope) : null;
|
||||
} catch (error) { return unreadable(error); }
|
||||
},
|
||||
|
||||
@@ -1325,6 +1325,10 @@ function trackShardBrowser(stateDir: string, env: NodeJS.ProcessEnv) {
|
||||
check(operation);
|
||||
if (!Number.isSafeInteger(pid) || (pid as number) <= 1) throw new BrowserCleanupError('invalid browser child identity');
|
||||
const identity = identities.get(pid as number);
|
||||
if (!identity && identities.get(daemon as number)?.root) {
|
||||
if (!await inspect(operation, pid as number)) return;
|
||||
throw new BrowserCleanupError(`browser child ownership is unconfirmed: recorded pid ${pid} is alive outside daemon ${daemon}'s process tree`);
|
||||
}
|
||||
if (!identity || identity.daemon !== daemon || identity.root) throw new BrowserCleanupError('browser child ownership is unconfirmed');
|
||||
if (await live(operation, identity) && (typeof start !== 'string' || !start
|
||||
|| await nativeStart(operation, identity) !== start.replace(/\s+/g, ' '))) throw new BrowserCleanupError('browser child identity was replaced');
|
||||
|
||||
Reference in new issue
Block a user