wire(switchboard): demote on p95 tail latency; drop plan_routes + p50#21
Merged
Merged
Conversation
Coupled lane/routing-subsystem change from the incomplete-integration remediation: - WIRE p95: AdjustmentEngine._evaluate gated the latency-demote on the MEAN latency, but ProfileSignals.p95_latency_ms was computed and never read. Gate on p95 instead — a backend whose typical request is fast but whose slow tail is consistently bad still degrades UX, and the mean hides it. Mean is reported alongside for operator context (stays used). Adds a low-mean/high-p95 test. - DELETE LaneSelector.plan_routes: redundant wrapper; production constructs DecisionPlanner.plan directly (app.py:49, api/routes_routing.py:62). Rewire the RoutingPlanDemote tests to DecisionPlanner.plan; delete the dedicated delegation tests; drop the now-unused RoutingPlan import. - DELETE ProfileSignals.p50_latency_ms: computed but read nowhere; remove it + its tests + the now-unused `median` import. 345 tests green; ruff(src+test) + ty + docs + audit(B2 only) + doctor clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Coupled lane/routing-subsystem change from the cross-repo incomplete-integration remediation (Phase 2 WIRE + Phase 3 DELETE in one PR — they touch the same tests).
WIRE — p95 into the demote heuristic
AdjustmentEngine._evaluategated the latency-demote on mean latency, whileProfileSignals.p95_latency_mswas computed and never read. Now it gates on p95 (tail): a backend whose typical request is fast but whose slow tail is consistently bad still degrades UX, and the mean hides that. Mean is reported alongside in the demote reason for operator context (so it stays used). New test: a low-mean / high-p95 tail now demotes (it wouldn't have under the mean gate).DELETE —
LaneSelector.plan_routesRedundant wrapper; production constructs
DecisionPlanner.plandirectly (app.py:49,api/routes_routing.py:62). TheRoutingPlanDemotetests used it as the entry point — rewired toDecisionPlanner.plan; the dedicated delegation tests are removed; dropped the now-unusedRoutingPlanimport.DELETE —
ProfileSignals.p50_latency_msComputed but read nowhere (p95 is the signal now). Removed it + its tests + the now-unused
medianimport.Verified: 345 tests green;
ruff check src test+ ty +check_docs.shclean; working-detector audit B2-env-only; doctor OK (no stale exclusions).🤖 Generated with Claude Code