Skip to content

test: Change the file size in the override retry test so the poller sees the malformed write - #576

Open
kinyoklion wants to merge 1 commit into
feat/overridesfrom
rlamb/overrides-python-retry-test-size
Open

kinyoklion wants to merge 1 commit into
feat/overridesfrom
rlamb/overrides-python-retry-test-size

Conversation

@kinyoklion

@kinyoklion kinyoklion commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Requirements

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions
  • Sync/async parity: matching changes made to async_* siblings (or N/A). N/A: a test-only change to the file override source tests.

Related issues

test_source_retries_a_failed_load_without_a_change_signal failed on windows (3.10) in the CI of #572, with AssertionError: the load failure was not logged. The test passed on every other Windows and Linux version.

Describe the solution you've provided

The test writes valid content, then malformed content, then fixed content. The fixed content keeps the malformed content's size and modification time, so that only the automatic retry can recover. The initial content had that same size too. The poller compares a file's modification time and size. Where file times are coarse, as on Windows, the initial and malformed writes can share a modification time, so the poller saw no change. Nothing was then logged, and the test timed out.

The initial content now has a different size from the malformed content, so the poller always sees the malformed write. The part of the test that depends on an unchanged size and time is unchanged.

To confirm the cause, I patched _observe to round modification times down to whole seconds and ran the test. It failed after its 10-second timeout without this change, and it passes with it. The whole test file passes normally (72 tests), and isort and pycodestyle are clean.

Describe alternatives you've considered

Setting the file's modification time after the malformed write. Changing the size states the intent in the content itself, and needs no extra system call.

Additional context

This merges cleanly with #574, which adds tests to the same file.

Opened from termag


Note

Overview
Stabilizes test_source_retries_a_failed_load_without_a_change_signal on Windows by changing the initial override JSON so its file size differs from the later malformed payload.

The test still relies on malformed and fixed content having the same length and mtime so recovery must come from automatic retry, not polling. On platforms with coarse mtimes, the old initial content could match the malformed write on size and time, so the poller missed the bad edit and the expected load-failure log never appeared. Comments were added to document that intent.

Reviewed by Cursor Bugbot for commit 0d9ba1c. Bugbot is set up for automated code reviews on this repo. Configure here.

…ees the malformed write

The initial and malformed contents had the same size. Where file times are coarse, as on Windows, both writes can share a modification time, so the poller saw no change, nothing was logged, and the test timed out. The initial content now has a different size.
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