You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bugUnintended behavior or logic failure in the enginecore-engineModifications to the central physics and parsing enginedata-qualitylegacy-modernizationCOBOL refractor, dead-code extraction, and JCL forgingpriority: highCore feature broken, but workarounds existthreat: false-positiveAccuracy tuning: Engine incorrectly flagged safe code
Every other stripping path in this file — _strip_segment_comments's generic pipeline, _strip_nested_comments — masks string literals via LITERAL_MASK_PATTERN before scanning for comment delimiters, specifically to avoid mistaking a delimiter-like character inside a string for a real comment marker. _strip_positional_comments (used for column_sensitive languages — COBOL, Fortran) does not:
pythonif ">" in line:
parts = line.split(">", 1)
code.append(parts[0]); lits.append("*>" + parts[1])
elif "!" in line:
parts = line.split("!", 1)
code.append(parts[0]); lits.append("!" + parts[1])
A line like PRINT *, "Warning!" gets truncated at the ! inside the string, misclassifying the rest of the line as a comment. Given COBOL/Fortran get first-class treatment elsewhere in the docs (the whole "Legacy Modernization" toolchain), this is a real gap rather than a documented tradeoff.
Fix: apply the same LITERAL_MASK_PATTERN shielding used elsewhere before the *>/! split.
Reopening: this was closed with "resolved by #273", but #273 (core: fix issue #261, miscounting files with the same name) only touched gitgalaxy/core/network_risk_sensor.py / tests/security_auditing/test_network_risk_sensor.py — it never touched prism.py at all. The
closure comment appears to reference the wrong PR number.
Verified against current main (as of this writing) that the bug this issue describes is still
live in Prism._strip_positional_comments (gitgalaxy/core/prism.py, the function used for the positional_anchored family — cobol, fortran). It still splits directly on *>/! with no LITERAL_MASK_PATTERN shielding beforehand, unlike every other stripping path in this file:
>>>fromunittest.mockimportpatch>>>fromgitgalaxy.core.prismimportPrism>>>MOCK_COMMENT_DEFS= {"lexical_families": {"positional_anchored": {"delimiters": []}}}
>>>MOCK_LANG_DEFS= {"cobol": {"lexical_family": "positional_anchored"}}
>>>withpatch("gitgalaxy.core.prism.PRISM_CONFIG", {
... "SHIELD_PATTERN": r'(?P<shield>"(?:\\.|[^"\\])*"|\'(?:\\.|[^\'\\])*\'|`(?:\\.|[^`\\])*`)',
... "PYTHON_DOC_PATTERN": "", "PHP_HEREDOC_PATTERN": "",
... "POSITIONAL_ANCHORS": {"*", "C", "c", "/", "!"},
... }):
... p=Prism(comment_definitions=MOCK_COMMENT_DEFS, language_definitions=MOCK_LANG_DEFS)
... code, lits=p._strip_positional_comments(
... ' DISPLAY "Rate *> 5%" TO CONSOLE.\n MOVE X TO Y.'
... )
>>>code' DISPLAY "Rate \n MOVE X TO Y.'>>>lits'*> 5%" TO CONSOLE.\n'
A COBOL DISPLAY literal containing *> (or, for the Fortran/free-format ! branch, any COBOL
string literal containing ! — same code path) gets truncated mid-literal: TO CONSOLE. silently
disappears from code_stream (misclassified as a comment) and the code stream is left with a
dangling unterminated ". Reproduced identically for the plain-Fortran ! branch.
Also confirmed tests/core_engine/test_prism.py's only positional_anchored coverage
(test_prism_strips_comments_against_the_real_config) exercises just the column-7 * fixed-form
comment case, not this inline-delimiter-inside-a-string-literal case — so this gap has no
regression test guarding it either, which is presumably how it survived #1745 (which fixed a
different bug in the same function — a code/lits line-count "geometry corruption" — without
touching the string-shielding gap this issue is actually about).
Found while writing docs/language_status/cobol.md (documentation-only pass, not fixing this
inline per that skill's scope discipline) — flagging for a real fix via harden-language-extraction or a standalone PR.
bugUnintended behavior or logic failure in the enginecore-engineModifications to the central physics and parsing enginedata-qualitylegacy-modernizationCOBOL refractor, dead-code extraction, and JCL forgingpriority: highCore feature broken, but workarounds existthreat: false-positiveAccuracy tuning: Engine incorrectly flagged safe code
Activity
squid-protocol commentedon Jul 21, 2026
resolved by #273
squid-protocol commentedon Aug 20, 2026
Reopening: this was closed with "resolved by #273", but #273 (
core: fix issue #261, miscounting files with the same name) only touchedgitgalaxy/core/network_risk_sensor.py/tests/security_auditing/test_network_risk_sensor.py— it never touchedprism.pyat all. Theclosure comment appears to reference the wrong PR number.
Verified against current
main(as of this writing) that the bug this issue describes is stilllive in
Prism._strip_positional_comments(gitgalaxy/core/prism.py, the function used for thepositional_anchoredfamily — cobol, fortran). It still splits directly on*>/!with noLITERAL_MASK_PATTERNshielding beforehand, unlike every other stripping path in this file:A COBOL
DISPLAYliteral containing*>(or, for the Fortran/free-format!branch, any COBOLstring literal containing
!— same code path) gets truncated mid-literal:TO CONSOLE.silentlydisappears from
code_stream(misclassified as a comment) and the code stream is left with adangling unterminated
". Reproduced identically for the plain-Fortran!branch.Also confirmed
tests/core_engine/test_prism.py's onlypositional_anchoredcoverage(
test_prism_strips_comments_against_the_real_config) exercises just the column-7*fixed-formcomment case, not this inline-delimiter-inside-a-string-literal case — so this gap has no
regression test guarding it either, which is presumably how it survived #1745 (which fixed a
different bug in the same function — a code/lits line-count "geometry corruption" — without
touching the string-shielding gap this issue is actually about).
Found while writing
docs/language_status/cobol.md(documentation-only pass, not fixing thisinline per that skill's scope discipline) — flagging for a real fix via
harden-language-extractionor a standalone PR.docs: add cobol language-status doc (sections 1-8) (#1893)