Skip to content

doc-health: stop uncited-resolution findings from echoing themselves - #519

Merged
brettheap merged 1 commit into
mainfrom
fix/515-uncited-resolution-echo
Aug 31, 2026
Merged

brettheap merged 1 commit into
mainfrom
fix/515-uncited-resolution-echo

Conversation

@brettheap

Copy link
Copy Markdown
Contributor

Mechanism

scripts/doc_health/report.py::uncited_resolutions() stamps every finding it emits with resolution="contested" — correctly: the resolution-class taxonomy (doc-health spec) has exactly two values, auto-fixable or contested, and an uncited-resolution finding is not a mechanical auto-fixable defect. parse_previous() then folded every class="contested" ranked-plan line into previous_contested regardless of family — including a family=uncited-resolution line.

So once the original finding an uncited-resolution line cited was genuinely gone, the uncited-resolution finding about it read back as contested-and-vanished with no citation of its own, and was re-emitted forever: an uncited-resolution finding about an uncited-resolution finding, ad infinitum. The 2026-08-30 xFactory nightly carried 25 such rows — exactly the 25 uncited-resolution findings of the 2026-08-26 baseline, echoing themselves, with zero documents behind any of them.

Fix chosen, and why

Exclude family=uncited-resolution from previous_contested in parse_previous (narrowest of the two directions the issue offered). The original finding's key is already tracked under its own family's line and keeps demanding its citation — nothing is lost. uncited-resolution stays in the regression-tracking keys set (a persisting echo is still recognized as persisting, never misread as a fresh regression), and the finding's own resolution="contested" stamp and action text are unchanged.

I did not re-classify the finding as auto-fixable (the other direction offered): it plainly is not a mechanical defect, and families.FAMILY_RESOLUTION["uncited-resolution"] = CONTESTED already registers it as contested (though that entry turns out to be dead code today — uncited_resolutions() builds its Finding directly and never passes through FAMILY_RESOLUTION, which only applies to run_suite's per-family output before uncited_resolutions() runs and appends its own).

Spec check (did I silently override the contract?)

Read docs/doc-health.md and openspec/specs/doc-health/spec.md before deciding, per the issue's instruction to stop rather than silently change behavior if the spec makes the uncited-resolution finding itself require a disposition.

  • The spec's general scenario ("A contested finding is resolved" — openspec/specs/doc-health/spec.md under "Requirement: Finding severity and regression handling") is written over "a finding classified contested" without an explicit self-exclusion, so read in isolation it is ambiguous about recursion.
  • But the contract's own architecture settles it: docs/doc-health.md's "Check Families" section runs exactly twenty-two named families, and uncited-resolution is not one of them — it is never a member of FAMILY_IDS / families.FAMILIES. It is the enforcement of the contested-finding rule for those 22 families, not a 23rd family subject to the rule itself. Every spec passage that discusses uncited-resolution (the promotion-fidelity, duplicate-packet, release-inventory-drift, modified-block-currency, client-identity-composition requirements) treats it exclusively as the downstream consequence of another family's contested resolution — never as a family whose own vanishing needs a citation.
  • docs/doc-health.md itself never mentions "uncited-resolution", "cited", or "citation" anywhere — the rule is described only in the OpenSpec spec, so the task's conditional doc addition ("if docs/doc-health.md describes the uncited-resolution rule, add one sentence...") does not apply; nothing was added there.
  • openspec/ was not touched — the spec does not literally contradict this fix once read against its own family architecture.

Tests (tests/doc-health/test_suite.py)

Three new cases, appended after the existing skip-family block:

  1. test_a_vanished_uncited_resolution_finding_does_not_re_echo_itself — a previous report's uncited-resolution line, absent from current and undispositioned, yields zero new findings.
  2. test_a_genuinely_contested_finding_of_another_family_still_fires — regression guard: a different family's genuinely contested, vanished, undispositioned finding still raises exactly one uncited-resolution finding.
  3. test_an_emitted_uncited_resolution_finding_does_not_parse_as_contested — the finding uncited_resolutions() itself emits, round-tripped through render()/parse_previous(), never lands in previous_contested, and a second run raises no further echo.

Confirmed all three fail against the pre-fix code (verified via git stash) and pass after. Full suite: 1336 passed on unmodified origin/main (ec8be5a); 1339 passed on this branch (the 3 new tests; no other test's outcome changed).

Real-corpus proof

Per issue #342, --single-repo's repo key is Path(...).resolve().name, and .resolve() dereferences symlinks — so a symlink named openxFactory pointing elsewhere does not work. I used a detached git worktree add --detach <path>/openxFactory <ref> instead (a real checkout, correctly named, full git functionality for location-conformance's blob-checksum sub-check), once at origin/main (before) and once at this branch's tip (after).

Saved health/reports/2026-08-26.md (from the xFactory aggregation repo) to the scratchpad and ran, in each worktree:

python3 scripts/doc-health.py --single-repo . --family location-conformance --previous-report <2026-08-26 baseline> --report-out <out> --as-of 2026-08-30
before after
family=uncited-resolution lines whose rule reads "contested uncited-resolution finding resolved without citation" 25 0
family=uncited-resolution lines whose rule reads "contested location-conformance finding resolved without citation" 12 12 (byte-identical to before)

Closes #515

🤖 Generated with Claude Code

Mechanism: uncited_resolutions() stamps every finding it emits with
resolution="contested" (the two-value taxonomy has no third option, and
an uncited-resolution finding is not a mechanical auto-fixable defect).
parse_previous folded EVERY class="contested" ranked-plan line into
previous_contested regardless of family, including a
family=uncited-resolution line. So once the ORIGINAL finding an
uncited-resolution line cited was genuinely gone, the uncited-resolution
finding about it read back as contested-and-vanished with no citation of
its own, and was re-emitted forever: an uncited-resolution finding about
an uncited-resolution finding, ad infinitum. The 2026-08-30 xFactory
nightly carried 25 such rows -- exactly the 25 uncited-resolution
findings of the 2026-08-26 baseline, echoing themselves, with zero
documents behind any of them.

Fix: exclude family=uncited-resolution from previous_contested in
parse_previous (report.py). The ORIGINAL finding's key is already
tracked under its own family's line and keeps demanding its citation;
only the DERIVED echo's self-audit is removed. uncited-resolution stays
in the regression-tracking key set (a persisting echo is still
recognized as persisting, not misread as a fresh regression), and the
finding's own resolution="contested" stamp and action text are
unchanged.

Why this fix and not re-classifying the finding as auto-fixable: the
resolution-class taxonomy (doc-health spec, Requirement: Finding
severity and regression handling) has exactly two values, and an
uncited-resolution finding plainly is not a mechanical defect -- it is
the ENFORCEMENT of the contested-finding rule for the twenty-two
registered check families (doc-health.md "Check Families"), not itself
one of them. It never appears in FAMILY_IDS/FAMILIES, so its own
disappearance is not a fact about corpus state a second citation could
discharge. The spec's general "a contested finding that disappears...
must be emitted as a new error finding" scenario, read in that
architecture, governs the 22 check families the mechanism protects, not
the mechanism's own output.

Tests (tests/doc-health/test_suite.py): three new cases pin (1) a
previous uncited-resolution line, vanished and undispositioned, yields
zero new findings, (2) a genuinely contested finding of ANOTHER family
still raises exactly one uncited-resolution finding (regression guard),
and (3) the finding uncited_resolutions() itself emits, round-tripped
through render()/parse_previous(), never lands in previous_contested.
Confirmed all three fail against the pre-fix code and pass after.
Full suite: 1336 passed on unmodified origin/main (ec8be5a); 1339
passed on this branch (the 3 new tests above; no other test's
outcome changed).

Real-corpus proof (repo basename forced to 'openxFactory' via a detached
git worktree, per issue #342): running
scripts/doc-health.py --single-repo . --family location-conformance
--previous-report <2026-08-26 baseline> before and after this change --
the count of family=uncited-resolution lines whose rule reads 'contested
uncited-resolution finding resolved without citation' goes from 25 to 0;
the 12 lines reading 'contested location-conformance finding resolved
without citation' are byte-identical in both runs.

Closes #515

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI lite review requested due to automatic review settings August 30, 2026 13:57

@sourcery-ai sourcery-ai 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.

Hi @brettheap! 👋

Your private repo does not have access to Sourcery.

Please upgrade to continue using Sourcery ✨

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.

Pull request overview

This PR fixes an infinite-regression loop in doc-health where uncited-resolution findings could re-emit themselves forever after the original cited finding disappeared, by preventing family=uncited-resolution rows in a previous report from being treated as “contested upstream findings” during parse_previous().

Changes:

  • Update parse_previous() to exclude family=uncited-resolution from previous_contested while still tracking it in the broader keys set.
  • Introduce UNCITED_RESOLUTION_FAMILY constant and use it consistently when emitting uncited-resolution findings.
  • Add regression tests covering the self-echo case and ensuring genuinely-contested upstream findings still produce uncited-resolution output.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
scripts/doc_health/report.py Prevents uncited-resolution findings from being reclassified as contested upstream inputs, eliminating the self-echo loop.
tests/doc-health/test_suite.py Adds targeted tests to reproduce the echo and verify the corrected parsing/emission behavior.
Suppressed comments (1)

scripts/doc_health/report.py:312

  • The docstring splits the identifier UNCITED_RESOLUTION_FAMILY across two lines inside backticks (UNCITED_RESOLUTION_ / FAMILY), which reads like a typo and makes it harder to search for the constant name.
    though it is written with `class="contested"`. See `UNCITED_RESOLUTION_
    FAMILY` above for why: it is the enforcement of the rule for OTHER

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

file=sys.stderr)


# The family `uncited_resolutions` itself emits. Not a member of `FAMILY_IDS`
@brettheap
brettheap merged commit 1d7e9bd into main Aug 31, 2026
4 checks passed
@brettheap
brettheap deleted the fix/515-uncited-resolution-echo branch August 31, 2026 01:05
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.

doc-health: uncited-resolution findings are themselves contested, so every one re-emits forever once it vanishes

2 participants