Skip to content

fix(core): retain ambiguous files that extracted real structure (#2326) - #2333

Merged
squid-protocol merged 1 commit into
mainfrom
fix-consensus-structure-retention-2326
Aug 27, 2026
Merged

fix(core): retain ambiguous files that extracted real structure (#2326)#2333
squid-protocol merged 1 commit into
mainfrom
fix-consensus-structure-retention-2326

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Fixes #2326.

Problem

statistical_auditor.py's Heuristic Extension Consensus loop-back sent every tier >= 4 or "Collision" in proof artifact to ambiguous_artifacts, then deleted any it couldn't confirm via an 80% ecosystem vote (or the .h/.hpp/.inc C-family fallback, or #2324's decisive-collision keep) — even when the file classified to a real language and GitGalaxy had extracted real named functions/classes from it. #1926 was one instance (every .y grammar deleted); this is the general case.

The identity label on such a file may be shaky, but a symbol GitGalaxy actually named is real signal that shouldn't vanish from file_data with nothing but a line in the Excluded Artifacts list.

Fix — Structure Retention

Replaces the "banish unless decisively-resolved collision" tail:

case before after
ambiguous + real language + ≥1 named symbol deleted kept, identity_lock_tier = 4, telemetry["provisional_identity"] = True, proof "Provisional Identity (Ambiguous, N symbol(s) retained: <lang>)", WARNING log
decisively-resolved collision (conf ≥ 0.85, ≥5 signals) kept, Tier 3 "Lexically Decisive" unchanged
degenerate lang_id, or zero extracted structure deleted deleted — "Unresolved Ambiguity (No Retainable Structure)"

Downstream consumers can key off telemetry["provisional_identity"] to discount the label without losing the extracted structure.

Impact — zero

After #2324, no file in the ~80-repo crucible corpus hits this path (verified: 0 "Unresolved Ambiguity" entries in the golden master, and an instrumented scan confirms 0 banishes). Both golden masters unchanged; crucible_check PASS both modes. This is defensive hardening for arbitrary real-world repos with rare or collision-prone extensions.

Verification

  • test_statistical_auditor.py — 10 pass (added TEST 10: provisional retention + genuine noise still banished)
  • full tests/security_auditing suite — 161 pass
  • ruff / mypy --ci — clean (ruff baseline: one PERF203 line-shift)
  • crucible_check.py — PASS both modes, no golden-master change

🤖 Generated with Claude Code

The Heuristic Extension Consensus loop-back in `statistical_auditor.py` sent
every `tier >= 4 or "Collision" in proof` artifact to `ambiguous_artifacts`
and then DELETED any it couldn't confirm via an 80% ecosystem vote (or the
`.h`/`.hpp`/`.inc` C-family fallback, or #2324's decisive-collision keep) --
even when the file classified to a real language and GitGalaxy had extracted
real named functions/classes from it. #1926 was one instance (every `.y`
grammar); this is the general case.

Replaces the "banish unless decisively-resolved collision" tail with a
Structure Retention rule:

- ambiguous + real language + >=1 named symbol (function/class), OR a
  decisively-resolved collision (conf >= 0.85, >= 5 signal hits) -> KEEP.
- a decisively-resolved collision keeps the stronger "Lexically Decisive"
  Tier-3 label (unchanged from #2324); anything else is kept as an explicitly
  PROVISIONAL identity: `identity_lock_tier = 4`,
  `telemetry["provisional_identity"] = True`, source proof
  "Provisional Identity (Ambiguous, N symbol(s) retained: <lang>)", and a
  WARNING log so nothing downstream silently over-trusts the label.
- only genuine noise -- a degenerate `lang_id`, or zero extracted structure --
  is still banished, now as "Unresolved Ambiguity (No Retainable Structure)".

Zero corpus impact: after #2324, no file in the ~80-repo crucible corpus hits
this path, so both golden masters are unchanged (crucible_check PASS both
modes). Defensive hardening for arbitrary real-world repos with rare or
collision-prone extensions.

Verification: test_statistical_auditor.py (10, +1 retention case) and the full
tests/security_auditing suite (161) green; ruff/mypy --ci clean (ruff
baseline: one PERF203 line-shift); crucible_check both modes PASS.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit 9391c70 into main Aug 27, 2026
28 checks passed
@squid-protocol
squid-protocol deleted the fix-consensus-structure-retention-2326 branch August 27, 2026 15:50
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.

Heuristic Extension Consensus silently deletes cleanly-extracted ambiguous files

1 participant