Skip to content

Pins the ADR guard's two-line citation window - #455

Merged
johnnyt merged 1 commit into
mainfrom
st-djjm-record-guard-window-test
Oct 11, 2026
Merged

johnnyt merged 1 commit into
mainfrom
st-djjm-record-guard-window-test

Conversation

@johnnyt

@johnnyt johnnyt commented Oct 11, 2026

Copy link
Copy Markdown
Member

What

The ADR guard (Mix.Statifier.AdrGuard) clears a finding when an ADR citation, or for the ADR-0018 check the ADR-0018-exempt marker, sits on the flagged line or on the line directly above it in the same hunk. This PR keeps that window exactly as it is, states it plainly in the guard's documentation, and pins its upper edge with tests.

  • Mix.Statifier.AdrGuard's moduledoc and analyze/1's doc, and Mix.Tasks.Adr.Check's moduledoc, now say where a citation must sit: on the flagged line or the line directly above it. A citation two or more lines above clears nothing, for instance one written above a defp ... do head whose first body line is the flagged call. The old wording, "on or above the line", read as any line above.
  • test/mix/statifier/adr_guard_test.exs gains two tests: an ADR-0003 citation two lines above a receive do does not clear the effects finding, and the ADR-0018-exempt marker two lines above a bead-id comment does not clear that finding.

No guard behaviour changes: the lib/ diff touches doc text and one comment only.

Decision

The window stays at two lines. Widening it would change what the gate accepts, and ADR-0011 leaves that to a human (decided by the conductor under a standing consent, 2026-10-10: keep the window, document it, pin it with a test).

Sabotage

Each new test carries its # sabotage: line. Mutation: parse_line/2 carries every earlier line of the hunk in previous, which widens the window to the whole hunk. Both new tests failed on their assertions (each returned [] instead of the finding), and no other test failed. The file was restored from a copy, byte-equal, and the suite is green again.

Gate

Full mix quality (mix gate.verify) and mix quality --profile merge ran green on the rebased head. The ADR judge skipped, because no file in this diff is in a judged ADR scope.

No changelog fragment: gate tooling documentation and tests (changelog.d/README.md).

Review

Tier: gate (tooling docs and tests, under the size threshold, no contract surface). In-turn review: I checked each documentation claim against cited?/1, bead_cited?/1 and parse_line/2, and the ADR-0011 cite against that record's "human call" paragraph. No record under docs/adr/ is edited.

The ADR guard clears a finding when an ADR citation (or, for the
ADR-0018 check, the ADR-0018-exempt marker) sits on the flagged line
or on the line directly above it in the same hunk. Nothing pinned the
upper edge of that window, and the moduledocs said only "on or above
the line", which reads as any line above.

- Mix.Statifier.AdrGuard's moduledoc and analyze/1's doc, and
  Mix.Tasks.Adr.Check's moduledoc, now state the window and where a
  citation must sit: a citation two or more lines above the flagged
  line, such as one above a defp head whose first body line is the
  flagged call, clears nothing. The window stays as it is; widening
  it changes what the gate accepts, which ADR-0011 leaves to a human
  (decided by the conductor under a standing consent, 2026-10-10).
- Adds two tests to test/mix/statifier/adr_guard_test.exs: an
  ADR-0003 citation two lines above a receive does not clear the
  effects finding, and the ADR-0018-exempt marker two lines above a
  bead-id comment does not clear that finding. Carrying every earlier
  hunk line in parse_line/2's previous (a wider window) turns both
  red; restored from a copy, byte-equal.

No guard behaviour changes. Gate tooling docs and tests; no changelog
fragment.

After the rebase onto main, full mix quality (mix gate.verify) and
mix quality --profile merge ran green on this commit's tree
(write-tree ef02975).

Refs: st-djjm
@johnnyt
johnnyt merged commit cde0ff0 into main Oct 11, 2026
1 check passed
@johnnyt
johnnyt deleted the st-djjm-record-guard-window-test branch October 11, 2026 16:11
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