Skip to content

Commit 93c8df4

Browse files
cliffhallclaude
andcommitted
Read an empty automated-security-fixes success as enabled; analyze from the lowest installed SDK; state what each sweep does when work goes away
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: cliffhall <[email protected]>
1 parent 138d1ed commit 93c8df4

5 files changed

Lines changed: 28 additions & 7 deletions

File tree

‎AGENTS.md‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,12 @@ its reasoning; these are the rules.
211211
setting can be flipped in the UI with no commit, so the alert sweep reads it
212212
back and fails on `enabled: true` (under the workflow's token it can only
213213
report UNVERIFIED, since `administration: read` is not grantable).
214-
- **A sweep files an issue, never a PR, and never closes one.** When the work
215-
goes away it rewrites the issue to say so; closing, and deciding whether the
216-
card goes to Done or is deleted, stays a maintainer's act.
214+
- **A sweep files an issue, never a PR, and never closes one.** Closing, and
215+
deciding whether the card goes to Done or is deleted, stays a maintainer's
216+
act. When the work goes away, the refresh and alert sweeps rewrite their
217+
issue to say so; the SDK watch leaves a supersession note on an issue a
218+
newer release has passed, and otherwise leaves the issue to the upgrade PR
219+
that closes it.
217220
- **Sweeps do not write the board.** `GITHUB_TOKEN` cannot hold `organization
218221
projects: write`. A sweep issue arrives labeled `v2` + `chore` +
219222
`dependencies` (+ a `server-<name>` scope where it concerns one server) and

‎scripts/dependabot-alerts.mjs‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,12 @@ function checkSecurityPrsOff(repo, spawn, { dryRun, log }) {
707707
);
708708
return false;
709709
}
710-
const state = JSON.parse(result.stdout || "{}");
710+
// Today the endpoint answers 200 with `{"enabled": …, "paused": …}`. An
711+
// older contract answered 204 with no body to mean "enabled", so an empty
712+
// success is read as enabled: reading it as `{}`, i.e. off, would wave the
713+
// one condition this guard exists for straight through.
714+
const text = (result.stdout ?? "").trim();
715+
const state = text === "" ? { enabled: true } : JSON.parse(text);
711716
if (state.enabled === true) {
712717
const message =
713718
"Dependabot security-update PRs are ENABLED. This sweep replaces them, so both are running " +

‎scripts/dependabot-alerts.test.mjs‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ function fakeWorld(state = {}) {
529529
if (a === "api" && /automated-security-fixes/.test(b)) {
530530
const r = s.securityFixes;
531531
return r.status === 0
532-
? ok({ stdout: JSON.stringify(r.body) })
532+
? ok({ stdout: r.body === undefined ? "" : JSON.stringify(r.body) })
533533
: ok({ status: 1, stderr: r.stderr });
534534
}
535535
if (a === "api" && args.some((x) => /dependabot\/alerts/.test(x))) {
@@ -675,6 +675,14 @@ test("a real run fails on security PRs switched back on, before reading alerts",
675675
);
676676
});
677677

678+
test("an empty success (the older 204 contract) reads as enabled", () => {
679+
const world = fakeWorld({
680+
alerts: [pipAlerts],
681+
securityFixes: { status: 0 },
682+
});
683+
assert.throws(() => run(world), /ENABLED/);
684+
});
685+
678686
test("security PRs read back as off are stated in the body", () => {
679687
const world = fakeWorld({
680688
alerts: [pipAlerts],

‎scripts/sdk-watch.mjs‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,12 @@ export function main({
598598
issue,
599599
label: state.group.label,
600600
repo: state.group.repo,
601-
from: state.rows.find((r) => r.behind).installed,
601+
// The LOWEST installed copy, so the analysis covers every
602+
// release some install here still has to cross.
603+
from: state.rows
604+
.filter((r) => r.behind)
605+
.map((r) => r.installed)
606+
.sort(compare)[0],
602607
to: state.target,
603608
});
604609

‎scripts/sdk-watch.test.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ test("main files one issue per group behind, and hands them to the analysis", (t
443443
issue: 600,
444444
label: "MCP TypeScript SDK (v1)",
445445
repo: "modelcontextprotocol/typescript-sdk",
446-
from: "1.30.0",
446+
from: "1.29.0",
447447
to: "1.32.1",
448448
},
449449
{

0 commit comments

Comments
 (0)