feat(query): add exact multi-title filter (PRO-1969) - #34
Conversation
Signed-off-by: SohamRatnaparkhi <soham.ratnaparkhi@gmail.com>
f4da38c to
7e3a9f0
Compare
Greptile SummaryAdds repeatable exact-title filtering to
Confidence Score: 5/5The PR appears safe to merge, with no outstanding blocking or non-blocking findings. The previously reported client-side limit and missing validation coverage are fixed in the current code. The stale release examples were manually resolved without explanation, and the current README now consistently matches version 0.2.1. No new actionable failures were introduced by the changes since the previous review.
|
| Filename | Overview |
|---|---|
| src/hydradb_cli/commands/_impl.py | Normalizes and validates repeatable title values before forwarding them to the query wrapper. |
| src/hydradb_cli/commands/canonical.py | Exposes the repeatable --title CLI option and passes its values into query execution. |
| src/hydradb_cli/hydra/client.py | Routes title-filtered queries through the authenticated raw API-v2 transport while preserving the SDK path for ordinary queries. |
| tests/test_cli_commands.py | Covers title forwarding, whitespace normalization, case-insensitive deduplication, and blank rejection. |
| tests/test_wrapper.py | Verifies the title-filtered request body, scope fields, endpoint, and API-version header. |
| README.md | Documents repeatable title filtering and updates release examples consistently to version 0.2.1. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[hydradb query] --> B[Trim, validate, and deduplicate titles]
B --> C{Titles present?}
C -- No --> D[Generated SDK query]
C -- Yes --> E[Authenticated API v2 POST /query]
E --> F[Backend resolves exact titles to source IDs]
D --> G[Normal query pipeline]
F --> G
Reviews (6): Last reviewed commit: "docs(readme): point the install examples..." | Re-trigger Greptile
Signed-off-by: SohamRatnaparkhi <soham.ratnaparkhi@gmail.com>
Two conflicts, both from #37 (feedback) landing on main first. 1. src/hydradb_cli/hydra/client.py — BOTH sides independently added a `_raw_post` helper: this branch for the titles field, #37 for /feedback. The implementations are identical below the signature, so the duplicate collapses to one. Kept main's: `json_body: Any` rather than `dict` (which still accepts this branch's call sites) and the docstring naming CONTRACT §2 rule 7. httpx sets Content-Type from `json=`, so dropping the explicit header changes nothing on the wire. 2. CHANGELOG.md — both sides appended under Unreleased. Kept both entries. Everything else merged cleanly, and both features are intact: `titles` on context.query and the _Feedback resource, each with their own tests. 354 tests + 33 conformance pass, ruff clean. Signed-off-by: gun29may <gunmayjhingran29@gmail.com>
Patch bump covering repeatable `--title` on hydradb query, and the `hydradb feedback` command (#37) which main took without a bump of its own. Nothing was removed or renamed, and no existing invocation changes. Both places, because this package keeps the version twice -- pyproject.toml for packaging and __init__.py for `hydradb --version` -- and nothing in the tests or the build asserts they agree. They would drift silently, and the one users see is the one that is easiest to forget. Verified equal after the change, and `hydradb --version` reports 0.2.1. Signed-off-by: gun29may <gunmayjhingran29@gmail.com>
32fcbef to
b7320a6
Compare
Greptile on #34: the package and `hydradb --version` declare 0.2.1 while the README still told people to install 0.2.0 — a pinned installer version, a release wheel URL, and the expected `--version` output. Someone following those instructions would install the previous release and then see output that disagrees with the page they were reading. The CHANGELOG's `## 0.2.0 — 2026-07-31` heading is deliberately left alone: that is the historical entry for that release, not a stale reference. Verified `hydradb --version` prints exactly what the README now claims. Signed-off-by: gun29may <gunmayjhingran29@gmail.com>
🔍 Security Scan Results
Findings🟢 Server-controlled strings rendered as Rich markup allow terminal output spoofing in query results and error messagesSeverity: Server-controlled strings are interpolated into Rich markup-parsed output without escaping, enabling terminal output spoofing. Confirmed injection sites: (1) _feedback_hint (commands/_impl.py:87) embeds the server-supplied request_id verbatim into a markup string that _format_query_result renders via Text.from_markup at line 122; (2) print_error (output.py:97) interpolates server error body text into a markup-parsed f-string on stderr; (3) commands/_impl.py:213 embeds server request_id into a markup string passed to console.print; (4) commands/_impl.py:108 embeds chunk source_title into a markup-parsed Panel title — the highest-impact variant, since a co-tenant who ingests a document titled e.g. "[red]SYSTEM: quota exceeded[/red]" can spoof other users' query output without controlling the server. This violates the codebase's own documented convention in make_table (output.py:151-155), which explicitly escapes cells because "a title like '[draft] Q3 plan' would otherwise be read as a style tag and vanish". Impact ceiling is verified: Rich markup cannot emit arbitrary ANSI escapes or execute commands — damage is limited to recoloring, concealing text, and injecting clickable OSC-8 phishing hyperlinks (e.g. a fake "ERROR: rotate your key" line linking to an attacker URL). Location: 🟢 API key echoed in full to stdout by
|
Linear
PRO-1969
What
Adds a repeatable
--titleoption tohydradb query. Each value is preserved as one exact document title and forwarded to the backend, which resolves matching source IDs before running the normal query pipeline.--titleto supply multiple titlesDependency
Depends on hydra-db/hydradb-application#1355. Deploy the backend and complete its MongoDB index/backfill rollout first.
Checks
.venv/bin/python -m pytest(335 passed)