Match display refs whose project prefix carries digits - #13
Merged
raine merged 3 commits intoAug 19, 2026
Conversation
raine
force-pushed
the
fix-numeric-project-prefix-ref-search
branch
2 times, most recently
from
August 18, 2026 10:15
1bc7215 to
a789f00
Compare
Search's ref lane only treated a leading token as a project prefix when it was entirely alphabetic, but prefix_base builds prefixes from the first character of each key word, so a key like 00-main yields 0M and 03-lge yields 0L2. Those display refs fell through to the suffix-only branch, where 0M-XYMT collapses to 0MXYMT and never matches the task id XYMT..., so searching them returned nothing. That surfaced in the TUI: accepting a search result re-runs the search against the result's display ref, so pressing enter on any task in a digit-prefixed project landed on the empty "no search results" view. Treat any leading group of at most four characters as a prefix candidate (unique_project_prefix mints at most a three-character base plus a collision counter), which keeps ordinary hyphenated prose out of the ref lane. Cover the parser shapes and the preview-then-accept round trip.
seungjuchoi
force-pushed
the
fix-numeric-project-prefix-ref-search
branch
from
August 18, 2026 21:42
a789f00 to
d857c48
Compare
The numeric-prefix parser used a four-character ceiling that excluded valid custom prefixes and changed how longer alphabetic prefixes were parsed. Those refs could not resolve after selecting their tasks from TUI search. Use the explicit project-prefix length limit for numeric groups and preserve alphabetic prefix parsing regardless of length. Share the limit with project validation and cover longer numeric and alphabetic refs in parser tests.
The shared prefix limit applies to explicitly assigned prefixes, while the search parser intentionally preserves alphabetic prefix candidates of any length. The previous constant name and parser comment obscured that distinction. Name the explicit-prefix limit precisely and separate numeric and alphabetic parser coverage so failures identify the affected behavior directly.
Owner
|
Thanks! |
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
In the TUI, pressing enter on a search result lands on the empty "no search results" view for every task that lives in a project whose prefix contains a digit.
Repro (hit this on my own data with v0.1.28):
00-main.prefix_basederives the prefix from the first character of each key word, so the project gets prefix0Mand its tasks display as0M-XYMT./, and type something that matches such a task. The preview lists it fine.Same thing from the CLI:
Alphabetic prefixes (
AVN-RHGF) are unaffected, which is why this went unnoticed.Root cause
Accepting a search result re-runs the search against the result's display ref (
App::accept_search_result→accept_search_input(result.display_ref)), so the ref lane has to be able to parsePREFIX-SUFFIXback.parse_ref_queryonly treated a leading group as a project prefix when it was entirely alphabetic:But
prefix_basetakes the first character of each dash-separated key word, so digits are perfectly ordinary in a prefix (00-main→0M,01-loop→0L,03-lge→0L2). For those refs the branch was skipped and the query fell through to the suffix-only branch, where0M-XYMTcollapses into0MXYMT— which never prefix-matches the task idXYMTB8W8T3NRZDXY. No ref evidence, no results, empty view.refs.rs::split_ref(used byshow,edit, …) has always split on the first-without an alphabetic requirement, soaven show 0M-XYMTworks and only search disagreed.Fix
Treat any leading group of at most four characters as a prefix candidate.
unique_project_prefixmints at most a three-character base plus a collision counter, so four is the real ceiling, and the length bound keeps ordinary hyphenated prose (release-cleanup) out of the ref lane the way the alphabetic check used to.The prefix stays a hard filter against the project prefix in
score_ref_lane, so/WRONG-7KQ9still returns nothing.Test
task_search_parser_identifies_ref_shapes_for_numeric_project_prefixescovers0M-XYMT,/0L2-7OKI, and thatrelease-cleanupstill parses as suffix-only.task_search_resolves_display_refs_for_numeric_project_prefixesseeds a0M-prefixed project and walks the actual TUI round trip: preview a task, then re-search itsdisplay_refand assert the task comes back withmatched_field = Ref.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 every display ref in my own workspace (186 of them) through
aven searchand they all resolve now. The only refs that still don't are recurrence series refs (RCR-…), which are a separate matter — happy to send that as its own PR.