Corgi join: consolidate compound values when advancing reorders product times - #905
Merged
Merged
Conversation
…rders product times SideScratch's single-chunk path assumed that joining each time with the lower bound keeps a value's times in order, so equal (coordinate, time) entries stay adjacent and consolidation can be adjacent. For partially ordered times that is false: (0,2), (1,0), (1,2) joined with (1,0) become (1,2), (1,0), (1,2). With diffs +1, +1, -1 the +1/-1 pair at (1,2) is not adjacent and survives, and the staged entries are no longer sorted. Detect an inversion within a value coordinate after staging and consolidate in that case; ordered runs keep the existing path. The primitive-value path already consolidated; this covers compound values. The new test fails before the fix. Co-Authored-By: Astra (OpenAI Codex) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
SideScratch::stage_runs(interactive/src/corgi/join.rs) has a single-chunk path that assumes joining each time with the lower bound keeps a value's times in ascending order ("join is monotone"), so equal(coordinate, time)entries stay adjacent and adjacent consolidation suffices.For partially ordered times that is false. With product times
(0,2), (1,0), (1,2)and lower bound(1,0), the advanced times are(1,2), (1,0), (1,2). With diffs+1, +1, -1for one compound value, the+1/-1pair at(1,2)is not adjacent, so it survives staging, and the staged entries are no longer sorted:The fix checks for an inversion within a value coordinate after staging and consolidates only then; ordered runs keep the existing path. The primitive-value path already consolidated, so this covers compound values. +23 −3, one file.
compound_tokens_consolidate_after_product_time_reordering; it fails on master-next with the output above.cargo test --release -p interactive: 104 passed, 5 ignored.🤖 Generated with Claude Code