Skip to content

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

Description

@squid-protocol

Summary

Found by the #1096 control corpus (cobol reference folder): fragile_debt / planned_debt
are whole-text rules, not comment-anchored — and because - is a regex word boundary,
they match inside hyphenated code identifiers.

Evidence (verified via finditer + end-to-end scan, 2026-08-31)

data/cobol/c.cpy plants exactly one * HACK: comment and one * TODO: comment, plus a
reverse decoy data item 77 HACK-LEVEL PIC 9. (referenced once more via DISPLAY HACK-LEVEL.)
and a paragraph named PROBE-TODO.:

  • observed fragile_debt = 3 (the comment + both code occurrences of HACK-LEVEL)
  • observed planned_debt = 2 (the comment + the PROBE-TODO paragraph name)

Python's equivalent reverse decoy (HACK_LEVEL = level) is inert — but only by accident of
tokenization: _ is a word character so \bHACK\b can't match, while - is a boundary so
it can.

Why it matters

Real hyphenated-identifier ecosystems hit this constantly: COBOL data items like BUG-COUNT
or WS-FIX-FLAG, CSS classes like .bug-icon, Lisp-family symbols like fix-me. Every one
of them currently contributes tech-debt signal from ordinary code, inflating debt scoring in
exactly the legacy languages (COBOL/JCL) where debt measurement matters most.

Possible directions (needs a design decision, not proposing one unilaterally)

  1. Anchor the debt rules to the comment surface (prism already separates it — the branch/io
    family is stripped from comments today, so the plumbing exists).
  2. Keep whole-text but require a following :/! or comment-marker context.
  3. Per-language identifier-shape guards for hyphenated-word languages.

References

Activity

  1. added
    core-engine
    on Aug 31, 2026
  2. squid-protocol commented on Aug 31, 2026

    @squid-protocol
    OwnerAuthor

    Batch-4 addendum from the corpus: scheme reproduces the leak — (define (probe-todo plan) ...) records planned_debt 2 (the TODO comment + the identifier), confirming the lisp-family exposure predicted in this issue. Corpus evidence: keyword-rosetta/data/scheme/c.scm + ledger cobol-hyphen-identifier-debt-leak.

  3. added
    bug
    legacy-modernization
    metrics
    priority: high
    threat: false-positive
    on Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcore-enginelegacy-modernizationmetricspriority: highthreat: false-positive

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions