Skip to content

Commit 551b68e

Browse files
test(daemon): adopt shared lane-envelope for torture lane
Rebase onto main (post-#1441) and replace the lane-local LaneEnvelope dialect with the shared scripts/lib/lane-envelope.ts builder, so the #1430 health watcher parses one schema: commitSha->commit, sourceHash-> configHash, seedRange/runs moved into the typed data payload, and the sweep encoded as seed "<start>-<end>". Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent c5c2c74 commit 551b68e

4 files changed

Lines changed: 41 additions & 34 deletions

File tree

‎.github/workflows/concurrency-torture-nightly.yml‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,10 @@ jobs:
4141
env:
4242
TORTURE_RUNS: ${{ github.event.inputs.runs || '5000' }}
4343
TORTURE_SEED_START: ${{ github.event.inputs.seed-start || '0' }}
44-
# Standard scheduled-lane artifact envelope (#1430): schemaVersion, commit
45-
# SHA, tool/config hashes, seed range, duration, and result. Emitted by the
46-
# test and uploaded below so the observatory can detect a lane going dark.
44+
# Standard scheduled-lane artifact envelope (#1430) built via the shared
45+
# scripts/lib/lane-envelope.ts (commit, tool/configHash, seed range, result);
46+
# the seed sweep rides in the typed data payload. Emitted by the test and
47+
# uploaded below so the freshness watcher can detect a lane going dark.
4748
TORTURE_ENVELOPE: ${{ github.workspace }}/torture-results/envelope.json
4849
steps:
4950
- name: Checkout

‎docs/agents/testing.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,10 @@ replay command. The lane lives under `test/integration/nightly/`, deliberately *
244244
`test:integration:node` glob so it is not an accidental PR-time run: the PR gate runs a fast default
245245
sweep via an explicit `Run seeded concurrency torture lane` step in the Integration job, and the
246246
`Concurrency Torture Nightly` workflow sweeps a much larger seed range on schedule. The nightly run
247-
emits a machine-readable envelope (schema version, commit SHA, tool/config hash, seed range, duration,
248-
result) via `TORTURE_ENVELOPE=<path>`, uploaded as the `concurrency-torture-envelope` artifact. The
247+
emits the shared scheduled-lane envelope (`scripts/lib/lane-envelope.ts`, #1430 — commit,
248+
tool/`configHash` from the lane source hash, `seed` range, duration, result, with the seed sweep in
249+
the typed `data` payload) via `TORTURE_ENVELOPE=<path>`, uploaded as the `concurrency-torture-envelope`
250+
artifact. The
249251
envelope is written once, after **all** lane tests settle, and reports `fail` if any of them (sweep,
250252
replay self-check, or forced-contention guardrail) failed — a later-failing guardrail can never be
251253
published as a passing envelope. Optional knobs: `TORTURE_CLIENTS`, `TORTURE_OPS`.

‎test/integration/nightly/concurrency-torture.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ after(() => {
5454
// measured to this hook, so it can't understate work by excluding later tests.
5555
const envelope = buildEnvelope({
5656
...sweepRange,
57-
durationMs: Date.now() - laneStartedMs,
57+
startedAtMs: laneStartedMs,
5858
result: laneFailed ? 'fail' : 'pass',
5959
});
6060
const written = writeEnvelopeIfRequested(envelope);

‎test/integration/nightly/concurrency-torture/envelope.ts‎

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,31 @@
11
// Standard scheduled-lane artifact envelope (#1430) for the concurrency torture
2-
// lane (#1416). #1430 requires every scheduled lane to emit a machine-readable
3-
// envelope — schema version, commit SHA, tool/config hashes, seed range,
4-
// duration, and result — so the observatory can detect a lane going dark or
5-
// stale. Written when TORTURE_ENVELOPE names an output path (set by the nightly
6-
// workflow, which uploads it as an artifact); a no-op otherwise.
2+
// lane (#1416). Builds the shared `LaneEnvelope` from scripts/lib/lane-envelope.ts
3+
// so the #1430 health watcher parses one dialect, not a lane-local one; the
4+
// lane's seed range / run count ride in the typed `data` payload, and the lane
5+
// source hash maps onto the generic `configHash`. Written when TORTURE_ENVELOPE
6+
// names an output path (set by the nightly workflow, which uploads it as an
7+
// artifact); a no-op otherwise.
78

89
import crypto from 'node:crypto';
910
import fs from 'node:fs';
1011
import path from 'node:path';
1112
import { fileURLToPath } from 'node:url';
13+
import {
14+
laneEnvelope,
15+
type LaneEnvelope,
16+
type LaneResult,
17+
} from '../../../../scripts/lib/lane-envelope.ts';
1218

13-
const ENVELOPE_SCHEMA_VERSION = 1;
19+
const LANE_ID = 'concurrency-torture';
1420

15-
export type LaneEnvelope = {
16-
schemaVersion: number;
17-
lane: string;
21+
export type TortureEnvelopeData = {
1822
issue: number;
19-
commitSha: string | null;
20-
tool: { node: string };
21-
sourceHash: string;
2223
seedRange: { start: number; end: number };
2324
runs: number;
24-
durationMs: number;
25-
result: 'pass' | 'fail';
2625
};
2726

27+
export type TortureEnvelope = LaneEnvelope<TortureEnvelopeData>;
28+
2829
/** Content hash of the lane's own source, so config/tool drift is visible. */
2930
function laneSourceHash(): string {
3031
const dir = path.dirname(fileURLToPath(import.meta.url));
@@ -46,25 +47,28 @@ function laneSourceHash(): string {
4647
export function buildEnvelope(params: {
4748
seedStart: number;
4849
runs: number;
49-
durationMs: number;
50-
result: 'pass' | 'fail';
51-
}): LaneEnvelope {
52-
return {
53-
schemaVersion: ENVELOPE_SCHEMA_VERSION,
54-
lane: 'concurrency-torture',
55-
issue: 1416,
56-
commitSha: process.env.GITHUB_SHA?.trim() || null,
50+
startedAtMs: number;
51+
result: LaneResult;
52+
}): TortureEnvelope {
53+
const end = params.seedStart + params.runs;
54+
return laneEnvelope<TortureEnvelopeData>({
55+
lane: LANE_ID,
56+
commit: process.env.GITHUB_SHA?.trim() || '',
5757
tool: { node: process.version },
58-
sourceHash: laneSourceHash(),
59-
seedRange: { start: params.seedStart, end: params.seedStart + params.runs },
60-
runs: params.runs,
61-
durationMs: params.durationMs,
58+
configHash: laneSourceHash(),
59+
seed: `${params.seedStart}-${end - 1}`,
60+
startedAtMs: params.startedAtMs,
6261
result: params.result,
63-
};
62+
data: {
63+
issue: 1416,
64+
seedRange: { start: params.seedStart, end },
65+
runs: params.runs,
66+
},
67+
});
6468
}
6569

6670
/** Write the envelope to TORTURE_ENVELOPE when set; returns the path or null. */
67-
export function writeEnvelopeIfRequested(envelope: LaneEnvelope): string | null {
71+
export function writeEnvelopeIfRequested(envelope: TortureEnvelope): string | null {
6872
const target = process.env.TORTURE_ENVELOPE?.trim();
6973
if (!target) return null;
7074
fs.mkdirSync(path.dirname(target), { recursive: true });

0 commit comments

Comments
 (0)