Skip to content

Make Aperture's file-size gate tiered and Intent-aware - #343

Merged
squid-protocol merged 1 commit into
mainfrom
fix/aperture-tiered-size-ceiling
Jul 23, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
fix/aperture-tiered-size-ceiling

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

  • MAX_FILE_SIZE_MB was a single flat, Intent-blind cutoff (50MB) enforced only after the entire file had already been read into memory (galaxyscope.py reads the file before ApertureFilter.is_in_scope() ever checks its size) — 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.
  • Net effect: large but legitimate/important files (e.g. a generated schema someone explicitly cares about) were silently excluded purely on byte count, while the size check itself did nothing to actually bound memory use on a truly giant file, since the read had already happened by the time it ran.
  • Fix: split the single cutoff into two tiers:
    • 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 in evaluate_path_integrity before the file is ever opened for reading, so it's a real memory bound regardless of Intent Lock or content.
  • Both are user-overridable via the existing YAML/CLI config resolver (config_resolver.py).

Test plan

  • Updated test_aperture_system_guardrails for the new "without Intent Lock" message text.
  • Added 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-read evaluate_path_integrity gate).
  • 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

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]>
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit 340cf89 into main Jul 23, 2026
22 checks passed
@squid-protocol
squid-protocol deleted the fix/aperture-tiered-size-ceiling branch July 23, 2026 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant