fix: harden peek's audit checks against false positives and blind spots - #16
Open
OnePunchMonk wants to merge 1 commit into
Open
fix: harden peek's audit checks against false positives and blind spots#16OnePunchMonk wants to merge 1 commit into
OnePunchMonk wants to merge 1 commit into
Conversation
- split: fix embargo check being a no-op on datetime time columns (previously gated on np.issubdtype(..., np.number), so it never fired for the normal datetime case); now computed in row-index space. - causality: guard against false CRITICALs from feature_fn contract violations — length-changing feature_fn (e.g. dropna()) and non-deterministic feature_fn now emit a WARNING instead of a bogus leak. - target_leak: emit a WARNING listing non-numeric columns that are skipped by the correlation test, instead of silently ignoring them. - report: CLEAN verdict now names which checks actually ran, and flags when only the shallow target_leak check fired (the common CLI case), so a CLEAN result can't be mistaken for a full audit. - cli: add --json output for CI pipeline use (AuditReport.to_dict() was already there but unreachable from the CLI). Adds 7 new tests covering each fix. Full suite: 87 passed.
2 tasks
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
time_colvalues (it was gated onnp.issubdtype(dtype, np.number), which is false for the normal datetime case — every embargo check for a typical time series never fired). Now computed in row-index space, dtype-agnostic.feature_fnthat changes row count (e.g.dropna()), and a non-deterministicfeature_fn(unseeded randomness). Both now surface as a WARNING explaining the contract violation instead of a bogus leak finding.CLEANdoesn't imply "all columns checked" when some weren't.CLEANverdict now lists which checks actually ran, and adds an explicit hint when only the shallowtarget_leakcheck fired (the default when runningpeek audit file.csvwith nofeature_fn/splits/pipeline) — the case most likely to give a user false confidence.--jsontopeek audit, exposing theAuditReport.to_dict()output that already existed but had no CLI path (needed for CI gating).Why
Found while reviewing peek for gaps: several of these were bugs that would silently produce wrong verdicts (embargo dead code, positional-alignment false positives) rather than missing features, which is worse for a tool whose entire value proposition is being an honest auditor.
Test plan
87 passedpeek demoto confirm output still renders correctly end-to-end🤖 Generated with Claude Code