Skip to content

fix(engine): plan cache Put/Get keys after Optimise (#238) - #263

Open
MrBeldum wants to merge 3 commits into
FraiseHQ:mainfrom
MrBeldum:fix/plan-cache-put-get-key-mismatch
Open

fix(engine): plan cache Put/Get keys after Optimise (#238)#263
MrBeldum wants to merge 3 commits into
FraiseHQ:mainfrom
MrBeldum:fix/plan-cache-put-get-key-mismatch

Conversation

@MrBeldum

@MrBeldum MrBeldum commented Sep 4, 2026

Copy link
Copy Markdown

Summary

  • Dedupe.Optimise mutates the query in place, so Plan previously hashed the raw query for Get and the deduplicated query for Put. Any recall with a repeated keyword/topic/entity was stored under a key that was never looked up.
  • Optimise first, then use a single post-Optimise hash for both Put and Get.
  • Regression test: a fresh parse of recall@0 foo foo top:5 must hit the cached query from the first Plan.

Fixes #238

Test plan

  • go test ./pkg/engine/ -count=1
  • CI on this PR

Dedupe mutates the query in place, so Get(raw) and Put(deduped) disagreed
for any duplicate-keyword recall and the entry was never hit. Optimise
first, then use one key for both Put and Get.

Fixes FraiseHQ#238
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

Thanks for the contribution! Before it can be merged, please read the CLA and comment exactly:


I have read the CLA and I hereby agree to its terms


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown

Thanks for the contribution.

Before this can be merged, the following need to sign the CLA: MrBeldum

To sign, post a comment on this pull request containing exactly:

I have read the CLA Document and I hereby sign the CLA

@codecov

codecov Bot commented Sep 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@RonsenbergVI

Copy link
Copy Markdown
Collaborator

Thanks for your PR @MrBeldum , could you use the PR template in the repo for your PR description and have a look at the CLA?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: plan cache Put/Get keys disagree — any query with a duplicate keyword misses forever

2 participants