Skip to content

fix(standards): guard debt patterns against hyphenated identifiers (closes #2537) - #2622

Merged
squid-protocol merged 1 commit into
mainfrom
fix/2537-debt-hyphen-identifier-guards
Aug 31, 2026
Merged

fix(standards): guard debt patterns against hyphenated identifiers (closes #2537)#2622
squid-protocol merged 1 commit into
mainfrom
fix/2537-debt-hyphen-identifier-guards

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

Closes #2537 — the rosetta[cobol] sweep's (#2567) one real engine bug. - is a regex word
boundary, so the two shared debt patterns (GLOBAL_FRAGILE_DEBT / GLOBAL_PLANNED_DEBT)
matched debt keywords embedded inside hyphenated code identifiers: COBOL HACK-LEVEL /
BUG-COUNT data items, PROBE-TODO paragraph names, Lisp probe-todo symbols, css
.bug-icon classes. Ordinary code inflated tech-debt scoring in exactly the legacy
ecosystems where debt measurement matters most (HACK_LEVEL in python was inert only
because _ is a word char — tokenization luck, not design).

The fix

Fixed-width lookaround guards on the SPACED (Latin/Cyrillic) alternation only:
(?<![A-Za-z0-9]-) / (?!-[A-Za-z0-9]) — a match is refused when glued to
hyphen-plus-alphanumeric (the shape of an identifier continuing through the hyphen).
Every real marker keeps counting, including hyphen-adjacent comment shapes whose neighbor
char is NOT alphanumeric: -- TODO x (Ada/Haskell/SQL comments), glued --TODO, trailing
TODO--, @todo. The DENSE CJK/RTL alternation is untouched (no hyphenated-identifier
idiom to guard).

Golden-master re-bless (both modes) — diff shape verified before blessing

17 diffs, all tech-debt drops, each disputed source line read and confirmed as the FP
class (not a lost real marker):

corpus file drop disputed text
cobol carddemo COACTUPC.cbl fragile 1→0 *Format xxx-xx-xxxx — an SSN format mask counted as XXX
shell ansible ansible-galaxy__runme.sh fragile 4→0 roles-path-bug kebab directory name, 4 occurrences
m4 gnucobol configure.ac fragile 12→11 bug-gnucobol@gnu.org mail alias
dart flutter object.dart fragile 1→0 "bug-prone" prose compound in a doc comment

No diffs outside tech-debt surfaces.

Tests

  • Cross-language regression on both shared patterns (7 identifier-embedded negatives, 9
    marker positives incl. the hyphen-adjacent comment family, ReDoS detonation with a
    hyphen-heavy payload) in tests/core_engine/test_language_standards_strict.py.
  • Corpus-shaped repros in test_cobol_strict.py / test_scheme_strict.py.
  • Full suite: 7171 passed. crucible_check.py PASS both venvs; audit_check.py all clear.

Cross-repo

🤖 Generated with Claude Code

https://claude.ai/code/session_01BsVATdyMPhUoAUNBKbMUVi

…2537)

`-` is a regex word boundary, so GLOBAL_FRAGILE_DEBT/GLOBAL_PLANNED_DEBT's
bare \b(...)\b alternations matched debt keywords EMBEDDED INSIDE hyphenated
code identifiers -- COBOL data items (HACK-LEVEL, BUG-COUNT), COBOL/Lisp
paragraph and symbol names (PROBE-TODO, probe-todo), css classes (.bug-icon)
-- inflating tech-debt scoring from ordinary code in exactly the hyphenated-
identifier ecosystems (COBOL/JCL, Lisp, css) where debt measurement matters
most. Python's HACK_LEVEL was inert only by tokenization luck (_ is a word
char).

Fix: fixed-width lookaround guards on the SPACED alternation only --
(?<![A-Za-z0-9]-) / (?!-[A-Za-z0-9]) -- refusing a match glued to
hyphen-plus-alphanumeric (an identifier continuing through the hyphen).
Real markers keep counting, including hyphen-ADJACENT comment shapes whose
neighbor is not alphanumeric: `-- TODO` (Ada/Haskell/SQL), glued `--TODO`,
trailing `TODO--`. The DENSE CJK/RTL alternation is untouched (no
hyphenated-identifier idiom).

Golden masters re-blessed (both modes): 17 diffs, ALL tech-debt drops on
verified identifier-embedded shapes -- cobol carddemo COACTUPC.cbl's
`*Format xxx-xx-xxxx` SSN mask counted as XXX, shell ansible's
`roles-path-bug` directory name (x4), m4 gnucobol's `bug-gnucobol@gnu.org`
mail alias, dart flutter object.dart's "bug-prone" prose compound. No
diffs outside tech-debt.

Tests: cross-language regression on both shared patterns + ReDoS detonation
(hyphen-heavy payload) in test_language_standards_strict.py; corpus-shaped
repros in test_cobol_strict.py / test_scheme_strict.py. Full suite 7171
passed; audit_check all clear.

Closes #2537

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BsVATdyMPhUoAUNBKbMUVi
@squid-protocol squid-protocol added bug Unintended behavior or logic failure in the engine core-engine Modifications to the central physics and parsing engine legacy-modernization COBOL refractor, dead-code extraction, and JCL forging metrics Heuristics, risk exposures, and topological math updates priority: high Core feature broken, but workarounds exist threat: false-positive Accuracy tuning: Engine incorrectly flagged safe code labels Aug 31, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

squid-protocol added a commit that referenced this pull request Aug 31, 2026
…sweep) (#2623)

Second §10 capstone after jcl.md's. Records the #2567 sweep's five-bucket
decomposition: #2537/#2622 hyphenated-identifier debt fix, the comment-mass
authoring re-baseline, the args clause-match morphology ledger entry, and
the #2535/#2546-blocked residuals. Also annotates §3's debt-rule row with
the new hyphen guard.


Claude-Session: https://claude.ai/code/session_01BsVATdyMPhUoAUNBKbMUVi

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
@squid-protocol
squid-protocol merged commit 8abffd0 into main Aug 31, 2026
102 of 103 checks passed
@squid-protocol
squid-protocol deleted the fix/2537-debt-hyphen-identifier-guards branch August 31, 2026 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Unintended behavior or logic failure in the engine core-engine Modifications to the central physics and parsing engine legacy-modernization COBOL refractor, dead-code extraction, and JCL forging metrics Heuristics, risk exposures, and topological math updates priority: high Core feature broken, but workarounds exist threat: false-positive Accuracy tuning: Engine incorrectly flagged safe code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fragile_debt/planned_debt match inside hyphenated code identifiers (HACK-LEVEL, PROBE-TODO) — debt rules are whole-text, not comment-anchored

1 participant