Skip to content

Lose only answers to writes Drive carried out in the live tests - #458

Draft
shcheklein wants to merge 2 commits into
mainfrom
lose-only-done-answers
Draft

shcheklein wants to merge 2 commits into
mainfrom
lose-only-done-answers

Conversation

@shcheklein

@shcheklein shcheklein commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

A live test from #443 failed on an unrelated PR while CI was under Drive's rate limit:

FAILED test_fs.py::test_write_whose_answers_keep_getting_lost_stops_with_one_result[move]
AssertionError: assert ['source', 'sub'] == ['sub', 'sub/new']

The test lets Drive carry out a move and then replaces the answer with a lost connection, four times. It expects the file to be moved once. Its fixture replaced every matching answer, including Drive's 403 rateLimitExceeded, which means Drive did nothing. When all four tries were refused that way, the test lost four refusals and found the file unmoved.

The fixture now loses only answers to requests Drive carried out: a 2xx success, or the 409 fileIdInUse that says an earlier try already did the work. Any other answer, including another kind of 409 and a 308 that asks for the next part of an upload, reaches the filesystem unchanged. A refusal, such as a rate limit, reaches the filesystem unchanged, and the filesystem handles it as it always does. The test checks what it was written for, a write whose answer was lost, even when CI is busy.

The shortcut copy test no longer needs skip=1, so the parameter is gone. Drive's refusal of the first copy (an ID meant for files, 400) is no longer counted.

Test-only change. The lost-answer tests pass against the local fake Drive.

🤖 Generated with Claude Code

The lost-answer tests replaced every matching answer with a lost
connection, also a rate limit that said Drive had done nothing. Under
load all tries of a write could be refused that way, and a test then
found nothing on Drive. Refusals now reach the filesystem as they are.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread pydrive2/test/test_fs.py Resolved
Comment thread pydrive2/test/test_fs.py Resolved

@shcheklein shcheklein left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[AI generated — Copilot]

5-pass review summary: clean, targeted fix for rate-limit CI flakiness in lose_answers. One now-dead parameter (skip) left to remove.

Comment thread pydrive2/test/test_fs.py Resolved
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No actionable issues were found in the reviewed changes to pydrive2/test/test_fs.py.

No open issues 🎉

What changed in this PR

Refines the live write-retry tests from #443 so rate-limit refusals are not mistaken for lost answers to completed writes. Production code is unchanged.

Changes:

  • Lose only 2xx responses and 409 fileIdInUse; pass other responses through unchanged.
  • Remove the shortcut-copy test’s now-unnecessary skip parameter.
File Description
pydrive2/​test/​test_fs.py Filters simulated answer loss to completed writes and simplifies shortcut-copy testing.

Review effort: Balanced

This branch has not been deployed

No deployments
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