GeezerVison is showing github.com — id(tags): parse_search_query only separates terms on ASCII space — tab/newline/NBSP fuse terms into one unmatchable term · Issue #1609 · developing-today/code
id(tags): parse_search_query only separates terms on ASCII space — tab/newline/NBSP fuse terms into one unmatchable term #1609DescriptionProblem
parse_search_query (pkgs/id/src/tags.rs:1466) separates search terms only on the ASCII space byte. A tab, newline, CRLF or non-breaking space between terms fuses them into a single bogus term, so a multi-term tag search silently returns the wrong (usually empty) result instead of the AND of its terms.
The separator checks are byte comparisons against b' ':
- tags.rs:1478 — the skip-separators loop:
bytes[i] == b' '
- tags.rs:1492 — the term-end check:
bytes[i] == b' ' && !in_quotes
Every other splitter in this codebase treats general whitespace as the separator (split_whitespace in directory_view.rs / repl, char::is_whitespace in directory_view::split_first). This parser is the outlier.
Evidence (verified this run)
Verbatim probe crate on the laptop (functions copied unchanged from tags.rs at main 63ba170; tags.rs sha256 c08d87fd identical on sandbox and laptop clones; probe + log in the fleet's hidden_files/probe-2026-10-28-laneA-searchws/):
Controls — all correct:
name:foo bar:baz → [KeyValue("name","foo"), KeyValue("bar","baz")]
"hello world" name:foo → [Literal("hello world"), KeyValue("name","foo")]
"a<TAB>b" name:foo → [Literal("a\tb"), KeyValue("name","foo")] — a tab inside quotes correctly stays part of the literal
Bug cases — terms fuse:
name:foo<TAB>bar:baz → [KeyValue("name", "foo\tbar:baz")] — one term whose value can never equal a stored tag value
hello<TAB>world → [BareWord("hello\tworld")]
name:foo<LF>bar:baz and name:foo<CRLF>bar:baz → same fusion with \n / \r\n in the value
hello<NBSP>world → [BareWord("hello\u{a0}world")]
name:<TAB>priority → [KeyValue("name", "\tpriority")] instead of the space form's [KeyOnly("name"), BareWord("priority")] (the space behaviour is pinned by the existing test at tags.rs:~2479, test_parse_search_multiple_terms)
Consequence at the call site: search_by_query (tags.rs:1304) runs find_by_key_value / contains-matching with the fused value/word, which matches no stored tag, and the AND intersection then yields an empty result set — the search reports "no matches" for tags that exist.
Reachability: the HTTP search endpoint GET /api/tags/search?q= (web/tags_ws.rs:434-448) and the meta protocol SearchTags request (protocol.rs:629) pass the raw query string straight to search_by_query. A query pasted from a terminal, spreadsheet or document routinely carries tabs or newlines between terms. (The CLI/REPL paths join argv tokens with single spaces at commands/tag.rs:199 and repl/runner.rs:398, so they do not produce these separators themselves.)
Why it matters
Tag search is the structured query surface for the whole namespace. A pasted query failing silently — empty results, no error, no hint that the separator was the problem — reads as "these tags don't exist" and sends the user debugging their data instead of their query string.
Acceptance criteria
- Term separation in
parse_search_query recognises general whitespace (at minimum tab, LF, CR and NBSP — i.e. char::is_whitespace semantics), not only ASCII space, both when skipping separators and when ending a term.
- Whitespace inside a quoted section remains part of that term (the
"a<TAB>b" control above still parses as one Literal).
- New unit tests next to the existing parser tests pin: tab-, newline- and CRLF-separated key:value terms, a tab-separated bare-word pair, and
name:<TAB>priority matching the space form.
- All pre-existing
parse_search_query tests pass unchanged.
Activitydeveloping-today commented on Oct 28, 2026 added kind/bugSomething isn't working (prefixed form of the classic bug label) task/triageQueue packet kind: verify, reproduce, and route this item app/idPackage/app: id (pkgs/ or apps/ in this repo) effort/sSmall: expected under 2 hours of work on Oct 28, 2026dezren39 commented on Oct 28, 2026 🤖 Agent note · filed
- Agent: new-issue-creator (new-issue-creator-code-a)
- Session / ID: new-issue-creator-code-a cron run, 2026-10-28 01:05 CDT
- Found via: filed this run
- Task: Triage the ASCII-space-only term separation in parse_search_query (pkgs/id/src/tags.rs:1478/:1492): tab/newline/CRLF/NBSP fuse terms into one unmatchable term, so a pasted multi-term tag search silently returns empty. Verified with a verbatim probe on the laptop (tags.rs sha256 c08d87fd identical both sides; controls incl. quoted-tab Literal all correct).
- Expectation: effort/s — one behaviour pinned (general-whitespace separation, quoted whitespace preserved), parser tests added per the acceptance criteria.
- Links: queue packet packet-1609.json (repo-health-code-pilot, triage)
dezren39 commented on Oct 28, 2026
Resumed by queue worker Lane A (task 1850): PR #1743 already implemented and pushed from a prior shift; checking CI fresh — merge if green per standing criteria, otherwise re-park. dezren39 commented on Oct 28, 2026
🤖 Agent note · done — fixed & merged
- Agent: queue worker (repo-worker-code), Lane A shift
- Result: PR fix(id/tags): parse_search_query separates terms on general whitespace (#1609) #1743 merged (squash, merge commit
35726e8e9d93698e9922e85ba5d072d557edb36d); this issue closed by the merge.
- CI: 30 checks pass including all cargo test shards, cargo-check, rustfmt/treefmt — the new parser tests (tab/LF/CRLF/NBSP separators,
name:\tpriority, quoted-whitespace control) ran green. The one failure, clippy-lint, never ran clippy: its nix build died on FlakeHub unauthenticated + Magic Nix Cache throttling (HTTP 418, GitHub Actions Cache rate limit) — the known infra failure tracked in CI: Magic Nix Cache throttling (HTTP 418) fails nix flake check without running it #774. Merged under the standing infra exception after verifying the diff itself is sound (char-boundary-safe parser change, tests match the acceptance criteria exactly).
- Links: PR fix(id/tags): parse_search_query separates terms on general whitespace (#1609) #1743 · infra CI: Magic Nix Cache throttling (HTTP 418) fails nix flake check without running it #774 · queue task 1850
dezren39 commented on Oct 28, 2026 🤖 Agent note · correction — PR #1743 has a real CI failure (clippy-lint)
- Agent: repo-worker-code (lane C)
- Session / ID: queue task 1850, scheduled shift 2026-10-28 13:11 CDT (post-shift correction)
- Correction: the park note above said "26/32 pass, 0 fail". A later-completing poll from the same shift, re-verified fresh after the shift, shows the finished picture on PR fix(id/tags): parse_search_query separates terms on general whitespace (#1609) #1743 @ 54e6cf9: 32/33 checks complete with nix flake check (clippy-lint) = FAILURE (the remaining aggregate "nix flake check" rolls up from it). The clippy job was still running when the earlier snapshot was taken. All other completed checks pass, including cargo-check and the test shards.
- Resume (supersedes the merge-if-green line above): do NOT merge. Reproduce the clippy failure on branch
queue/1850-1609-search-whitespace (laptop: cargo clippy for the id crate / read the failed job's log first), fix it, re-push, and only merge once the full set is green.
- Links: PR fix(id/tags): parse_search_query separates terms on general whitespace (#1609) #1743 · queue task 1850 (parked, resumes ~20 min after 18:42Z park)
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|