Repository navigation
Promote edge to stable: eMudhra distrust, every eligible comment routable, simultaneous joins, the vote path, unknown ids answer 404, seed CSV fixes (migrations 000043, 000044) - #3268
Merged
Conversation
…switch (#3229) Rust read route only, off by default (POLIS_API_DELPHI_LOGS_READS=1 plus the delphiLogs arm of RUST_API_ROUTES); no Node handler, schema or write change. GET /api/v3/delphi/logs?job_id=… served by polis-api with the run-record route's moderator rule (never an identity inferred from an unverified token), byte-faithful to Node against the Postgres-mode recording baseline, including stored log text carrying lone UTF-16 surrogate escapes, which Node accepts. A 502 hands the request to Node. Reviewed independently: publish as-is with the correction (folded in). Claude-Session: https://claude.ai/code/session_018NVGBuYCk4EZmiz4csUv9s Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…ind its own switch (#3230) Rust read route only, off by default (its own switch plus a RUST_API_ROUTES arm); stacked on the job-log route PR (merge that first; retargeted to edge after). GET /api/v3/delphi/visualizations with the job filter, order, archived and live-work behaviours byte-faithful to Node against the Postgres-mode baseline. When the liveness query fails, the route hands the request back to Node instead of answering with live-work true (the reviewer's required edit, with its test), so a Rust statement timeout can never report a run as live where Node says otherwise. Claude-Session: https://claude.ai/code/session_018NVGBuYCk4EZmiz4csUv9s Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…own switch (#3231) Rust read route only, off by default (its own switch plus a RUST_API_ROUTES arm); stacked on the visualizations route PR (merge order: logs, visualizations, topics; retargeted to edge as each merges). The public topics-by-layer read with moderation state, byte-faithful to Node against the Postgres-mode baseline; it passes stored topic names through unchanged. No write, schema or Node change. Reviewed independently: publish as-is after the rebase. Claude-Session: https://claude.ai/code/session_018NVGBuYCk4EZmiz4csUv9s Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…behind its own switch (#3232) Rust-only read of GET /api/v3/delphi/reports, off by default (its own switch plus a RUST_API_ROUTES arm); byte-faithful to Node against the Postgres-mode baseline (stored timestamps are copied strings on both sides); a query string the legacy parser would decode differently is handed to Node, and an unmatched section filter falls back to the section Node names; a 502 hands the request to Node. Claude-Session: https://claude.ai/code/session_018NVGBuYCk4EZmiz4csUv9s Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…tive statement (#3233) CLI only (34 files); no server change. The participant command family is renamed: statement list, view and next become comment list, view and next; report statements list becomes report comments list; polis comment (submitting) and the collective statements commands are unchanged. Help text, README, tests and the differential census follow, including every user-visible error and help string that still said statement for a participant's comment. Reviewed independently: publish with edits (applied). Claude-Session: https://claude.ai/code/session_018NVGBuYCk4EZmiz4csUv9s Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…greement or divisiveness (#3234) CLI only (seven files), stacked on the naming change (merge that first; retargeted to edge after). polis comment stats --conversation ID [--sort agree|disagree|pass|divisive|consensus|important|votes] [--by-group] [--json]: per comment the vote count, agree, disagree and pass percentages over votes cast, the important count when the site serves it, a divisiveness measure stated in the help (1 minus the absolute difference between agree and disagree over their sum), per-group columns on request, and the text. Counts print as integers; a conversation without opinion groups yet is said so, with a test. Source: the math read's per-group tallies and the comment list; input validated before any credential is read. It answers: which comments divided the room the most? Reviewed independently: publish with edits (applied). Claude-Session: https://claude.ai/code/session_018NVGBuYCk4EZmiz4csUv9s Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…for each (#3235) CLI only (seven files), stacked on comment stats (merge order: naming, stats, questions). polis questions prints, with no sign-in, the ten patterns an organizer looks for in a conversation (what everyone agreed on; what divided the room; the groups and what defines each; what each group alone believes; what is important to people; what is new; what lacks votes; how it moved over time; the collective statements per topic; one participant against the room) with the exact command for each, plus a root help section and a JSON guide. All examples use the renamed commands. Reviewed independently: publish as-is. Claude-Session: https://claude.ai/code/session_018NVGBuYCk4EZmiz4csUv9s Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…te, site add/list/use/remove (#3236) CLI only. pol.is stays the default with no configuration and every existing command is unchanged without one. A named site (a local stack, a self-hosted or regional instance) is added once with polis site add NAME URL, selected per command with --site NAME or made the saved default with polis site use NAME; polis site use default returns to pol.is. Sign-ins are kept per site, the config write is atomic and locked, and the active site is named in output whenever it is not pol.is. Claude-Session: https://claude.ai/code/session_018NVGBuYCk4EZmiz4csUv9s Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
) CLI only. Every command has --json; the 77 tabular reads gain --csv (RFC 4180 quoting and line endings, a header row, byte-stable for the same response). No output gains an identity field a route does not return; participant-visible reads carry no xid; owner and moderator outputs keep xid where the route gives it. The README shows an organizer joining their own member list to the votes export on xid. Claude-Session: https://claude.ai/code/session_018NVGBuYCk4EZmiz4csUv9s Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
* nginx: switch a Rust route on or off without an outage Observable changes: none for any request by default. Every Rust route stays off unless RUST_API_ROUTES names it, as before. What changes when an operator flips RUST_API_ROUTES: - nginx regenerates its Rust map and reloads in place; the nginx-proxy container is never recreated. Before this, a flip recreated nginx-proxy and polis-api together (about 11 s), and every route through nginx, votes and comments included, failed for that long. - polis-api starts or stops without touching nginx; nginx tolerates the upstream being absent while every route is off (no failed startup, no 502 on Node-served routes). - A container start always obeys its RUST_API_ROUTES environment: unset or off overrides any previously persisted selection. - Rendering holds a kernel flock that dies with its process, so a hard stop can never leave a stale lock that blocks nginx startup. Proof on a local stack: four 50 ms probe streams on participationInit, nextComment, POST votes and POST comments plus pca2 and testConnection, with real votes and comments arriving, across pca2 on and off: 3152/3152 requests succeeded; nginx, Node and dependency container ids unchanged; only polis-api had lifecycle events. Hard-stop-with-stale-lock and env-off-after-persisted-on restarts both come back serving Node. Local checks: nginx-routing.sh 62/62; file-server/nginx/test-rust-reload.sh 10/10 (2238 stub probes, 0 failures). Files: docker-compose.yml, file-server/nginx.Dockerfile, the nginx entrypoint and two render scripts, test-rust-reload.sh, file-server/nginx/README.md, scripts/rust-api-switch.sh. No Node change. No schema change. How a production deploy would carry the reload path is documented separately as a proposal and is not part of this change. Review round 1 by the second reviewer; corrections applied and re-proven. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * differential: the CLI check builds the production nginx image and switches routes by reload The differential harness mounted the split entrypoint into a stock nginx image without the route helper it now calls, so the proxy exited before nginx started, in the Node phase too. The harness now builds the image from file-server/nginx.Dockerfile, gives the proxy its own routing volume, and enters each phase through the reload helper instead of recreating the container; the access log is truncated after old workers drain so each phase's counts stay independent. No product code, expectation or bound changed. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
#3239) * votes: a typed contract for POST /api/v3/votes with 140 recorded cases The contract in polis-contracts names the request, every response Node produces on this pin and the vote convention it speaks through; the characterization harness records and replays 140 cases of the real route against unchanged Node with zero differences. Three opt-in probes stay red on purpose: they document the deferred bookkeeping writes failing after a durable vote, which a separate change fixes. No served behaviour changes. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * votes: drop two unused bindings in the recorder Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…h that no longer stores vote_count (#3241) The vote-path recorder derives a participant's count from the votes table when settling and in its recorded participants query; the routing replay's substitute pg gains a notification passthrough and extracts updateVoteCount only when the server still declares it. Harness only; goldens unchanged. Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
… derived at read (#3240) Node's deferred bookkeeping after every vote (a participant recount, the conversation's modified time, the notification state) ran on the two participation write pools and, behind a held row lock, starved votes, comments and nextComment until they timed out. The vote and comment paths no longer write vote_count or modified; readers derive both from committed history. Notification state moves to its own bounded pool and fails soft. A participation-under-load integration test holds the realistic lock (NO KEY UPDATE on the conversation and participant rows) and asserts every request answers within 5 s. No schema change. Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…ion makes no request (#3242) The updater resolves the newest release at the configured release location, verifies the asset's SHA-256, replaces the binary atomically and keeps a backup; every failure has its own exit code and leaves the installation untouched, and a sync failure after replacement reports an unknown outcome. --version prints the version and commit, plain or JSON, offline. Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…, as deployed (#3119) The web security group no longer opens SSH (22), HTTP (80) or HTTPS (443) to the internet in code. Production has run this way since 2026-10-11: the web instances take port 80 from the load balancer's security group only, and nothing else reaches them from outside the VPC. Until now the code still added the three 0.0.0.0/0 rules, so the next deploy from this branch would have reopened them. Also brought over from the deployed stack, unchanged: - SSH stays off unless asked for, and turning it on now requires naming a range (CDK_SSH_ALLOWED_IP_RANGE); there is no 0.0.0.0/0 default. - cdk/originAccess.ts: two controls that let only the CDN reach the load balancer, both off by default. `-c restrictAlbIngress=true` replaces the load balancer's 80/443-from-anywhere rules with a prefix list or a list of CIDRs (config/cloudflare-ips-v4.json holds the CDN's published IPv4 ranges); `-c requireOriginHeader=true` makes both listeners answer 403 unless the request carries the CDN's origin header, read from Secrets Manager by name. dns.ts takes the listener settings from it. - test/originAccess.test.ts covers the web group, SSH, and both controls on and off. With every flag off, the load balancer's rules and listeners are exactly as before. The whole-stack snapshot changes only by the three web rules. The other deployed edits were already here and are untouched: the Delphi small box on r7i.2xlarge, the operational alarms, the ops dashboards policy, the large memory class (now the worker class table), the backup function packaging and the build box. Not changed here, and not yet in the deployed stack: the inactive coordinator service (always synthesized) and the reworded description of the CI worker's security group (synthesized with enableCiEc2; a description change replaces the group). Checked with `cdk synth -c enableCiEc2=true --no-lookups` of this branch and of the deployed tree: apart from those two and the CDK metadata resource that lists the constructs used, the templates are identical, including the backup function's asset hash. cdk tests: 10 suites, 182 passed; tsc clean. Claude-Session: https://claude.ai/code/session_018NVGBuYCk4EZmiz4csUv9s Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
… contract; concurrent index builds get a restricted header (#3244) The replays, the coordinator tools, several test fixtures and db-reset sent each migration file to PostgreSQL as one query, an implicit transaction that refuses anything which must run outside one. A shared Node helper and a shared Python helper now hand header-marked files to polis-migrate, which gains a restricted concurrent-indexes header: one autocommit per plain btree index under the deploy's advisory lock, verified valid before history is written, everything else refused with a test. No migration is added. Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…, built concurrently (#3243) Adds votes(zid, created), comments(zid, created) and comments(zid, modified) under the concurrent-indexes header so the activity time derived at read is an index probe instead of a scan of the conversation's votes. Selected for the next deploy; declared additive; listed in the deploy report and the upgrade notes. Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…3245) The first visit to an embedded page creates its conversation after looking up which account owns the page's site id. When no account does, the route reported a server failure; it now answers 404 with the code the handler already used for that case. Nothing is created in either case and every other path keeps its status. Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…me, staged off (#3247) * polis-api: typed read routes for GET /api/v3/votes and /api/v3/votes/me, staged off Two contracts and two routes with their own bounded read pool; they serve the demonstrated empty and single-row results byte-exactly against Node's recordings and hand everything else back to Node. Off by default behind the nginx switch; nothing is served until switched on. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * differential: the routing census carries the two vote read routes; contracts crate formatted The CLI differential's route inventory now lists the votes and votes/me selector with scenarios and exact serving counts, and the contracts crate's lib.rs is rustfmt-clean. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
… from stable in every build (#3246) * version: one Polis version, embedded with the commit and the distance from stable in every build The root VERSION file holds the Polis version; the server, the three browser clients and the CLI embed it with the full build commit and, off a tagged stable build, the distance from the last stable, rendering 2.x.y+dev.N.<commit>. polis --version, a server version route and the admin's About page report the same string; a source run without the generated build file falls back to the VERSION file. No tag, release or workflow change; the updater keeps its contract. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * version: the bootstrap number is 2.41.0 under the effective-selection rule Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…tag and the promoted range (#3248) polis-version applies the one rule (a promotion that ships a migration is a minor bump, otherwise a patch; the major never moves; hotfixes follow the same rule; a redeploy gets no new number), prints the plan as text or JSON, dry-run by default, and extends the seeded history of promotions since 2.0.0 to the given stable commit. Nothing calls it yet. Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
The updater resolves the newest release tagged vMAJOR.MINOR.PATCH, the Polis release on the stable merge commit, and takes the CLI's eight assets from it; asset names, checksum verification, atomic replacement and every failure case are unchanged. A cli-v tag is ignored with a clear message, and a development build never replaces itself unasked. Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
GET /api/v3/participation reported a server failure for a well-formed conversation id that matches no conversation; it now answers 404 with the code the resolver already used for that case, through an optional error responder on the shared parameter helper that only this route calls. Malformed ids keep their 400 codes and auth failures their 401; the success path is byte-identical. Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…image, with tests (#3253) * tls: distrust the eMudhra intermediates in every runtime, bundle and image, with tests Eight eMudhra intermediate CA keys were recoverable; browsers block them but file-based trust stores do not until updated. Node images move to 22.23.4 / 24.22.1 (compiled-in SPKI blocklist), certifi to 2026.10.19, webpki-roots to 1.0.10 and rustls-webpki to 0.103.16, base image CA packages updated, and ci/tls asserts offline that each trust store rejects the sixteen affected certificate objects, direct and cross-signed. No served behaviour changes. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * tls: the review's corrections: hash-checked Lambda payload, all sixteen objects with native verifiers, final runtime images and the probe base's local distrust The backup Lambda's certifi wheel is hash-checked and its real package is tested. ci/tls now checks all sixteen affected certificate objects by fingerprint and SPKI, including the code-signing intermediates, and proves the result with each runtime's native verifier (Node's compiled blocklist, Python's ssl/certifi/botocore paths, Java PKIX). The image gate covers the fifteen final runtime images. The probe base's Amazon Linux 2023 ca-certificates package has no fix yet, so it distrusts the affected roots locally by exact fingerprint through the p11-kit blocklist, to be removed once the vendor package ships. The legacy commentgraph image, which is not built or deployed, stays selectable but outside the required gate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
… the form (#3258) The bulk seed upload's rejection handler was never attached to the request, so a failed POST /api/v3/comments-bulk left the form on "Saving..." with nothing shown. It now dispatches the existing error action: the form leaves its loading state and shows the server's message, and a retry works. A component test covers success and failure. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…st 999 (#3261) Ordinary routing ordered a participant's eligible, unvoted comments by creation and kept the first 999 before the weighted draw, a default limit from 2013 meant for the comments list. In a conversation with more than 999 such comments, later ones could never be offered until the participant had voted on older ones. Node and the Rust route now draw the same weighted lottery over the ids of every eligible comment and then read only the chosen row, so a vote does not pull every candidate's text. The public comments list keeps its existing default. Node and Rust stay byte-identical for the same database state and draw. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…d cases (#3256) * comments: a typed contract for POST /api/v3/comments with 153 recorded cases The contract in polis-contracts names the request, every response Node produces for POST /api/v3/comments on this pin, the durable-before-response boundaries and the vote convention the author's explicit vote speaks through. The characterization harness records and replays 153 serial cases and four concurrent ones against unchanged Node with zero differences: anonymous, standard, OIDC first use, XID, Treevite and owner/moderator identities; first and repeat membership; absent, null, empty, long and duplicate text; closed and strictly moderated conversations; the comment number held to commit under concurrency; and the moderation email to the owner and site moderators, captured by a local SES endpoint with an explicit expected-attempt policy. A separate declared observation profile waits out the language-detection budget for the timeout cases only. A golden guard keeps product and recordings from changing together, and a plan for qualifying a second writer is written down. No served behaviour changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * comments: recorder artifact paths are safe for upload; an unused argument is marked A recorded case whose id contains a quote wrote a directory name the artifact upload refuses; case directories are now percent-escaped reversibly. The upload action is pinned by commit like the other workflows, and the control's unused argument is named for the linter. No recording changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…3257) * polis-api: typed read routes for /iip and /iim, each behind its own switch Recorded byte for byte against unchanged Node and replayed; the public conversation id is resolved by one indexed lookup per request. Off by default: nothing is served until its switch is named. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * polis-api: a typed read route for GET /api/v3/participants, behind its own switch Recorded byte for byte against unchanged Node and replayed; the public conversation id is resolved by one indexed lookup per request. Off by default: nothing is served until its switch is named. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * polis-api: a typed read route for GET /api/v3/ptptois, behind its own switch Recorded byte for byte against unchanged Node and replayed; the public conversation id is resolved by one indexed lookup per request. Off by default: nothing is served until its switch is named. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * polis-api: a typed read route for GET /api/v3/treevite/myInvites/csv, behind its own switch Recorded byte for byte against unchanged Node and replayed; the public conversation id is resolved by one indexed lookup per request. Off by default: nothing is served until its switch is named. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * polis-api: typed read routes for GET /api/v3/bid and /api/v3/locations, each behind its own switch Recorded byte for byte against unchanged Node and replayed; the public conversation id is resolved by one indexed lookup per request. Off by default: nothing is served until its switch is named. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * polis-api: typed routes for the conversation pages (root, explore, share, summary, ot), each behind its own switch Recorded byte for byte against unchanged Node and replayed; the public conversation id is resolved by one indexed lookup per request. Off by default: nothing is served until its switch is named. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * differential: scenarios and serving assertions for the twelve new read routes Each new selector is inventoried with its serving counts with the switch off and on: the five API routes through the real CLI, the seven HTML routes through GET, HEAD and query hand-back scenarios comparing complete bodies, status and type. Test-only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…essage (#3262) * comments: a seed CSV without its header row is refused with a clear message A seed CSV's first row must be the header comment_text, optionally with original_id. A file without it answered 200 after treating its first comment as column names and skipping the rest, and some wrong headers stored comments anyway. The upload is now checked before any participant or comment is created and refused with 400 polis_err_csv_header, "CSV header must be comment_text, optionally with original_id.", which the admin upload form shows. Well-formed one- and two-column uploads are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * comments: a seed CSV saved with a byte-order mark is read normally Excel's 'CSV UTF-8' export starts with a byte-order mark, which made the first header read as '\ufeffcomment_text' and the upload be refused. The parser now drops the mark, so those files upload as before. Four cases cover both header shapes and quoting with a leading mark. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…cipants joining at once each get a number on the first try (migration 000044) (#3266) The pid_auto trigger numbers a conversation's participants MAX(pid) + 1 under a per-conversation advisory lock, but took it as a session lock that pid_auto_unlock released when the INSERT ended, before COMMIT. A second join could read the same MAX(pid) and fail with 23505 on (zid, pid); one retry hid most of these, and two collisions in a row reached the caller as HTTP 500, for example a Treevite invite accept that left the invitation unused. Migration 000044 takes pg_advisory_xact_lock on the same key and drops pid_auto_unlock and its trigger, the participant twin of 000042. Numbering, participant_count and the down migration are as before. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…able, simultaneous joins, the vote path, unknown ids answer 404, seed CSV fixes (migrations 000043, 000044)
Contributor
Delphi Coverage Report
|
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.
Promotes edge to stable (merge commit; the tree equals edge at 1c6e874). 30 commits.
Database: two migrations apply during the deploy.
Security
Participants
Admins
No user-visible change
polis updateand--version(cli: a participant's submission is a comment; a statement is a collective statement #3233–cli: raw data out of every read, as JSON and as CSV where tabular #3237, cli: polis update replaces the binary from a verified release; --version makes no request #3242, cli: polis update follows the Polis release tag #3249).🤖 Generated with Claude Code