Fix test_distinct_titles_keep_unsuffixed_ids failing on the 20th-29th - #323
Merged
Conversation
The test asserted `"-2" not in <first line of the response>` to mean "no collision suffix was appended". Task ids carry a date prefix, so from the 20th of any month that substring matches the date itself (`2026-08-20-rotate-…`) and the test fails — 119 days a year, on main, with nothing wrong with the code under test. Assert on the id instead of hunting a substring: build the expected unsuffixed ids with `_make_task_id` and require the response to name each one verbatim. A collision suffix would put a "-2" exactly where this expects the space before "(status: …)", so the test still fails for the reason it was written to catch.
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.
tests/test_task_id_collision.py::TestSlugCollision::test_distinct_titles_keep_unsuffixed_idsfails onmaintoday, and on 119 days a year, with nothing wrong with the code it covers.Why
The test means "two distinct titles get ids with no
-2collision suffix", but it checks that by searching the response line for the substring-2:Task ids are date-prefixed, so from the 20th of any month the date supplies that substring itself:
Days 20-29 of every month — 119 days in 2026. (The 1st-19th are safe: a
-is only ever followed by a2in the day field, months being 01-12.)Fix
Assert on the id rather than hunting for a substring: build the expected unsuffixed ids with
_make_task_id(the helper this file already uses to pin collisions) and require each response to name its id verbatim.This keeps the test's teeth — a collision suffix would put a
-2exactly where the assertion expects the space before(status: …), so...-credentials-2 (status: …)still fails. Verified against clean and suffixed strings across dates on both sides of the boundary, plus a harness guard that the two titles remain distinct.Testing
pytest tests/— 3336 passed, run today (2026-08-20), the exact date that breaks the current assertion.