Resolve recurrence series refs from search - #14
Merged
Conversation
A recurring row shows its series ref (RCR-NP3S) in the task list preview, and resolve_recurrence_ref accepts that ref everywhere else, but search returned nothing for it: the ref lane only ever matched a task id, and the prefix check demanded a project prefix, which RCR never is. Give the ref lane a second identity to match. When the query names no prefix or names RCR, load the occurrence tasks whose series id carries the suffix — under the same visibility rules the task ref lane uses, so paused and archived projections stay out — and score them against the series ref. Recurrence grouping then collapses the occurrences into the single row the caller expects. The scoring math moves into score_ref_identity so both identities weigh a ref the same way, and SERIES_REF_PREFIX moves next to the display-ref formatter that mints it.
seungjuchoi
force-pushed
the
search-recurrence-series-refs
branch
from
August 18, 2026 21:44
c488e90 to
85a6a1d
Compare
Bind the complete GLOB prefix pattern so SQLite can use the existing (workspace_id, series_id, slot_on) primary key as a bounded series ID range. The previous LIKE expression constrained the index only by workspace and scanned every recurrence occurrence while filtering the prefix afterward. This keeps the normalized Crockford Base32 matching behavior unchanged while reducing the work performed by CLI and TUI live searches. There are no breaking behavior changes.
Owner
|
Thanks again |
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.
Problem
A recurring row advertises its series ref in the task list preview:
Every other command takes that ref —
aven recur show RCR-NP3Sresolves it, andresolve_recurrence_refaccepts it wherever a series is named. Search does not:Same in the TUI: typing a series ref you just read off the screen lands on the empty "no search results" view. In my own workspace 23 of 186 display refs were unsearchable, all of them series refs.
Root cause
The ref lane only ever had one identity to match against:
score_ref_lanecompares the query suffix totask.id, and gates onnormalize_ref_query(task.project_prefix) == prefix.RCRis not a project prefix and a series id is not a task id, so a series ref fails both halves — no ref evidence, no candidates, empty result.resolve_recurrence_refalready models the right shape: the hint must be absent orRCR, and the suffix matchesrecurrence_series.id.Fix
Give the ref lane a second identity.
series_ref_suffixreturns the suffix a series ref addresses — when the query names no prefix, or namesRCR— andNonewhen it names a project prefix.load_series_ref_search_documentsloads the occurrence tasks whose series id carries that suffix, under the same visibility rules the task ref lane already applies (ordinary_task_clause, so paused and archived projections stay out) and the same project/deleted scoping.attach_recurrence_series_refshangs each candidate's series id and series display ref off the document, reusingtask_recurrence_summaries— the same call the preview path already makes.score_series_ref_lanescores that identity;score_ref_lanekeeps whichever of the two identities scores higher.Recurrence grouping then collapses the matched occurrences into the single row callers expect, so
search RCR-NP3Sreturns exactly the recurring row, and a bare suffix (NP3S) works too, matching how bare suffixes already address task ids.Two things moved rather than changed: the scoring math is now
score_ref_identity, shared by both lanes so a ref weighs the same either way (the task lane's behaviour, including the/WRONG-7KQ9rejection, is unchanged), andSERIES_REF_PREFIXmoved fromoperations::recurrencetorecurrence, next to the display-ref formatter that mints it.Test
search_resolves_recurrence_series_refs_to_their_occurrencescreates a series and searches its ref three ways: qualified (RCR-…), bare suffix, and a wrong prefix (/APP-…) that must stay empty. It fails onmainwith 0 results.cargo test,cargo clippy --all-targets, andcargo fmt --checkpass. The 8 failures I see incli_sync/cli_workspaces/cli_daemon_sync/cli_inference_errorsare pre-existing onmain— theexec_sqlhelper shells out to my systemsqlite3, which has no fts5 module.I also re-ran all 186 display refs in my own workspace through
aven search; every one resolves now.Independent of #13 (that one is the parser, this one is the lane), though both came out of the same "enter on a search result shows no results" report.