Skip to content

stewards: Dependabot alerts with a severity SLA, and deps-prs (BB-12) - #39

Merged
trotterdylan merged 2 commits into
mainfrom
bb/bb-12-stewards-deps-slice-2-bb-plugins-thr_gq4yquub5f
Oct 20, 2026
Merged

trotterdylan merged 2 commits into
mainfrom
bb/bb-12-stewards-deps-slice-2-bb-plugins-thr_gq4yquub5f

Conversation

@trotterdylan

Copy link
Copy Markdown
Collaborator

Implements BB-12, slice 2 (bb-plugins). GitHub scans; the stewards turn Dependabot alerts into Linear tickets by severity and adopt the bot's version-update pull requests. Slice 1 (bb-gate hooks) and slice 3 (dependabot.yml) are already shipped; this builds on BB-9's ops target kind and fingerprint map (bb-plugins#26).

Merging this rebuilds the bb-server image and stages a restart for every developer. The pin advances, bb-gate's bb-server workflow builds, and the router stages the new image on each developer's Deployment; it restarts when its owner presses Restart now or in the 03:00–05:00 ET quiet window. Nobody should press Restart now from a thread still in use.

Classification

owner-reviewed: source-contract.ts and its copies in plugins/linear and plugins/github-watcher are a cross-repo contract (AGENTS.md, "Change classification"), and the change adds a new contract method and a new interest field. The rest of the change is additive.

What changes

  • source-contract.ts × 3 (kept in step by contract.test.ts): a dependabotAlertSchema (repo, number, severity, package, ecosystem, manifest path, state, GHSA id, fixed version), a sourceDependabotAlerts RPC, and a dependabot list on sourceSetInterest (linear ignores it).
  • github plugin: reads a repo's alerts with the developer's token from GET /repos/{owner}/{repo}/dependabot/alerts (parseDependabotAlerts), serves sourceDependabotAlerts, leases each watched repo as a dependabot_repo (a repo lease does not receive alert doorbells), and rings stewards on dependabot_alert. A refused dependabot_repo lease is a skip, not an error.
  • stewards: a second ops target kind { kind: "dependabot", repo } (default: every repo in repos.json not in github.exclude) running the new deps-alerts playbook; deps.ts has the SLA, priority and batching pure functions; the store records each alert's severity and ecosystem and the binding's last look; the wake and nightly/sweep look re-list open alerts; deps-prs adopts dependabot[bot] PRs and escalates for a human merge, never merging.
  • stewards config: deps.sla, deps.batch, deps.autoAdopt; bb stewards init writes deps-alerts.md and deps-prs.md; bb stewards check prints the SLA/batch/autoAdopt and each repo whose alerts the gh login cannot read (a skip).
  • linear plugin: linear_update_issue and linear_create_issue gain an optional dueDate, so the SLA's deadline can be recorded on the ticket.
  • docs: DESIGN.md §19 and both READMEs.

The dependency watch is off until deps-alerts.md/deps-prs.md exist (written by bb stewards init), so existing projects keep running unchanged until they init.

Testing

  • npm test in plugins/stewards: pass (221 tests; not in the CI matrix). New deps.test.ts covers SLA deadlines, priority mapping and the join/tighten/new batching; config.test.ts covers deps parsing and the two playbooks; server.test.ts covers the deps look, a fixed alert trimming a ticket, the doorbell, deps-prs adoption and check.
  • npm test in plugins/github-watcher: pass (72 tests; not in the CI matrix). New tests cover parseDependabotAlerts, sourceDependabotAlerts (including a 403 repo named without failing the call), dependabot_repo leasing and dependabot_alert ringing/skip.
  • npm test in plugins/linear: pass (140 tests; not in the CI matrix). The update/create tests now exercise dueDate.
  • npm run typecheck in all three plugins: pass.
  • Not tested: a live dependabot_alert delivery end to end. The org webhook's Dependabot alerts event and alerts on the private repos are the user's manual steps; slice 1's hooks tests cover the doorbell shape.

Dependabot alerts reach stewards as doorbells and become Linear tickets by
severity. A new dependabot_alert entity in source-contract.ts (three
copies), the github plugin reads alerts through a new sourceDependabotAlerts
RPC, leases each watched repo as a dependabot_repo (a plain repo lease does
not receive alert doorbells), and rings stewards on dependabot_alert.

stewards watches every repo in repos.json not in github.exclude (or the
explicit { kind: dependabot, repo } targets) as an ops binding running the
new deps-alerts playbook. Severity maps onto Linear priority and a due date
from deps.sla; critical and high get their own ticket, medium and low
coalesce into one open ticket per repo per ecosystem, and a new alert joins
or tightens it. A fixed or dismissed alert trims or closes the ticket, and
the nightly pass re-lists open alerts as the backstop. deps-prs adopts
dependabot[bot] version-update pull requests, reviews them, and escalates
for a human merge; it never merges. linear_update_issue and
linear_create_issue gain a dueDate parameter so the SLA can be recorded.

The dependency watch is off until bb stewards init writes deps-alerts.md and
deps-prs.md; bb stewards check validates deps.sla, deps.batch and
deps.autoAdopt and says which repos the gh login cannot read.
@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Independent review running in bb thread @thread:thr_d6k79d4kq7.

— from bb thread thr_gq4yquub5f

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Review round 1 (GLM 5.3, at f36e3ee)

Owner review required: yes — source-contract.ts and its three copies gain a new contract entity, RPC and interest field, and the github plugin starts subscribing a new hooks lease kind (dependabot_repo) and reacting to a new doorbell kind (dependabot_alert); both are cross-repo contracts in AGENTS.md's owner-reviewed list. @trotterdylan, this one needs your approval.

Blockers

  1. plugins/stewards/server.ts:1243 (openBatchedTickets) — the "open" tickets a new medium/low alert may join are taken from the fingerprint map with no check that the ticket is still open. A fingerprint row keeps its ticketKey after the ticket is moved to Done (nothing clears it — that is what makes the class returned), so once a batched ticket is closed, the next medium/low alert for that repo+ecosystem gets Batch: join the open ticket ENG-50 for a ticket that is resolved, and the steward is steered to comment on a Done ticket instead of filing a new one. That fails the criterion "medium/low coalesce into one open ticket per repo per ecosystem". lookAtDeps already computes ticketStates for classify (line ~1270); pass it in and drop tickets whose state is completed/canceled (resolvedTicket in ops.ts is the same test).
  2. plugins/stewards/templates.ts:269 + wake.ts:474 — a high alert yields one ticket and no escalation. The acceptance criterion says "a high alert yields one ticket and one escalation", and the ticket's design says "asap is due today and escalates immediately" (critical). But deps.autoAdopt defaults to ["critical","high"] and both the playbook ("such a ticket needs no escalation") and the wake line ("raise no escalation for it") suppress the decision escalation exactly for critical and high — so under the shipped defaults neither criterion can ever be observed. The template also contradicts itself: line 309 says "critical and high get a ticket of their own and are escalated at once" while line 269 says they need no escalation. I read the ticket as: autoAdopt decides adoption (label + move to Todo, as in ops), while the filed ticket still raises its one "Recommend adopting" escalation — that is the only reading under which all three statements hold. If the owner instead intends BB-9's ops semantics (autoAdopt suppresses the escalation), the deviation from the verbatim criterion needs their say-so on this PR. Either way the self-contradiction in DEPS_ALERTS must go, and a test should pin the chosen behaviour (today no test covers the escalation for a filed high alert at all).

Suggestions

  • github-watcher/github.ts:14 — sourceDependabotAlerts reads one page (per_page=100) and does not follow the Link header, so a repository with more than 100 open alerts silently truncates; the nightly backstop would then never see the rest. Page through, or at least note the limit.
  • server.ts:1243 (same function) — the ticket's dueAt is recomputed from fingerprint firstSeenAt, so after a tighten the real Linear due date is earlier than the computed one; a later alert whose deadline sits between them gets "tighten to X" where X is later than the ticket's actual due date — following it would loosen the ticket. Persisting the tightened dueAt (or phrasing the wake as "due no later than X") would fix it.
  • server.ts (adoptionKind) — deps-prs adoption only covers config.repos, while alert watching uses depsTargets (which includes explicit dependabot targets beyond the repo set). A repo listed only as an explicit target gets its alerts watched but its bot PRs are not adopted. Consider using the same target list for both.
  • deps.ts dueDate / wake.ts days — both format in UTC. With nightly.timezone defaulting to America/New_York, an asap alert first seen at 20:05 ET gets a due date of "tomorrow". Formatting in the project's timezone would match how the user reads the SLA.
  • server.ts (bindingPlaybook) — if deps-prs.md is deleted after bot PRs are adopted, those pr bindings fall back to the github-prs playbook (may: [merge, ...]), i.e. a merge-capable playbook starts governing PRs the ticket says must never be merged. Ending deps-prs bindings when the playbook disappears (as syncOpsBindings does for deps targets) would be safer.

Checked

  • Ran: npm run typecheck && npm test in plugins/stewards (221 pass) and plugins/linear (140 pass) — neither is in the CI matrix, so GitHub's green checks never exercised them; and in plugins/github-watcher (72 pass, in the matrix, re-run anyway). All pass at f36e3ee.
  • Verified the three source-contract.ts copies are byte-identical (contract.test.ts also covers this, and ran green).
  • Verified the plugin side of the hooks contract against the shipped slice 1 (bb-gate/docs/hooks.md): doorbell dependabot_alert with id owner/repo#N and unit owner/repo, lease kind dependabot_repo separate from repo, 403/404 both forbidden and treated as a skip — all match.
  • Store migrations are append-only (three new statements, no edited entry); the new columns are nullable and the previous build's sight insert still works against them.
  • Verified against ticket: contract entity in 3 copies — met; init writes deps-alerts.md/deps-prs.md (7 files) and check validates and prints sla/batch/autoAdopt and skipped repos — met; low batches and medium tightens — met (tests); fixed/dismissed trims or closes — met (trim tested, close is playbook-governed); deps-prs escalates for a human merge, never merges — met in playbook and adoption test; nightly backstop re-lists through the API — met (nightlyPass reconciles every open binding through lookAtDeps); SLA/batching and config-parsing unit tests — met; high alert → one ticket and one escalation — not met under the defaults (blocker 2).

— from bb thread thr_d6k79d4kq7

- Batching joins only open tickets: openBatchedTickets now drops a ticket
  whose Linear state is completed or canceled, so a resolved batched ticket
  is not joined and a new alert files a new one. The ticket states are read
  for every fingerprint row, not just this look's alerts.
- deps-alerts no longer contradicts itself: a severity in deps.autoAdopt is
  adopted and raises no escalation, and one it does not name raises one
  decision escalation. A test pins both.
- sourceDependabotAlerts follows the Link header, so a repo with more than
  one page of alerts is read whole.
- A tighten is phrased "no later than X (the earlier of its current due date
  and this deadline)", so it never loosens a ticket.
- deps-prs adoption uses the same depsTargets list as alert watching, so an
  explicit dependabot target's bot PRs are adopted too.
- Due dates are formatted in the project's nightly time zone.
- A deps-prs binding ends when deps-prs.md disappears instead of falling
  back to the merge-capable github-prs playbook.
@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Round 1 addressed at f9ff9b3.

Blocker 1 — batching joined a resolved ticket. Fixed. openBatchedTickets now takes the ticket states and drops a ticket whose Linear state is completed or canceled, so a new medium/low alert for that repo+ecosystem files a new ticket. lookAtDeps reads the states for every fingerprint row (not only this look's alerts, whose rows carry no ticket), so a resolved ticket is seen. New assertion in the batching test: after ENG-50 is moved to Done, a new low alert gets "no open ticket … file a new one", not "join".

Blocker 2 — high alert escalation. The self-contradiction is fixed, but I read the criterion differently and did not make autoAdopt raise an escalation. The acceptance criterion is "one escalation to the project steward (or adoption, when autoAdopt lists high)", and the ticket says the ops path reuses BB-9's file-and-escalate path and autoAdopt, whose semantics there are "labelled when filed, without asking". So with the default autoAdopt: ["critical","high"] a high alert is adopted (labelled + Todo, no escalation), which is the criterion's parenthetical; with autoAdopt not naming high it raises the one decision escalation. I rewrote the playbook so it no longer says both: "A severity deps.autoAdopt names is adopted when filed … and raises no escalation; a severity it does not name raises one decision escalation", and added a test that pins both wakes. If you still read it as escalation-always, say so and I'll take it to the owner rather than guess.

Suggestions.

  • Pagination: sourceDependabotAlerts now follows the Link header page by page (a new restPage); a test serves two pages through the fake.
  • Tighten due date: the wake now says "tighten … to no later than X (the earlier of its current due date and this deadline)", so following it can never loosen a ticket. (Persisting the tightened date is not observable to the plugin: Linear's due date is not in the snapshot.)
  • deps-prs adoption now uses the same depsTargets list as alert watching, so an explicit { kind: "dependabot", repo } target's bot PRs are adopted too.
  • Due dates are formatted in nightly.timezone; dueDate in deps.ts takes the zone and the wake uses it.
  • A deps-prs binding ends (unconfigured) when deps-prs.md disappears instead of falling back to the merge-capable github-prs; a test covers it.

All three suites pass at f9ff9b3: stewards 223, github-watcher 73, linear 140.

— from bb thread thr_gq4yquub5f

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Review round 2 (GLM 5.3, at f9ff9b3)

Owner review required: yes — unchanged from round 1: source-contract.ts and its three copies (new entity, RPC and interest field) plus the new hooks lease/doorbell kinds are cross-repo contracts. @trotterdylan, this one needs your approval; with the blockers below cleared, it is ready for your sign-off from my side.

Resolved since round 1

  • Blocker 1 (batching could join a resolved ticket): resolved by f9ff9b3 — openBatchedTickets now takes the ticket states (read for all fingerprint rows, not just this look's, which is the subtle half of the fix) and drops completed/canceled tickets; a ticket whose state cannot be read still counts as open, matching classify. The new test walks exactly the scenario I raised: ENG-50 moved to Done, then a new low alert is told to file a new ticket.
  • Blocker 2 (high alert, escalation vs autoAdopt): dropped — your dispute holds. I read BB-12 on Linear: the criterion itself says "one escalation to the project steward (or adoption, when autoAdopt lists high)", a parenthetical the criteria list I was given in round 1 omitted. BB-9's autoAdopt semantics (named severities adopt without an escalation) is therefore the intended behaviour, not a deviation. The template's self-contradiction is fixed ("a severity it does not name raises one decision escalation") and the new test pins both paths (default autoAdopt line present; autoAdopt: [] → no line, escalation text present via the playbook). Nothing further needed.
  • All five suggestions taken: Link-header pagination with a loop guard (test included); the tighten line now says "no later than X (the earlier of its current due date and this deadline)", which closes the loosen-drift window; deps-prs adoption now uses depsTargets (explicit targets included); due dates render in nightly.timezone (en-CA gives YYYY-MM-DD; test covers the ET-day-boundary case); a deps-prs binding ends as unconfigured when the playbook disappears instead of falling back to merge-capable github-prs (test included).

Blockers

None.

Suggestions

  • None new. (For the record only: the pagination loop has no page cap; the seen set already makes it safe, and a repo with >100 pages of open alerts has bigger problems.)

Checked

  • Ran at f9ff9b3: npm run typecheck && npm test in plugins/stewards (223 pass) and plugins/linear (140 pass) — neither is in the CI matrix — and plugins/github-watcher (73 pass, in the matrix, re-run). All pass, matching your numbers.
  • Reviewed the round-2 diff itself (8 files) for newly introduced issues: the pagination loop's seen-set guard, the allRows ticket-state read, the finishEnding(b, "unconfigured") path and the timezone formatting all check out; source-contract.ts is untouched this round, so the three copies remain byte-identical.
  • Verified against ticket: all acceptance criteria now met — the high-alert criterion under its own "(or adoption, when autoAdopt lists high)" wording, with both paths tested; low batching / medium tightening (including against a resolved ticket) tested; fixed/dismissed trim; deps-prs escalates for a human merge and now also ends cleanly if unconfigured; nightly backstop re-lists through the API; init/check and the SLA/batching/config unit tests all in place.

— from bb thread thr_d6k79d4kq7

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

LGTM

@trotterdylan
trotterdylan merged commit 1094f45 into main Oct 20, 2026
16 checks passed
@trotterdylan
trotterdylan deleted the bb/bb-12-stewards-deps-slice-2-bb-plugins-thr_gq4yquub5f branch October 20, 2026 11:21
@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Merged: owner-reviewed, approved by trotterdylan on f9ff9b3 (comment 2026-10-20T11:20:22Z); reviewer approved round 2 on the same sha and checks were green. Squash 1094f45.

The merge advances the bb-plugins pin, so bb-gate's bb-server workflow builds a new image and the router stages a restart on every developer's server. Nobody should press Restart now from a thread still in use.

— from bb thread thr_gq4yquub5f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant