Repository navigation
Make Aperture's file-size gate tiered and Intent-aware - #343
Merged
Merged
Conversation
Previously MAX_FILE_SIZE_MB was a single flat, Intent-blind cutoff (50MB) enforced only after the entire file had already been read into memory, unlike every other size-related gate in ApertureFilter (static-asset LOC cap, machine-gen source check, lexical monotony shield), which already carve out an exception for GuideStar's Intent Lock. This meant large but legitimate/important files could be silently excluded purely on byte count, while the size check itself did nothing to actually bound memory use on a truly giant file. Splits the single cutoff into two tiers: - MAX_FILE_SIZE_MB (soft, 50MB): above this, Intent-Locked files bypass the gate and are handed to the existing content-based classifiers (binary/minified/monotony/embedded-array shields) instead of being excluded on size alone. - MAX_FILE_SIZE_HARD_MB (new, absolute, 250MB): an unconditional, Intent-blind backstop checked in evaluate_path_integrity before the file is ever opened for reading, so it actually bounds memory use regardless of Intent Lock or content. Both are user-overridable via the existing YAML/CLI config resolver. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Contributor
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.
Summary
MAX_FILE_SIZE_MBwas a single flat, Intent-blind cutoff (50MB) enforced only after the entire file had already been read into memory (galaxyscope.pyreads the file beforeApertureFilter.is_in_scope()ever checks its size) — unlike every other size-related gate inApertureFilter(static-asset LOC cap, machine-gen source check, lexical monotony shield), which already carve out an exception for GuideStar's Intent Lock.MAX_FILE_SIZE_MB(soft, 50MB, unchanged default) — above this, an Intent-Locked file now bypasses the gate and is handed to the existing content-based classifiers (binary/minified/monotony/embedded-array shields) instead of being excluded on size alone.MAX_FILE_SIZE_HARD_MB(new, absolute, 250MB default) — an unconditional, Intent-blind backstop checked inevaluate_path_integritybefore the file is ever opened for reading, so it's a real memory bound regardless of Intent Lock or content.config_resolver.py).Test plan
test_aperture_system_guardrailsfor the new "without Intent Lock" message text.test_aperture_tiered_mass_ceiling, covering: soft-blocked without intent, soft-bypassed with intent, and hard-blocked even with intent (verified caught at the pre-readevaluate_path_integritygate).python -m pytest tests/core_engine/test_aperture.py -q— 12 passed, 1 xfailed (pre-existing, unrelated).python -m pytest tests/ -q— full suite, 811 passed, 1 xfailed.🤖 Generated with Claude Code