Fix findNextWorkItem tie-break and in-progress boost tests (WL-0MN7GBSL41M52FTM)#1041
Merged
SorraTheOrc merged 3 commits intomainfrom Mar 26, 2026
Merged
Conversation
cfaaed5 to
ea9176b
Compare
…SL41M52FTM) Fix: Ensure priority dominance is preserved by using raw priority (not effective priority) in the base score, so that high priority always dominates medium regardless of inheritance or boosts. The blocked penalty applies to ALL blocked items (original behavior, restored per user request). Tie-breaking in selectBySortIndex (effective priority → createdAt → ID) preserves the original algorithm with cleaner comments. Test pollution note: The priority dominance test passes in isolation but can fail in the full suite due to pre-existing test isolation issues (not a code bug).
ea9176b to
dcd03ce
Compare
added 2 commits
March 26, 2026 14:53
…ests (WL-0MN7GBSL41M52FTM) Root cause: When items were created at the same millisecond, they had identical createdAt timestamps. The sort tie-breaker used ID comparison via localeCompare, but the random component in IDs meant lexicographic order didn't preserve creation order. Fix: Added a sequence counter to ID generation. When multiple IDs are generated within the same millisecond, the sequence number ensures deterministic ordering that reflects creation order. Changes: - Added _lastIdTime and _idSequence fields to WorklogDatabase - Modified generateUniqueId to use sequence counter - Updated ID length constants to accommodate sequence (now 16 chars total) - Added defensive JSONL refresh skip for TEST prefix databases Test results: database.test.ts and next-regression.test.ts now pass consistently (5/5 runs) where they previously had 0-2 failures per run.
The check was preventing CLI tests from importing work items from JSONL files, causing export/import tests to fail with itemsCount=0. The sequence counter fix in generateUniqueId already addresses the test pollution issue, so this defensive check is no longer needed.
This was referenced Mar 30, 2026
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.
Summary
Reduced failing tests from 7 to 3. Fixes tie-breaking and in-progress boost handling in
selectBySortIndexandcomputeScore.Changes
computeScoreuses effective priority (not raw priority) for base score — children now correctly inherit parent priority for scoring.Blocked penalty only applies when item has active dependency edges — fixes "ignore blocking issues mentioned in description/comments" tests (items with
status='blocked'but no active outgoing edges are treated as normal candidates).ancestorsOfInProgresspassed tocomputeScoreinselectBySortIndextie-break — parent-in-progress boost now applies during tie-breaking.New
computeBoosthelper — separates boost calculation from base score for tie-breaking.selectBySortIndextie-break order: effective priority → boost → createdAt → ID.in_review staged blocked items treated as non-blocking in
computeScore.Remaining Failures (design conflicts — 3 tests)
These tests encode incompatible design requirements:
should preserve priority dominance(×2): Both items have effective priority 3 (itemB inherits from blocked dependent). Boost tie-break then selects itemB (boost 500). Test expects itemA (high, no boost) to win. This is a design conflict: boost correctly lets medium unblockers win over equal-priority peers, but also incorrectly lets medium+boost win over high when effective priorities are equal via inheritance.should not boost a blocked item: Blocked parent without active dependency edges ties with open item on effective priority and wins by createdAt. Test expects open item to win (requires -10000 penalty on ALL blocked items, which conflicts with the "ignore description/mentions" fix).These 3 tests will fail until a design decision is made about priority inheritance and the blocked penalty scope.
Test Results
References