Skip to content

ML threat layer: real stand-in model leg, clear half-loaded classifier (Part of #2986) - #6129

Merged
squid-protocol merged 1 commit into
mainfrom
churn/2986-20261023T0154Z
Oct 23, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
churn/2986-20261023T0154Z

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Part of #2986.

What

  • New tests/security_auditing/test_ml_real_model_2986.py: trains a tiny synthetic 5-class XGBoost model and drives the real SecurityAuditor chain (load, feature_names_in_, reindex incl. a missing feature, predict_proba, ai_threshold, static-asset shield, shadow patch, recorder to DB columns, corrupt model file). Plumbing only, not detection quality.
  • Fix in security_auditor.py: a model file that fails to load left the unloaded classifier in self.model; now cleared (found by the corrupt-file case). Failure path only, so golden-neutral.
  • docs/zero_dependency_mode.md: states the code path is exercised, the model is not.

Class table

Member Status
real load + score per class this PR
threshold gate, asset shield, shadow patch this PR
missing-feature NaN reindex this PR
corrupt model file this PR (+ fix)
recorder DB columns this PR
full extra lacks scikit-learn sibling gap (below)
full-deps scan of temporal-crucible blocked, no model ships

Cross-repo

None.

Gates

pr_gates --fast 7/7, --ratchets 9/9, tree-wide guards 194 passed, new tests 9 passed with scikit-learn on a scratch path (time ratchet clean); skipped without it.

Lessons for agents

  • xgboost.XGBClassifier() raises ImportError without scikit-learn and the selfscan venv lacks it: the real-model test skips there; run it with pip install --target <scratch> scikit-learn on PYTHONPATH.

🤖 Generated with Claude Code

…er (Part of #2986)

Every ML test patched XGBClassifier. Add a leg that trains a tiny synthetic
model and runs load, reindex, scoring, threshold, static-asset shield,
shadow patch and the recorder against it. It found that a model file that
fails to load left the unloaded classifier in self.model; clear it.
XGBClassifier also needs scikit-learn, which the `full` extra omits; the leg
skips without it and the doc says so.

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 02:10
@squid-protocol
squid-protocol enabled auto-merge (squash) October 23, 2026 02:26
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol

Copy link
Copy Markdown
Owner Author

No description provided.

@squid-protocol
squid-protocol merged commit 80f7353 into main Oct 23, 2026
76 checks passed
@squid-protocol
squid-protocol deleted the churn/2986-20261023T0154Z branch October 23, 2026 02:54
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