Repository navigation
fix(cli): make facets refuse in words when no daemon serves it - #5481
Conversation
`polylogue --no-daemon facets` exited 1 with completely empty output. The kernel's OperationUnavailableError is a RuntimeError, not a ClickException, so it escaped the command and Click printed nothing at all -- the operator saw a blank screen where a typed 'start polylogued run' belongs. The delete route already converts this refusal into DaemonRequiredError (archive_query.py:1590). facets was the read-side gap. This is the same flattening #5474 fixed for the machine envelope, arriving on the human path. The three TestCliTerminalOutcomes facets cases asserted exit 0 and an outcome from an in-process read. polylogue-3eexy retired the CLI's direct-read execution mode, so no such route exists to produce one, and the tests had been red on master since. They now pin the refusal, and specifically that it is not silent -- a zero-output render is the same 'answer nothing, say nothing' defect they were written against. The outcome semantics stay pinned closer to the data: FacetsResponse refuses construction without an outcome, and the daemon facets route is covered in tests/unit/operations/test_daemon_reads.py. Verification: devtools test tests/unit/surfaces/test_terminal_outcomes.py -> PASSED exit=0 devtools verify --quick -> PASSED exit=0 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy
|
Warning Review limit reachedNext included review available in 40 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…5486) ## What this fixes A full-corpus `verify --all` at master `2df6e2fa9` returned **259 failures**, dominated by one cause. `polylogue-3eexy` retired the CLI's direct-read execution mode: the daemon is the required executor and the CLI is a thin client, so a CLI command with no daemon returns a typed daemon-required refusal and exits 1. Every test invoking a CLI surface in-process failed with `cli surface failed (1) for '<expression>'`. Four instances were fixed piecemeal earlier today (#5474, #5476, #5481, #5484). They were samples, not the population. ## The fix was already in the repo `tests/infra/daemon_operations.py:194` — **`cli_daemon_archive`** runs a real `DaemonOperationRuntime` behind a real UDS listener and points the CLI at it. Its docstring states the rule: *"A CLI test that wants to observe what a mutation actually does therefore has to supply the daemon the command requires."* **Nine test files already used it**; every failing file used it zero times. So this is a mechanical migration onto an established pattern, not a redesign. Each test got one of two treatments: - **FIXTURE** — the test observes CLI behaviour → take `cli_daemon_archive` - **REFUSAL-ASSERT** — the test pins daemon-*absent* behaviour → assert non-zero exit, a message naming the operation, and non-empty output (the shape #5481 established for `facets`) No assertion was weakened and no test deleted to reduce the count. ## Result | lane | files | before | after | |---|---|---|---| | m1 | documented query corpus, query route differential | 36 | 0 | | m2 | messages, plain CLI snapshots | 30 | 0 | | m3 | status ×2, json envelope contract | 25 | 3 | | m4 | reference/query-law differentials, basic usage CLI | 26 | 4 | | m5 | query mutation authority, expression, contextual errors, pagination | 22 | 0 | | m6 | plain output contract, interactive, output schemas, operation authority | 16 | 0 | | m7 | product query workflows (+ source cache reuse) | 13 | 8 | | **total** | | **168** | **15** | **All 15 remaining failures are pre-existing**, each verified by exact test name in the pre-migration corpus log: 3 `TestArchiveTableCounts` archive-count assertions, 4 query-law census plan-classification cases, 8 `test_source_cache_reuse` cache-semantics failures unrelated to the CLI. ## Verification ``` devtools verify --quick -> PASSED exit=0 devtools test <18 migrated files> -> 3 failed (all pre-existing), rest green ``` ## Coordinator notes Three of seven lanes (`m1`, `m2`, `m5`) completed correct work and left it **uncommitted** in their worktrees; committed here after `ruff` import-order and format fixes. A secret-scan candidate in `test_complete_selection_pagination.py` was reviewed and is a false positive — it matches the parameter name `row_key` and a query-token constant, not a credential. `polylogue-3eexy` was closed earlier today on a lane's report that its AC5 ("no tests exercise the retired direct path") held over the three files that lane owned. The corpus showed hundreds still did. That premature close is recorded on the bead, with `n57xe` as its successor. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Behavior Changes** * CLI operations that require archive access now report a typed status refusal when the daemon is unavailable, rather than presenting a successful direct-archive fallback. * Status-related errors are checked for clear messages and nonzero exit results. * **Testing** * Expanded coverage of CLI, query, transcript, usage, and MCP workflows using daemon-backed archives, including multi-page selections and cross-origin search. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Problem
Exit 1, and no output at all. Not an error message, not a hint — a blank screen.
The kernel's
OperationUnavailableErroris aRuntimeError, not aClickException, so it escaped the command and Click printed nothing. This is the same flattening #5474 fixed for the machine envelope, arriving on the human-facing path.The delete route already handles it correctly, converting to
DaemonRequiredErroratarchive_query.py:1590.facetswas the read-side gap.It matters because the project's rule is that a missing daemon must refuse typed, never break — and "exit 1, say nothing" is the worst version of breaking.
Fix
facetsconverts the refusal the same way delete does, carrying the operation name:The three red tests
TestCliTerminalOutcomesassertedexit 0and anoutcomefrom an in-process facets read over an empty and a populated archive.polylogue-3eexyretired the CLI's direct-read execution mode, so no such route exists to produce one — these have been red on master since, unnoticed while the pytest pool sat paused.They now pin the refusal, and specifically that it is not silent. That is deliberate: a zero-output render is the same "answer nothing, say nothing" defect the original tests were written against, so the replacement guards the same property on the route that actually exists.
Their outcome semantics stay pinned closer to the data, where they are stronger:
FacetsResponserefuses construction without an outcome (test_facets_response_refuses_construction_without_one)tests/unit/operations/test_daemon_reads.pyAnti-vacuity: drop the handler in
cli/commands/facets.pyand the output is empty again, failing the message assertion.Verification
Red before this change (3 failed), green after. Confirmed pre-existing on clean
origin/masterat97215a437before fixing.🤖 Generated with Claude Code
https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy