feat(format): drift-detection-v1 4-gate PARTIAL discharge#1374
Closed
noahgift wants to merge 2 commits into
Closed
feat(format): drift-detection-v1 4-gate PARTIAL discharge#1374noahgift wants to merge 2 commits into
noahgift wants to merge 2 commits into
Conversation
Binds FALSIFY-DRIFT-001..004 from drift-detection-v1 at PARTIAL_ALGORITHM_LEVEL via 4 verdict functions plus a pure-Rust reference classifier (univariate_drift_score + classify_drift). - DRIFT-001: drift_score >= 0 for all inputs - DRIFT-002: higher score → equal-or-higher severity (monotone) - DRIFT-003: |data| < min_samples → NoDrift - DRIFT-004: identical reference == current → score=0 → NoDrift ## Five Whys 1. Why does drift-detection-v1 list 4 falsification IDs without algorithm-level discharge? PMAT lints flagged FALSIFY-DRIFT-001..004 as unbound at PARTIAL_ALGORITHM_LEVEL. 2. Why does that block ship? Coverage % cannot move while peripheral ML monitoring contracts have no algorithm-level verdict module. 3. Why bind both verdicts AND a reference classifier? The monotone-classification gate (DRIFT-002) requires a deterministic threshold predicate; the identical-distribution gate (DRIFT-004) requires that mu_ref == mu_cur ⇒ score == 0. Both need the classifier in-module to avoid coupling the verdict to a specific downstream impl. 4. Why fail-closed (NoDrift) on invalid thresholds? Per Gama 2004, alarming on insufficient or malformed input is a worse failure mode than missing real drift; the spec lists `min_samples_guard` as an invariant for this reason. 5. Why a 7-section mutation-survey layout? The score-sweep over 81 pairs (9×9 probes around the threshold band) catches AND→OR classification mutations and off-by-epsilon boundary regressions that single-fixture tests would miss. Adds 29 unit tests. Realistic-healthy vector covers a passing production scenario; pre-fix vector encodes the 4 regression classes (sign-bug, inverted-threshold, premature-alarm, invalid-sigma). No runtime % shift; algorithm-level coverage advances by 4 gates.
066f46d to
a098426
Compare
Contributor
Author
auto-merge was automatically disabled
May 12, 2026 09:21
Pull request was closed
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
drift-detection-v1atPARTIAL_ALGORITHM_LEVELvia 4 verdict functions + in-module reference classifier.Gates bound
drift_score >= 0ANDis_finite()for all inputss_lo <= s_hi⇒status(s_lo) <= status(s_hi)(monotone)|data| < min_samples⇒status == NoDrift(fail-closed)mu_ref == mu_cur⇒score == 0ANDstatus == NoDriftReference impl
univariate_drift_score(mu_ref, mu_cur, sigma_ref) = |mu_ref - mu_cur| / sigma_ref(NaN onsigma_ref <= 0).classify_drift(score, warn, drift)— fail-closedNoDrifton invalid thresholds.Five Whys
See commit message — captures why fail-closed on invalid thresholds (Gama 2004 reasoning) and why the reference classifier ships in-module rather than coupling to a downstream impl.
Test plan
cargo test -p aprender-core --lib drift_001_004— 29 passed🤖 Generated with Claude Code