Skip to content

Promote edge to stable: Polis 2.47.1 - #3484

Merged
colinmegill merged 7 commits into
stablefrom
edge
Nov 25, 2026
Merged

colinmegill merged 7 commits into
stablefrom
edge

Conversation

@github-actions

@github-actions github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Release plan

Version: 2.47.1

Reason: no new selected migrations

Previous stable: 40392945febfda4a78c1208c9a487910b5d205b3

Candidate: 26442a01b1ff7af751bbd8bdf1a0a9c601a4efda

release.txt additions:

  • none

Merge the reviewed version preparation into edge, then refresh this plan for the resulting edge SHA before merging the promotion with a merge commit.

colinmegill and others added 7 commits November 23, 2026 19:51
…otes it handed back to Node, behind two new switches that are off (#3469)

* polis-api: the vote writer's identity cases that write nothing, behind a switch that is off

A new switch, POLIS_API_POST_VOTES_IDENTITY_NO_WRITE (unset, empty or 0 is
off; 1 is on; read only by the main role and accepted only beside
POLIS_API_POST_VOTES=1). Off, admission, its hand-backs and every reply are
exactly what they were.

On, the live vote writer also serves, with no row written and no token
minted:
- an external-id token's member, for the external id it is bound to: the
  signed account is checked first, as Node's hybrid auth does, then the
  owner's allow-list on every vote;
- a member token beside the four external-id keys, which are dropped (Node's
  vote route parses only xid, and ignores it beside such a token);
- a member of a conversation that requires or lists external ids (Node
  refuses neither for a caller with a member token);
- a Treevite member whose participant row is the token's.

And it answers, with Node's failJson bytes, the refusals Node's participant
middleware makes before it writes anything for a request with no token: a
required external id (403), an external id not on the allow-list (403), a
Treevite non-member (401), and an external id bound to an owner, moderator
or administrator account (403), decided by admission's read-only snapshot in
Node's order. A first contact, a failed account check, a token whose row is
not the token's, and an external id Node's parser would refuse are still
handed back to Node.

polis-auth gains RequestIdentity::member, participant::resolve_member (the
membership read without the Treevite exclusion) and admission::xid_allowed.

Tests: a database test per case through the whole route, with Node's bytes
for each refusal and row counts showing nothing is written; one with the
switch off showing every new case is handed back; and one showing identity
reads take only the admission reads pool, never the vote append's or the
notification pool.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* polis-api: the vote writer's first contact (a first vote with no token and no external id), behind a switch that is off

POLIS_API_POST_VOTES_FIRST_CONTACT=1, accepted only beside
POLIS_API_POST_VOTES=1 and POLIS_API_POST_VOTES_IDENTITY_NO_WRITE=1, read
only by the main role, and requiring the participant signing key at
startup. Off (the default), every request is handled exactly as before.

On:
- A first contact into a closed conversation, or with a malformed field,
  is refused first, with nothing written: the fields are parsed, then the
  open check, before any write. A closed conversation that also has an
  external-id or Treevite rule is handed back, since Node answers that rule.
- Otherwise the user, the participant's extended row and the participant
  (under the participant-number lock) are written by admission on a pool of
  their own (two connections, 100 ms to get one, 100 ms for a lock, one
  second a statement), after dispatch has begun and before the vote. The
  vote is then written as a member's is, and an anonymous participant token
  is signed after the commit and sent as the last key of the 200 reply.
- No connection, a lock or statement timeout, an unavailable database or a
  commit whose outcome is unknown hands the request back before the vote is
  dispatched. A lost commit acknowledgement is logged and counted on
  /health, so a second person Node then creates is never silent.

The 200 reply contract gains an optional auth key, absent unless a
participant was created. Admission gains admit_within, the same writes
under a caller's own transaction bounds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* polis-api: tests of the vote writer's first contact under concurrency and load

Two database tests through the whole route, with the first-contact switch on
and migration 000044's participant-number lock applied to the fixture:

- Sixteen first votes at once in one conversation: every voter is either
  served (200, its own token, exactly one user, extended row, participant and
  vote, participant numbers 2.. with none twice and none skipped) or handed
  back before dispatch with nothing written; no other answer is accepted.
  The served and handed-back counts are printed.
- Members' votes, the comment list and the next comment at once, idle and
  then while the first contact cannot create anybody (its two connections
  held; then the participant-number lock held elsewhere): every member vote
  and read is 200, none of their pools times out an acquire, and every first
  vote is handed back before dispatch within a vote's reply deadline, with
  nothing written.

No change to the writer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* polis-api: the vote writer's first contact answers with its token on every reply, and serves tokens for another conversation, behind the switch that is off

With POLIS_API_POST_VOTES_FIRST_CONTACT=1 (still off everywhere):

- A person the request created always receives the token. It is signed
  right after the creating commit, so the vote's 406 and 500 carry it as the
  last key of Node's failJson body (as Node's token injector places it), and
  so does the 202 receipt of unknown acceptance and its degraded 200. The
  202 body now has a contract (UnknownAcceptance); without a token its bytes
  are unchanged.
- An anonymous participant token for another conversation is a new person,
  as a first vote with no token is: a user, a participant and an anonymous
  token for this conversation.
- A signed-in account's participant token for another conversation keeps
  its user: a participant in this conversation and a standard-user token
  with the presented token's subject. An account that is already a
  participant here is handed back.
- "Another conversation" is decided by resolved conversation, as Node does:
  a token for another code of the same conversation is handed back. A code
  that resolves to nothing is another conversation. With an external id in
  the body, either token stays Node's.

polis-auth: the request identity carries the token's conversation code and,
for a standard-user token, its subject.

Switch off, every reply and hand-back is what it was.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* polis-api: the vote writer hands back a tokenless Treevite refusal Node makes after creating a user, and reads a token's membership before any refusal of it, behind the switches that are off

A request with no token into an open Treevite conversation, naming no
external id or one bound to nobody, is now handed back to Node before
dispatch: Node creates a user before it makes that refusal. Only an
external id already bound to an ordinary user, where Node creates nobody,
is still answered with Node's 401. This holds with the first-contact
switch on as well as off.

An external-id token's participant row is now read before its account
check and the owner's allow-list, and an administrator's external-id token
is no longer refused before admission: a token whose row is gone, or is not
the token's, is handed back whatever those checks would say. For a member,
the account is still checked before the allow-list.

With the identity switch off nothing changes. Tests: the Treevite refusal
with no external id, an unbound one and a bound one, with the first-contact
switch off and on; a missing row with an external id not on the allow-list,
with a privileged account, and an administrator's token with and without
its row. The existing refusal test now expects the tokenless Treevite
request to be handed back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* polis-api: the vote writer's identity reads run on a pool of their own, and an external id is bound only where logging cannot write it, behind the switches that are off

With the identity switch on, every admission that is not an ordinary
member token's (an external id's token, no token, a first contact, an
account's token for another conversation) now reads on its own pool,
polis-api-vote-identity-reads/1: two connections, 50 ms to get one,
100 ms a statement, inside the one 250 ms admission deadline. When it is
full the request is handed back before dispatch. An ordinary member
token's admission reads on the members' pool as before, so identity work,
finished or cut by the deadline, never takes or keeps a member's slot.
With the switch off the pool is not built and nothing changes.

Before an external id is bound as a parameter (the allow-list read for an
external id's token, and the tokenless decision's snapshot), the
connection's logging settings are read on that connection, for each
request, and checked with the vote observer's rule. Unsafe or unreadable
settings hand the request back before dispatch, so the id is not sent.
The first-contact path binds no external id.

Tests: an ordinary member votes while both identity slots are held (no
wait and no acquire timeout on the members' pool, 200, latency printed
beside an idle control; an identity request meanwhile is shed); an
external id is served with the server's defaults and handed back once
every statement is logged, set after the pool was built, with the server
log showing a made-up control id and not the external id. Two existing
tests now assert the identity reads leave the members' pool untouched.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* polis-api: a first contact records its referrer and origin as Node does, behind the switch that is off

With POLIS_API_POST_VOTES_FIRST_CONTACT=1, after the commit that creates a
person, the vote writer writes to that participant's participants_extended
row what Node's participant middleware writes when it creates one
(addParticipantAndMetadata in server/src/participant.ts): the Referer header
(or Referrer when that is absent or empty) up to its first ? or #, and the
Origin header, each only when present and non-empty, with modified from the
server's clock. One UPDATE, so a value longer than its column fails it and
nothing is written, as in Node. With neither header nothing is written.

The work is best effort and never waited for: it runs on the notification
lane the writer already has (two connections, an admission bound of 64),
never on the vote append, admission, identity or first-contact pools. Not
admitted, or failed, it is counted (firstContactExtendedInfoDropped in
/health, only with the switch on) and logged with the count only; the
values never reach a line.

Node's encrypted address, written only when APPLICATION_NAME is
PolisWebServer, is not written: the repository does not say whether a
production deployment sets that name, and a database built from the
migrations has no such columns.

Tests through route::handle: the columns after a first vote for referrers
with and without a query string or fragment, the Referrer spelling, an
empty Referer, an origin present, empty and absent, and values over the
columns' length; a member's vote writes no extended row; with the lane full
the vote answers 200 with its token and the drop is counted; with the
switch off nothing is written.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* polis-api: a created person's vote is always dispatched, and first contact starts only when its signing key matches the verifier

Both behind POLIS_API_POST_VOTES_FIRST_CONTACT, which is off; with it off,
behaviour and bytes are unchanged.

A request cancelled after its person was created (the listener's request
deadline, a closed connection) used to drop the vote: creation and signing
were awaited in the request's own future, so cancelling it after the
creating commit left a user and a participant with no vote and no alarm.
A first contact's creation, token and vote now run in one task the request
does not own. The request waits for the token and then for the vote's
outcome as before (the dispatch budget still starts after the token);
cancelled at any point, the task carries on and the vote is dispatched. A
created person whose vote was not written, with nobody left waiting for that
outcome, is logged (post_votes_first_contact_vote_not_written) and counted
(health: firstContactVoteNotWritten, present only with the switch on).

At startup with the switch on, the writer now mints a token with the
participant signing key and verifies it with the verifier it will use, and
refuses to start when they disagree, naming the settings and no key.

Tests: a first vote cancelled while its person is created gets its vote
written exactly once; the same with a vote that cannot be written raises the
count; cancelled with the first-contact pool full, nothing is written. In a
child process, matching keys start, a mismatched public key file refuses,
and with the switch off nothing is checked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* polis-api: the first-contact load tests write comments, measure latency against an idle control, and reach hand-backs

The concurrent first-vote test now sends 32 first votes at once with each
participant insert slowed by 30 ms (a trigger on the test's own table, inside
the creating transaction), so the first contact's two connections and their
100 ms wait hand some voters back. It asserts both outcomes occur, every
hand-back is marked before dispatch and within the reply deadline, every
served voter has exactly one user, participant and vote, numbers are given
once and contiguously, and nothing exists for a voter handed back.

The loaded test runs itself in a child process so the live comment writer is
built by its own startup from the environment. Each phase (idle, first-contact
pool exhausted, creations parked on the participant-number lock) runs ten
rounds of members' votes, members' comments, the next comment, the comment
list and the votes read. Members' votes and comments must be answered in every
round and stored; no participation pool, including the members' admission
reads and the comment writer's three pools, may time out an acquire. Each kind
of request in a loaded phase is held to the idle control: misses of its own
deadline no more than the control's plus 5% of samples, and a 95th percentile
within twice the control's plus 25 ms. The numbers are printed.

The fixture also applies migration 000042, so concurrent comments are
numbered as production numbers them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* polis-api: a first contact's referrer and origin are sent only where the server cannot log them, and its token names the code Node selects

Behind POLIS_API_POST_VOTES_FIRST_CONTACT, still off by default.

The referrer and origin a first contact stores on its extended row were
bound as parameters with no look at the sending connection's logging
settings; with statement and parameter logging on, PostgreSQL wrote both
into its log. The write now reads the settings on the connection that would
send them, just before, for each write, with the rule an external id already
uses. Unsafe or unreadable settings: nothing is sent, the write is counted as
dropped (firstContactExtendedInfoDropped) and logged with its reason and a
count, never the values. The vote and its reply are untouched.

The token a first contact receives named the conversation code the request
used. Node signs with the code getZinvite selects: the first row of
"select * from zinvites where zid = ($1);". The same query is now read on the
first-contact connection before anything is written, and the token names that
code, so a first vote through a second code gets the token Node issues.

Tests: the values are not sent where every statement is logged (the row keeps
neither, the drop is counted, the server log holds neither); a logging setting
changed after the lane's pool was built is seen by the next write; a first vote
through a second code gets the code Node selects, and that token serves a later
vote under that code and is handed back under the second.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* polis-api: a first contact's task that fails after its creating commit is never handed back

A first vote with no token, behind POLIS_API_POST_VOTES_FIRST_CONTACT (off),
creates its person, signs the token and writes the vote in a task the request
does not own. The request mapped any closed channel from that task to a
hand-back, including one closed by a panic after the creating commit: nginx
then gave the vote to Node, which would create a second person, and nothing
counted the person left without a vote.

The task now holds a value, armed at the creating commit and disarmed once
the vote's outcome is dealt with, whose Drop runs when the task ends any
other way (a panic, an unwind, the task dropped). It tells a request still
waiting for the person that the person was committed, and, unless the
vote's receipt was published, counts the vote as not written
(firstContactVoteNotWritten) and logs post_votes_first_contact_vote_not_written
with "ended":"early".

- Failed after the commit, before the request is told of the person: 500
  with Node's failJson body for a failed vote (polis_err_vote), without the
  pre-dispatch marker. nginx intercepts only 502 and 504 for this route, so
  the client gets the 500 and Node is never called. No token had been issued.
- Failed after the request is told of the person: unchanged, the request
  answers the 202 of unknown acceptance (or the degraded 200 when a receipt
  exists) with the token; the alarm is now raised there too.
- Failed before the commit: unchanged, a hand-back with nothing written.
- A creating commit whose acknowledgement is lost is unchanged: handed
  back, logged and counted.

Test: a first contact's task panics, by a fault a test caller injects
through its dispatch observation, before creation (502 with the marker,
nothing written), after the commit (500 polis_err_vote, unmarked, one person
and no vote, the alarm raised once) and after the request is told of the
person (202 with the token, unmarked, the alarm raised once). With the
switch off nothing changes; no existing assertion changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* polis-api: the first-contact load test runs every phase's rounds at one period

The loaded participation test compared each loaded phase with an idle
control whose rounds were sent back to back. A round lasts as long as its
slowest request, and a handed-back first vote takes far longer than any
participation request, so the control's rounds were short and the loaded
phases' rounds long. The length of a round alone changes how fast every
request in it is answered, so the comparison measured the rounds' length as
well as the first votes' work.

Every phase, the idle control included, now starts round n at its start
plus n periods of 400 ms, longer than the slowest loaded round (a parked
round has taken up to about 275 ms in a release build). The schedule does
not drift: a round that ends after the next should have started is counted
as an overrun and printed, and the rounds after it keep their times. The
control and a loaded phase then differ only in the first votes' own work.

The rule is unchanged (a loaded p95 within twice the control's plus 25 ms;
misses within the control's plus 5 percent of samples), as are every status,
row, hand-back and pool assertion, the three phases, the request mix and the
sample counts. Each kind's line now also prints both phases' sample counts,
p50, and round overruns, and each phase prints its overruns and longest round.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* polis-api: a first contact's creating commit is recorded inside the blocking operation

With the first-contact switch on, the fact that the creating COMMIT was
acknowledged is now written inside the creating operation's blocking work,
the moment admission returns the person this request created, into state
the task made before anything was written. Every way the task can end after
that point reads it: an error or an unwind on the way back from the worker,
the pool failing after the operation succeeded (its idle-connection lock),
a panic later in the task, or the task dropped. None of them is a
pre-dispatch hand-back: the request gets Node's 500 for a failed vote (or,
once told of the person, the 202 or degraded 200 with the token), and a
person whose vote was not written is counted once. Only a failure with no
acknowledged COMMIT is handed back, as before; a COMMIT whose
acknowledgement is lost is still handed back, logged and counted.

A table test injects a fault at each state of the lifecycle, from before
creation to the reply, and checks the answer, the rows written and the
count. With the switch off nothing changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* polis-api: a first contact's worker and task share its outcome and alarm

Behind the first-contact switch, which stays off. A first vote's person is
created in blocking work that a dropped task does not stop. The creating
COMMIT's acknowledgement used to be a flag the worker set and the task's
Drop read, so a task dropped before the worker recorded it (dropped while
the worker was in flight, a runtime stopping while blocking work finished,
or between the acknowledgement and the record) left a committed person with
no vote, no alarm, and a closed channel that a still-waiting request read as
a hand-back.

The task and the worker now hold one shared lifecycle, which owns the
request's channel, the acknowledgement and the alarm. Whichever lets go of
it last decides on drop, after every write of the worker: an acknowledged
COMMIT that never settled answers a waiting request with Node's 500 for a
failed vote, never a hand-back, and, with no vote receipt, counts and logs
the vote as not written exactly once, by the worker itself when the task is
already gone. The log event is written at that moment, with the conversation
and nothing of the person, so a stopping process leaves a record. With no
acknowledged COMMIT, the request is handed back only once neither holder can
write any more. Before the commit nothing changes, and a COMMIT whose
acknowledgement is lost is still handed back, logged and counted.

The lifecycle table test gains the task dropped while the worker is in
flight, after the COMMIT is acknowledged and before it is recorded, and
after it is recorded, each with the worker paused and let go on after the
drop, and a real runtime shutdown with the worker finishing during the
shutdown's grace for blocking work; every row now also checks the alarm's
log event. With the old drop-time decision restored, the test fails at the
first of these.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* polis-api: the first-contact load test holds participation to its same-period control

Every phase of the loaded participation test now runs its rounds at one
fixed period, so the idle control and the loaded phases are comparable. The
old rule (a loaded 95th percentile within twice the control's plus 25 ms)
stays, with every other assertion. Beside it, two more: each kind's loaded
95th percentile is within the same-period control's plus 20 ms, and no
round overran its period in any phase. Each kind's line prints both rules'
bounds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* polis-api: the first-contact lifecycle test compares its alarm count with a named count

The vote sign lint counts any comparison with a literal 1 as a sign literal.
The two comparisons here are of an alarm count, not a vote; they now use a
named constant, so the lint reports no new literal and needs no allowlist entry.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* polis-api: the cancelled first-vote test cancels at a pause it controls and reads its own rows before the shared alarm count

The test of a first vote whose request is cancelled while its person is
created timed the cancellation with a 0.4 s trigger on users and a 100 ms
request timeout, and its second case waited on the process-wide count of
votes not written. Tests running beside it raise that count, so with four
test threads it passed its wait on another test's alarm while its own
person was still being created, and then found no person. The writer
created the person later; nothing was lost.

The request is now cancelled only once the creating operation's blocking
work is held at its pause before the transaction (and, for the full pool,
once the first-contact task exists), the pause is released after the
request is gone, and every case waits for its own task to end and its own
rows before anything else. The shared count is read only after this
request's person is in the table. The cases also assert that nothing is
committed while the request is still there, and that no alarm is raised
for a vote written or a person never created.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* polis-auth: admission runs a caller's callback inside its transaction, before COMMIT

admit_then is admit_within with the caller's own statements in the same
transaction. When the attempt creates the participant, the callback runs
after every admission statement (user, extended row, participant, the final
open check) and before COMMIT, with the transaction and the admitted ids.

- The callback's error rolls everything back and is returned as its own
  error, never retried: the uniqueness-race retry covers admission's own
  statements only, which all run before the callback.
- Every lock admission takes, the participant-number lock among them, is
  held through the callback until COMMIT, and the transaction's bounds apply
  to the callback's statements.
- The transaction id is read with txid_current() after the callback and
  before COMMIT (the writes have already assigned it), and a lost COMMIT
  acknowledgement returns it, for txid_status. The same read refuses to
  commit a transaction the callback left aborted.
- When no participant is created (an existing member, or nobody), the
  callback does not run and the attempt is rolled back.

admit and admit_within are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* polis-api: a first vote writes its person and its vote in one transaction

A first vote (no token and no external id, or a token for another
conversation, behind the first-contact switch, which stays off) now runs
admission through polis_auth::admission::admit_then: the user, the
participant's extended row and the participant, then the vote's own
statements (append_in_transaction, the value through the vote convention),
then one COMMIT on the first contact's own pool. The person and the vote
exist together or not at all.

- After the COMMIT: the referrer and origin on the notification lane, the
  token, then the follow-on (the star on the first contact's own
  connection, the notification state, the next comment), each best effort.
  A failure after the COMMIT answers a 200 with the vote's receipt and the
  token, never a hand-back and never an error. A first vote takes no
  connection of the vote append pool.
- Any failure before or at the COMMIT rolls both back and is handed back,
  counted; a lost COMMIT acknowledgement is still handed back and counted,
  and its transaction id is now carried to that hand-back and logged.
- Removed, as unreachable with one commit: the two-commit lifecycle and its
  drop, the count and log line of a person without their vote and its
  /health key, the 500 after the person's commit, and the 202 with a token
  for a created person (the 202 contract no longer carries a token).
- Tests: the state table of a first vote, every row both-or-neither with its
  answer, marker and count; the cancelled request; the pools (no append
  pool, even with all of it held and a star); a second first voter waits on
  the participant-number lock at most its 100 ms and is handed back with
  nothing written, while a member's vote is answered; /health keys; the
  equal creation time of the person and the vote.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* polis-api: a first vote whose commit reply is lost asks the database again

When the connection breaks at the moment a first vote's one transaction is
committed, the writer does not know whether the person and the vote were
saved. It now asks once more, on a connection of the identity read pool and
inside 250 ms for the whole look: SELECT txid_status(id), read again while
the transaction is still in progress, up to three reads.

- committed: the person and the vote exist. The reply is the degraded 200
  any failure after a commit gives, with the vote's receipt and a token
  minted from the ids the transaction returned before its COMMIT. Counted as
  firstContactCommitConfirmed and logged with the conversation and the
  transaction id.
- aborted: nothing was saved. Handed back to Node, marked, before dispatch,
  as before (reason first_contact_commit_aborted).
- anything else (still in progress, an id too old to answer for, a failed
  read, the pool full, the bound passing): handed back, counted as
  firstContactCommitUnresolved and logged every time with what the look
  found, since this is the case in which a person may be counted twice.

With no transaction id, nothing changes. The two counts appear in /health
only with the first-contact switch on, which stays off.

Tests through route::handle: a commit that landed with its reply lost (the
degraded 200 with a token that verifies, one person and one vote, the
confirmed count, a hand-back never given; the look takes one identity read
connection and none of the members' admission, append or first-contact
pools); a commit refused at COMMIT and a session ended during COMMIT (a
marked hand-back, no rows, no token); a status read that fails or stays in
progress (a marked hand-back, the unresolved count); a stalled look cut at
its bound while a member's vote is answered without waiting on it; and the
switch off, unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* polis-api: a first vote handed back can never commit afterwards

A first vote's request and its worker now decide the vote's fate through
one shared state, claimed once by compare-and-swap. The request hands the
vote back only after it claims it abandoned; the worker, inside the
transaction as the last thing before COMMIT, claims it committing and rolls
back if the request abandoned it first. A transaction timeout cannot stop
work that has not begun (a pool wait, a lock wait, a task not yet
scheduled); the claim does.

A request that finds the COMMIT claimed never hands the vote back as
nothing written: it waits for the outcome within its wait. Committed, it
answers the degraded 200 with the person's token. A lost acknowledgement
is now kept by the blocking work itself where the request can read it, so
when the task's answer never comes (the task ended during its second
look, or the operation's result was lost on its way back) the request asks
the database itself. If that cannot tell, or no outcome came at all, the
vote is the counted and logged hand-back of an unresolved COMMIT, as
before. That outcome is counted once, by the task or by the request.

The participant-number lock test now holds the lock and the conversation's
row lock for the whole measurement from a session that cannot time out,
checks both are still held after the member's vote, and commits the holder
afterwards.

With the first-contact switch off nothing changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* polis-api: after the worker claims a first vote's COMMIT, only its outcome answers

A first vote (switched off) is written, person and vote together, by a
blocking worker in a task the request does not own. Its fate and its
outcome now live in one cell under one lock:

- The worker's side (a single writer, moved from the task into the
  blocking work and, after a lost acknowledgement, into a second-look task
  of its own) writes the outcome once: rolled back, committed (confirmed
  by the second look or not), or unresolved. Dropped unwritten, it writes
  nothing-written when the worker never claimed its COMMIT and unresolved
  when it did.
- The request hands the vote back as nothing written only when it
  abandons it before the worker's claim. Once the worker has claimed it,
  the request waits for the worker's outcome with no deadline of its own
  and answers from it; an expired wait or an empty record never
  authorizes a hand-back after the claim.
- Every outcome is counted and logged exactly once: by the request that
  takes it, by the request's side as it ends with the outcome untaken, or
  by the worker's side when the request is gone.

The first contact's connections (that pool only) fail when silent for
3 seconds: tcp_user_timeout and keepalives, so a read after the claim
cannot wait for the operating system's own limits.

Observable change, with the switch on only: a first contact whose worker
never runs (an acquire timeout) or unwinds before its transaction is now
counted in firstContactHandedBack, where before it was not counted there.

Tests: a worker held after its claim past the request's wait is answered
by its commit, never handed back; a lost acknowledgement whose request and
task are both gone is counted once by the second look; a confirmation that
arrives after the request began waiting is the request's answer, counted
once; the first contact's connector bound.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* polis-api: a first vote's every ending, as one table test

One table-driven test, through the route and a real database, drives a
first vote (no token, no external id) to each way it can end: which side
claims its fate first (the request abandoning it, or the worker claiming
its COMMIT), and where the worker, the second look and the request are
held, cancelled or dropped. Seventeen rows. For each it asserts that the
person and the vote both exist or neither does (users, participants,
participants_extended, votes, votes_latest_unique); the answer the request
gets, if a request is left (status, the pre-dispatch marker, a token that
verifies for the person whose vote was stored); and exactly what the
vote's outcome was counted as across the first contact's four counters,
per vote, with the process-wide counters rising by at least as much.

And for every row in one place: a marked hand-back never comes with the
person and the vote committed, except in the accepted case (the COMMIT's
acknowledgement lost and the second look unable to tell), which is
counted unresolved exactly once.

The row in which the session ends during COMMIT runs on a writer of its
own: the ended session's connection can stay in the first contact's pool,
and the next first vote to take it fails before its transaction and is
handed back with nothing written.

Test only; no change to the writer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* polis-contracts: the vote contract's serde_json imports in a form both workspaces' formatters accept

queue-rs and polis-cli format this file with different style editions and
disagreed on the order inside one braced import. Two separate imports are
stable under both.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* polis-api: the first-contact load test counts a read's hand-back as a miss and samples every kind forty times

A read that Rust answers 502 (at its own deadline, or while a timed-out read
still holds its pool's connection) is handed to Node by nginx in production;
the test now counts it as a miss in whichever phase it occurs, the control
included, under the existing rule that compares the loaded phases with the
control. A member's vote or comment write that is not 200 still fails the test
outright. Every kind now has forty samples a phase, so no p95 rests on a single
request. Both latency rules and the zero-overruns assertion are unchanged.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* polis-contracts: one import that both style editions format the same way

This file is formatted twice: by the polis-cli workspace (2021 style) and, as
a module of polis-api, by queue-rs (2024 style). The two sort Value and
value::RawValue in opposite orders, on one line or two. Importing both from
serde_json::value has one order under both.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* polis-api: the first-contact load test keeps its original load a round and runs twenty rounds a phase

Forty samples of every kind now come from more rounds at the same period, not
from more requests in a round, which overloaded a two-CPU runner even with no
first votes arriving. A member's vote or comment write that is handed back is
counted, and may happen in a loaded phase no more often than in the control
phase: where the control is clean, one hand-back still fails the test. Any
other answer but 200 to a member's write fails outright. Both latency rules
and the zero-overruns assertion are unchanged.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…s the CLI (#3474)

* release: a Polis release is the tag and its notes; it no longer builds the CLI

Dispatching "Publish Polis release" now runs tool, plan, review and the
approved publish job only. It no longer calls the four-target CLI build, so a
release waits on no macOS runner, and the GitHub release it publishes carries
the reviewed notes and no attached files.

- polis_release.py: verify, commands and publish refuse --assets; the
  reviewed publication.json is now named with --publication. Publication
  creates the release with one `gh release create --verify-tag ... --latest`
  call (no draft, no uploads). A retry against an existing release is a no-op
  only when it has no attached files, and is refused otherwise. The current
  stable head check, the comparison with the reviewed record, the release
  environment and its sole reviewer, the first-attempt rule, the live notes
  recheck, the API budget reads and the annotated tag checks are unchanged.
- polis-cli-release-build.yml: dispatched by hand only (workflow_dispatch with
  the same commit and tag inputs); it keeps its stable-head check, gives no
  step a token, and publishes nothing.
- Tests: the publication tests no longer build asset fixtures. New tests show
  that a complete, valid CLI asset set is refused by every action that takes
  the reviewed record, before anything is read or requested; that an existing
  release with attached files is refused and never changed; and that the
  workflow runs no build, macOS or asset step.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* docs: releases carry no CLI binaries; what polis update does meanwhile

The release docs now describe a release as the annotated tag and its notes,
with no attached files. They state what an installed CLI does when the newest
release has no archive (polis update stops with update_failed and leaves the
executable unchanged; no other command checks for updates), how to dispatch
the CLI build by hand, and that publishing its archives again is to be
designed when CLI builds resume. The manual commands name the reviewed
publication.json with --publication.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…sed (#3476)

* clients: stop shipping the Font Awesome files the legacy client never draws with

The legacy participant client's build copied the six Font Awesome 4.7
font files (1,085,661 bytes: otf, eot, svg, ttf, woff, woff2) into
/fonts/. No stylesheet or script it builds declares an @font-face for
them, and it imports no Font Awesome CSS, so no page ever requested them.
This removes the copy step, the font-awesome package, and the unused
react-fontawesome package from the legacy client and from the report
(neither client imports it).

What a person would notice: nothing. Every other built file is
byte-identical; the build output shrinks from 1,611,779 to 526,118 bytes.
The `font-family: FontAwesome` names in the stylesheet and the map are
left as they are, so a reader with Font Awesome installed on their own
machine still sees what they saw. Files already uploaded under /fonts/
by earlier deploys are not removed by a deploy, and the /fonts/ route
stays.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* unsupported-browser page: no longer requests a font kit from use.typekit.net

Both copies of unsupportedBrowser.html (the legacy client's and the
server's) loaded the Typekit kit wzs2fuq from use.typekit.net and then
called Typekit.load() inside a try. That kit no longer exists: a GET of
https://use.typekit.net/wzs2fuq.js answers 404, so the script failed,
the call threw, and the catch swallowed it. Neither copy is in any build
output today (the legacy client's build does not copy it, and the server
asks the static host for it), so no browser currently receives the page.

What a person would notice: nothing. The page sets its text in the next
fonts of its own list, as it already did with the kit missing. One request
to another host is gone from the source.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* clients: drop typeface names that nothing provides from font lists

Each of these names was asked for and could never load from us: no
font file, @font-face or font service provides it. The browser skipped
each to the next font in its list. Removing the name leaves that next
font in front.

- Report: "VT323" ahead of monospace on the four large counts of the
  standard report and the topic-map narrative report.
- Report: Plotly's default "Open Sans", verdana, arial, sans-serif on the
  topic scatterplots and the layer distribution chart; their layouts now
  name verdana, arial, sans-serif themselves.
- Legacy client: "brandon-grotesque", "Brandon Grotesque" ahead of Futura
  on the signed-in menu button.
- Legacy client: "brandon-grotesque" on the unsupported-browser page (no
  build ships that page); proxima_nova in the form-switch module (not
  imported by any stylesheet); "Source Serif Pro" and "Montserrat" in
  vis2 globals that no live code reads (neither string is in the build).

What a person would notice: nothing, unless that exact typeface is
installed on their own machine; then they now see the next font in the
list (monospace, Verdana, Futura) where before they saw their local copy.
The legacy client's bundle changes only in the menu button's style
string; the report's only in these strings.

Left as they are, because the name is the only one in its declaration
and taking it out would change what everyone sees: chaparral-pro on the
conversation description, brandon-grotesque on the map's waiting text,
and the menu's dropdown list, whose style attribute is malformed and so
already ignored by browsers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* legacy client styles: remove font variables and comments nothing compiles

The legacy client's Bootstrap configuration defined the font-family
variables ($font-family-sans-serif with "brandon-grotesque", -serif,
-monospace, -base) and the Glyphicons icon-font variables, but no
Bootstrap partial that reads them is imported, and no stylesheet of ours
uses them. The client's own font variables carried commented-out lists
of Brandon Grotesque, Chaparral Pro and Canada Type Gibson.

What a person would notice: nothing. The compiled polis.css is
byte-identical before and after.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…-out comments reach a public reader as bare points (#3475)

* polis-api: the report topic map is read with the report id alone, for every run of the conversation

GET /api/v3/delphi/topicMap verifies no identity any more. Anyone who holds
the report id reads the current map and the map of any run of that
conversation named by job_id, under any comment rule, from the served
runs or the Delphi shadow's, as for the report's other Delphi reads. A job
of another conversation is still 404 "Job not found".

A query that names no source reads the served env first and, when it has
nothing stored for the query (no served run, a run whose own batch holds
no map, or no such job), the shadow env on the same connection; when the
shadow has nothing stored either, the served env's answer is given.
source=served and source=shadow read their side alone, as before.

Removed with the sign-in: the 401 and 403 refusals, the route's one-slot
identity pool and its POLIS_API_DELPHI_TOPIC_MAP_AUTH_DATABASE_URL, the
resolver form only this route used, and the private Cache-Control and
Vary the signed-in answers carried. The switch, the two-connection read
pool and its 50 ms wait, the four places, the stored-bytes checks, ETag
and gzip, and every other refusal are unchanged. No schema change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* polis-topic-map: the map document can say which points are moderated out

`points.moderatedOut` is the count of the last points that are comments
moderated out at the time of a read: a position and nothing else, `id`
null and `topic` -1 at every level, ordered by position. A stored
document never sets it (it holds every comment its run laid out) and is
written byte for byte as before; the map route sets it in the form it
sends a reader who may not see moderated-out comments. The contract's
closed type reads it, and its `points.id` allows the null.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* polis-api: a report topic map sends moderated-out comments as bare points to everyone but its moderators

Any job's map is still read with the report id alone. What the reader
receives now depends on who they are and on moderation at the time of
the read:

- A moderator of the conversation or a site administrator (a bearer
  token that verifies, then the moderation list's rule) receives the map
  as stored, `Cache-Control: private, no-store`, `Vary: Authorization,
  Accept-Encoding`. The one-slot identity pool, its setting and the
  resolver form this needs come back as they were.
- Everyone else receives each comment that is moderated out now
  (`comments.mod = -1`) as a bare point: its position, `id` null, no
  topic, after the other points and ordered by position, counted in
  `points.moderatedOut`. A topic with no visible member is not sent; the
  others' counts, weights and parents are counted again over what this
  reader sees. A map that holds no moderated-out comment is the stored
  bytes.

The moderated-out ids are one indexed statement on the route's own read
pool, on the connection that reads the map. While a conversation has
any, a reader's ETag is a digest of the stored digest, the form's name
and those ids, computed the same in the part statement, so a current
validator is still a 304 with no part crossing the connection, a
moderator's validator never answers 304 to a reader, and a moderation
change is a new ETag from the next read. The rewrite runs off the
runtime's threads while the request keeps its place. The switch, the
read pool and its 50 ms wait, the four places, the stored-bytes checks
and gzip are unchanged. No schema change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* polis-api: a report topic map's public form reveals nothing of what is held back

For a reader who is not a moderator:

- Held back now means moderated out (mod = -1), inactive (active = false)
  or muted (velocity <= 0), the states Node's participant list leaves out.
  A comment not yet moderated is not held back.
- A topic with a held-back member, at any level, is sent with the
  generator's neutral name (Topic <cluster>) and its label at the mean of
  its visible members, with its count and weight over them; a topic with
  none keeps its name and place. Every label's colours and each level's
  cmapPalette are chosen again by the generator's palette from what is
  sent, because the stored colours were chosen over every label.
- The ETag of a reader's form is keyed: HMAC-SHA256 of the conversation
  and the held-back ids under a key each process draws at start, so
  guessing ids confirms nothing. Another process (the other web box, the
  next deploy) costs a client one download, never a wrong 304.
- A login that may not read comments is a 500 that names nothing, not
  503: the failure is classified inside the connection's closure, where
  the database error is still typed.

Tests: the reader's form leaves only a held-back comment's position (a
topic it alone made and its place inside a mixed topic change no byte or
label), the validator against keyless guesses over small id sets and
another process's key, HMAC-SHA256 against RFC 4231, inactive and muted
comments held back and unmoderated ones shown, the missing grant, and a
bearer while the identity database is down (503, restored).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* polis-api: a load test of the topic map reader's form beside votes, comments and the next comment

While the report topic map is at its places with readers' requests, each
reading the held-back comments and rewriting a stored map of 30,000
comments (inflate, rewrite, colours, deflate), a vote and a comment are
written and the next comment, the comments and the votes are read, round
after round, under the saturation test's rules: no read waits for a slot
of its own pool, the vote writer never waits, misses at most the
control's plus two in forty, and each 95th percentile within twice the
control's plus 25 ms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* polis-api: the topic map validator's text says what a reader's tag does and does not hide

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* polis-api: the topic map reader's form load test runs at the proxy's rate, for one hot map and for more maps than a process keeps, and prints the process's CPU

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* polis-api: a reader's topic map form is made once per held-back set, one at a time within a time budget, and a held-back set past its bound gives no map

The rewritten form and its gzip are kept per stored digest and keyed
held-back set (64 forms, 32 MiB, least recently used out first); a
request for a form being made waits for it. At most one rewrite runs at a
time, off the runtime's threads, within 100 ms of rewriting per second;
a request that cannot start one within the route's deadline is shed as
before (503, Retry-After). The held-back read stops one past 25,000 ids,
and past it a reader gets 422 too_large.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* polis-api: a topic map rewrite is charged before it starts, and the load tests cover the burst, forms let go, costly maps and a flood from outside the quota

The rewrites' budget charged each rewrite after it finished, so the first
burst after a quiet period could start on credit it had not yet paid. Each
rewrite is now charged its estimate before it starts (the slowest rate per
stored byte the process has seen, with headroom; before any, the whole burst
for a part at the stored-row bound) and settled when it ends, a panic
included. A unit test asks for six distinct four-level maps at once and holds
the rewrite time to the burst plus the share of the elapsed time plus what
the rewrites took beyond their charges.

The reader's form load tests now sample from the flood's first moment as
well as once it is steady, assert the rewrite time against the budget, and
gain a case of 64 four-level maps of 16,000 comments with 7,500 held back
each, which samples until forms have been let go and made again. Run with
the split variables, the server serves the same test over TCP and a flood
from another process (the proxy's burst of 200, then 200 a second, paced
whatever the answers) drives it from outside the server's CPU quota.

/health's topic map entry is pinned with its five readers' form counters;
the deploy's validation reads named fields only and none of these.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* polis-api: a topic map rewrite is charged its whole estimate, and the eviction load test sets a small cache so a debug build lets forms go

The rewrites' budget charged at most its 200 ms bank before a rewrite
started, so a rewrite costlier than that went beyond its charge every time.
The estimate is now charged in full: a rewrite estimated above the bank
starts only from a full bank and leaves the budget owing the rest, which
the next rewrite waits to see repaid. From any moment, rewrite time over
the next t seconds is at most the larger of 200 ms and the costliest single
estimate, plus a tenth of t, plus what rewrites took beyond their estimates.
A unit test charges a rewrite estimated at more than twice the bank and
checks the charge, the wait it leaves and that nothing goes beyond it.

The layered load test made 27 forms in a debug build within its two
minutes and let none go, because the process keeps 64 forms and 32 MiB.
It now keeps at most four forms (a bound the test sets on its own route
state) over twelve conversations with four-level maps of 4,000 comments,
so forms are let go and made again within the budget in a debug build as
in a release one. The participation rules and the two-minute cap are
unchanged; the load tests assert rewrite time against the new bound.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* polis-api: the topic map route lists a report's runs that have a map (list=jobs), from the run records alone

GET /api/v3/delphi/topicMap?report_id=<id>&list=jobs answers which runs
of the report's conversation have a stored map, newest first, at most 50,
so a page can offer a choice and read one by its job_id. Each entry names
the run, its side (served or shadow), its comment rule, when it was
created, how many comments it laid out, how its topics were named and
whether it is the run a read without job_id answers. source and selection
narrow the list as they narrow a map read; list with job_id is 400, as is
a list value other than jobs.

The list is read from the run records only (the jobs by their
conversation index, each one's run record, each side's served pointer),
never from a map, so it is the same for every reader, reads no comment
and no identity, and moderating a comment never changes it. Topics per
level are in the map only, so the list's levels are null. It takes one of
the route's places and its pool like a map read, so a flood of lists is
shed with the route's 503 and the participation path shares nothing new.

The nginx routing check sends a list request through the route's
location and asserts it reaches polis-api with its query and never Node.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* polis-api: the topic map route's list of runs is two bounded statements, with no run record read per run

The list (list=jobs) read one run record (pd_run_record) for each of up to
200 finished runs. The route's login can read whether a run stored a map,
its point count and its topic names only through that per-run function, so
the list now reads the jobs' rows alone: the newest 50 finished full
pipeline runs of the conversation on the sides, by the (env, zid::text)
index, with the comment rule and the naming from each run's configuration;
then the sides' served pointers (at most two rows) with their runs' records
for `current`. A listed run may have stored no map (reading it says so);
`points` and `levels` are null; `names` is the configuration's
`naming.model` when present (`by: model`), else `by: keywords`.

Tests: the list fixtures and expectations follow; a new test lists 1, 50
and 2,000 runs, prints the whole request's time, and shows that a run
record taking 50 ms leaves a list of 2,000 runs answering at once; the
topic map saturation load test has one client in four ask for the list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* polis-api: the layered topic map test fixture points each level at its own topics, and three test-only helpers are built only with the database tests

The layered fixture used one global topics array but referred to topics by
their index within a level, so levels 1 to 3 pointed into level 0 and the
public form dropped them. Each level now adds its offset, and a test checks
that every level keeps its topics after redaction. The cache's sent,
keep_at_most and forms_evicted helpers are used only by the database tests,
so clippy without that feature no longer fails on them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* polis-api: the topic map route's list of runs says the keyword fallback for every run, never the naming a run's configuration asked for

A run's configuration says what naming was asked for; a run that asked for a
model can still have stored the keyword fallback (no key, over its cap, a
failed call). The outcome is the run manifest's models.topic, which the
route's login reads only through the run record, one call per run, so the
list does not read it. Every listed run now says {"by":"keywords",
"model":null}, the configuration's naming is no longer read, and the test's
run that asked for a model and stored keywords is listed as keywords with
the requested model nowhere in the answer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* polis-api: the split topic map load test sends every participation request from an independent client outside the server's quota, on an open-loop schedule, and fails if the flood falls behind

Over TCP the server process now only serves, inside its CPU quota, and
reports its counters on a control listener. The other process, outside the
quota, runs the vote, the comment and the three reads on its own thread,
runtime and connection on a fixed 50 ms schedule (a late round is timed from
its scheduled time), and the map flood on another runtime: the proxy's
burst of 200, then 200 a second open-loop, each request on an idle or new
connection without waiting for any answer. Flood and burst sample start
together. The clients hold every rule: each call's misses and 95th
percentile against the control phase, every vote and comment written, no
participation read or vote write waiting for a slot of its own pool, the
flood behind its schedule (late, unsent or failed) on at most one request in
a hundred, and the rewrites within their budget. The README states the
measured cost of a reader's form for the one-level and four-level maps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
… when the route is selected (#3482)

The deploy's Rust health check compares the handler switches polis-api
reports as on with the switches the selected routes need. It had no entry
for the report topic map route, so a box that selected delphiTopicMap with
POLIS_API_DELPHI_TOPIC_MAP_READS=1 would have failed the check and the
deploy. It now expects that switch exactly when delphiTopicMap is
selected, as it does for version, comments, testConnection and postVotes:
selected with the switch off, or the switch on without the route, still
fails.

No other switch is newly accepted. Nothing is selected by this change: for
every route list that does not name delphiTopicMap the check is unchanged,
and the empty-list rollback is unchanged. The tests run the check's own
JavaScript over every combination of pca2, version, comments and
delphiTopicMap with their switches, near-miss selector names, unrelated
switches beside it, and the existing health and version refusals.


Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…a clean, reusable page (#3478)

* report: /topicsVizReport/<report id> is the first-party topic map as a clean, reusable page

The page is the topic map alone: a Solid component around client-topic-map, served at /topicsVizReport/<report id>. It loads a run's stored map by report id, lets a reader choose between a report's runs when the route lists more than one, and draws held-back comments as grey points that say so. It requests nothing from another host and neither datamapplot listing.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* topic map page: a token-bearing read never shares the page-wide comment text, and a new token reloads the map

From an independent review: the module-wide comment text was keyed by report
alone, so a signed-in placement and an anonymous one in the same document
shared one answer, and the map read the token untracked, so a changed token
did not reload it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* topic map page: the licences of everything the page ships travel with it

The build writes NOTICE.txt beside the page's script and font: Solid's
licence (solid-js, @solidjs/web and @solidjs/h publish none of their own, so
it is the Solid repository's LICENSE at their release tags), the one
@solidjs/signals publishes, client-topic-map's notices and the font's OFL,
whole. The script's first comment and the page name it; the standalone file
carries the same text inline. A test checks the emitted files, and that every
package in the bundle is named in the package's NOTICE.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* topic map page: tooltip text is asked for as the report pages ask, and is kept for one reader only

The comment list for the tooltips now carries the report's own moderation
level as mod_gt, read from the report as client-report does (a host may give
the conversation id and the level instead); with no level, no text is asked
for. So a tooltip never shows a comment's text the report would not show
that reader.

Each component keeps the text for one reader (report, conversation id,
level, token) and makes it afresh with every read of the map: nothing is
shared between components, and a token added, changed or removed reloads
the map and its text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* topic map page: the chooser describes a run without levels, model or count

A run whose list entry has no levels, no model name or no count is
described by what it has, never as null or an empty count; the route
records today's keyword-named runs as "none", and the chooser calls both
"none" and "keywords" keyword names.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* topic map page: a host that changes the reader's moderation or conversation props gets the map and its text loaded again

Review round: the two props join the map effect's dependencies, so comment text fetched for one reader's settings is never left showing after the host changes them.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* client errors: the reporter keeps the topic map page's static path name, and the page installs the reporter as every client does

The topic map page added /static/topic-map/ to the routing table, so the
reporter's list of static path names, generated from it by
ci/local/client-error-paths.cjs, gains topic-map in all five copies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* topic map page: the client error reporter runs inline in its head, as on every other client

/topicsVizReport was served by the report client, which reported its
errors; the static page that took the address over reported none. The
served page now installs the report client's copy of the reporter, inline
before the font and the script, as the report client did (client report,
the build commit when the image is given one, the API on the same host).
The standalone file asks no host and carries none. The file-server's page
stage copies the reporter and the prelude builder, and the package's
workflow runs when either changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

* topic map page test: closing beacons of earlier specs' pages are set aside, and the font is read from the page

Run after other specs in one browser, as its hosted shard runs it, the
test counted Simple Analytics closing beacons (queue.simpleanalyticscdn.com
/append) that the admin, report and participation pages of earlier specs
send while it runs, and failed the topic map page for them. Run alone it
passes. They are now set aside, by that one address, only while the page
has no Simple Analytics of its own (its script from another host is still
blocked and counted, and window.sa_event must be undefined); how many were
set aside is logged.

The font was checked by waiting for its request, which a retried attempt
never makes (the first attempt cached it for a year), so the retries failed
on the font and hid the first attempt's failure. It is now read from the
page: the resource from /static/topic-map/ and the Roboto face loaded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvftUARCjBArGpuPBmjRZ1

---------

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@colinmegill
colinmegill marked this pull request as ready for review November 25, 2026 00:29
@colinmegill
colinmegill merged commit d395a9a into stable Nov 25, 2026
96 checks passed
@github-actions

Copy link
Copy Markdown
Contributor Author

Delphi Coverage Report

File Stmts Miss Cover
polismath/init.py 2 0 100%
polismath/benchmarks/bench_pca.py 128 107 16%
polismath/benchmarks/bench_repness.py 81 65 20%
polismath/benchmarks/bench_update_votes.py 38 28 26%
polismath/benchmarks/benchmark_utils.py 34 0 100%
polismath/components/init.py 1 0 100%
polismath/components/config.py 165 70 58%
polismath/conversation/init.py 2 0 100%
polismath/conversation/conversation.py 1293 264 80%
polismath/conversation/group_vote_counts.py 38 2 95%
polismath/conversation/manager.py 131 42 68%
polismath/database/init.py 1 0 100%
polismath/database/dynamodb.py 392 176 55%
polismath/database/postgres.py 414 95 77%
polismath/delphi_storage/init.py 1 0 100%
polismath/delphi_storage/codec.py 300 22 93%
polismath/delphi_storage/embedding_spool.py 58 6 90%
polismath/delphi_storage/golden_corpus.py 60 9 85%
polismath/delphi_storage/import_report.py 51 3 94%
polismath/delphi_storage/legacy_import.py 171 16 91%
polismath/delphi_storage/postgres.py 51 22 57%
polismath/delphi_storage/production_import.py 614 131 79%
polismath/delphi_storage/resource.py 179 32 82%
polismath/delphi_storage/scan_pacing.py 77 0 100%
polismath/delphi_storage/topic_map.py 128 7 95%
polismath/delphi_storage/writer.py 200 13 94%
polismath/embedding_model.py 197 49 75%
polismath/empty_output.py 29 2 93%
polismath/engine_adapter.py 317 265 16%
polismath/job_child/init.py 372 52 86%
polismath/job_child/census.py 74 9 88%
polismath/job_child/input_bundle.py 106 7 93%
polismath/pca_kmeans_rep/init.py 5 0 100%
polismath/pca_kmeans_rep/clusters.py 257 38 85%
polismath/pca_kmeans_rep/corr.py 98 17 83%
polismath/pca_kmeans_rep/group_k_smoother.py 28 0 100%
polismath/pca_kmeans_rep/legacy_kmeans.py 197 8 96%
polismath/pca_kmeans_rep/pca.py 162 19 88%
polismath/pca_kmeans_rep/repness.py 226 5 98%
polismath/poller/init.py 4 0 100%
polismath/poller/admission.py 318 15 95%
polismath/poller/backfill.py 936 32 97%
polismath/poller/capacity.py 485 27 94%
polismath/poller/capacity_queue.py 248 13 95%
polismath/poller/coordinator_bridge.py 317 317 0%
polismath/poller/math_writer.py 120 3 98%
polismath/poller/promotion.py 112 4 96%
polismath/poller/readiness.py 368 13 96%
polismath/poller/rebuild_child.py 133 5 96%
polismath/poller/recompute_line.py 141 9 94%
polismath/poller/service.py 760 50 93%
polismath/poller/worker_pool.py 143 0 100%
polismath/queue/executor.py 221 111 50%
polismath/regression/init.py 4 0 100%
polismath/regression/clojure_comparer.py 188 20 89%
polismath/regression/comparer.py 891 640 28%
polismath/regression/datasets.py 126 27 79%
polismath/regression/recorder.py 36 27 25%
polismath/regression/utils.py 130 85 35%
polismath/replay/init.py 2 0 100%
polismath/replay/attribution_capture.py 49 0 100%
polismath/replay/axis_continuity.py 347 24 93%
polismath/replay/certify.py 999 59 94%
polismath/replay/crosslang.py 128 2 98%
polismath/replay/decision_ties.py 51 8 84%
polismath/replay/diagnostics.py 50 7 86%
polismath/replay/driver.py 73 1 99%
polismath/replay/dsn_admission.py 36 1 97%
polismath/replay/equiv_query.py 10 0 100%
polismath/replay/event_ingress.py 95 1 99%
polismath/replay/fixture_bundle.py 815 62 92%
polismath/replay/fixture_config.py 266 11 96%
polismath/replay/fixture_extract.py 285 12 96%
polismath/replay/fixture_generate.py 103 1 99%
polismath/replay/fixture_samples.py 157 14 91%
polismath/replay/fixture_selection.py 119 0 100%
polismath/replay/fixture_survey.py 147 11 93%
polismath/replay/legacy_pca.py 29 17 41%
polismath/replay/polarity.py 319 25 92%
polismath/replay/poller_equiv.py 776 99 87%
polismath/replay/prodclone.py 193 2 99%
polismath/replay/real_data.py 146 10 93%
polismath/replay/schedule.py 205 10 95%
polismath/replay/served_math.py 159 4 97%
polismath/replay/shard_bench.py 189 65 66%
polismath/replay/stagecompare.py 890 161 82%
polismath/replay/stages.py 256 40 84%
polismath/replay/stepcompare.py 86 1 99%
polismath/replay/store.py 120 11 91%
polismath/replay/tie_capture.py 107 19 82%
polismath/replay/types.py 58 6 90%
polismath/run_math_pipeline.py 284 93 67%
polismath/selection.py 58 0 100%
polismath/step_log.py 127 16 87%
polismath/tools/engine_rebuild.py 230 11 95%
polismath/types.py 6 0 100%
polismath/utils/cli_flags.py 15 0 100%
polismath/utils/clj_hash.py 44 0 100%
polismath/utils/env_flags.py 13 0 100%
polismath/utils/general.py 63 39 38%
polismath/utils/output_profile.py 66 2 97%
polismath/utils/serialization.py 10 5 50%
polismath/utils/vote_convention.py 159 5 97%
umap_narrative/700_datamapplot_for_layer.py 514 470 9%
umap_narrative/701_static_datamapplot_for_layer.py 310 310 0%
umap_narrative/702_consensus_divisive_datamapplot.py 435 275 37%
umap_narrative/801_narrative_report_batch.py 657 209 68%
umap_narrative/803_check_batch_status.py 268 148 45%
umap_narrative/llm_factory_constructor/init.py 2 0 100%
umap_narrative/llm_factory_constructor/model_provider.py 232 106 54%
umap_narrative/narrative_data.py 178 55 69%
umap_narrative/numerical_stages.py 111 21 81%
umap_narrative/polismath_commentgraph/init.py 1 0 100%
umap_narrative/polismath_commentgraph/cli.py 268 268 0%
umap_narrative/polismath_commentgraph/core/init.py 3 3 0%
umap_narrative/polismath_commentgraph/core/clustering.py 108 108 0%
umap_narrative/polismath_commentgraph/core/embedding.py 104 104 0%
umap_narrative/polismath_commentgraph/lambda_handler.py 219 219 0%
umap_narrative/polismath_commentgraph/schemas/init.py 2 0 100%
umap_narrative/polismath_commentgraph/schemas/dynamo_models.py 80 6 92%
umap_narrative/polismath_commentgraph/tests/conftest.py 17 17 0%
umap_narrative/polismath_commentgraph/tests/test_clustering.py 74 74 0%
umap_narrative/polismath_commentgraph/tests/test_embedding.py 55 55 0%
umap_narrative/polismath_commentgraph/tests/test_storage.py 87 87 0%
umap_narrative/polismath_commentgraph/utils/init.py 9 7 22%
umap_narrative/polismath_commentgraph/utils/converter.py 283 50 82%
umap_narrative/polismath_commentgraph/utils/group_data.py 332 279 16%
umap_narrative/polismath_commentgraph/utils/storage.py 616 486 21%
umap_narrative/reset_conversation.py 162 53 67%
umap_narrative/run_pipeline.py 474 171 64%
umap_narrative/topic_naming.py 159 9 94%
Total 26459 7424 72%

This branch was successfully deployed

1 active deployment
release — 26442a01 Deployed Nov 25, 2026 by colinmegill via publish #24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant