Skip to content

Block ADRs that cite tickets, repo files or history - #312

Merged
thrawn01 merged 5 commits into
mainfrom
thrawn01/eng-862-block-adrs-that-cite-tickets-files-or
Nov 22, 2026
Merged

thrawn01 merged 5 commits into
mainfrom
thrawn01/eng-862-block-adrs-that-cite-tickets-files-or

Conversation

@thrawn01

Copy link
Copy Markdown
Contributor

Intent

An ADR is for someone reading a decision years later. Ticket numbers, repo file paths, PR and commit citations and amendment history go stale or mean nothing to that reader. The rule against them existed only in writing, and ADRs committed during a build skipped the step that reviewed them. This PR adds a blocking check that a managed repo calls from CI, runs it on this repo, cleans up this repo's ADRs so they pass, and has build workers review an ADR before they commit it.

Fixes ENG-862

Surfaces

Workflow .github/workflows/adr-check.yml (reusable, workflow_call)

jobs:
  adr:
    uses: kapetan-io/dispatch/.github/workflows/adr-check.yml@main
    with:
      ticket-keys: ENG          # required, comma separated team keys
      # dispatch-ref: main      # optional, the dispatch version whose check runs

Command make adr-check (runs go run ./cmd/adrcheck)

go run ./cmd/adrcheck -root <repo> -ticket-keys ENG,LOC -repo owner/name

It exits 0 when every ADR under <repo>/docs/adr passes, 1 with one line per problem, and 2 on bad arguments.

Skill skills/build/SKILL.md, the "Leave existing ADRs alone" rule: before a worker commits a new ADR, a fresh sub-agent reviews it for history, implementation detail, whether the code meets it yet, references in any form, and a decision a test could prove.

Behavior changes

An ADR like this one now fails the pull request:

## Status

Accepted, amended

## Context

- Proposed in ENG-630 (#223), see `internal/rules/state.go:42`.
docs/adr/0007-x.md:7: has a Status outside the allowed forms (Proposed, Accepted, Rejected, Deprecated, Superseded by ADR N, Superseded in part by ADR N, Amends ADR N, Amended by ADR N): "Accepted, amended"
docs/adr/0007-x.md:11: cites a ticket: "ENG-630"
docs/adr/0007-x.md:11: cites the repo's pull requests, commits, branches or issues: "#223"
docs/adr/0007-x.md:11: references a file or directory in the repo: "internal/rules/state.go:42"
adrcheck: 4 ADR problem(s)

It also fails an ADR that shares its number with another, links to an ADR that doesn't exist, or has a Status naming one. ADR 0007, ADR-0008, relative links to other ADRs, outside URLs, the repo's home page, images beside the ADRs, SHA-256 and UTF-8 stay allowed. A Status may hold several lines, each an allowed form (Accepted then Amends ADR 0006).

This repo's test workflow gains an adr job that calls the reusable workflow at the commit under test, with keys ENG,LOC.

ADRs rewritten to pass, with no decision changed:

  • 0001: undated its two Note headings, dropped a test file path, Status gains Amended by ADR 0006.
  • 0003: linear.ticket/ENG-1/status became linear.ticket/<id>/status.
  • 0004, 0005, 0008, 0010, 0017: dropped a file path.
  • 0006: folded the dated Rex Amendment into Context, Decision and Consequences. Status is Accepted, Amends ADR 0001, Amended by ADR 0019.
  • 0007: replaced the ticket-by-ticket list of earlier proposals with the facts the decision rests on.
  • 0011, 0015: dropped ticket ids and a file name.
  • 0012: dropped "until ENG-684 lands". ENG-684 was canceled, so the limit stands.
  • 0019: Status Accepted. Amends ADR 0006, ... became Accepted and Amends ADR 0006, with the reason moved into Context.

Concerns and risks

  • The check is pattern-based, and the build reviewer covers what it can't see. Known misses: a bare file name not at the repo root (labels.go), a ticket or PR named in words ("pull request 5"), a second commit in commits a1b2c3d and e4f5a6b, and api.github.com URLs. Known false positive: #1 in prose ("the Launch a Claude build worker when a ticket moves to In Progress #1 cause").
  • The cleanup stops at what the check flags plus dated notes, amendments and the earlier-proposals list. Some history and code identifiers remain: 0003's notes on the first restart onto the new names, 0004's "first stacked tickets design", 0017's "first design of dispatch ask", and the "known holdout" and "debt" lines in 0011 and 0017. Telling an identifier that is the decision from one that isn't needs judgment, so I left them for you.
  • The user's adr-write skill writes ADR-NNNN and forbids ADR cross-references in prose. The check accepts both ADR 7 and ADR-0007 and allows cross-references, as the ticket says, so the two disagree on cross-references.
  • The build rule differs from the ticket's text in one place. A decision a test could prove goes to the user before the worker drops it, because the user approved that ADR in the blueprint.
  • A repo that pins the workflow to a tag but leaves dispatch-ref at main runs the workflow and the check from different versions. The workflow's comment says to pass the same tag.
  • Not checked: the reusable workflow has not run in GitHub Actions yet, and this PR's adr job is its first run. A fork PR's checkout of dispatch at github.sha is untested. The build skill change was reviewed by a sub-agent but not run in a worker, since evals are paused.
  • On merge, every PR to this repo that adds or edits an ADR must pass the check. The other managed repos adopt it in ENG-863, ENG-864 and ENG-865.

🤖 Generated with Claude Code

Rewrite this repo's ADRs to pass it, and have build workers review an ADR
before committing it.
Catch relative and line-numbered paths, scheme-less repo links, PR numbers in
words and Status lines naming a missing ADR. Stop flagging hex words, the repo's
home page and images beside the ADRs. Keep Accepted on the two amending ADRs.
Read ./ paths in prose from the repo root, check footnote lines as prose, stop
reading backticked numbers and the repo's home page as history, report a PR once,
and catch raw file links. Tighten messages and comments, and record that ADR 0006
amends 0001 on both Status lines.
Report PR#14 and a backticked #12, allow the repo home page with a trailing
slash, and stop reporting a lone ../ or an absolute path outside the repo.

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deep Code Review Agent🐛

Review completed with 2 suggestions.

Reviewed commit: c403439

Comment thread internal/adrcheck/adrcheck.go Resolved
Comment thread internal/adrcheck/adrcheck.go Resolved
A typo in -root made the check pass with nothing checked. A link definition
for an image beside the ADRs was refused although the inline image passed.
@thrawn01
thrawn01 merged commit 1ae7c15 into main Nov 22, 2026
5 of 6 checks passed
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