Enforce queue entry type boundary across acknowledge/requeue API#383
Open
Enforce queue entry type boundary across acknowledge/requeue API#383
Conversation
3df35fe to
82f31fc
Compare
744c478 to
de1d2ef
Compare
All queue entries are now consistently JSON. acknowledge/requeue accept queue entries (JSON strings), not plain test IDs or test objects. Lua scripts use the full entry as Redis hash keys instead of test_id, eliminating the type ambiguity that caused JSON::ParserError crashes.
de1d2ef to
fc66d7c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Situation
Following #381, the codebase still conflated queue entries (JSON records) and plain test ID strings — passing both through
acknowledge,requeue, and Lua scripts. This causedJSON::ParserErrorcrashes in production when a plain string hit a JSON-only code path.Execution
Established a clean type boundary:
acknowledge/requeueaccept queue entries (JSON), Lua scripts use the full entry as Redis keys. Read-side methods (failed_tests,requeued_tests, etc.) extract test_ids for display.Using the full entry (test_id + file_path) as the Redis key — not just test_id — is intentional: in lazy streaming mode, two files can define the same test_id with different implementations. Since files are lazy-loaded, we can't depend on Ruby's method override semantics to make the test unique at queue time. The entry (which includes file_path) is the true identity.
Also fixed a latent bug where
try_to_reserve_lost_testcheckedkey('completed')butacknowledgewrites tokey('processed')... different Redis keys. Every timed out test looked unprocessed and got re-reserved. This has been broken since 2021 (bfc2bb1) but was masked because heartbeats rarely missed.