feat: add support for additional search filters#353
Conversation
📝 WalkthroughWalkthroughModified request-building to enforce doc vs wiki filter scoping: detect non-empty Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Greptile SummaryThis PR adds explicit filter routing for The implementation is correct and well-tested. The shallow-clone and omitted-counterpart-filter concerns raised in prior review threads remain as-is (no change from the original review), but no new P0/P1 issues were found in this revision. Confidence Score: 5/5Safe to merge — all remaining findings are P2 or lower; the routing logic is correct and fully covered by tests. The only open concerns (shallow clone sharing nested map references, and whether omitting the counterpart filter leaks results from the other scope) were surfaced in prior review threads and left as acknowledged trade-offs. No new P0 or P1 issues were found. Tests exercise all four new branches; documentation is thorough. No files require special attention.
|
| Filename | Overview |
|---|---|
| shortcuts/doc/docs_search.go | Adds filter routing logic: folder_tokens → doc_filter only, space_ids → wiki_filter only, with conflict validation; introduces cloneFilterMap (shallow) and hasNonEmptyFilterArray helpers. |
| shortcuts/doc/docs_search_test.go | Adds four targeted tests for doc-only routing, wiki-only routing, opposite-key stripping, and mixed-scope conflict validation; all new paths are covered. |
| skills/lark-doc/references/lark-doc-search.md | Substantial documentation expansion: adds Boolean query syntax examples, comprehensive --filter field reference, scope-attribution table, usage guidance, and handoff rules for agents. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["buildDocsSearchRequest(query, filterStr, pageToken, pageSizeStr)"] --> B{filterStr empty?}
B -- Yes --> C["doc_filter = {}\nwiki_filter = {}\nreturn"]
B -- No --> D[Parse JSON filter]
D --> E[convertTimeRangeInFilter\nopen_time / create_time]
E --> F{Both folder_tokens\nAND space_ids set?}
F -- Yes --> G[return ErrValidation\n'cannot combine both']
F -- No --> H["docFilter = clone(filter) - space_ids\nwikiFilter = clone(filter) - folder_tokens"]
H --> I{hasFolderTokens?}
I -- Yes --> J["requestData['doc_filter'] = docFilter\n(wiki_filter omitted)"]
I -- No --> K{hasSpaceIDs?}
K -- Yes --> L["requestData['wiki_filter'] = wikiFilter\n(doc_filter omitted)"]
K -- No --> M["requestData['doc_filter'] = docFilter\nrequestData['wiki_filter'] = wikiFilter"]
J --> N[return requestData]
L --> N
M --> N
Reviews (2): Last reviewed commit: "feat: add support for additional search ..." | Re-trigger Greptile
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@ff72ba6b28bfeeb55f851968f886e1992d670e73🧩 Skill updatenpx skills add larksuite/cli#refactor/search-filter-support -y -g |
Change-Id: Ib5b06e2df513a835a79a295c45ef1637413afa4e
91b9b1b to
ff72ba6
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@skills/lark-doc/references/lark-doc-search.md`:
- Around line 119-147: Update the conflict wording for folder_tokens and
space_ids to state the runtime rule: the shortcut rejects only when both
folder_tokens and space_ids are provided as non-empty arrays (i.e., "both
non-empty"), not merely when both keys exist; change the short table note
(`两者不能同时传`) and the later sentence that currently reads `如果同时传 folder_tokens 和
space_ids,shortcut 直接报错,不支持...` to explicitly say the error occurs only if both
arrays are non-empty, and keep references to the terms folder_tokens and
space_ids so readers can locate the two places to edit.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 7c744ec1-785d-4bee-a5d7-7640d650849d
📒 Files selected for processing (3)
shortcuts/doc/docs_search.goshortcuts/doc/docs_search_test.goskills/lark-doc/references/lark-doc-search.md
🚧 Files skipped from review as they are similar to previous changes (1)
- shortcuts/doc/docs_search_test.go
Change-Id: Ib5b06e2df513a835a79a295c45ef1637413afa4e
Summary
Add support for additional
docs +search --filterfields and make filter routing explicit for doc-scoped and wiki-scoped searches. This change prevents invalid mixed-scope requests, improves request construction forfolder_tokensandspace_ids, and updates the skill documentation so agents can use the new search capabilities correctly.Changes
docs +searchrequest building sofolder_tokensis only sent todoc_filter,space_idsis only sent towiki_filter, and requests containing both are rejected with a validation errorlark-doc-searchskill documentation with additional--queryexamples, supported--filterfields, scope-specific filter behavior, and usage guidance for agent handoff scenariosTest Plan
lark docs +searchcommand works as expectedRelated Issues
Summary by CodeRabbit
New Features
Improvements
Tests
Documentation