Skip to content

fix: Phase 2 code review — critical resilience and state integrity - #31

Merged
Lothnic merged 1 commit into
mainfrom
milestone/phase2-observability-elasticity
Jul 28, 2026
Merged

fix: Phase 2 code review — critical resilience and state integrity#31
Lothnic merged 1 commit into
mainfrom
milestone/phase2-observability-elasticity

Conversation

@Lothnic

@Lothnic Lothnic commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to #30, addressing the code review findings.

Critical fixes (7)

Issue Fix
KEDA ScaledObject API v1alpha1v1beta1 v1alpha1 has been removed from KEDA releases
Backend.last_activity_ms == 0.0 sentinel Never-active backends are no longer marked idle — they are awaiting first traffic, not stale
Backend.wake() skips circuit reset Now calls self.circuit.reset() to clear CircuitBreaker.consecutive_failures
HealthChecker.update_config() missing Recreates the httpx client when timeout changes, fixing stale client config after reload
Telemetry poller leak on reload failure Wrapped in try/except — rolls back to old poller on failure
Partial state mutation in reload_config Budget store creation moved after config/registry/strategy swap
502 error leaks backend URL Removed exc details from GatewayError message

Moderate fixes (4)

  • _warn_if_changed calls restored for cost, audit_bus, logging sections (accidentally dropped during restructure)
  • Added warning logs for rate-limit and session-affinity store rebuilds
  • Inline imports moved to module level in test files
  • HealthChecker constructor simplified (removed clock= kwarg which was unused)

Validation

Critical:
- KEDA ScaledObject API v1alpha1 → v1beta1
- Backend.last_activity_ms==0.0 sentinel (never-active not idle)
- wake() resets CircuitBreaker counters; CircuitBreaker.reset()
- HealthChecker.update_config() recreates client on timeout change
- Telemetry poller rollback on reload failure
- Budget store moved after swap section (partial state mutation)
- 502 error message sanitization (backend URL removed)

Moderate:
- _warn_if_changed restored for cost/audit_bus/logging
- Rate-limit and session-affinity rebuild warnings
- Test imports moved to module level
Copilot AI review requested due to automatic review settings July 28, 2026 09:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Lothnic
Lothnic merged commit 140e4a4 into main Jul 28, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants