Skip to content

test(adr): check the code citations in the ADR corpus against the tree - #807

Merged
CybotTM merged 1 commit into
mainfrom
docs/adr-code-citations
Aug 18, 2026
Merged

test(adr): check the code citations in the ADR corpus against the tree#807
CybotTM merged 1 commit into
mainfrom
docs/adr-code-citations

Conversation

@CybotTM

@CybotTM CybotTM commented Aug 18, 2026

Copy link
Copy Markdown
Member

The ADR corpus carries 74 citations of the form File.php:NNN, and nothing read any of them. AdrLifecycleTest checks form inside the corpus; AdrReferenceIntegrityTest checks that ADR filenames named from outside it resolve, and its docblock says outright that this is the part it does not cover — "a line number that has drifted still points at a line that exists".

What the census found that #793 did not

21 of the 74 citations point into .Build/vendor: TYPO3 core (DataHandler.php, RootLevelCapability.php, BackendUtility.php, …), cms-install, and the sibling extension nr-vault. 18 of them are in ADR-169 alone. That code is not committed and its line numbers move with every patch release of a dependency this repository does not pin, so no test here can check them — and they are the most fragile citations in the corpus, not the least.

They are declared in a hand-maintained list instead. A new one fails the third assertion rather than being silently skipped by the resolver, which is the difference between a list and a blind spot.

The remaining 53 resolve to exactly one file each. Basename resolution is unambiguous today, and the resolver asserts that rather than picking the first match.

Assertions, each seen to fail

A guard that has only been seen green proves it runs, not that it catches anything. Every branch was broken on purpose and the failure observed:

Control Result
citation to NoSuchFileAnywhere.php:12 everyCitationNamesAFileThatStillExists + the list assertion fail
citation to ResumeCoordinator.php:204 (blank line) noCitationPointsPastTheEndOfItsFileOrAtABlankLine fails
citation to ResumeCoordinator.php:99999 (past EOF) same assertion fails
citation to DataHandler.php:1, undeclared for that record file + list assertions fail
a second ResumeCoordinator.php added to the tree all three fail on the ambiguity assertion

Each was reverted and the suite returned to green; git status was clean afterwards.

What it does not catch

Stated in the docblock, not only here: a line that moved onto different but non-blank code. That is the common case and the dangerous one — the record then asserts something the cited code does not say, and the citation's precision is what makes a reviewer trust it. Nothing mechanical can tell the difference, which is the argument for citing a symbol rather than a line number wherever the prose allows.

One correction to the issue

#793 gives ADR-171 citing ResumeCoordinator.php:204 as confirmed rot. That is already repaired on main — the record cites :205, which is where d3a8d718 moved the check. So this test does not fix a live defect. It stops the next one from being invisible, and the corpus is clean as of this commit.

I found that by re-running the census against origin/main rather than against the main/ worktree, which was ten commits behind when I first measured.

#793 stays open: it also asks for the convention (symbol over line number) and covers the two counting issues, #791 and #792. This is the enforceable part.

Tests: unit (exit 0), phpstan level 10 clean, cgl and rector -n both stable at PHP 8.2 after applying.

Refs #793

74 citations of the form File.php:NNN across Documentation/Adr, and
nothing read them. AdrLifecycleTest checks form inside the corpus,
AdrReferenceIntegrityTest checks that ADR filenames named elsewhere
resolve, and its docblock says outright that a drifted line number still
points at a line that exists.

Three assertions, each seen to fail before being trusted:

- a cited file that is in neither the tree nor the declared list
- a citation past the end of its file, or at a blank line
- a change to the set of citations that resolve to nothing here

The census turned up something the issue did not: 21 of the 74 point into
.Build/vendor — TYPO3 core, cms-install, nr-vault. That code is not
committed and its line numbers move with every patch release of a
dependency this repository does not pin, so no test here can check them.
They are listed by hand instead, which makes adding one deliberate rather
than something the resolver quietly skips.

What it does not catch is in the docblock: a line that moved onto
different but non-blank code. That is the common case and the dangerous
one, and nothing mechanical can tell the difference.

The rot #793 names — ADR-171 citing ResumeCoordinator.php:204 for a check
that d3a8d71 pushed to :205 — is already repaired on main. This test does
not fix a live defect; it stops the next one from being invisible.

Refs #793

Signed-off-by: Sebastian Mendel <sebastian.mendel@netresearch.de>
Copilot AI lite review requested due to automatic review settings August 18, 2026 06:11
@CybotTM
CybotTM requested a review from a team as a code owner August 18, 2026 06:11
@sonarqubecloud

Copy link
Copy Markdown

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added the tests Test-related changes label Aug 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Automated approval for maintainer PR

All automated quality gates passed. See SECURITY_CONTROLS.md for compensating controls.

@codecov

codecov Bot commented Aug 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.43%. Comparing base (105f0c1) to head (d0cff99).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##               main     #807   +/-   ##
=========================================
  Coverage     87.43%   87.43%           
  Complexity     9710     9710           
=========================================
  Files           566      566           
  Lines         31418    31418           
=========================================
  Hits          27471    27471           
  Misses         3947     3947           
Flag Coverage Δ
unit 65.38% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@CybotTM

CybotTM commented Aug 18, 2026

Copy link
Copy Markdown
Member Author

Review record — no Copilot review exists for this diff (monthly, account-wide quota exhausted), so the green gate is not a read of the change. What was checked:

The test was built from a census, not from the issue. #793 said 74 citations and one confirmed rot. Re-derived against origin/main: 74 is right, the rot is already repaired, and the 74 are not one population — 21 point into .Build/vendor (TYPO3 core, cms-install, nr-vault), 18 of them in ADR-169 alone. That code is not committed and its line numbers move with every patch release of an unpinned dependency, so no test here can check them. They are declared in a hand-maintained list so a new one fails rather than being skipped by the resolver.

Each of the three assertions was seen to fail — a missing file, a blank line, a past-EOF line, an undeclared vendor path, and an ambiguous basename each produce the failure they exist for. Reverted, green, git status clean.

What it does not catch is in the docblock, not only in the PR: a line that moved onto different but non-blank code. That is the common case and the dangerous one, and nothing mechanical distinguishes it.

Cross-checked against the siblings in flight, because this test reads the whole corpus and two other open PRs edit ADR text: none of #808, #810 or #811 adds a File.php:NNN citation, and none touches ADR-140 or ADR-169, the two records whose vendor citations this test hard-codes. So merge order among them is free.

phpstan level 10 clean, unit exit 0, cgl and rector -n stable at PHP 8.2 after applying.

Merging on that basis.

@CybotTM
CybotTM added this pull request to the merge queue Aug 18, 2026
Merged via the queue into main with commit 72a8e37 Aug 18, 2026
93 of 94 checks passed
@CybotTM
CybotTM deleted the docs/adr-code-citations branch August 18, 2026 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Test-related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants