Skip to content

Parse the ## Status heading form and never drop a present ADR - #1

Merged
JAORMX merged 1 commit into
mainfrom
fix-status-heading-form
Jun 28, 2026
Merged

Parse the ## Status heading form and never drop a present ADR#1
JAORMX merged 1 commit into
mainfrom
fix-status-heading-form

Conversation

@JAORMX

@JAORMX JAORMX commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

What

The extraction inlined adrstatus's classifyStatus but reproduced only one of the two status forms the original parseADR handled. loadADRStatusByNumber matched the **Status:** bold line and silently ignored the ## Status heading form (where the status value sits on the next non-empty line).

Consequences in the backward gate:

  1. An ADR using the ## Status heading form got no entry in the status map. The backward gate reads a missing entry as a missing ADR, so every TestADR_NNNN_* pinning that ADR failed.
  2. Same trap for a present-but-statusless ADR: the original parseADR defaulted it to "unknown" (not a violation); the inlined version omitted it entirely → false "missing ADR" violation.

This surfaced during adoption in the original consuming repo: its lone heading-form ADR produced three false backward-gate failures (TestADR_0043_*) that the old in-repo tool did not.

Fix

  • Restore the ## Status heading branch so both status forms classify exactly as the original adrstatus did.
  • Default a present-but-statusless ADR to "unknown" instead of omitting it.

Why it slipped through

The inlined loadADRStatusByNumber shipped with no test — the extraction ported all original tests verbatim, but the original tool drove this path via exec.Command("go run <tool>"), so there was nothing to port. This PR adds TestLoadADRStatusByNumber_HandlesBothStatusForms covering: the **Status:** form, the ## Status heading form, a retired heading-form ADR (→ superseded), and the statusless default (→ unknown).

Verification

Built the patched binary and ran it against the original consuming repo's tree:

  • --strict, --json, --reverse, --matrix output byte-identical to the old in-repo tool on the same tree.
  • Exits 0 on a clean checkout ("every landed plan passes its forward checks; every TestADR_* pins a live ADR").
  • No drift in the generated docs/acceptance/traceability.md.

go build, go vet, go test ./..., and gofmt all clean.

The extraction inlined adrstatus's classifyStatus but reproduced only one
of the two status forms parseADR handled. loadADRStatusByNumber matched
the `**Status:**` bold line and silently ignored the `## Status` heading
form (status value on the next non-empty line). An ADR using the heading
form got no entry, and the backward gate reads a missing entry as a
missing ADR, so its TestADR_* pins failed. Atrium's ADR-0043 is the lone
heading-form ADR and surfaced this as three false backward-gate failures
on adoption.

Restore the heading-form branch so both forms classify exactly as the
original adrstatus did. Also default a present-but-statusless ADR to
"unknown" instead of omitting it: the original parseADR set "unknown",
and an omitted entry reads as a missing ADR (a false violation) too.

The inlined loadADRStatusByNumber had no test, which is how the dropped
branch slipped through. Add one covering both status forms, a retired
heading-form ADR, and the statusless default.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XfX5F1DpdEsAhw9A8E4wJU
@JAORMX
JAORMX merged commit 99bc8b5 into main Jun 28, 2026
1 check 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