Skip to content

fix(tests): replay go-gdpr's recorded first sync on a fixed clock - #29

Merged
ChrisHuie merged 1 commit into
mainfrom
feature/recorder-replay-clock
Oct 22, 2026
Merged

ChrisHuie merged 1 commit into
mainfrom
feature/recorder-replay-clock

Conversation

@ChrisHuie

Copy link
Copy Markdown
Contributor

Five tests in tests/source/test_recorder.py fail on every run since 2026-10-21 23:36 UTC, on main and on every pull request:

  • test_recording_a_first_sync_of_its_recordings_gives_them_back
  • test_a_retried_item_records_one_unit_per_file[first sync]
  • test_a_first_sync_that_does_not_exit_0_stops_the_recording
  • test_only_first_sync_writes_its_directory_alone[False] and [True]

Each fails with UnexpectedResponse: GitHub answered 418: no user unit for {'id': ...}.

Cause

record_first_sync (tests/source/recorder.py) ran its sync on SystemClock(). The tests replay go-gdpr's recorded first sync (tests/fixtures/source/first_sync/, recorded 2026-10-20 23:36 UTC). The sync's 24-hour account refresh (REFRESH_AFTER, sync/writer.py) measures each account from its recorded Date header. So once a day had passed, the replayed run looked up accounts the recording does not hold, and the replay answered 418.

tests/sync/test_first_sync.py replays the same recordings on FakeClock and is unaffected.

Change

  • record_first_sync takes clock, as record does, and uses it for both the source and the engine. A live recording (scripts/record_fixtures.py --only first-sync) keeps the system clock.
  • Every replayed call in tests/source/test_recorder.py passes FakeClock(), which starts at 2026-10-17 12:00 UTC, before the recordings.
  • test_recording_a_first_sync_of_its_recordings_gives_them_back already asserts the replay asks for exactly Resolve, PullRequestIndex, PullRequestBatch, and one UserLookup, so a refresh lookup fails it.

No code under src/, scripts/, or alembic/ changes.

Head: f79e239b2c5baa1c5220119cedd1ff34a85bf362

Ran:

  • uv run --no-sync pytest tests/source/test_recorder.py on main's code: the five tests above fail.
  • The same on this head: 22 passed.
  • This head's tests against main's tests/source/recorder.py: they fail with TypeError: record_first_sync() got an unexpected keyword argument 'clock'.
  • uv run --no-sync pytest (full suite): 2058 tests, 0 failures, 0 errors, 0 skipped (JUnit report), and scripts/check_junit.py --max-skipped 0 passes.
  • uv run --no-sync pre-commit run --all-files: passed.

Not run: a live recording (scripts/record_fixtures.py --only first-sync).

record_first_sync ran the replayed sync on the system clock. The sync's
24-hour account refresh measures each account from its recorded Date header
(2026-10-20 23:36 UTC for the go-gdpr recordings), so from a day after the
recording the replay asked for user lookups the recording does not hold,
the replay answered 418, and five tests in tests/source/test_recorder.py
failed on every run.

record_first_sync takes a clock, as record does, and uses it for the
source and the engine; a live recording keeps the system clock, and every
replayed call in the tests passes FakeClock.
@ChrisHuie
ChrisHuie merged commit 27f4c0e into main Oct 22, 2026
4 checks passed
@ChrisHuie
ChrisHuie deleted the feature/recorder-replay-clock branch October 22, 2026 20:25
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