Skip to content

Add idempotency-key store with stored responses#311

Merged
JE-Chen merged 1 commit into
devfrom
feat/idempotency-batch
Jun 22, 2026
Merged

Add idempotency-key store with stored responses#311
JE-Chen merged 1 commit into
devfrom
feat/idempotency-batch

Conversation

@JE-Chen

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

Copy link
Copy Markdown
Member

What

RetryPolicy re-executes on retry and work_queue dedups only in-flight refs — nothing cached the first result so a duplicate request returns the same response without re-running the side effect.

  • IdempotencyStore.begin(key, request_fingerprint?){status: new|in_progress|completed, response}; complete(key, response); get; injectable-clock ttl; save/load.
  • Reusing a key with a different request raises IdempotencyConflict.
  • request_fingerprint(payload) — stable order-independent SHA-256.

Layers

  • Headless core: utils/idempotency/ (pure stdlib hashlib/json, zero PySide6).
  • Facade: 3 symbols + __all__.
  • Executor: AC_idempotency_begin, AC_idempotency_complete (named-instance registry).
  • MCP: ac_idempotency_begin, ac_idempotency_complete.
  • Script Builder: both under Flow.
  • Tests: test/unit_test/headless/test_idempotency_batch.py (8 tests; TTL via injected clock).
  • Docs: v103_features_doc.rst (EN + Zh) + toctrees + 3 README What's-new sections.

Verification

  • pytest → 8 passed; ruff/pylint 10.00/bandit/radon clean; Qt-free.

RetryPolicy re-executes on retry and work_queue dedups only in-flight
references — nothing cached the first result so a duplicate returned the
same response without re-running the side effect. Add a Stripe-style
IdempotencyStore (begin → new/in_progress/completed, complete, replay,
fingerprint-conflict detection, injectable-clock TTL, JSON persistence)
and request_fingerprint. Wired through facade, executor (AC_idempotency_
begin / AC_idempotency_complete, named-instance registry), MCP, and the
Script Builder with a headless test batch and EN/Zh docs.
@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 8a6f13c into dev Jun 22, 2026
16 checks passed
@JE-Chen
JE-Chen deleted the feat/idempotency-batch branch June 22, 2026 02:10
@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