Skip to content

feat(python): add asyncio port with shared conformance replay - #200

Merged
lan17 merged 8 commits into
mainfrom
codex/python-port
Sep 22, 2026
Merged

lan17 merged 8 commits into
mainfrom
codex/python-port

Conversation

@lan17

@lan17 lan17 commented Sep 22, 2026

Copy link
Copy Markdown
Owner

Python applications can now use DialCache's explicit request scopes, layered caching, runtime policy, and tracked Redis invalidation through an asyncio-native package for Python 3.11+.

The API retains source-reviewed gcache conveniences (cached, id_arg, argument adapters, context managers, aget, and ainvalidate) while implementing DialCache's behavioral and wire contracts. The port includes coalescing, deadline and cancellation ownership, stale recovery, shadow validation, compression, and a borrowed-client Redis/Cluster adapter.

Also adds independent Python replay of all 17 shared profiles, completion fingerprint checks, native and real-server CI, packaging, and Python examples throughout the shared documentation. python/API-DESIGN.md records the gcache revision and API choices.

Python CI measures native and real Redis/Valkey/Cluster coverage with separate production-source LCOV reports. Both Python versions upload under the python Codecov flag using OIDC on PRs and main pushes; reports are retained as CI artifacts, and the README includes a Python coverage badge.

Local validation

Validated source commit: 4c1290393fded92e39608eb77e49992ea0427042.

  • make check: all four language checks, package checks, documentation build, and audit gates passed.
  • Complete shared corpus regeneration and committed Quint fixture checks passed.
  • make formal-python: 7,759 conformance cases passed, including 6,022 generated/regression histories, 244 scenarios, 1,477 protocol vectors, and 16 witness checks.
  • Python 3.14: 2,200 native/wire/scenario/smoke tests passed. Python 3.11: 2,098 passed with 102 expected eager-task-feature skips; asyncio.eager_task_factory was introduced in Python 3.12.
  • Real Redis and Valkey integration: 343 tests passed per server, including six-node Redis Cluster and TypeScript interoperability; zero skips.
  • Minimum zstandard 0.23.0: 1,515 protocol cases passed. Redis adapter/routing checks passed with redis-py 5.0.0 and 6.4.0.
  • Python 3.11 with minimum coverage.py 7.11.0: full native suite and repository-relative LCOV path checks passed. Native plus real-server reports cover 1,495 / 1,573 production lines (95.04%) locally.
  • Shared validation/diagnostic tests, coverage acceptance and import-isolation tests, workflow actionlint, Ruff, and the wheel build passed. Coverage is a test-only package dependency.

Scope

The package is experimental and unpublished. The complete replay gate establishes finite shared conformance evidence; a Python-specific semantic mutation campaign is not yet registered. Cached wrappers are always awaitable, and applications own their event loop and Redis client lifecycle.

— Levicus 🤖

# Conflicts:
#	.github/workflows/formal-full.yaml
#	README.md
#	formal/explore.mjs
#	formal/go-parity.json
#	formal/source-audit.json
#	formal/validation.mjs
#	scripts/generate-docs.mjs
#	typescript/test/formal-exploration.test.ts
@lan17
lan17 marked this pull request as ready for review September 22, 2026 07:25
# Conflicts:
#	docs/index.md
#	docs/maintainers.md
#	formal/go-parity.json
#	formal/source-audit.json
Keep mismatch details in logger events, discard denied async predicates without starting work, bound oversized decoder memory, and bind validation and saved replay inventories to their source snapshots.

— Levicus 🤖
Require primary-only Cluster connections for tracked reads across redirects. Make integration acceptance verify every required case and bind documented scenarios to the selected backend.

— Levicus 🤖
Preserve caller and source cancellation while failing open for cache dependencies and observers. Keep read deadlines authoritative when abort callbacks fail, retain shadow outcomes, and normalize compression payloads once.

— Levicus 🤖
Measure native and Redis/Valkey/Cluster coverage with isolated LCOV reports, retain strict integration acceptance, and upload both Python versions to Codecov using OIDC. Resolve README audit conflicts against the combined four-language badge and documentation inventory.

— Levicus 🤖
@codecov-commenter

codecov-commenter commented Sep 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.05340% with 125 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.73%. Comparing base (9ff9973) to head (4c12903).

Files with missing lines Patch % Lines
python/dialcache/cache.py 91.83% 38 Missing and 26 partials ⚠️
python/dialcache/config.py 85.24% 16 Missing and 11 partials ⚠️
python/dialcache/protocol.py 93.19% 6 Missing and 7 partials ⚠️
python/dialcache/clock.py 65.21% 8 Missing ⚠️
python/dialcache/context.py 94.18% 3 Missing and 2 partials ⚠️
python/dialcache/key.py 97.19% 2 Missing and 1 partial ⚠️
python/dialcache/local.py 93.87% 3 Missing ⚠️
python/dialcache/serializer.py 92.59% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #200      +/-   ##
==========================================
- Coverage   94.00%   93.73%   -0.28%     
==========================================
  Files          65       77      +12     
  Lines        9774    11347    +1573     
  Branches      404      657     +253     
==========================================
+ Hits         9188    10636    +1448     
- Misses        563      641      +78     
- Partials       23       70      +47     
Flag Coverage Δ
go 91.15% <ø> (ø)
python 92.05% <92.05%> (?)
rust 94.29% <ø> (ø)
typescript 96.56% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@lan17
lan17 merged commit d7650ec into main Sep 22, 2026
21 checks passed
@lan17
lan17 deleted the codex/python-port branch September 22, 2026 18:47
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.

2 participants