Repository navigation
Comment routing: one conversation's weights built once, and a one-call draw that returns the chosen comment and its chance (dormant) - #3502
Draft
colinmegill wants to merge 5 commits into
Conversation
… check) A plan is one conversation's weights for a configured rule (stored-weights/1, uniform/1, or symmetric-gic-floor/2 over symmetric-gic/2 weights), built once from one read's frames. Its draw takes today's candidate ids and the caller's unit: the bound before any copy, checked id conversion, the plan's own exclusion under meta_policy = exclude, one library draw, and the receipt's comment id as the comment to fetch. Every refusal maps to a closed reason with no comment id. The plan's charge and the draw's scratch bound are pure, checked upper bounds, tested with a counting allocator. Nothing calls it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…le fix found on mm5) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…m the read The plan keeps its own copy of the meta set, which can name comments in no other key; its size is now taken from the frames rather than from the weights' sets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ne-call draw Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From review. Every library refusal was already named in the mapping to a fall back, but a wildcard as its last arm kept today's outputs and passed the check, so a refusal added to the library later could be swallowed. The function now denies clippy's wildcard lints, and that mutation fails the check. No behaviour changes.
This branch has not been deployed
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.
What this is
The plan build and the one-call draw in
queue-rs/polis-routing-plan, stacked on PR #3501. Nothing calls the crate, so nothing a person can observe changes.queue-rs/polis-api/.What it adds
Plan::build: one conversation's weights, computed once from the adapter's frames for a named rule and its parameters (RuleConfig:stored-weights/1,uniform/1, andsymmetric-gic-floor/2oversymmetric-gic/2).Plan::draw: one call that leaves out the comments a participant has voted on and the ones the plan excludes, chooses the next comment with the random input it is given, and returns aPlanDrawholding the chosen comment's id and the chance it had. The comment to fetch is always that id, never a position in a filtered list.Fallback(a caller then uses today's draw); the mapping cannot gain a wildcard arm, and no refusal carries a comment id. A fall back's chance is never reported as the plan's.charged_bytesanddraw_reservationgive upper bounds on what a plan holds and on a draw's scratch.Checks
Passed locally at this head:
make check-polis-routing-plan(61 tests, formatting, clippy, the source scan, the dependency rule),make check-polis-routing-equation(157 tests; today's equation still 1,386 of 1,386 grid cases and 3,257 of 3,257 replayed cells bit for bit against the Python formula) andmake check-vote-sign-lint. Reviewed by the second reviewer, whose own 1,892 constructed draw and refusal cases matched the library's receipts and probability bits; its one correction is the last commit.All fixtures are constructed; no real conversation's data is used.
🤖 Generated with Claude Code