feat: Phase 1 complete — DRIFT detection, unit tests, CI fix#3
Merged
Conversation
Mirrors the Node.js implementation (§7.2.4 of the CDC). get_drift_data() in database.py aggregates P90 latency per endpoint per day over the last 30 days. _detect_drift() in insights.py runs ordinary least squares on the daily series: slope >= 5ms/day with at least 7 days of data emits a DRIFT insight with the slope and a 30-day projection.
…nd middleware 60 tests covering: - Aggregator: record() (counters, bucket keys), _flush() (percentiles, min/max, total_calls, buffer clear), stop() flush-on-exit - ApiForgeDatabase: insert_batch, get_summary, get_time_series, get_dead_candidates, get_release_comparison, upsert_known_routes, get_drift_data, get_global_time_series - get_insights: ANOMALY, DEAD, PERF, OK, UNTRACKED, DRIFT detection, error resilience - compute_health_score: None on empty data, 0-100 range, high score on healthy API - ApiForgeMiddleware: pass-through, parametric routes, ignored paths, sampling, 5xx error pass-through, crash resilience
The CI workflow only triggers on push to dev — the badge was pointing to main where no run ever happens, causing the permanent "no status" state.
Adding main to the push trigger ensures a workflow run exists on main after each merge, so the shields.io badge can resolve a real status instead of showing "no status".
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.
Context
Closes Phase 1 of the ApiForge roadmap. This PR brings sdk-python up to spec with the CDC v4.0 requirements: DRIFT insight detection, full unit test suite (≥80% coverage), and CI pipeline fix.
Changes
aggregator,database,insights,middlewareusing pytest — all passingmainso the README badge resolves correctlyDRIFTfilter chip to the Insights panel1.0.3How to test
Check the Insights panel in the dashboard at
http://localhost:4242— the DRIFT chip should appear alongside ANOMALY, DEAD, and PERF.Checklist