fix(core): retain ambiguous files that extracted real structure (#2326) - #2333
Merged
Merged
Conversation
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>
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2326.
Problem
statistical_auditor.py's Heuristic Extension Consensus loop-back sent everytier >= 4 or "Collision" in proofartifact toambiguous_artifacts, then deleted any it couldn't confirm via an 80% ecosystem vote (or the.h/.hpp/.incC-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.ygrammar 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_datawith nothing but a line in the Excluded Artifacts list.Fix — Structure Retention
Replaces the "banish unless decisively-resolved collision" tail:
identity_lock_tier = 4,telemetry["provisional_identity"] = True, proof"Provisional Identity (Ambiguous, N symbol(s) retained: <lang>)",WARNINGloglang_id, or zero extracted structure"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_checkPASS 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)tests/security_auditingsuite — 161 pass--ci— clean (ruff baseline: one PERF203 line-shift)crucible_check.py— PASS both modes, no golden-master change🤖 Generated with Claude Code