Skip to content

python: concurrency and the sync contract #1394

Open

Description

@yujiyokoo

Created with Claude Code from the spec in #1341.

Parent

Sub-issue of #1341. Ticket 13 of 14.

What to build

The concurrency and interrupt contract from #1341 holds from the public API:

  • Two threads entering their first operation at the same time build one engine client and load the default keyset once.
  • Two Cipher instances for different models share that client.
  • Concurrent encrypt and decrypt from several threads all succeed and all rows open.
  • A KeyboardInterrupt during a long encrypt behaves as ticket 3 found: it lands after the detached call returns, and the Cipher is usable afterwards. If ticket 3 amended the fact, implement and test the amended behaviour.

Acceptance criteria

  • A test with a barrier releases 8 threads into their first encrypt; the client-built counter reads 1 and the keyset-load counter reads 1.
  • 8 threads × 100 encrypts of distinct values, then one decrypt of all 800, all equal.
  • A subprocess test sends SIGINT during a 5000-value encrypt; the process observes KeyboardInterrupt exactly once, the call did not leave a half-built result, and a subsequent encrypt succeeds.
  • The README documents the sync-only, GIL-released, one-client-per-process contract in a short section.

Metadata

Metadata

Assignees

No one assigned

    Labels

    SDKready-for-agentFully specified and ready for an AFK agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions