Repository navigation
Conversation
search_terms documented subject_kind as called at most once per subject, but its per-term loop re-filtered every subject through the lookup for each SubjectKind term (N subjects x K kind terms = N*K calls). Resolve kinds lazily into a per-call cache so the lookup runs at most once per distinct subject, including for duplicate kind terms. AND results are unchanged. Adds a counting-lookup integration test: 3 subjects x 2 identical kind terms and x 3 kind terms (two distinct + a duplicate) each assert <= 3 lookup calls with results identical to single-term behaviour. Fixes #3013
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 59 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Closing as superseded — not merged. This PR and PR #3688 are the same work: queue task 5518 for issue #3013 (memoize Before closing, this PR was diffed in full against the canonical PR per the duplicate-PR protocol, and the salvage note is posted on PR #3688 (#3688 (comment)): the implementation has nothing unique (a Disposition tracked by issue #6608 (pr-shepherd, Lane W fallback mode). |
Fixes #3013. Queue task 5518 (routed by triage task 4363, CONFIRMED on main).
What
search_termsinpkgs/id/src/search.rsdocumented itssubject_kindlookup as "called at most once per subject", but the per-term loop re-filtered every subject through the lookup for eachSubjectKindterm — N subjects × K kind terms = N×K calls (store reads for an uncached lookup), including for duplicate kind terms.This resolves kinds lazily into a per-call cache (
RefCell<HashMap<[u8;32], Option<String>>>) consulted before callingsubject_kind, so the lookup runs at most once per distinct subject across the whole call. AND semantics, hit selection, and ordering are unchanged.Test
New counting-lookup integration test in
pkgs/id/tests/search.rs(test_search_terms_resolves_subject_kind_at_most_once_per_subject): 3 subjects (kinds alpha / beta / none) —Targeted run:
cargo test --test search search_termson the laptop (results in the queue-task completion note; laptop under heavy fleet load this shift).Scope exclusions per packet: no change to
search_store_termscaller-side behaviour (#2779 separate), no search-semantics change.Need help on this PR? Tag
@codesmith-botwith what you need.