Skip to content

docs(adr): add MADR front matter, a Status History and the ADR rules - #5270

Merged
dan-petty merged 6 commits into
mainfrom
docs/5225-adr-front-matter-and-rules
Nov 12, 2026
Merged

dan-petty merged 6 commits into
mainfrom
docs/5225-adr-front-matter-and-rules

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

Give each decision record 0001 to 0025 a MADR 4 front matter: status, date, roles, issue, links and body-hash. The notes at the top and the Status sections move word for word into a last ## Status History section, with dated lines for facts that are out of date. ADR 0003 is superseded by ADR 0017 and ADR 0021. No decision changes.

docs/adr/README.md gives the rules, the template and an index that devops docs generate writes. adr.py reads the front matter with mdit-py-plugins and PyYAML, and its three status patterns go, so the alternatives check keeps every record in force. A test fails on a missing status, a one-way link, an edit of an accepted body and a stale index. The scope adr is declared.

Folds #4918 and #4617.

Closes #5225

Change: openspec/changes/archive/2026-11-12-5225-adr-front-matter-and-rules/

Plan #5225 as an OpenSpec change, and add the tests first: the reader
of the alternatives check reads the front matter of an ADR, the docs
module gives the body hash, the index and the problems of each record,
and an invariant test holds the records of the repository to the rules.
adr.py reads the MADR 4 front matter with the front_matter plugin of
mdit-py-plugins and yaml.safe_load, and the three prose patterns go. An
ADR is in force when it is accepted, or has no status, and no ADR
supersedes it. Its entry names the ADRs that amend it.

docs/adr_records.py gives the body hash with no link target, the index
that devops docs generate writes into docs/adr/README.md, and the
problems of each record. mdit-py-plugins becomes a runtime dependency.
Each record 0001 to 0025 gets its front matter. Its notes at the top and
its Status section move word for word into a last Status History
section, and dated lines record the facts that are out of date. ADR 0003
becomes superseded by ADR 0017 and ADR 0021. docs/adr/README.md gives
the rules, the template and the generated index.

The scope adr is declared for the labels and the title check. The docs
site gives each record status a title and an icon.
@dan-petty dan-petty added the type/docs Type docs: a change to the documents label Nov 12, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Measurements and test runs of this pull request.

Tokens of the decisions that the alternatives check reads (count_tokens of the entries of the records in force, joined by blank lines; cap CONST_ROADMAP_ALTERNATIVES_MAX_ADR_TOKENS = 8,192):

Records in force Tokens fit_to_budget leaves out
Before: code and records of origin/main 0a14161 22 8,464 ADR 0003, ADR 0001
After: this branch 21 7,355 none

ADR 0003 is now superseded by ADR 0017 and ADR 0021, so it is no longer in force. ADR 0001 is in the request again. The margin under the cap is 837 tokens. The budget test of #5049 is not in the tree yet, and #5049 stays open.

Words of the 25 records: 66,340 before. The bodies now hold 63,542 words, and the Status History sections hold the other 2,798 words word for word (the moved notes and Status sections). The new dated lines add 250 words. A script compared each moved note with the original text.

fail-to-pass (uv run devops ci fail-to-pass --base origin/main, exit 0): on the base, the 3 new test modules fail at collection (tests/docs/test_docs_adr_records.py, tests/invariants/test_adr_records.py, tests/roadmap/test_roadmap_adr.py), and 2 changed tests of tests/roadmap/test_roadmap_alternatives.py fail: test_the_request_holds_the_titles_status_and_options_of_the_adrs_in_force_newest_first and test_an_adr_that_the_job_cannot_confirm_is_dropped_and_the_verdict_stays[adr-that-a-later-adr-supersedes]. They pass on the head.

Scoped checks on the head: 588 covering tests pass (tests/roadmap/test_roadmap_adr.py, the alternatives tests, tests/docs, tests/invariants/test_adr_records.py, test_workflow_contracts.py, test_change_folders.py, test_living_specs.py, test_roadmap_limit_classes.py). The rows lint, format, actionlint, zizmor, docs, uv-check, lockfile, deps and openspec pass. mypy passes on the changed files of src/. uv run devops docs site build --strict builds 109 pages with no issue, and the nav shows 21 accepted and 4 superseded records.

Folded items: #4918 (the index) is the generated table of docs/adr/README.md. #4617 (the link of ADR 0021 and ADR 0022) is a dated line in each record, because the rules freeze the old sentence of ADR 0021 as history. Both stay open for the owner.

@dan-petty
dan-petty force-pushed the docs/5225-adr-front-matter-and-rules branch from 31e7961 to a8f2d6c Compare November 12, 2026 22:24
docs/TESTING.md lists tests/invariants/test_adr_records.py, which the
source tree test asks for. The constant of the front matter token type
is _FRONT_MATTER_TYPE, a more exact name that bandit B105 does not read
as a password.
Archive 5225-adr-front-matter-and-rules: the roadmap-alternatives spec
reads the status of an ADR from its front matter.
@dan-petty
dan-petty force-pushed the docs/5225-adr-front-matter-and-rules branch from a8f2d6c to 9ae81d8 Compare November 12, 2026 22:34
@dan-petty
dan-petty marked this pull request as ready for review November 12, 2026 22:42
@dan-petty
dan-petty merged commit 4b86dd5 into main Nov 12, 2026
32 checks passed
@dan-petty
dan-petty deleted the docs/5225-adr-front-matter-and-rules branch November 12, 2026 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type/docs Type docs: a change to the documents

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs(adr): add MADR front matter, a Status History and the ADR rules

1 participant