Skip to content

aperture: virtualenvs by marker, prose comment lines exempt from saturation (#4542, #4543) - #4550

Merged
squid-protocol merged 3 commits into
mainfrom
fix/4542-scan-exclude
Oct 6, 2026
Merged

squid-protocol merged 3 commits into
mainfrom
fix/4542-scan-exclude

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Closes #4542
Closes #4543

What

#4542, virtualenvs by marker. env, .env and virtualenv are removed from IGNORED_DIRECTORIES. A directory with one of those names is excluded only when aperture.looks_like_virtualenv finds markers: pyvenv.cfg, bin/activate, Scripts/activate(.bat), lib/python*/site-packages, Lib/site-packages or conda-meta. venv and .venv stay excluded by name: they are a convention, and nobody names a source directory that. virtualenv is marker-gated because pypa/virtualenv's own package is src/virtualenv/. The GuideStar doc-coverage walk and the chronometer's fallback mtime walk prune in the same way. The other name-only entries (build, out, target, ...) are out of scope here and unchanged.

#4543, comment lines and the saturation gate. Gate 4.1 no longer counts a line over MAX_LINE_LENGTH when that line is wholly a comment in the file's own syntax. That means a line-comment token, or a line inside a block comment, or one complete block comment, judged by lexical_family. When several languages claim an extension, it gets only the tokens they all agree on, so C's #define is never read as a comment. Two more conditions apply: the line must read as prose (spaced words, no base64, or inline sourceMappingURL=data:), and it must be no longer than the new MAX_COMMENT_LINE_LENGTH (5000). These stay blocked: minified code, a license comment glued to code (/*! x */!function...), a block comment closed mid-line with code after it, a table literal on one line, and base64 in a comment.

Evidence

I ran real scans with this branch and diffed excluded_artifacts against the doom-study scans:

  • room4doom: 378 → 395 files, 144,525 → 154,783 LOC. All 10 gameplay/src/env/*.rs files are scanned now, and 7 of the 8 editor files. math/src/og_trig_tables.rs is a data payload and stays blocked. tools/editor/src/render/wgpu.rs is now blocked by Gate 4.3 instead, because its line 28 is a doc comment saying "...thresholds are generated by surface_wgsl". That is a separate false positive and needs its own follow-up issue.
  • crispy-doom: src/hexen/p_map.c is scanned (2,343 LOC, 32 functions). Nothing else moved.
  • There are new unit fixtures in tests/core_engine/test_scan_exclusions_4542_4543.py. They cover env, virtualenv and venv directories, each virtualenv marker, long comments in Rust, C, C++, .h and Python, plus minified JS and CSS and the payload cases.

Gates

pr_gates.py: 7/7 pass (lint, audits, secrets, xray, gauntlet, golden, suite). --ratchets: port-surface, estate, fact-crosscheck, completeness and ground-truth pass. ports was skipped because this box has no cics-crucible checkout. The golden masters pass on both legs with no drift, so I did not bless anything. After that run I merged origin/main, which only had det-only changes (#4540, #4541).

🤖 Generated with Claude Code

https://claude.ai/code/session_01W3KVtYHQp8KsfKcHsdiPbR

squid-protocol and others added 2 commits October 6, 2026 03:10
…ration (#4542, #4543)

#4542: `env`, `.env` and `virtualenv` leave IGNORED_DIRECTORIES. A directory with one
of those names is excluded only when it carries a virtualenv's markers (pyvenv.cfg,
bin/activate, Scripts/activate, lib/python*/site-packages, Lib/site-packages,
conda-meta). `venv` / `.venv` stay excluded by name. The GuideStar doc walk and the
chronometer's fallback walk prune the same way.

#4543: Gate 4.1 no longer counts a long line that is wholly a comment in the file's
own syntax (line token, or inside / one whole block comment, by lexical family;
an extension shared by languages gets only the tokens they all agree on), as long
as it reads as prose and is within MAX_COMMENT_LINE_LENGTH (5000). Minified code,
a comment glued to code, base64 / inline source maps and table literals stay blocked.

Real scans: room4doom gameplay/src/env/*.rs (10 files) and 7 of the 8 editor files
now scanned (wgpu.rs is now caught by Gate 4.3 on a "generated by" doc comment, a
separate bug); crispy-doom src/hexen/p_map.c scanned; og_trig_tables.rs stays blocked.

Closes #4542
Closes #4543

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01W3KVtYHQp8KsfKcHsdiPbR
@squid-protocol squid-protocol added bug Unintended behavior or logic failure in the engine data-integrity Issues relating to RAM state or SQLite database fidelity core-engine Modifications to the central physics and parsing engine priority: high Core feature broken, but workarounds exist labels Oct 6, 2026
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

LEXICAL_FAMILY_HEURISTICS is inferred as dict[str, object]; read it through an
explicit dict[str, Any], annotate the per-language syntax tuple, and stop reusing
tuple-typed names for frozensets. No behaviour change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01W3KVtYHQp8KsfKcHsdiPbR
"""
families: dict[str, Any] = dict(LEXICAL_FAMILY_HEURISTICS.get("lexical_families", {}))
per_lang: dict[str, list[str]] = families.get("line_exclusive", {}).get("language_delimiters", {})
Syntax = tuple[frozenset[str], frozenset[tuple[str, str]]]
@squid-protocol
squid-protocol marked this pull request as ready for review October 6, 2026 07:43
@squid-protocol
squid-protocol merged commit e78abd3 into main Oct 6, 2026
27 checks passed
@squid-protocol
squid-protocol deleted the fix/4542-scan-exclude branch October 6, 2026 07:43
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 data-integrity Issues relating to RAM state or SQLite database fidelity priority: high Core feature broken, but workarounds exist

Projects

None yet

2 participants