Skip to content

fix(audit): repair the merge-residue guardrail so it can actually run - #76

Merged
mdheller merged 7 commits into
mainfrom
rescue/runtime-parity-audit
Jul 29, 2026
Merged

fix(audit): repair the merge-residue guardrail so it can actually run#76
mdheller merged 7 commits into
mainfrom
rescue/runtime-parity-audit

Conversation

@mdheller

Copy link
Copy Markdown
Member

Rescues validation/current-main-runtime-parity-20260504, which was set aside as "failing" during the 2026-07-04 batch-integration attempt and then lost when that batch was closed unmerged.

It was failing for a reason worth naming: the guardrail did not compile.

Two blocks carried 2-space indentation inside a 12-space scope, so audit_current_runtime_static.py raised IndentationError before executing a single check. It is a detector for merge residue that was itself broken by merge residue, and it has never run since the day it was written. The branch was excluded for failing; the failure was the bug.

A second defect was latent behind the first. Conflict-marker detection tested bare substrings:

markers = ("<<<<<<<", "=======", ">>>>>>>")
require(path, marker not in body, ...)

"=======" in body matches any run of seven =, which includes markdown setext underlines and ASCII rules — and CRITICAL_PATHS includes docs/CAPABILITY_FABRIC_SEMANTIC_SOURCE.md. The first prose heading added to that file would have reported an unresolved merge conflict. Markers are now line-anchored to the forms git actually writes (^<<<<<<< , ^=======$, ^>>>>>>> ).

Verification

Mutation-tested, not assumed — a guardrail that only ever passes is indistinguishable from one that is not wired up:

control expected result
planted conflict marker in envelope.go detected exit 1 ✅
removed blake2b import detected exit 1 ✅
markdown ===== underline in the .md ignored exit 0 ✅
current main content, unmodified passes exit 0 ✅

The third row is the specific regression the substring form would have caused.

Provenance

Recovered by a content-level audit rather than commit reachability. ahead_by over-reports stranded work badly — of 261 branches ahead of default across 13 repos, 194 had every byte already present on main (squash residue, or content landed via a different branch). This branch is one of the 67 that genuinely carried unique content: .github/workflows/current-runtime-parity.yml and the audit tool.

mdheller and others added 7 commits July 29, 2026 13:25
tools/audit_current_runtime_static.py did not compile. Two blocks carried
2-space indentation where the enclosing scope was 12 — the failure mode the
script itself exists to catch, in the script that catches it. It has been
dead since it was written, which is why the branch was set aside as
'failing': nothing in it ever executed.

Conflict-marker detection also matched bare substrings. `"=======" in body`
fires on any run of seven '=', including markdown setext underlines, and
CRITICAL_PATHS carries a .md file — so the first prose heading would have
reported a merge conflict. Markers are now line-anchored to the forms git
actually writes.

Mutation-tested rather than assumed: a planted conflict marker is caught, a
removed BLAKE2b import is caught, and a markdown underline is correctly
ignored. Verified against current main content, which passes clean.
The three-marker set misses '|||||||', which git writes for the common
ancestor under merge.conflictStyle=diff3 or zdiff3. That is not the default,
so a repo opting into it would have had its merge residue pass the check
cleanly — the exact blind spot this tool exists to remove.

Verified with a diff3-style conflict planted in envelope.go.
@mdheller
mdheller merged commit 08121c1 into main Jul 29, 2026
8 checks passed
@mdheller
mdheller deleted the rescue/runtime-parity-audit branch July 29, 2026 18:00
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