Add Python SDK core with wrap and signed outbox#51
Conversation
Implement configure, wrap, correlation context, flush, SQLite outbox, Ed25519 signing, and ingest export. Golden signing fixtures match the Node SDK byte-for-byte in CI. Signed-off-by: Nathan Gillett <nathan@intentproof.io>
PR SummaryHigh Risk Overview
Updates packaging/CI to use Reviewed by Cursor Bugbot for commit c0cf402. Bugbot is set up for automated code reviews on this repo. Configure here. |
Record event and chain state in one transaction; chain app exceptions when outbox recording fails after a wrapped failure. Signed-off-by: Nathan Gillett <nathan@intentproof.io>
Prevents flush() from joining a thread that is still in _pending but not yet started. Signed-off-by: Nathan Gillett <nathan@intentproof.io>
Drop finished threads from the exporter pending list on enqueue; flush and close prior outbox and exporter when configure() runs. Signed-off-by: Nathan Gillett <nathan@intentproof.io>
Create keypair.json with mode 0600 via O_CREAT|O_EXCL; resolve Path.home() only in default_data_dir() so import works in containers. Signed-off-by: Nathan Gillett <nathan@intentproof.io>
Open SQLite with check_same_thread=False and serialize access with a lock so wrap() works under Flask/gunicorn workers. Signed-off-by: Nathan Gillett <nathan@intentproof.io>
record_chained_event holds the outbox lock from chain read through signing to commit so concurrent workers cannot reuse the same chain position. Signed-off-by: Nathan Gillett <nathan@intentproof.io>
Swap outbox only after new config succeeds; use Exception in wrap so CancelledError propagates; remove unused public_key_bytes. Signed-off-by: Nathan Gillett <nathan@intentproof.io>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 932b68a. Configure here.
If another process creates keypair.json first, catch FileExistsError and read the file instead of failing. Signed-off-by: Nathan Gillett <nathan@intentproof.io>
Losers on O_EXCL can read an empty or partial file; retry JSON load and fsync on create so CI concurrent test is stable. Signed-off-by: Nathan Gillett <nathan@intentproof.io>

Summary
configure,wrap,run_with_correlation_id,push_subject_mapping(no-op stub), andflush.over JCS canonical bytes, and background HTTP ingest export.
SDK canonicalizer and signer.
Test plan
cd intentproof-sdk-python && pytest -q(33 passed locally)canonicalizeIntentProof+ Ed25519 ontests/fixtures/signing_unsigned_event.jsonmatches Python fixturesReview
push_subject_mappingisintentionally a no-op until reconciliation storage lands. Node does not
ship this API yet.