Repository navigation
Description
Summary
Follow-up to #691 (fixed for markdown) and the reopened #617 (yaml). detector.py's
"Prose Deflection" gate (splice(), ~line 435) unconditionally discards equations
(and therefore every structural signature) for plaintext, json, yaml, and csv
alike:
if confidence < 0.42 or self.primary_lang_id in (
"plaintext", "json", "yaml", "csv",
):
return {"equations": {}, ...} # early return, nothing scannedmarkdown used to be in this same tuple too -- #691/#692 fixed that one. yaml,
json, and csv are still in it.
Why this is a different bug shape than markdown's, and needs a different fix
Markdown is genuinely pure prose -- prism.py's Prose Bypass correctly routes its
entire content into comment_stream, leaving code_stream empty, so #691's fix had
to route it through comment_analysis() instead.
yaml/json/csv are not pure prose. Confirmed via direct Prism.split_streams()
execution: none of the three go through prism.py's Prose Bypass, and all three get
code_stream populated correctly and normally (e.g. a realistic yaml sample:
coding_loc=14, doc_loc=0 -- treated as real structural content, not documentation).
signal_processor.py agrees: its separate doc_languages set (the "STATIC LITERATURE
OVERRIDE" that legitimately zeroes out logic-risk math for pure documentation) only
contains {"markdown", "plaintext", "rst", "text"} -- yaml/json/csv were never in it,
correctly, because a CI/CD yaml pipeline, a package.json with a malicious
postinstall script, or a CSV-driven build matrix can all carry real structural/
security signal that plain prose can't.
So detector.py's gate is inconsistent with the rest of the pipeline's own design
intent -- it treats yaml/json/csv as if they were pure documentation (like markdown/
plaintext), while signal_processor.py already correctly treats them as real
structured content. The fix isn't to add them to doc_languages anywhere (that would
make things worse -- it would make risk math incorrectly report 0% for genuinely risky
config/pipeline files). The fix is removing them from this one gate and letting them
flow through the normal coding_analysis/code_stream path, the same one every real
code language already uses.
Confirmed impact
Directly proved yaml's already-shipped regex fixes (#617/#681: high_risk_execution's
rm -rf / boundary bug, events' schedule: anchor bug, telemetry's ::warning::
anchor bug, etc.) have been sitting completely dead in production since that PR merged
-- calling coding_analysis() directly (bypassing only the gate) against a realistic
yaml sample containing those exact constructs correctly fires all of them. Same class
of bug, same fix shape, for json and csv (not yet individually verified against their
own strict-parsing rule sets, but code_stream population confirmed identical).
Scope of this issue
- Remove
yaml,json,csvfromdetector.py's Prose Deflection gate (leave
plaintext-- it has an emptyrulesdict, genuinely nothing to gain). - Re-run
pytest -m golden_cruciblein both full-precision and zero-dependency venvs
after the fix and walk through the diff file-by-file (per
how_to_add_a_language.md's Step 5) -- expect real, previously-invisible diffs on
every yaml/json/csv file in the corpus, same shape as Prose-bypass languages (markdown, plus yaml/json/csv/plaintext) never get their structural signatures counted, regardless of regex correctness #691/Let markdown's structural signatures reach the detector output #692 produced for
markdown. - Check whether any other language currently sitting in this gate's tuple, or a
similar one elsewhere in the pipeline, has the same problem -- this is the second
gate found this way (the first was markdown's, discovered while closing Strict parsing tests:markdownstructural signatures #597); worth
treating "does this language's structural signatures actually reach a real scan" as
a standing checklist item for every remaining strict-parsing issue in epic Epic: Strict & exact regex test coverage for all structural signatures, per language #518, not
just something to discover by accident per-language. - Closes/unblocks the reopened Strict parsing tests:
yamlstructural signatures #617 (yaml) -- that issue's own strict-parsing test
suite is already correct; it just needs this pipeline fix plus a real
golden_cruciblerun to actually close cleanly.
Activity
Use line_exclusive's real delimiter list instead of a hardcoded guess…
Strict tests for livecode, fix 7 real bugs (issue #593) (#707)
Fix #587: Strict parsing tests for html structural signatures (#734)
Fix #609: Strict parsing tests for scheme structural signatures (#771)
Let yaml/json/csv structural signatures reach the detector output (is…