Skip to content

Add explicit SQLite BusinessOperation support - #75

Open
philipgreat wants to merge 1 commit into
mainfrom
codex/python-business-operation
Open

philipgreat wants to merge 1 commit into
mainfrom
codex/python-business-operation

Conversation

@philipgreat

@philipgreat philipgreat commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

The requirement came from independent acceptance testing of an AI-built inventory transfer app. Shipping 10 units saves both source stock and the transfer order. With ordinary graph saves, rejecting the order write after the stock write leaves on-hand and reserved quantities at 90 and 20 while the order still reports zero shipped. The acceptance tests also exposed reuse of a key with a different quantity and the need to recover the original result after a retry or a lost commit acknowledgement. SQLite failure reproduction

The Work Management FastAPI example has the same operation boundary. Creating a project saves the project, the creator's membership, and the default section. Its acceptance test injects a failure on the third write and checks that all three changes roll back. Project creation callback

Applications supply the domain action, authorization, and invariants. The runtime commits the declared writes, retry result, and operation audit together and serializes competing operations on file-backed SQLite.

Summary

  • Add an explicit BusinessOperation boundary for file-backed SQLite. Multiple entity graph saves share one transaction, including the durable idempotency result and operation audit record.
  • Require complete typed inputs, authorization on every call, and final invariant validation. Different inputs for the same key conflict. A lost commit acknowledgement is recoverable with the original key.
  • Preserve graph preparation, checker presentation, and commit and rollback callbacks with the current generated-entity API.
  • Add a shipping example, a runtime guide, and the focused tests to the existing example verification gate.

Verification

  • BusinessOperation tests on Python 3.13 with file SQLite — 33 passed, including concurrent writers, process exits, rollback and generated graph saves.

  • Repository regression on Python 3.13 — 1,718 passed, 8 skipped, 21 subtests passed. Optional S3 and OpenTelemetry SDK suites were excluded from this local container run.

  • Shipping example — one stock adjustment and the original result on replay.

  • Work Management FastAPI example against this branch — 18 browser checks passed.

  • The same FastAPI example passed all three contract checks against this branch, including rollback on the third project-creation write.

This branch has not been deployed

No deployments
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