Skip to content

Add resilience primitives: RetryPolicy, CircuitBreaker, AC_circuit_call#233

Merged
JE-Chen merged 1 commit into
devfrom
feat/resilience-primitives-batch
Jun 19, 2026
Merged

Add resilience primitives: RetryPolicy, CircuitBreaker, AC_circuit_call#233
JE-Chen merged 1 commit into
devfrom
feat/resilience-primitives-batch

Conversation

@JE-Chen

@JE-Chen JE-Chen commented Jun 19, 2026

Copy link
Copy Markdown
Member

Remaining-backlog batch 15 — reusable resilience primitives, full layers + tests + EN/Zh v25 docs + README.

Features (utils/resilience, pure-stdlib)

  • RetryPolicy / retry_call — retry a callable on configured exceptions with exponential backoff (injectable sleep). Reusable wrapper; the existing AC_retry flow command already covers retrying an action body, so this adds the programmatic primitive (no duplicate executor command).
  • CircuitBreaker / CircuitOpenError — open after N consecutive failures, short-circuit until reset_timeout, half-open trial (injectable clock). New AC_circuit_call / ac_circuit_call runs an action list through a named breaker → {state, record}.

Note

Discovered AC_retry already exists as a flow-control block command (exec_retry); dropped the redundant/colliding retry command and kept RetryPolicy as a facade primitive.

Verification

  • 7 tests pass (retry success-after-flakes + backoff growth + exhaustion, breaker open/short-circuit/half-open/close with fake clock, wiring); ruff clean; radon no CC≥C; bandit clean; PySide6-free.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 37 complexity · 0 duplication

Metric Results
Complexity 37
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@JE-Chen JE-Chen merged commit 70b73fc into dev Jun 19, 2026
16 checks passed
@JE-Chen JE-Chen deleted the feat/resilience-primitives-batch branch June 19, 2026 09:28
@sonarqubecloud

Copy link
Copy Markdown

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.

1 participant