Skip to content

Fix retry queue in preresolved lazy loading mode#377

Merged
danielahrnsbrak merged 1 commit intomainfrom
dahrnsbrak/fix-retry-queue-preresolved-lazy-loading
Mar 31, 2026
Merged

Fix retry queue in preresolved lazy loading mode#377
danielahrnsbrak merged 1 commit intomainfrom
dahrnsbrak/fix-retry-queue-preresolved-lazy-loading

Conversation

@danielahrnsbrak
Copy link
Copy Markdown
Contributor

Summary

  • Fix KeyError crash when a Buildkite job is manually retried in preresolved-tests mode
  • Preserve full queue entries (test_id + file_path) in retry queue so lazy loading can resolve them
  • Fix Static#requeue to push back original entry with file path instead of bare test ID

Problem

When a CI job using --preresolved-tests is manually retried, the retry crashes with:

KeyError: key not found: "SomeTest#test_method..."
ci-queue/lib/ci/queue/static.rb:100:in 'Hash#fetch'

Root cause: Retry inherits stream_populate from Static, so QueuePopulationStrategy#populate_queue overwrites the retry queue's failed test entries with the full preresolved test list, then Static#poll crashes on index.fetch because the index wasn't built for those entries.

Fix

  1. Retry#stream_populate — Override as no-op so the retry queue's pre-populated failed entries aren't replaced. configure_lazy_queue still sets entry_resolver, so poll lazily resolves each entry.

  2. Worker#retry_queue — Preserve full queue entries (with file paths) instead of stripping to bare test IDs. Uses uniq! with block for idiomatic dedup by test ID.

  3. Static#requeue — Track original queue entries during poll and push them back on requeue, preserving file paths and load-error payloads for subsequent retry attempts.

  4. Version bump — 0.83.0 → 0.84.0

What's NOT changed

Retry#populate is intentionally left intact — RSpec and non-lazy Minitest retries call populate to build the @index for yielding runnable test/example objects. Those paths use bare test IDs that match index keys correctly.

Test plan

  • Unit tests: Retry#stream_populate no-op, poll with entry_resolver, populate still builds index for eager mode, bare test ID backwards compatibility, requeue preserves full entries
  • Redis integration tests: full entries preserved through stream_populatepollretry_queue, stream_populate no-op on retry, end-to-end with entry_resolver, multiple failure dedup
  • All existing tests pass (59 tests, 154 assertions, 0 failures)

@danielahrnsbrak danielahrnsbrak force-pushed the dahrnsbrak/fix-retry-queue-preresolved-lazy-loading branch 2 times, most recently from eba4462 to 78df554 Compare March 31, 2026 14:16
@danielahrnsbrak danielahrnsbrak force-pushed the dahrnsbrak/fix-retry-queue-preresolved-lazy-loading branch from 78df554 to 57a69d2 Compare March 31, 2026 14:33
@danielahrnsbrak danielahrnsbrak merged commit 0b4073c into main Mar 31, 2026
22 checks passed
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