Repository navigation
feat(providers)!: put in-process backends on the platform clock - #80
Conversation
MemoryState checked rate-gate turns against real time.monotonic() while the geocoder set retry_at from the platform clock, so a host test that advanced its FixedClock to a booked turn was still refused and had to sleep. Every in-process backend now reads the clock build_platform wires in: memory state expiry, both rate gates and the tiered lockout, the local upload-session stamp, the geocoder's in-wait sleep and the reloading retry. BREAKING CHANGE: ClockProvider has a new method, sleep(seconds); a host that implements its own clock must add it. Under install_test_platform, memory:// state stands still until the test advances the FixedClock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bumps the version and dates the platform-clock changelog entry as 0.25.0, with the breaking ClockProvider method and the FixedClock behavior for host tests under Upgrading. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
What does this PR do?
MemoryStatechecked rate-gate turns against realtime.monotonic(), while the geocoder setsretry_atfrom the platform clock. A host test that advanced itsFixedClockto a booked geocoding turn was still refused, so it had to sleep the interval out in real time.Every in-process backend now reads the clock
build_platformwires in:memory://state (MemoryState(clock)): key and index expiry, the sweep,reserve_slot/reserve_send, and therecord_tiered_failurelockout deadline.ClockProvider.sleep(seconds)(new protocol method):SystemClockcallstime.sleep;jasil.testing.FixedClock.sleepadvances the clock and refuses a negative length astime.sleepdoes. The HTTP geocoder's wait for a turn withinmax_wait_secondsgoes through it.LocalStorage(..., clock=...)): stamps a resumable upload session's start time, whichcleanup_uploadscompares with its cutoff.It also releases 0.25.0: version bump in
pyproject.toml,uv.lock,README.md,docs/index.md, and the dated changelog entry.Related issue
No issue. This came from a hand-off found while removing the last real
sleep()from Endurain's in-process test suite.Type of change
Checklist
timemodule to aFixedClock)Notes for the reviewer
ClockProvidermust addsleep.install_test_platform,memory://state stands still until the test advances the clock.MemoryStateandLocalStorageconstructors now require the clock, as every other internal component does. Backend classes are not covered by SemVer.monotoniccallable onMemoryStatefor the host to build itself. That would not reach the gate the platform's geocoder holds, and it leaves the two clocks disagreeing.created_epochis stored but never compared; its cleanup uses S3'sLastModified.RedisStatekeeps the server clock andtime.time(), as documented inproviders-and-backends.md.ruff checkandruff format --checklint-imports(5 contracts kept)mypypytest: 4386 passed, 149 skipped, coverage 97.93%check_module_coverage.pycheck_docs_api.py🤖 Generated with Claude Code
Summary by CodeRabbit