mirror of
https://github.com/callstack/agent-device.git
synced 2026-09-14 20:06:34 +08:00
885c1486bb
* test(ci): single-retry policy for enumerated contention-flaky files * fix: satisfy fallow * test(ci): read failures through a lane reporter so timeouts stay distinguishable * test(ci): cover the lane reporter and drop its duplicated boilerplate * chore(fallow): own the retry lane's tool-loaded export seams * test(ci): block retries on non-test failures and classify timeouts structurally * test(ci): decide retry eligibility from runner metadata and route gate verdicts through blockers * refactor(ci): name the retry policy's rules in code instead of comments * test(ci): mark runner-aborted timeouts inside the runner instead of inferring them * test(ci): make timeout provenance a per-run secret, not a writable flag Cover direct task.meta mutation in the real child-Vitest fixture gate. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * test(ci): retry the failed files in the first run's project and coverage modes Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix: drop deleted repo-health file from the retry list after #1480 Rebase onto main post-#1480: the SkillGym/repo-health descope deleted scripts/repo-health/run.test.ts, whose CONTENTION_RETRY_FILES entry would now fail this PR's own missing-file check, and inlined the slow-test budgets into the reporter, resolving the budgets-module import. Envelope comments now point at scripts/lib/lane-envelope.ts instead of the closed #1430. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FUv7bvbWNryuXgSBuqTtep --------- Co-authored-by: Michał Pierzchała <thymikee@gmail.com> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com>
32 lines
1.3 KiB
TypeScript
32 lines
1.3 KiB
TypeScript
// Marks, from inside the runner, every test the runner itself aborted at its
|
|
// timeout — the only failures the contention retry lane (#1419) may rerun.
|
|
//
|
|
// `context.signal` is the runner's own AbortSignal: only the runner holds its
|
|
// controller, and it aborts with the timeout error it raised. A test body can
|
|
// throw whatever it likes, including the runner's exact timeout text, without
|
|
// ever aborting the signal.
|
|
//
|
|
// The mark is the run's secret, taken out of the environment here — before any
|
|
// test module is imported — so a test writing `task.meta` has nothing to write.
|
|
|
|
import { beforeEach, onTestFailed } from 'vitest';
|
|
import { RUNNER_TIMEOUT_META, takeRunnerTimeoutToken } from './lib/runner-timeout-meta.ts';
|
|
|
|
const TOKEN = takeRunnerTimeoutToken(process.env);
|
|
|
|
/** Distinguishes the timeout abort from a run cancellation, on the runner's own reason. */
|
|
const RUNNER_TIMEOUT_REASON = /^(Test|Hook) timed out in \d+ms\./;
|
|
|
|
function abortedByRunnerTimeout(signal: AbortSignal): boolean {
|
|
if (!signal.aborted || !(signal.reason instanceof Error)) return false;
|
|
return RUNNER_TIMEOUT_REASON.test(signal.reason.message);
|
|
}
|
|
|
|
beforeEach(({ signal, task }) => {
|
|
onTestFailed(() => {
|
|
if (TOKEN && abortedByRunnerTimeout(signal)) {
|
|
(task.meta as Record<string, unknown>)[RUNNER_TIMEOUT_META] = TOKEN;
|
|
}
|
|
});
|
|
});
|