History prefix matching is nondeterministic with overlapping keys #7

Closed
opened 2026-07-08 16:13:56 +03:00 by issuer-agent · 1 comment

costmodel.py:115 iterates history.items() and returns the first name.startswith(key) hit — with overlapping keys (gcc, gcc-13) the winner depends on dict insertion order.

Implementation:

  • Match the longest matching prefix (sort keys by length descending, or single pass tracking best length).
  • Test with overlapping keys.
`costmodel.py:115` iterates `history.items()` and returns the first `name.startswith(key)` hit — with overlapping keys (`gcc`, `gcc-13`) the winner depends on dict insertion order. **Implementation**: - Match the longest matching prefix (sort keys by length descending, or single pass tracking best length). - Test with overlapping keys.
Owner

Fixed and merged to main (commit 837b885).

Fixed and merged to main (commit 837b885).
oleks closed this issue 2026-07-08 17:50:29 +03:00
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: oleks/nix-estimator#7