chore(deps): address Copilot review round 14 on #2243

- Reconcile on (package, manifest, GHSA) tuples, not GHSAs alone.
  Dependabot alerts are per manifest and this repo has five lockfiles,
  so the same advisory legitimately covers the root install and a
  client. Keyed on the GHSA alone, another manifest's still-filable
  alert could vouch for this one and clear an issue whose own alert is
  open with no bump available.
- Rename the cleared-date test: it asserts the NEW date is taken when
  the reason changes, which is the opposite of what its name said.
- AGENTS.md no longer implies both sweeps select a dated milestone.
  Only the security sweep filters undated buckets; the monthly one's
  selection is raised on #2239.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013H6Cew3KB3jVmQ5x4Dq1sq
Signed-off-by: cliffhall <cliff@futurescale.com>
This commit is contained in:
cliffhall 2026-09-04 09:00:13 -04:00
commit e846dec491

View file

@ -15,6 +15,7 @@ import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
import { dirname, join } from "node:path";
import { tmpdir } from "node:os";
import {
advisoryKey,
parseClearedDate,
SUPPORTED_ECOSYSTEM,
PRIORITY_FIELD_ID,
@ -1486,7 +1487,7 @@ test("a cleared issue is not re-edited on a LATER day", () => {
assert.equal(ghCall(spawn, "edit"), undefined);
});
test("a cleared issue keeps its original date when its reason changes", () => {
test("a cleared issue takes the new date when its reason changes", () => {
// A real change still gets one edit — and takes the new date, since the state
// genuinely changed on that day.
const cleared = buildClearedBody(
@ -1564,6 +1565,61 @@ test("main does not clear an issue when the lockfile cannot be parsed", () => {
);
});
test("advisoryKey distinguishes the same GHSA in different manifests", () => {
assert.notEqual(
advisoryKey("fast-uri", "package-lock.json", "GHSA-a"),
advisoryKey("fast-uri", "clients/tui/package-lock.json", "GHSA-a"),
);
});
test("another manifest's alert cannot vouch for this one when clearing", () => {
// The same GHSA legitimately covers the root install and a client's. Here the
// ROOT alert lost its patched version while the TUI one is still filable —
// keying on the GHSA alone would let the TUI group vouch for the root issue
// and clear it, even though the root alert is open with no bump available.
const [rootFiled] = groupAlerts([alert({ ghsa: "GHSA-a" })]);
const rootUnpatched = alert({ ghsa: "GHSA-a" });
rootUnpatched.security_vulnerability.first_patched_version = null;
const spawn = fakeSpawn({
alertPages: [
[
rootUnpatched,
alert({
ghsa: "GHSA-a",
manifest: "clients/tui/package-lock.json",
range: "< 3.1.6",
}),
],
],
issues: [
{
number: 41,
title: buildIssueTitle(rootFiled),
body: buildIssueBody(rootFiled, asInstalled()),
},
],
});
const log = inTempRepo(
{
"package-lock.json": lockWith("fast-uri", "3.1.5"),
"clients/tui/package-lock.json": lockWith("fast-uri", "3.1.5"),
},
() =>
withoutProjectToken(() =>
captureLog(() => main("o/r", spawn, "2026-09-04")),
),
);
// The TUI bump is filed; the root issue is left alone, not cleared.
assert.ok(ghCall(spawn, "create"));
assert.equal(ghCall(spawn, "edit"), undefined);
assert.ok(
log.some((l) => l.includes("#41 left as is")),
`expected the root issue left as is, got: ${log.join(" | ")}`,
);
});
test("main reads every page of open dependabot issues", () => {
// The second page holds the matching marker. Truncating the lookup would
// file a duplicate issue rather than recognising this one.