Repository navigation
tests: security_auditing tests call the real code, not inline copies (Part of #8434) - #8620
Merged
Merged
Conversation
…(Part of #8434) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Contributor
|
No description provided. |
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.
Part of #8434 (slice 3 of 4:
tests/security_auditing/*; slices 1-2 merged in #8619).What changed
Swept all 37 files in
tests/security_auditing/(grep for manually/mirror/simulate/replicate/inline, then read each hit) for tests that rebuild production logic inline.test_security_auditor.py::test_construct_feature_matrix_nan_handling: it built the matrix with_construct_feature_matrix, then re-typed thereindex(fill_value=np.nan)andreplace([inf,-inf], nan)lines fromaudit_repositoryand asserted on its own copy. It now runs the realaudit_repositorywith a mocked model and asserts on the matrixpredict_probaactually received.test_security_lens.py::_safe_content: its docstring said "Mirror of scan_content's ReDoS-armored haystack construction". It also differed from the real one (dropped long lines instead of emptying them). It now callsSecurityLens._armor, the functionscan_contentuses.Mutation check
security_auditor.py:166replace([inf,-inf], np.nan)changed to0.0:test_construct_feature_matrix_nan_handlingFAILS (before: passed, the copy was unaffected).:163fill_value=np.nanchanged to0.0: the test FAILS._armorchange (keep long lines):test_signature_gates_are_one_sidedstill passes. Honest note: that test uses the armor on both sides of its gate-vs-regex comparison, so it is consistent under any armor. The end-to-end guard istest_gated_scan_content_matches_ungated(already callsscan_content). This edit removes a drifting copy; it is not a new detector of a mutation.Gates:
pr_gates.py --fast9/9 pass; both touched files 101 passed, 1 skipped (selfscan venv, numpy/pandas/xgboost present). Ratchets not run (tests-only change, no engine, golden or ledger input).Class / Sibling gaps
Class: tests that re-implement the code under test inline (a local copy of a production step, asserted instead of calling it). Members swept in
tests/security_auditing/: 37 files; 2 re-implementers found and fixed here (above); the other 35 call the real functions (the "mirror" hits were corpus prose, "simulate" hits intest_pii_leak_hunter.py,test_api_network_map.py,test_supply_chain_firewall.pyandtest_security_lens.py:137feed inputs or fault-inject through the real code).Sibling gaps (not fixed here; no issues filed):
tests/tools/*sweep: not done (remaining slice 4 per the issue table).tests/core_engineActive Hemorrhage post-hoc reimplementation (test_galaxyscope.py:1366): covered by slices 1-2 or slice 4; not re-checked here.test_supply_chain_firewall.pyfeeds a shape the CLI no longer reads: tracked by the CLI issue in the epic, not a re-implementation.Remaining slices
tests/tools/*: grep for manually/mirror/local helper copies of production logic (not touched here).🤖 Generated with Claude Code