Skip to content

Add optimistic-concurrency versioned store (CAS / If-Match)#314

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

Add optimistic-concurrency versioned store (CAS / If-Match)#314
JE-Chen merged 1 commit into
devfrom
feat/optimistic-batch

Conversation

@JE-Chen

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

Copy link
Copy Markdown
Member

What

http_conditional uses ETag for read caching but never for write concurrency. This is the local compare-and-swap store for "update only if the version is unchanged".

  • VersionedStore.put(key, value, *, expected_version) → new version (raises VersionConflict on a stale write; 0 = create-only, omit = blind).
  • get{value, version}; guarded delete; save/load.
  • if_match_header(version) / check_if_match(current, header) bridge to HTTP If-Match.

Layers

  • Headless core: utils/optimistic/ (pure stdlib json, zero PySide6).
  • Facade: 4 symbols + __all__.
  • Executor: AC_cas_put, AC_cas_get (named-instance registry).
  • MCP: ac_cas_put, ac_cas_get.
  • Script Builder: both under Flow.
  • Tests: test/unit_test/headless/test_optimistic_batch.py (9 tests).
  • Docs: v106_features_doc.rst (EN + Zh) + toctrees + 3 README What's-new sections.

Verification

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

http_conditional uses ETag for read caching (If-None-Match / 304) but
never for write concurrency. Add a local compare-and-swap VersionedStore:
put only when expected_version matches (VersionConflict on a stale write),
monotonic version, guarded delete, JSON persistence, plus if_match_header
/ check_if_match to bridge to HTTP If-Match. Wired through facade,
executor (AC_cas_put / AC_cas_get, 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 40 complexity · 1 duplication

Metric Results
Complexity 40
Duplication 1

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 dbc24a7 into dev Jun 22, 2026
16 checks passed
@JE-Chen JE-Chen deleted the feat/optimistic-batch branch June 22, 2026 02:42
@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