Skip to content

Add saga orchestrator with compensating rollback#260

Merged
JE-Chen merged 1 commit into
devfrom
feat/saga-batch
Jun 20, 2026
Merged

Add saga orchestrator with compensating rollback#260
JE-Chen merged 1 commit into
devfrom
feat/saga-batch

Conversation

@JE-Chen

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

Copy link
Copy Markdown
Member

Workflow batch (from multi-agent web research; verified absent — long-listed, never built). Full layers + tests + EN/Zh v52 docs + README.

Feature (utils/saga, pure-stdlib)

  • Saga records a compensating action per step; on any step failure, runs the completed steps' compensations in LIFO order — the durable-transaction primitive AC_try (single-block try/catch/finally) couldn't provide. SagaResult carries ok/completed/compensated/failed_step/error. Compensation is best-effort (a failing undo is logged, rollback continues).
  • Forward actions/compensations are plain callables (or, via run_saga, JSON action lists run through the executor), so it's fully unit-tested with no side effects.
  • Executor AC_run_saga (steps as list or JSON string); MCP ac_run_saga; Builder under Flow.

Verification

  • 7 tests pass (all-succeed no-compensation, failure→LIFO compensation, steps-without-compensation skipped, best-effort compensation continues past a failing undo, executor round-trip, wiring, facade); ruff clean; radon no CC≥C; bandit clean; PySide6-free.
  • Rebased onto dev after JSONPath (Add JSONPath querying over parsed JSON #259) merge.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 32 complexity · 0 duplication

Metric Results
Complexity 32
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 53cf582 into dev Jun 20, 2026
16 checks passed
@JE-Chen JE-Chen deleted the feat/saga-batch branch June 20, 2026 07:30
@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