Skip to content

perf: X-Ray and the vault scan run only the signatures they read (Part of #5500) - #6105

Merged
squid-protocol merged 1 commit into
mainfrom
churn/5500-20261022T0907Z
Oct 23, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
churn/5500-20261022T0907Z

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Part of #5500.

Owner decisions

Owner OK (phone 2026-10-21): engine work on the single-threaded phases of the path-independence scan step (4.6 min -> ~4 min).

What

run_xray_audit (Phase 10 of every galaxyscope scan) narrowed SecurityLens.THREAT_SIGNATURES to two keys after constructing the lens, but scan_content walks _scan_plan, which __init__ builds once, so the narrowing did nothing: X-Ray ran every signature (plus the hidden-text ones) on every file while reading only the entropy and bitwise_ops counts. New SecurityLens.restrict_signatures(keys) rebuilds the plan; the three call sites use it.

  • binary_anomaly_detector.py: run_xray_audit (Phase 10) and the standalone main now keep bitwise_ops (entropy is always computed). The old reflection_metaprogramming key was never read, so it is dropped.
  • vault_sentinel.py: keeps hardcoded_secrets (the only count/snippet read); dead_code was never read.

Measured (language-crucible data, 3737 files, 6-core box, via heavy-run.sh)

before after
run_xray_audit alone 14.7 s 2.6 s
anomalies_found 72 72 (identical, restricted vs. unrestricted lens on the whole corpus)

Per scan that is ~12 s off the ~40 s serial tail (Phase-10 audits were ~15 s of it), and both parent-path scans pay it. crucible_path_check.py still PASSes. I have no same-load before/after wall time for the full step: the box is shared and the earlier 147 s baseline was under different load. The CI number comes after merge.

Class sweep

Class: a SecurityLens whose THREAT_SIGNATURES is reassigned after construction (no effect on _scan_plan).

Member Status
run_xray_audit fixed here
binary_anomaly_detector.main fixed here
vault_sentinel fixed here
Sibling gaps: none (grep THREAT_SIGNATURES = { finds only these three).

Checklist: partial [c:3ef46cdf] -- the single-scan core usage was measured earlier on the issue; this drops the X-Ray work that never mattered to its result; the CI median is still to be confirmed after merge
Checklist: done [c:d640e0d1]
Checklist: done [c:7fff4ad5]

Gates

  • pr_gates.py --fast: 7/7 pass.
  • crucible_check.py (golden-lock, both legs): PASS, no re-bless needed (output unchanged).
  • pr_gates.py --ratchets: 8 pass, port-surface FAIL. This branch is 89 commits behind main and port-surface was changed by port_surface: a det port keeps the translator's facades (Part of #5089) #5986 on main; the same ratchet PASSES on a fresh origin/main checkout. Not caused by this change (no ports touched); I did not merge main.
  • New tests in tests/security_auditing/test_binary_anomaly_detector.py (restricted vs. full lens counts/snippets/positions on varied samples; run_xray_audit count parity). tests/security_auditing: 590 passed, 1 skipped.

Lessons for agents

  • Assigning SecurityLens.THREAT_SIGNATURES after SecurityLens() has no effect; scan_content reads _scan_plan (built in __init__). Use restrict_signatures.

🤖 Generated with Claude Code

…t of #5500)

run_xray_audit narrowed SecurityLens.THREAT_SIGNATURES after construction, but
scan_content walks _scan_plan, built in __init__, so every signature ran on all
files: 14.7 s of the ~40 s serial tail per galaxyscope scan of the crucible
corpus. restrict_signatures() rebuilds the plan; X-Ray 14.7 s -> 2.6 s with
anomalies_found 72 == 72.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@squid-protocol squid-protocol added the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Oct 23, 2026
@squid-protocol

Copy link
Copy Markdown
Owner Author

No description provided.

@squid-protocol
squid-protocol marked this pull request as ready for review October 23, 2026 00:31
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol enabled auto-merge (squash) October 23, 2026 00:41
@squid-protocol

Copy link
Copy Markdown
Owner Author

No description provided.

@squid-protocol
squid-protocol merged commit 2a70f9a into main Oct 23, 2026
76 checks passed
@squid-protocol
squid-protocol deleted the churn/5500-20261022T0907Z branch October 23, 2026 01:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant