fix(search): address review feedback on multi-folder path filter

- visualization.py: drop the CSV string-split branch. The Astrolabe PHP
  client sends path_prefixes as a JSON array, so only a list is accepted;
  any other shape is ignored rather than comma-split (which would corrupt
  folder names containing commas).
- viz_routes.py: split the path_prefixes query param on newline (a comma
  is a valid POSIX path char; a newline is not) and pass None instead of
  [""] when the param is absent.
- access_filter.py: widen build_base_filter_conditions' path_prefixes to
  Iterable[str] for consistency with normalize_path_prefixes.
- ADR-027: document the newline delimiter (frontend/viz route) and JSON
  array (PHP->MCP body), and the PHP-side cap on list width.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Chris Coutinho
2026-06-03 13:03:42 +02:00
co-authored by Claude Opus 4.8
parent de6c4b360d
commit cd243ed6c3
4 changed files with 24 additions and 26 deletions
+7 -4
View File
@@ -201,14 +201,17 @@ express:
drops blanks, and de-dupes). `build_base_filter_conditions` adds a single `MatchText` to the
`must` clause for one folder, and OR-s multiple folders via a nested `Filter(should=[...])` so a
file under **any** selected folder matches while still AND-ing against the ACL/doc_type/date
conditions. Every search surface parses the list: the MCP tool (`nc_semantic_search`), the
visualization API (JSON body), and the viz route (CSV query param).
conditions. Every search surface parses the list: the MCP tool (`nc_semantic_search`) takes a
real `list[str]`, the visualization API takes a JSON array body, and the viz route takes a
**newline-separated** query param. Newline (not comma) is the on-the-wire delimiter because it
can't appear in a POSIX path, so folder names are never split mid-value.
- **Frontend uses the native folder picker.** Instead of a free-text path input, the Astrolabe
app opens Nextcloud's server-side folder browser via `getFilePickerBuilder()` from
`@nextcloud/dialogs` (already a dependency — no `@nextcloud/vue` component-version coupling),
configured directory-only + multi-select. Picked folders are real, validated server paths
(no typos), rendered as removable chips, and sent as a comma-separated `path_prefixes` list. The
Astrolabe PHP `ApiController`/`McpServerClient` forward the list to the MCP server. The control
(no typos), rendered as removable chips, and sent as a newline-joined `path_prefixes` value. The
Astrolabe PHP `ApiController` splits on newline (capping the list to bound the OR-filter width)
and `McpServerClient` forwards a JSON array to the MCP server. The control
is enabled only when the **Files** doc type is in scope; an empty selection means "no filter".
- **Phase 3 — tags (and optionally category).** Add a `tags: list[str]` payload field in
`processor.py`, propagate Nextcloud system tags during scanning, trigger a re-index, then wire