Repository navigation
refactor(search): split the payoff arithmetic into shared modules - #72
Merged
Merged
Conversation
Move the audited native products (point_product, challenge_product), the card-bonus sum (card_bonus) and the two team-bonus maxima (largest_team_bonus, sum_rows) into search::bonus, together with their unit tests. The payoff bounds of the joint traversal and of the deck payoff now read the same functions instead of one reaching into the other. Each function keeps its body, error messages and visibility. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The joint traversal and the power bound each declared their own SLOTS table. Keep one constant in search::slots and re-export it from both modules, so every path that names SLOTS keeps working and the slot order has a single source. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Move the largest term payoff of a metric (term_cap), the largest reward row of an event table and the negative-score check into search::caps. The combined-level folding, the deck payoff and the joint compilation read them without depending on the point bound, which keeps only the per-order bound it computes. Values, error text and visibility are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Step, ScoreSteps and the TermSteps alias describe how an order's payoff steps with its score, which the joint traversal and the deck payoff both consume. They move to search::curve unchanged, apart from a largest_step accessor that replaces the deck payoff's direct read of the private step list. The payoff arithmetic of each step is the same text as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
payoff_of and the arithmetic error it reports describe one terminal outcome, not the evaluation driver. Move them to search::reward, keep the re-export from the physical module so every caller resolves as before, and add narrow score and points entry points for the payoff bounds that read those forms without a deck. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The score-step bound, the point bound and the certified native steps each re-derived the payoff of one order. They now call search::reward: the step's Points value and the point bound's products go through points_payoff, and the certified steps read payoff_of at each cut instead of reproducing the event preview. The ordering weight of a certified rank stays in the certified search, which is a ranking lattice rather than a payoff. Co-Authored-By: Claude Opus 5.5 <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.
Summary
The payoff bounds and the terminal payoff now share small leaf modules, so
deck_payoff,team_powerand the joint point bound depend on common building blocks instead of on each other:search::bonus: event-bonus table arithmetic (point_product,challenge_product,card_bonus,largest_team_bonus,sum_rows).search::slots: the physical slot order.search::caps: the largest payoff each term of a metric can pay.search::curve: how an order's payoff steps with its score (Step,ScoreSteps,TermSteps).search::reward: the payoff of one terminal outcome (payoff_of), plusscore_payoffandpoints_payoff, which the payoff bounds use for the same integer forms.Each commit moves code without changing its arithmetic; tests move with the functions they cover. Results, proofs and node counts are unchanged.
Tests
cargo check -p ournotes-search --all-targets).cargo clippy --workspace --all-targets -- -D warningsandcargo test -p ournotes-searchpass on the final commit.🤖 Generated with Claude Code