Repository navigation
Scan dense hand-written source instead of excluding it as minified (Fixes #7501) - #7503
Merged
Merged
Conversation
…ixes #7501) Whole programs packed onto a few dozen 500-3,000 char lines, several functions defined inline per line (typical of AI coding agents), were dropped by the generated-noise guards: aperture Gate 4.1 (and 3.4/5.1), whose definitions exemption skipped lines over 200 chars and only read `) {`-terminated heads; the worker's avg-line minification test; the detector's 1,500-char line shield; and the auditor's Packed Payload Guard, whose definitions exemption required ordinary width. New gitgalaxy/core/dense_source.py: in compiled languages only (C/C++, Rust, Go, Java, C#, Zig, Swift, Kotlin, Scala; minifiers emit web languages and data), a function defined inline on a long line, read by a bounded linear scan up to 5,000 chars, marks the file as source. The auditor accepts named functions at least every 10 physical lines in those languages. Co-Authored-By: Claude Opus 5.5 <[email protected]>
squid-protocol
marked this pull request as ready for review
November 2, 2026 03:30
Contributor
Contributor
|
No description provided. |
This was referenced Nov 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was broken
Dense hand-written source is a whole program packed onto a few dozen 500-3,000 char lines, with several functions defined inline per line. AI coding agents write this way (#7501: Codex chess engines in C and Rust, a SAT solver). GitGalaxy dropped these files whole. Synthetic repro (C, Rust, Go, about 420 functions on about 36 lines):
Blocked (Saturation: Line 4 exceeds 500 chars)MINIFIED/VENDOR DETECTED(avg line > 800), detector skipped, 0 functionsPacked Payload Guard (Impossible Density: 160 hits/line)Fix
The issue named two root causes. The class sweep turned up two more of the same kind. All four read width or density and take a long line for minifier output:
aperture._has_definitions(the exemption for Gates 3.4, 4.1 and 5.1) skips lines over 200 chars and only reads heads ending in) {.statistical_auditor._has_named_definitionsrequires_is_ordinary_width.is_minifiedtest (galaxyscope.py: average line > 800, or > 50 KB in < 15 lines).Signal: the language, plus functions defined inline on the long lines. Minifiers and packers produce web languages (JS, CSS, HTML) and data. Nobody minifies C, Rust or Go. The new module
gitgalaxy/core/dense_source.pyholds this:DENSE_EXTENSIONS/DENSE_LANGSlist the compiled languages: C/C++, Rust, Go, Java, C#, Zig, Swift, Kotlin, Scala. Template extensions (.jsp,.cshtml,.razor) are left out.defines_inline(line)is a bounded scan for inline definitions. It matches keyword-led heads (fn/func/fun/def) and C-family typed heads ([type] name(args) {). Each quantifier is bounded and each character class is disjoint from the one after it, so the scan is linear in the line. A test runs adversarial 5,000-char lines in well under 1 s. The scan only reads lines of up toDENSE_LINE_MAX= 5,000 chars.is_dense_sourcerequires a compiled-language extension, no line over 5,000 chars, and an inline definition on a long line. It is used by Gate 4.1 and the worker's minification test.Not admitted, because a wide line alone never qualifies:
Before -> after (tests:
tests/core_engine/test_dense_source_7501.py, 33 cases)is_minifiedis False and there is at least one function per packed line..c), a pure data table (.c), and dense C with one line over 5,000 chars..js/.tsis still excluded at 4.1, 3.4 (Embedded Hex Payload) and 5.1 (Lexical Monotony). This shows the language is the load-bearing signal..cdata file that the aperture admits for one ordinary function (Aperture/auditor payload guards drop real source files (aes_prng.c, tables.c, crc32.cpp, EntityFlags.cs ...: 64 files, ~900 functions) #5460).test_aperture_payload_guards_5460.py,test_statistical_auditor.py) pass unchanged.Golden masters (vs
f09970f72ff3)full-precision: unchanged. zero-dependency: unchanged. No corpus file is dense compiled-language source, so no file changes classification. Both legs were re-blessed through
bugfix_kit.py all/crucible_check.py --update, with zero diff.Ground-truth ledger
No change (
ledger checkPASS).Estate-crucible
61/63 horrors passing before and after; 0 moved.
Audits
mypy / ruff / dead-key PASS.
pr_gates.py --fast: lint, audits, secrets, xray, gen-docs, derived, workflows, gauntlet and affected all PASS.Known limit (separate, not fixed here)
The detector's
func_startrules are anchored at the start of a line. On a packed line only the first definition is extracted, so the fixtures yield one function per line, not every function. Java methods written inline in a one-line class body are missed the same way. Fixing either is a detector-wide extraction change with golden drift, so it is left for its own issue.Lessons for agents
is_minified(average line > 800), then the detector's 1,500-char line blanking, then the auditor's Packed Payload Guard. Fixing only the first one just moves the exclusion to the next. Sweep all of them..jsfixture namedbundle.jsis dropped by the ignore rules before any content gate runs. Name fixtures neutrally (app.js).Fixes #7501
🤖 Generated with Claude Code