GeezerVison is showing github.com — id(tags): tag search quote handling degenerates silently — "" matches every tag, name:"" widens to all values, an unterminated quote keeps its stray quote and matches nothing · Issue #2011 · developing-today/code
id(tags): tag search quote handling degenerates silently — "" matches every tag, name:"" widens to all values, an unterminated quote keeps its stray quote and matches nothing #2011Labels app/idPackage/app: id (pkgs/ or apps/ in this repo)effort/sSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobtask/triageQueue packet kind: verify, reproduce, and route this item DescriptionProblem
In pkgs/id tag search, the query parser's quote handling degenerates silently on empty and unterminated quoted components — three distinct wrong-result shapes, none of which reports anything to the user:
- An empty quoted literal matches everything.
id tag search '""' parses to Literal("") (parse_single_term, src/tags.rs:1540-1542 via strip_quotes, :1563-1569). search_by_query (src/tags.rs:1321-1337) matches a Literal/BareWord term with field.to_lowercase().contains(&text_lower) on subject/key/value, and "anything".contains("") is true — so the empty literal returns every tag, the same output as no query at all. ANDed with real terms it is a silent no-op instead of a constraint.
- A quoted empty component is silently dropped from
key:value. name:"" parses to KeyOnly("name") and "":high to ValueOnly("high"): parse_single_term (src/tags.rs:1523-1535) branches on key.is_empty() / value.is_empty() after strip_quotes, so it cannot tell "no value was written" (name:) from "the value written was explicitly empty" (name:""). Empty-string tag values are real (a tag set with an empty value is distinct from a bare tag), so name:"" should not widen to every value of name.
- An unterminated quote is kept as a literal quote character.
"abc def parses to BareWord("\"abc def") — the term extractor (src/tags.rs:1497-1513) consumes to end-of-input while in_quotes, and strip_quotes only strips a pair, so the stray " stays in the search text and the search silently matches nothing. key:"unclosed similarly becomes KeyValue("key", "\"unclosed") — a value with a leading quote that no tag has.
Evidence (verified this run, 2026-10-28, main 38f1f00f)
Probe compiled and run on the laptop (~/git/fleet/probe-2026-10-28-laneA-searchquotes/ there; SearchTerm, parse_search_query, parse_single_term, split_on_unquoted_colon and strip_quotes copied verbatim from src/tags.rs:1434-1569, sha256 of the source file e2483c0b…):
"\"\"" => [Literal("")] control should be: no match / error, not all tags
"\"hello world\"" => [Literal("hello world")] control ✓
"\"abc def" => [BareWord("\"abc def")] BUG: stray quote kept, silently matches nothing
"name:\"\"" => [KeyOnly("name")] BUG: explicit empty value dropped → widened to all values
"\"\":high" => [ValueOnly("high")] BUG: explicit empty key dropped
"key:\"unclosed" => [KeyValue("key", "\"unclosed")] BUG: value carries the stray quote
"\"a\" \"\"" => [Literal("a"), Literal("")] the empty term is a silent no-op in the AND
"name:foo" => [KeyValue("name", "foo")] control ✓
Existing parser tests (src/tags.rs:2425-2580) pin the empty query, bare colon, key: and quoted forms with content, but no test pins "", name:"", or an unterminated quote.
Why it matters
Tag search is the discovery surface for the whole store (CLI id tag search, REPL find/search paths share this parser's terms via search_by_query). A typo'd closing quote — the common case when typing a quoted phrase by hand in the REPL — turns the search into a silent empty result, and an empty quoted phrase turns it into a silent full dump. Both are the silent-reinterpretation class this codebase keeps fixing one parser at a time (#1609 whitespace separators in this same function, #1999, #2009); the quote paths are the un-pinned remainder in this function.
Acceptance criteria
-
parse_search_query("\"\"") does not produce a term that matches every tag: either the empty literal is refused/reported at the command layer, or it matches only empty fields — the chosen contract is pinned by a test.
-
name:"" and "":high keep their explicitly-empty component (distinct from name: / :high), or are refused the same way; a test pins whichever contract is chosen.
- An unterminated quote (
"abc def, key:"unclosed) never leaves a stray " in a search term: the term is parsed as if the quote closed at end of input, or the query is refused with a message naming the unterminated quote; a test pins it.
- New parser tests in
src/tags.rs cover at least "", name:"", "abc def, key:"unclosed; all existing parser tests (src/tags.rs:2425+) still pass, and the documented forms ("key:":":value", quoted phrases with spaces) are unchanged.
Filed by new-issue-creator-code-a. Related: #1609 (same function, whitespace separators), #2009 / #1999 (same silent-reinterpretation class in the REPL parsers). Activitydeveloping-today commented on Oct 29, 2026 dezren39 commented on Oct 29, 2026 🤖 Agent note · filed
- Agent: new-issue-creator (new-issue-creator-code-a)
- Session / ID: cron new-issue-creator-code-a, run 2026-10-28 19:35 CDT
- Found via: filed this run
- Task: Tag-search quote handling degenerates silently —
"" matches every tag, name:"" widens to all values, an unterminated quote keeps its stray quote; verified with a verbatim-copy probe of the parser on the laptop against main 38f1f00.
- Expectation: effort/s; done when the acceptance criteria in the issue body are met (quote-degenerate forms pinned by tests, no silent widening or stray-quote terms).
- Links: queue packet enqueued to repo-health-code-pilot this run
dezren39 commented on Nov 2, 2026 agent-note:v1 — picked up — OpenChamber scheduled lane
dezren39 commented on Nov 2, 2026 agent-note:v1 — parked — OpenChamber scheduled lane
dezren39 commented on Nov 2, 2026 🤖 Agent note · picked up — assignment recheck
dezren39 commented on Nov 2, 2026 🤖 Agent note · parked — active Drew assignment
dezren39 commented on Nov 2, 2026 🤖 Agent note · picked up (breaking park loop)
dezren39 commented on Nov 2, 2026 🤖 Agent note · done — fixed and merged
- Agent: repo-worker-code (Lane B cron shift)
- Task: queue task 5068 (repo-health-code-pilot)
- PR: fix(id): refuse degenerate tag-search quote forms #4134 merged (squash c8883fe); CI all checks SUCCESS; Codex review completed with no findings.
- Change: parse_search_query now returns Result<_, SearchQueryError> — "", name:"", "":high, and unterminated quotes are refused instead of silently broadening/emptying results; web search maps refused queries to 400; unquoted name: / :value meanings unchanged. Regression tests pin all forms from this issue.
MetadataMetadataapp/idPackage/app: id (pkgs/ or apps/ in this repo)effort/sSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobtask/triageQueue packet kind: verify, reproduce, and route this item DevelopmentNo branches or pull requestsIssue actions
|