Skip to content

E-SECTION-SCAN reports through err, so a scan fault can be downgraded to a warning #90

Description

@randomparity

Found while implementing #63. Recorded in ADR 0008's Consequences with this issue as its owner.

Problem

check_sections in check-records.sh reports its scan fault through err:

*)
  err "E-SECTION-SCAN: $label: could not scan $file for section '$section' (grep exit $grep_status)"
  continue
  ;;

err is the downgradable channel. For a record that was already non-conforming at the base ref the checker runs in downgrade mode, where err relabels the finding as ::warning::W-LEGACY-SHAPE and never sets failed=1 — so the gate exits 0 over a section it could not scan.

ADR 0005 states the rule this breaks, in its Consequences:

Reporting goes through err_full rather than err, so a scan fault cannot be downgraded to W-LEGACY-SHAPE for a record that was already non-conforming — a fault describes the scan, not the record.

check_title_number in profiles/adr.sh follows that rule and carries a comment explaining it. check_sections does not, and appears to predate it: E-SECTION-SCAN came from #25's sweep, before ADR 0005 was written.

Why it is narrow, and still worth fixing

The fault has to coincide with a record that is non-conforming at the base ref. A record that is conforming at base runs in report mode, where err and err_full behave alike — which is why the existing test for this code passes: it drives a tree-only fault (chmod 000 on the working-tree file) while the base pass reads a readable temp copy of the blob.

So this is not a live false green on the repo's current records. It is a rule that holds by accident of which pass faults, and the grandfathered-record path is exactly where a gate is least examined.

#63 hit the same distinction from the other side: E-SECTION-BODY-SCAN had to use err_full because section_body's awk faults in both passes, which marks the record non-conforming at base and downgrades the finding. The two codes now sit adjacent in the same function on different channels.

Expected

  1. E-SECTION-SCAN reports through err_full, with a comment giving the reason, matching check_title_number.
  2. A sweep of the remaining E-*-SCAN codes for the same inconsistency — this was one reading of one function, not a mechanical check.
  3. A regression test that fails on the current channel: a record non-conforming at the base ref whose section scan then faults, asserting exit 1 and E-SECTION-SCAN rather than W-LEGACY-SHAPE.
  4. Both mirrors (.github/scripts/skills/tome-of-lore/assets/) stay byte-identical.

Provenance

ADR 0005 (accepted) states the rule. ADR 0008 records the divergence and defers it here rather than widening #63's charter, which was scoped to the pipeline idiom.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:guardrailsGate scripts, test harnesses, Just recipes, hooks, and CI enforcementbugSomething isn't workingstatus:awaiting-mergegreen + mergeable; human just clicks merge

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions