Repository navigation
polis-cli: conversation list reads the current conversations API - #3059
Merged
Merged
Conversation
`polis conversation list` sent `mine`, `offset` and `search` to GET /api/v3/conversations and required an owner-paginated object in return; the API ignores those parameters and answers with an array, so every signed-in run ended with capability_unavailable (exit 8). The command now sends only what the API reads (limit, is_active, is_draft), keeps the rows whose server-set is_owner is true, applies --search as a literal case-insensitive topic match to the rows read, and reports pagination as limit / server_rows / returned / truncated. --offset is removed (the API has none); --limit accepts 1-9999 as the API does. An answer that is not an array of rows with a boolean is_owner is refused as invalid_response. `polis conversations list` (plural) is accepted as an alias of the canonical group. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018NVGBuYCk4EZmiz4csUv9s
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Observable changes
polis conversation listworks against the current API. Before: every signed-in run ended withcapability_unavailable(exit 8, "The server does not support owner-only paginated listing"). After: it lists the signed-in account's own conversations, newest created first.polis conversations list(plural) is accepted as a visible alias of theconversationgroup; command paths,schemaandhelpoutput are unchanged.--json,data):{"scope":"owner","conversations":[...rows as the API returns them...],"pagination":{"limit":N,"server_rows":N,"returned":N,"truncated":bool}}.server_rowsis the number of rows the API returned;returnedis the number kept after the owner filter;truncatedistruewhen the API returned--limitrows (raise--limitto read more). The earlieroffset/next_offset/has_morefields never shipped from any server.--offsetis removed (the API has no offset; it is now a usage error, exit 2).--limitaccepts 1–9999 (was 1–500), the API's own bound.--mine,--recent,--active,--draft,--searchare unchanged in name;--searchis applied by the CLI to the rows read (literal, case-insensitive topic substring), since the API has no search parameter.is_owneris refused asinvalid_response(exit 1), never shown as a list. Sign-in errors keep their mapping (auth_required3,auth_invalid3).No server change. No schema change. No route on the participation path is touched.
Cause
polis-cli/crates/polis/src/main.rssentGET /api/v3/conversations?mine=true&limit=…&offset=…[&search=…]and then required{scope:"owner", conversations:[…], pagination:{…}}, otherwise failing withcapability_unavailable. The server route (server/app.ts,GET /api/v3/conversations, handled bygetConversationsinserver/src/routes/conversations.ts) reads onlylimit,is_active,is_draft,conversation_id,context,xidandinclude_all_conversations_i_am_in, ignores the rest, and answersres.status(200).json(data)with a plain array of the conversations the account owns or shares a site with, each row carrying the server-setis_owner. The CLI's expected object shape exists on no deployed server, so the command could never succeed.Fix
CLI only. The command sends the parameters the API reads, keeps rows whose
is_owneristrue, applies--searchlocally, and reports what it read honestly (server_rowsvsreturned,truncated). Help text and README describe the API's actual contract (array, no offset/cursor/owner filter/search).Tests
scripts/test-polis-cli.sh(the CI entry point:cargo fmt --check,cargo clippy -D warnings,cargo test --workspace): pass, 226 tests (tests/cli.rs 39, including the request-shape and response-parsing tests forconversation list: query string sent, bearer header, owner filter, truncation, filters, literal search, unrecognized shapes,--offsetrefused, plural alias).admin@polis.testand a second account placed on the same site; conversations created through the CLI; 18/18 checks pass: owner-only rows equal a SQL oracle ofconversations.owner, the other account's site-shared row (present in the raw API array) is dropped, plural alias,--limit,--draft,--search(literal%/_),--active falseafterconversation close,--offsetrefused, no-credential and invalid-token errors.account view,conversation view/stats/share,statement list/view,vote list,moderate list,participant status/list/xid list/export/xid export/locations/highlight list,metadata question/answer list,context list,math view,topic list/hierarchy/proximity/stats,report list/create/view/stats/topics/statements list/export,delphi status/results/narrative view/visualization view,collective list,plan view,api) exceptparticipant group-members, which reportsmembership_unavailablebecause the stack runs no math service (the route answers 304 with no math; documented behaviour, unrelated to this change).🤖 Generated with Claude Code
https://claude.ai/code/session_018NVGBuYCk4EZmiz4csUv9s