DNM: feat(coderd/searchquery): parse search filter for chats - #27090
Conversation
|
/coder-agents-review |
|
Chat: Review posted | View chat Review historydeep-review v0.9.0 | Round 3 | Last posted: Round 3, 7 findings (1 P2, 2 P3, 4 Nit), APPROVE. Review Finding inventoryFindings
Round logRound 1Panel (14 reviewers). 1 P2, 1 P3, 3 Nit. Netero: no findings. Reviewed against d06ddf4..82f50b6. Round 2Panel (14 reviewers). CRF-1 through CRF-5 addressed. 1 P3, 1 Nit, 1 Note new. 1 dropped. Netero: no findings. Reviewed against 2a4e560..e740826. Round 3Panel (12 reviewers). CRF-6, CRF-7 addressed. No new findings. Netero: no findings. All findings resolved. Reviewed against 4904714..388bac7. About deep-reviewCRF = Coder Review Finding (P0-P4, Nit, Note)
|
d06ddf4 to
98a120b
Compare
3e6ec5b to
8504a14
Compare
98a120b to
71399d8
Compare
8504a14 to
fc7c727
Compare
71399d8 to
f17ee99
Compare
fc7c727 to
5384a41
Compare
f17ee99 to
30d3b97
Compare
5384a41 to
688db9b
Compare
30d3b97 to
2a4e560
Compare
688db9b to
e740826
Compare
|
/coder-agents-review |
There was a problem hiding this comment.
All five R1 findings addressed cleanly. The CRF-1 fix is well-crafted: replacing the manual empty check with parser.RequiredNotEmpty("search") leverages existing infrastructure (20+ uses across the codebase) rather than patching the symptom. The ExpectedErrorCount addition to the test harness is a good generalization that catches the error class, not just the instance.
Severity summary: 1 P3, 1 Nit new. Both are about the comment at line 611, which was rewritten to fix CRF-3 but introduced a new inaccuracy.
"The chart says the patient can take three medications; the pharmacist only stocks two." (Leorio, on a pre-existing doc issue that made us smile but is out of scope)
🤖 This review was automatically generated with Coder Agents.
| } | ||
| } | ||
|
|
||
| // search is mutually exclusive with the substring filters. |
There was a problem hiding this comment.
P3 [CRF-6] "substring filters" is inaccurate for this conflict set. title: and pr_title: use ILIKE (substring matching), but pr: uses cds.pr_number = @pr_number (exact integer match). The label groups three filters under a shared property that only two of them have.
Options:
- Delete the comment. The conflict checks and the "cannot be combined with" error message on the next 15 lines name each filter explicitly; the code is self-documenting.
- Name the filters:
// search is mutually exclusive with title, pr_title, and pr.(matches the doc comment at line 522).
(Gon P3, Razor Nit)
🤖
There was a problem hiding this comment.
Verified fixed in 388bac7. Comment deleted; the conflict checks and error message are self-documenting.
🤖
| Query string | ||
| Expected database.GetChatsParams | ||
| ExpectedErrorContains string | ||
| // ExpectedErrorCount, when non-zero, asserts the exact number of |
There was a problem hiding this comment.
Nit [CRF-7] Comment starts with the field name, which the next line already shows:
// When non-zero, asserts the exact number of validation errors.
ExpectedErrorCount int(Gon)
🤖
ab9672d to
7262cc4
Compare
f14b054 to
4904714
Compare
7262cc4 to
388bac7
Compare
|
/coder-agents-review All prior findings addressed and replied to inline. Requesting a convergence pass. 🤖 Requested via Coder Agents on behalf of @johnstcn. |
There was a problem hiding this comment.
All 7 posted findings (1 P2, 2 P3, 4 Nit) from R1 and R2 are resolved. No new findings from the R3 panel (12 reviewers) or Netero. The CRF-1 fix using RequiredNotEmpty was verified by tracing both the duplicate and empty paths through parseQueryParamSet/parseSingle, and the ExpectedErrorCount harness addition catches the error class going forward.
Clean, well-scoped parser addition. 26 lines of production code, 89 lines of tests, 77.4% test density. Ready to merge.
"I tried to build a case against this and couldn't." (Pariston, rounds 2 and 3)
🤖 This review was automatically generated with Coder Agents.
388bac7 to
ed6453d
Compare
Adds
search:parsing tosearchquery.Chats, populatingGetChatsParams.Search. The filter is single-valued, rejects empty values, and is mutually exclusive withtitle:,pr_title:, andpr:(the substring filters it replaces); the validation error names the conflicting filter(s) regardless of term order. Quoted values reuse the existing tokenizer. Parser only; SQL and handler wiring land separately.Stack: #26968 <- #26995 <- #27009 <- this.
Refs https://linear.app/codercom/issue/CODAGT-723
Implementation plan
CODAGT-723: Add
search:parsing to searchquery.ChatsIssue: https://linear.app/codercom/issue/CODAGT-723
Depends on:
GetChatsParams.Searchgenerated in CODAGT-724 (PR #27009).Branch:
cian/codagt-723-add-search-parsing-to-searchquerychats, stacked on the 724 branch (stack: #26968 <- #26995 <- #27009 <- this).Deliverable: one draft PR. Parser only; no SQL, no handler, no frontend.
Requirements
Extend
Chats(query string)incoderd/searchquery/search.go(~:522):search:<value>intoparams.Search. Quoted values (search:"foo bar") must work exactly as they do fortitle:(the existing tokenizer handles quoting; reuse it).search:terms return a validation error on fieldsearch(check how the existing parser reports repeated params; mirror it).search:combined with any oftitle:,pr_title:,pr:returns a validation error onsearchnaming the conflicting filter(s). Check after parsing all terms so the error is deterministic regardless of term order.search:orsearch:"") returns a validation error onsearch.archived,repo,diff_url,has_unread,pr_status,source.Out of scope, per ticket: the
websearch_to_tsqueryemptiness preflight (725's handler concern).Red: tests first
Table-driven cases in the existing parser test file, mirroring its style:
search:foo-> Search == "foo", no error.search:"foo bar"-> Search == "foo bar".repo:coder/coder archived:true search:"foo bar"-> Search set, Repo and Archived set, no error.search:-> no error.search:foo search:bar-> validation error onsearch.search:foo title:bar,search:foo pr_title:bar,search:foo pr:12-> validation error each; error message names the conflict.title:bar search:foo-> same error as 6.search:andsearch:""-> validation error onsearch.search:queries parse identically.Green: implementation
Chats.make gen(expect no diff; parser only),make fmt,make lint,make test RUN=<parser tests>.Refactor
Verification
make lintclean.Generated by Coder Agents on behalf of @johnstcn.