Ingest and Search - #5
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces the ingest and search commands to build and query a local search catalog using the anfra-node and canal-query sidecars, along with associated tests, client methods, and path helpers. The review feedback points out a potential issue where a failed search command returning a non-OK status could cause a JSON unmarshalling error in renderSearchResults, thereby masking the actual error details. It is recommended to check for a successful status before attempting to render search results.
| } | ||
| if err := render(env.Data, contentType); err != nil { | ||
| var err error | ||
| if commandName == "search" { |
There was a problem hiding this comment.
If the search command fails or returns a non-OK status (e.g., StatusInvalid with validation diagnostics), env.Data will contain error details rather than the expected search results structure. Attempting to parse this in renderSearchResults will fail with a JSON unmarshal error, masking the actual error details. Checking env.Status == app.StatusOK ensures that we only attempt to render search results on success, and otherwise fall back to renderTo to display the error/diagnostics as YAML.
| if commandName == "search" { | |
| if commandName == "search" && env.Status == app.StatusOK { |
3293d93 to
f27bbb2
Compare
6363c81 to
1bb3a9e
Compare
| if _, err := fmt.Fprintf(out, "%s | %s | %s\n", result.Source, result.Type, displayName); err != nil { | ||
| return err | ||
| } | ||
| } |
There was a problem hiding this comment.
Search is a specific module, its render function should not be placed at this level
There was a problem hiding this comment.
"rendering" is the CLI Command concern anh, so this function renderSearchResults should not be placed in the internal/search package either.
I think we should have an abstraction "Rendering table" then let the search commands utilize it. Later nhe :frog-hehe:
Prerequisites
https://github.com/holistics/holistics-core/pull/3045
Summary
Ingest Command
<repo>/.anfra/context_sources.yml. Sample:~/.anfra/repos/<repo-id>/catalog/catalog.duckdbpath.Search command
Demo
Screen.Recording.2026-07-23.at.17.09.34.mov