@botbuddy/cli 1.124.1 → 1.126.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/daemon/bin/darwin-arm64/botbuddy-daemon +0 -0
- package/daemon/bin/linux-x64/botbuddy-daemon +0 -0
- package/daemon-release/darwin-arm64.json +4 -4
- package/daemon-release/linux-x64.json +4 -4
- package/daemon-release/manifest.json +5 -5
- package/package.json +1 -1
- package/src/release-notes.mjs +78 -4
- package/src/run.mjs +7 -2
- package/src/test-lane-events.mjs +4 -0
- package/src/test-lane.mjs +66 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.126.0
|
|
4
|
+
|
|
5
|
+
- BOT-3262: `bb release-notes tour --release <version> [--customer <name>] [--out <file>]` prints a production release's internal testing tour as Markdown (version, commit and readiness as recorded; quick start; who checks what; numbered checks from each note's tour fields with a Pass / Issue / Not available result line; a change finder). `bb release-notes tour submit --release <version> <outline.json>` stores the release's `bbrn-tour-1` outline; an outline that names a note outside the release or leaves one out is refused with the notes listed.
|
|
6
|
+
|
|
7
|
+
## 1.125.0
|
|
8
|
+
|
|
9
|
+
- BOT-3691: `.botbuddy/lanes.json` lanes may declare `"advisory": true` and `"capacity": "none"`. An advisory lane's run is created with `advisory: true` (stamped as `metadata.advisory` on the test run), registered as `--category other --kind other` instead of `validation` / `full_suite`, and its `.botbuddy/test-runs/` summary carries `advisory: true`, so it never reaches `test_executions`, never counts toward the full-suite rerun block, and `publish_evidence` refuses it. `capacity: "none"` is recorded on the run; the lane's child gets `BOTBUDDY_LANE_CAPACITY=none` and `BOTBUDDY_LANE_ADVISORY=1` (both always set, empty when undeclared). A non-boolean `advisory`, a `capacity` other than `"none"`, and an advisory lane that is a result-bearing gate lane in `.botbuddy/telemetry-manifest.json` (`advisory_gate_lane`) are refused before any run is created, and so is an advisory lane whose `.botbuddy/telemetry-manifest.json` cannot be read (`gate_manifest_unreadable`). Lanes that declare neither field are unchanged. An older CLI ignores both fields and records such a lane as before (a full suite); see the PR for why that is accepted.
|
|
10
|
+
|
|
3
11
|
## 1.124.1
|
|
4
12
|
|
|
5
13
|
- BOT-3700: a fleet host now applies a stack's migrations with `supabase db push --local --include-all`, as staging and production do. A lease that re-adopts a warm stack no longer fails at `stage=schema` when the branch gained a migration older than one the stack already held. A remaining migration-history refusal is named on the provision failure as `history=out_of_order` or `history=missing_local`.
|
|
Binary file
|
|
Binary file
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"release_version": "1.
|
|
3
|
-
"source_commit": "
|
|
4
|
-
"source_sha256": "
|
|
2
|
+
"release_version": "1.126.0",
|
|
3
|
+
"source_commit": "d69762d62748e644a185c9e3d1d965311a5df397",
|
|
4
|
+
"source_sha256": "5b796ee978662cfd5c7534d26766848a507cf3ad3a4b610e93382fa622644ae5",
|
|
5
5
|
"target": "darwin-arm64",
|
|
6
|
-
"sha256": "
|
|
6
|
+
"sha256": "2059d4fb0dc1c2111f37e4180f290e1a2865b3d8fa21d4fa58d86f0d12b6a6a7"
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"release_version": "1.
|
|
3
|
-
"source_commit": "
|
|
4
|
-
"source_sha256": "
|
|
2
|
+
"release_version": "1.126.0",
|
|
3
|
+
"source_commit": "d69762d62748e644a185c9e3d1d965311a5df397",
|
|
4
|
+
"source_sha256": "5b796ee978662cfd5c7534d26766848a507cf3ad3a4b610e93382fa622644ae5",
|
|
5
5
|
"target": "linux-x64",
|
|
6
|
-
"sha256": "
|
|
6
|
+
"sha256": "49cca079b456244077e923e1903a30235df3b33077a12b41f6452fcd27a49321"
|
|
7
7
|
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema_version": 1,
|
|
3
|
-
"release_version": "1.
|
|
4
|
-
"source_commit": "
|
|
5
|
-
"source_sha256": "
|
|
3
|
+
"release_version": "1.126.0",
|
|
4
|
+
"source_commit": "d69762d62748e644a185c9e3d1d965311a5df397",
|
|
5
|
+
"source_sha256": "5b796ee978662cfd5c7534d26766848a507cf3ad3a4b610e93382fa622644ae5",
|
|
6
6
|
"targets": {
|
|
7
7
|
"darwin-arm64": {
|
|
8
8
|
"goos": "darwin",
|
|
9
9
|
"goarch": "arm64",
|
|
10
10
|
"binary": "daemon/bin/darwin-arm64/botbuddy-daemon",
|
|
11
|
-
"sha256": "
|
|
11
|
+
"sha256": "2059d4fb0dc1c2111f37e4180f290e1a2865b3d8fa21d4fa58d86f0d12b6a6a7",
|
|
12
12
|
"mode": "0755"
|
|
13
13
|
},
|
|
14
14
|
"linux-x64": {
|
|
15
15
|
"goos": "linux",
|
|
16
16
|
"goarch": "amd64",
|
|
17
17
|
"binary": "daemon/bin/linux-x64/botbuddy-daemon",
|
|
18
|
-
"sha256": "
|
|
18
|
+
"sha256": "49cca079b456244077e923e1903a30235df3b33077a12b41f6452fcd27a49321",
|
|
19
19
|
"mode": "0755"
|
|
20
20
|
}
|
|
21
21
|
}
|
package/package.json
CHANGED
package/src/release-notes.mjs
CHANGED
|
@@ -16,6 +16,8 @@ export const RELEASE_NOTES_USAGE = `Usage: bb release-notes submit <note.json> [
|
|
|
16
16
|
bb release-notes digest --release <version|run-id> --voice internal|external [--environment production|staging] [--format markdown|json|slack|discord|github-release] [--repository owner/name] [--json]
|
|
17
17
|
bb release-notes digest --candidate <sha> --repository owner/name --voice internal [--format …] [--json]
|
|
18
18
|
bb release-notes pack --release <version> [--format md] [--customer <name>] [--repository owner/name] [--out <file>] [--json]
|
|
19
|
+
bb release-notes tour --release <version> [--format md] [--customer <name>] [--repository owner/name] [--out <file>] [--json]
|
|
20
|
+
bb release-notes tour submit --release <version> <outline.json> [--repository owner/name] [--json]
|
|
19
21
|
bb release-notes grants list [--tenant <slug>] [--json]
|
|
20
22
|
bb release-notes grants add <email> <submit|manage> [--tenant <slug>] [--json]
|
|
21
23
|
bb release-notes grants remove <email> <submit|manage> [--tenant <slug>] [--json]
|
|
@@ -149,6 +151,19 @@ and UI. --customer keeps the changes that customer raised. --out writes a file
|
|
|
149
151
|
only you can read. The pack is internal: do not send it outside your company.
|
|
150
152
|
Refusals: customer_unknown and the digest's refusals.
|
|
151
153
|
|
|
154
|
+
Tour (BOT-3262). tour prints the internal testing tour for one production
|
|
155
|
+
release as Markdown: version, commit and readiness as recorded, a quick start,
|
|
156
|
+
who checks what, numbered checks from each note's tour fields (Find it, Try,
|
|
157
|
+
Look for, Watch) with a Pass / Issue / Not available result line, and a change
|
|
158
|
+
finder that maps every change except Chores to a check or an operational
|
|
159
|
+
location. Suggested checks are not PASS claims. --customer keeps the checks with
|
|
160
|
+
a change that customer raised. tour submit stores the release's outline
|
|
161
|
+
(bbrn-tour-1, docs/release-notes/bbrn-tour-1.schema.json): section titles, the
|
|
162
|
+
check order, which notes each check covers, the quick start and operational
|
|
163
|
+
locations. Write it yourself; BotBuddy never groups notes. Submitting again adds a
|
|
164
|
+
revision. Refusals: outline_note_outside_release and outline_note_missing (both
|
|
165
|
+
list the notes), schema_invalid (names the field) and the pack's refusals.
|
|
166
|
+
|
|
152
167
|
Exit codes: 0 stored or read · 1 refused or not found · 2 usage · 3 authentication · 5 BotBuddy unreachable.
|
|
153
168
|
|
|
154
169
|
Viewer keys and origins (tenant owners, BOT-3158):
|
|
@@ -183,6 +198,9 @@ export async function cmdReleaseNotes(args, {
|
|
|
183
198
|
if (args[0] === "digest") return await cmdDigest(args.slice(1), { resolveAuth, call, log, errorLog, write, isTTY });
|
|
184
199
|
// BOT-3261: the internal release pack.
|
|
185
200
|
if (args[0] === "pack") return await cmdPack(args.slice(1), { resolveAuth, call, log, errorLog, write, writeFile, isTTY });
|
|
201
|
+
// BOT-3262: the testing tour, and its outline.
|
|
202
|
+
if (args[0] === "tour" && args[1] === "submit") return await cmdTourSubmit(args.slice(2), { read, resolveAuth, call, log, errorLog });
|
|
203
|
+
if (args[0] === "tour") return await cmdPack(args.slice(1), { resolveAuth, call, log, errorLog, write, writeFile, isTTY }, TOUR_TOOL, "tour");
|
|
186
204
|
const json = args.includes("--json");
|
|
187
205
|
let rest = args.filter((a) => a !== "--json");
|
|
188
206
|
// BOT-3260: --pack <pack.json>, anywhere after submit.
|
|
@@ -654,9 +672,10 @@ export async function writePrivateFile(path, bytes) {
|
|
|
654
672
|
}
|
|
655
673
|
|
|
656
674
|
const PACK_TOOL = "get_release_note_pack";
|
|
675
|
+
const TOUR_TOOL = "get_release_tour";
|
|
657
676
|
const PACK_FLAGS = { "--release": "release", "--format": "format", "--customer": "customer", "--repository": "repository", "--out": "out" };
|
|
658
677
|
|
|
659
|
-
export async function cmdPack(argv, { resolveAuth, call, log, errorLog, write, writeFile, isTTY = false }) {
|
|
678
|
+
export async function cmdPack(argv, { resolveAuth, call, log, errorLog, write, writeFile, isTTY = false }, tool = PACK_TOOL, noun = "pack") {
|
|
660
679
|
const json = argv.includes("--json");
|
|
661
680
|
const opts = {};
|
|
662
681
|
for (let i = 0; i < argv.length; i++) {
|
|
@@ -679,10 +698,10 @@ export async function cmdPack(argv, { resolveAuth, call, log, errorLog, write, w
|
|
|
679
698
|
|
|
680
699
|
let result;
|
|
681
700
|
try {
|
|
682
|
-
const resolved = await resolveAuth({ toolName:
|
|
701
|
+
const resolved = await resolveAuth({ toolName: tool, preferSession: true });
|
|
683
702
|
result = resolved?.error || !resolved?.auth
|
|
684
703
|
? { ok: false, auth: true }
|
|
685
|
-
: await call(
|
|
704
|
+
: await call(tool, args, { auth: resolved.auth, signal: AbortSignal.timeout(120_000) });
|
|
686
705
|
} catch {
|
|
687
706
|
result = { ok: false, status: null };
|
|
688
707
|
}
|
|
@@ -697,12 +716,67 @@ export async function cmdPack(argv, { resolveAuth, call, log, errorLog, write, w
|
|
|
697
716
|
}
|
|
698
717
|
if (result?.ok && data?.ok !== false) {
|
|
699
718
|
if (json) log(JSON.stringify({ ok: false, error: "receipt_unavailable" }));
|
|
700
|
-
errorLog(
|
|
719
|
+
errorLog(`✗ BotBuddy did not return a ${noun}. Retry the same command; a ${noun} is a read and changes nothing.`);
|
|
701
720
|
return CALL_EXIT.ERROR;
|
|
702
721
|
}
|
|
703
722
|
return printRefusalOrFailure(result, json, log, errorLog, "Nothing was changed.");
|
|
704
723
|
}
|
|
705
724
|
|
|
725
|
+
// ── BOT-3262: bb release-notes tour submit ────────────────────────────
|
|
726
|
+
|
|
727
|
+
const TOUR_SUBMIT_TOOL = "submit_release_tour_outline";
|
|
728
|
+
|
|
729
|
+
export async function cmdTourSubmit(argv, { read, resolveAuth, call, log, errorLog }) {
|
|
730
|
+
const json = argv.includes("--json");
|
|
731
|
+
const opts = {};
|
|
732
|
+
let file = null;
|
|
733
|
+
for (let i = 0; i < argv.length; i++) {
|
|
734
|
+
const a = argv[i];
|
|
735
|
+
if (a === "--json") continue;
|
|
736
|
+
if (a === "--release" || a === "--repository") {
|
|
737
|
+
const v = argv[i + 1];
|
|
738
|
+
const key = a.slice(2);
|
|
739
|
+
if (!v || v.startsWith("--") || key in opts) return readUsage(errorLog);
|
|
740
|
+
opts[key] = v;
|
|
741
|
+
i++;
|
|
742
|
+
continue;
|
|
743
|
+
}
|
|
744
|
+
if (a.startsWith("-") || file !== null) return readUsage(errorLog);
|
|
745
|
+
file = a;
|
|
746
|
+
}
|
|
747
|
+
if (!opts.release || !file) return readUsage(errorLog);
|
|
748
|
+
let outline;
|
|
749
|
+
try {
|
|
750
|
+
outline = JSON.parse(await read(file, "utf8"));
|
|
751
|
+
} catch {
|
|
752
|
+
errorLog(`Could not read ${file} as JSON; nothing was submitted.`);
|
|
753
|
+
return 2;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
let result;
|
|
757
|
+
try {
|
|
758
|
+
const resolved = await resolveAuth({ toolName: TOUR_SUBMIT_TOOL, preferSession: true });
|
|
759
|
+
result = resolved?.error || !resolved?.auth
|
|
760
|
+
? { ok: false, auth: true }
|
|
761
|
+
: await call(TOUR_SUBMIT_TOOL, { ...opts, outline, route: "cli" }, { auth: resolved.auth, signal: AbortSignal.timeout(120_000) });
|
|
762
|
+
} catch {
|
|
763
|
+
result = { ok: false, status: null };
|
|
764
|
+
}
|
|
765
|
+
const data = result?.data;
|
|
766
|
+
if (result?.ok && data?.ok === true) {
|
|
767
|
+
if (json) log(JSON.stringify(data));
|
|
768
|
+
else if (data.changed === false) log(`Tour outline for ${data.version} unchanged: revision ${data.revision} is live.`);
|
|
769
|
+
else {
|
|
770
|
+
const n = (k, one, many) => `${k} ${k === 1 ? one : many}`;
|
|
771
|
+
log(`Tour outline for ${data.version} stored: revision ${data.revision}, ${n(data.checks, "check", "checks")}, ${n(data.operational, "operational location", "operational locations")}.`);
|
|
772
|
+
}
|
|
773
|
+
return CALL_EXIT.OK;
|
|
774
|
+
}
|
|
775
|
+
const code = printRefusalOrFailure(result, json, log, errorLog, "Nothing was stored.");
|
|
776
|
+
if (!json && Array.isArray(data?.notes) && data.notes.length > 0) errorLog(termClean(`Notes: ${data.notes.join(", ")}`));
|
|
777
|
+
return code;
|
|
778
|
+
}
|
|
779
|
+
|
|
706
780
|
// ── BOT-3166: bb release-notes list | get ──────────────────────────────
|
|
707
781
|
|
|
708
782
|
function readUsage(errorLog) {
|
package/src/run.mjs
CHANGED
|
@@ -1075,7 +1075,7 @@ async function completeTestRun(context, { status, exitCode, signal, startedAt, e
|
|
|
1075
1075
|
lane: tr.lane, runner: tr.runner, testRunId: tr.test_run_id,
|
|
1076
1076
|
startedAt, finishedAt: endedAt, durationMs, exitCode, signal,
|
|
1077
1077
|
command: context.command, cwd: context.cwd, gitSha: tr.git_sha ?? null, branch: tr.branch ?? null,
|
|
1078
|
-
counts, cancelled, lefthookEnv: laneLefthookEnv(),
|
|
1078
|
+
counts, cancelled, lefthookEnv: laneLefthookEnv(), advisory: tr.advisory === true,
|
|
1079
1079
|
});
|
|
1080
1080
|
try {
|
|
1081
1081
|
const summaryPath = join(context.cwd, ".botbuddy", "test-runs", laneSummaryFilename(endedAt, tr.lane));
|
|
@@ -1084,7 +1084,12 @@ async function completeTestRun(context, { status, exitCode, signal, startedAt, e
|
|
|
1084
1084
|
} catch { /* the summary is best-effort; the test_runs row is authoritative */ }
|
|
1085
1085
|
await retryUpdateTestRun({
|
|
1086
1086
|
test_run_id: tr.test_run_id, status: "completed",
|
|
1087
|
-
metadata: {
|
|
1087
|
+
metadata: {
|
|
1088
|
+
lane: tr.lane, runner: tr.runner, exit_code: exitCode ?? null, duration_ms: durationMs, cwd: context.cwd, command: context.command, command_run_id: context.run_id, cancelled, ...counts,
|
|
1089
|
+
// BOT-3691: re-assert the create-time stamp, so a run created by an
|
|
1090
|
+
// edge that predates the advisory argument still ends advisory.
|
|
1091
|
+
...(tr.advisory === true ? { advisory: true } : {}), ...(tr.capacity ? { capacity: tr.capacity } : {}),
|
|
1092
|
+
},
|
|
1088
1093
|
}, call);
|
|
1089
1094
|
return summary;
|
|
1090
1095
|
}
|
package/src/test-lane-events.mjs
CHANGED
|
@@ -90,8 +90,12 @@ export async function flushLaneCases({ call, testRunId, cases }) {
|
|
|
90
90
|
export function buildLaneSummary({
|
|
91
91
|
lane, runner, testRunId, startedAt, finishedAt, durationMs, exitCode, signal,
|
|
92
92
|
command, cwd, gitSha = null, branch = null, counts = null, cancelled = false, lefthookEnv = null,
|
|
93
|
+
advisory = false,
|
|
93
94
|
}) {
|
|
94
95
|
return {
|
|
96
|
+
// BOT-3691: an advisory lane's summary says so; report-test-runs drains it
|
|
97
|
+
// without ingesting it, so it never reaches test_executions (no gate reads it).
|
|
98
|
+
...(advisory === true ? { advisory: true } : {}),
|
|
95
99
|
runner, source: "cli-lane",
|
|
96
100
|
command: Array.isArray(command) ? command.join(" ") : String(command ?? ""),
|
|
97
101
|
started_at: startedAt, finished_at: finishedAt, duration_ms: durationMs,
|
package/src/test-lane.mjs
CHANGED
|
@@ -127,7 +127,55 @@ export function resolveLane(laneName, { cwd = process.cwd(), readFileImpl = read
|
|
|
127
127
|
if (lane.kind != null && !LANE_KIND_SET.has(lane.kind)) {
|
|
128
128
|
return { ok: false, error: "invalid", path, root, detail: `lane "${laneName}" lane_kind must be one of ${LANE_KINDS.join("|")} (got "${lane.kind}")` };
|
|
129
129
|
}
|
|
130
|
-
|
|
130
|
+
// BOT-3691: `advisory` is a boolean and `capacity` is "none" when present; any
|
|
131
|
+
// other value is a named failure, never a guessed default (gate 9).
|
|
132
|
+
if (lane.advisory !== undefined && typeof lane.advisory !== "boolean") {
|
|
133
|
+
return { ok: false, error: "invalid", path, root, detail: `lane "${laneName}" advisory must be true or false (got ${JSON.stringify(lane.advisory)})` };
|
|
134
|
+
}
|
|
135
|
+
if (lane.capacity !== undefined && lane.capacity !== "none") {
|
|
136
|
+
return { ok: false, error: "invalid", path, root, detail: `lane "${laneName}" capacity must be "none" when set (got ${JSON.stringify(lane.capacity)})` };
|
|
137
|
+
}
|
|
138
|
+
const advisory = lane.advisory === true;
|
|
139
|
+
// An advisory lane a gate requires would silently strip that gate of its
|
|
140
|
+
// evidence. A gate's required lanes are the result-bearing lanes of the repo's
|
|
141
|
+
// committed telemetry manifest (BOT-1319), keyed `<hook>:<lane>`.
|
|
142
|
+
if (advisory) {
|
|
143
|
+
const gate = gateLaneNamed(root, laneName, readFileImpl);
|
|
144
|
+
if (gate?.unreadable) return { ok: false, error: "gate_manifest_unreadable", path, root, detail: `lane "${laneName}" is advisory but .botbuddy/telemetry-manifest.json cannot be read (${gate.unreadable}); without it no one can prove the lane is not a gate lane` };
|
|
145
|
+
if (gate) return { ok: false, error: "advisory_gate_lane", path, root, detail: `lane "${laneName}" is advisory but the gate lane "${gate}" in .botbuddy/telemetry-manifest.json requires it; a gate lane cannot be advisory` };
|
|
146
|
+
}
|
|
147
|
+
return { ok: true, appSlug: config.app_slug ?? null, lane, laneKind: lane.kind ?? null, advisory, capacity: lane.capacity ?? null, path, root };
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function gateLaneNamed(root, laneName, readFileImpl) {
|
|
151
|
+
const manifestPath = join(root, ".botbuddy", "telemetry-manifest.json");
|
|
152
|
+
if (!existsSync(manifestPath)) return null;
|
|
153
|
+
let manifest;
|
|
154
|
+
// Fail closed: a manifest that exists but cannot be read or parsed proves
|
|
155
|
+
// nothing about which lanes the gates require.
|
|
156
|
+
try { manifest = JSON.parse(readFileImpl(manifestPath, "utf8")); } catch (err) { return { unreadable: err?.message ?? String(err) }; }
|
|
157
|
+
const lanes = manifest?.lanes && typeof manifest.lanes === "object" ? manifest.lanes : {};
|
|
158
|
+
for (const [key, entry] of Object.entries(lanes)) {
|
|
159
|
+
if (entry?.result_bearing === true && key.slice(key.indexOf(":") + 1) === laneName) return key;
|
|
160
|
+
}
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// BOT-3691: how the durable launcher registers a lane's command run. An
|
|
165
|
+
// advisory lane is never `validation` / `full_suite`, so the BOT-816 full-suite
|
|
166
|
+
// rerun block never counts it; every other lane registers exactly as before.
|
|
167
|
+
export function laneRunClass({ advisory = false } = {}) {
|
|
168
|
+
return advisory ? { category: "other", kind: "other" } : { category: "validation", kind: "full_suite" };
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export function laneRunArgv({ sessionId = null, sessionToken = null, rerunReason = null, environment, category, kind, expectedDurationSeconds, command }) {
|
|
172
|
+
return [
|
|
173
|
+
...(sessionId ? ["--session-id", sessionId] : []),
|
|
174
|
+
...(sessionToken ? ["--agent-session-token", sessionToken] : []),
|
|
175
|
+
...(rerunReason ? ["--rerun-reason", rerunReason] : []),
|
|
176
|
+
"--environment", environment, "--category", category, "--kind", kind,
|
|
177
|
+
"--expected-duration", String(expectedDurationSeconds ?? 0), "--", ...command,
|
|
178
|
+
];
|
|
131
179
|
}
|
|
132
180
|
|
|
133
181
|
// Best-effort git/gh context. Every field falls back to null — never fabricated
|
|
@@ -157,17 +205,11 @@ export function defaultGitInfo({ cwd = process.cwd(), ticket = null, pr = null,
|
|
|
157
205
|
|
|
158
206
|
// The production lane launcher: run the lane through the durable `botbuddy run`
|
|
159
207
|
// worker, carrying the telemetry env into its detached child.
|
|
160
|
-
async function defaultLaunchLane({ command, sessionId, sessionToken, environment, expectedDurationSeconds, childEnv, testRun, cwd, call, rerunReason }) {
|
|
208
|
+
async function defaultLaunchLane({ command, sessionId, sessionToken, environment, expectedDurationSeconds, childEnv, testRun, cwd, call, rerunReason, category, kind }) {
|
|
161
209
|
// BOT-1572/1582: pass --session-id only when a plain id is used; a token-only lane
|
|
162
210
|
// relies on the inherited $BOTBUDDY_AGENT_SESSION_TOKEN (and an explicit --agent-session-token
|
|
163
211
|
// so the child never falls back to a machine credential).
|
|
164
|
-
const argv =
|
|
165
|
-
...(sessionId ? ["--session-id", sessionId] : []),
|
|
166
|
-
...(sessionToken ? ["--agent-session-token", sessionToken] : []),
|
|
167
|
-
...(rerunReason ? ["--rerun-reason", rerunReason] : []),
|
|
168
|
-
"--environment", environment, "--category", "validation", "--kind", "full_suite",
|
|
169
|
-
"--expected-duration", String(expectedDurationSeconds ?? 0), "--", ...command,
|
|
170
|
-
];
|
|
212
|
+
const argv = laneRunArgv({ sessionId, sessionToken, rerunReason, environment, category, kind, expectedDurationSeconds, command });
|
|
171
213
|
const result = await launchRun(argv, { cwd, call: sessionToken ? null : call, childEnv, testRun });
|
|
172
214
|
return { exitCode: result.exitCode, runId: result.receipt?.run_id ?? null, receipt: result.receipt ?? null };
|
|
173
215
|
}
|
|
@@ -302,6 +344,9 @@ export async function launchTestLane(argv, {
|
|
|
302
344
|
source_kind: "cli-lane", source_id: laneRunId,
|
|
303
345
|
// BOT-1549: stamp the resolved lane kind on the run; absent ⇒ omitted (NULL).
|
|
304
346
|
lane_kind: laneKind ?? undefined,
|
|
347
|
+
// BOT-3691: stamped only when declared, so a normal lane's create is unchanged.
|
|
348
|
+
advisory: resolved.advisory ? true : undefined,
|
|
349
|
+
capacity: resolved.capacity ?? undefined,
|
|
305
350
|
};
|
|
306
351
|
const created = await callWithSessionRetry("create_test_run", createArgs);
|
|
307
352
|
const testRunId = created?.ok && !created.isError ? created.data?.id ?? null : null;
|
|
@@ -334,10 +379,18 @@ export async function launchTestLane(argv, {
|
|
|
334
379
|
childEnv.BOTBUDDY_TICKET = git.ticket ?? "";
|
|
335
380
|
childEnv.BOTBUDDY_PR_NUMBER = git.prNumber != null ? String(git.prNumber) : "";
|
|
336
381
|
childEnv.BOTBUDDY_PR_URL = git.prUrl ?? "";
|
|
382
|
+
// BOT-3691: tell the lane's command it runs advisory / capacity-free. Always
|
|
383
|
+
// set ("" when not declared) so a stale inherited value never leaks in.
|
|
384
|
+
childEnv.BOTBUDDY_LANE_ADVISORY = resolved.advisory ? "1" : "";
|
|
385
|
+
childEnv.BOTBUDDY_LANE_CAPACITY = resolved.capacity ?? "";
|
|
337
386
|
if (testRunId) { childEnv.BOTBUDDY_TEST_RUN_ID = testRunId; childEnv.BOTBUDDY_TEST_RUN_EVENTS = eventsPath; }
|
|
338
387
|
const testRun = testRunId
|
|
339
|
-
? {
|
|
388
|
+
? {
|
|
389
|
+
test_run_id: testRunId, events_path: eventsPath, lane: laneName, runner: resolved.lane.runner, git_sha: git.sha ?? null, branch: git.branch ?? null,
|
|
390
|
+
...(resolved.advisory ? { advisory: true } : {}), ...(resolved.capacity ? { capacity: resolved.capacity } : {}),
|
|
391
|
+
}
|
|
340
392
|
: null;
|
|
393
|
+
const runClass = laneRunClass({ advisory: resolved.advisory });
|
|
341
394
|
let launch;
|
|
342
395
|
try {
|
|
343
396
|
launch = await launchLane({
|
|
@@ -345,7 +398,7 @@ export async function launchTestLane(argv, {
|
|
|
345
398
|
sessionId: opts.sessionId, sessionToken: opts.sessionToken, environment: opts.environment,
|
|
346
399
|
expectedDurationSeconds: resolved.lane.expected_duration_seconds ?? 0,
|
|
347
400
|
childEnv, testRun, cwd, call, testRunId, lane: laneName, runner: resolved.lane.runner,
|
|
348
|
-
rerunReason: opts.rerunReason,
|
|
401
|
+
rerunReason: opts.rerunReason, category: runClass.category, kind: runClass.kind,
|
|
349
402
|
});
|
|
350
403
|
} catch (e) {
|
|
351
404
|
const error = `launch_exception:${e instanceof Error ? e.message : String(e)}`;
|
|
@@ -378,11 +431,13 @@ export async function launchTestLane(argv, {
|
|
|
378
431
|
const line = testRunId
|
|
379
432
|
? {
|
|
380
433
|
outcome: "launched", test_run_id: testRunId, command_run_id: commandRunId, lane: laneName,
|
|
434
|
+
...(resolved.advisory ? { advisory: true } : {}),
|
|
381
435
|
wait: waitCommand(testRunId, opts.sessionId, opts.sessionToken),
|
|
382
436
|
receipt_path: commandRunId ? receiptPath(commandRunId) : null, waits_url: WAITS_URL,
|
|
383
437
|
}
|
|
384
438
|
: {
|
|
385
439
|
outcome: "launched", test_run_id: null, command_run_id: commandRunId, lane: laneName,
|
|
440
|
+
...(resolved.advisory ? { advisory: true } : {}),
|
|
386
441
|
telemetry: "unavailable", wait: null,
|
|
387
442
|
receipt_path: commandRunId ? receiptPath(commandRunId) : null, waits_url: WAITS_URL,
|
|
388
443
|
};
|