Skip to content

feat(shared): the account list's signers - #4009

Merged
devswha merged 21 commits into
mainfrom
feat/account-list-signers
Nov 17, 2026
Merged

devswha merged 21 commits into
mainfrom
feat/account-list-signers

Conversation

@devswha

@devswha devswha commented Nov 17, 2026 •

Copy link
Copy Markdown
Owner

Change

Adds the signers of an account's signed list as a library that nothing calls yet: who may sign an entry, what a
member does with each entry and each answer of the log it is shown, and what a member does that is behind. This
is the second of the four pull requests agreed in #3996; the first, the entry format, was #3997.

Refs #3996

What is in it

  • shared/account-list-signers.ts (882 lines, 9 exported functions) and its test,
    shared/account-list-signers.test.ts (210 tests).
  • 51 JSON vectors, one file for each case the test names: 39 in shared/account-list-vectors/signers/ and 12 in
    unreadable/. The test also reads the 62 envelope vectors of the first piece, which are unchanged.
  • One change to the first piece: entryHolds in shared/account-list-entry.ts takes the body and the signature
    of the entry it is shown once each. It read each twice before it awaited, so an entry whose parts read
    otherwise the second time was refused with the wrong code. One new test there (128 in that file).
  • docs/account-list.md is unchanged. It specifies one entry and says that who may sign is checked on top of
    it; the signers' rules are stated in the comments of the module. The page's section on those rules and on the
    format of these vectors comes with the third piece, the approval exchange.
  • 21 commits, 55 files. The module does no I/O and reads no clock: the caller reads the log, stores the entries
    and the state, and keeps to its own pace when an answer makes a member ask again (asks_after).

Who may sign

  • From an entry's adds, power and ends alone the module keeps who may sign. Entry 0's signer is the first
    signer; after it, a key is a signer only when a signer of power full added it. A key that entry 0 or an
    adds made a signer is never made one again, and a key that was ended is never added again, whoever made it a
    signer.
  • A member of a higher level may also let a key in on a later kind's own proof (KeyProof, the caller's
    function). Level 1 defines no such kind. A proof may be asked only for an entry of a level above 1 that the
    list already needs, that carries no adds and no ends, and whose signer has no row. It is handed frozen
    copies of its own, of the entry and of the state, so nothing it keeps or does reaches the member.

What a member does with an entry, and with an answer

  • With the member's level, the module tells what the member does with one entry that holds by the first piece's
    rules. It passes it over, and nothing in it applies, when its signer is no signer or one of its fields is not
    lawful: signer_unknown, signer_not_allowed, key_reused or already_out. It cannot read it when its v
    is above the member's level: adds and ends still apply. Otherwise it reads it. judgeEntry judges one
    entry past the state's footing: an entry of another list, or one at or under the footing, is the caller's
    mistake, a RangeError.
  • shownEntries takes one answer of the log, entry by entry. An entry whose signer is no signer is loose, and
    the footing is the last entry a member holds that is not loose. Shown another entry that holds in the place of
    a loose one, a member drops its own entries from that place on and takes what it is shown. Shown another
    history at or under its footing, it stops and says stuck. signingPlace places a member's next entry only
    on its footing, and only when the head it is shown is its own entry there.
  • replayEntries reads a member's own copy from entry 0, by a level, told the member's saved state, and never
    goes back. readSignersState(value, level) reads a saved state again, at the level of the build that reads
    it.

Being behind, and the stop

  • A member is behind when a signer of power full signed an entry above its level. Behind, it goes on only
    while it holds what a member that reads everything holds: the same rows and the same footing. One entry alone
    can part the two: an entry for which a proof may be asked, which a member that is behind cannot hear. There it
    stops: needs_replay in an answer and in a replay, stops from judgeEntry. Until then it has passed over
    exactly what every member passes over.
  • The stop is part of the state: needs_replay, the place and the hash of the entry the member stopped at
    ({seq, hash}), saved and read again with the state. While it is set the member takes no entry, judges none
    and places none to sign, whatever it is shown, and its readers answer for nobody: signerPower is null for
    every key, and isBehind is true. Its copy ends before that entry: where it stopped in the place of loose
    entries of its own, those are dropped, as for any entry that holds there. Only a stop at the footing lies
    inside the copy: an older build reads a newer build's state stopped at its footing, and a replay of the copy
    clears it, by the level that wrote it or by one that reaches the footing.
  • replayEntries has a required option, saved: the member's saved state, or null for a first replay of a
    member that has none. A call that does not say it does not compile, and is refused when it runs. The replay
    never gives a shorter history than the saved member's, at any level, stopped or not: it reaches the saved
    footing, taking the very entry there, and for a stopped member the place before its stop. It clears the saved
    stop only by taking that very entry, the one with that hash in that place, by a level that can judge it; in
    every other case the stop stays in the state the replay gives.
  • Another entry in the place of the saved stop is another history than the one the member was shown: the replay
    ends there with chain_broken, and the stop stays. Another entry at the saved footing is another history too,
    and makes no member. A replay's result says whether the member it gives is stopped: stopped names the
    member's stop, also one that it did not come to, and stuck is true.
  • A replay by a lower level than the one that made the saved state (a downgrade) may be unable to place an entry
    under the saved footing, or before the saved stop. It makes no member then: member is null, stopped names
    the saved stop, and the caller keeps the member it has saved. So no replay gives a state of fewer judged
    entries than the saved member's, whether that member was stopped or not.
  • Nor can a lower build act on a saved state of a higher level. readSignersState takes the build's level,
    required, and reads a state that a higher level wrote stopped at its footing (needs_replay is the footing's
    place and hash), unless it is stopped already, which keeps its stop. So that build takes nothing, judges
    nothing, places nothing to sign and answers for no key through it, until a replay told that state takes the
    entry at its footing: by the build's level where it can reach it, which gives a state of that level, or by the
    level that wrote it. A replay reads the saved state it is told at its own level.

What a caller must do

Nothing calls the module yet, so these are requirements on the next pieces.

  1. Read the member's saved state with readSignersState(value, level), at the build's level, and hand it to
    every replay: { saved: state }, or { saved: null } for a first replay of a member that has none. Both are
    required. null is the caller's own word that there is no saved state: a member whose saved state is lost,
    or does not read, must not be replayed as a first one.
  2. Keep the text of the entry the member stopped at: the entry in the place stopped.seq when the member first
    stops. Its hash is needs_replay.hash, which tells it from any other entry shown in that place later. To go
    on after an update, the member replays its own entries together with that entry, by its new level, and then
    asks the log as it always does. The log may replace that entry if it was loose, so without the kept text the
    member cannot go on. A stop at the footing needs no kept text: that entry is in the copy.
  3. A saved state comes from the member's own store and is as trusted as its private key. readSignersState
    checks its form and that it agrees with itself; it does not prove that some history leads to it. A caller
    that loads a state from anywhere else must replay the entries.
  4. Where a replay gives no member, keep the saved one and write nothing.
  5. Ask signerPower, not state.signers, before trusting a key. While the member is stopped it answers null
    for every key.

What the functions are handed, they take once

  • Every exported function takes what a caller hands it once, when it is called. One reader for each type (a
    place, a row, a state and its rows, a list of texts, a member, an answer, a held entry, a replay's stop) reads
    each field once, by the name its type gives it, into plain frozen data of the module's own, and from then on
    the function reads that copy alone. So what a caller's object says at a second reading, or once a signature is
    being awaited, decides nothing. Nothing is taken by a spread, which takes an object's own enumerable fields
    alone.
  • Every state the module gives is frozen, with its footing and its rows, and has its six members, needs_replay
    when the member stopped, and no other. A level is a whole number from 1, for the functions that make a state
    and for readSignersState alike, so no member is made that cannot be read again.
  • An answer may be read in parts, each after the place where the part before ended; the comment of
    shownEntries says so. A part that shows only entries the member holds changes nothing and asks nothing, so a
    caller that asked only after the member's head or its footing would be shown that part again each time.

Default behaviour is unchanged

Nothing in server/, src/ or app/ imports either module, and no other shared/ file does: the signers
module imports the entry module, and the two test files import them. Nothing in those folders imports files by a
glob. The module has no top-level effect and reads no environment. OVIS_PREVIEW is read in one place,
server/preview.ts, and nothing there or behind it reaches the library. So a release behaves as main does, with
OVIS_PREVIEW unset or set: there is no caller to switch on. Neither the built client (dist/) nor a bundle of
server/main.ts holds any of the module's strings (see Validation). The rest of the change is tests and
vectors.

Known limits

  • A member that is behind reads nothing new once anything is uncertain: at an entry for which a proof may be
    asked it stops, also when that proof lets nobody in. So one entry of that shape, by any key, holds every
    member that is behind where it is, and a member that cannot be updated stays there.
  • A stopped member stays stopped until a replay takes the entry it stopped at. If its caller did not keep that
    entry and the log has replaced it, the member is stuck for good: another entry in that place is another
    history.
  • While a member is stopped it vouches for nobody: signerPower is null for every key, also for the keys that
    were signers when it stopped. So nothing can be trusted through a stopped member until a replay has taken the
    entry it stopped at.
  • null as the saved state is the caller's word. The module cannot tell a member that has none from one whose
    saved state was lost: told null, a replay forgets a stop, and a level below the one that made the member may
    give the member of a shorter history.

For the reviewer

  • The 21 commits are in the order they were made, and later ones replace parts of earlier ones, so the module
    and its test are best read whole, at the tip. In order: the module and its test; the vectors; the change to
    entryHolds; five that settle how the functions take what they are handed; one for a proof's bytes and for
    what a saved state may hold; one for an ended key and an entry of another list; one for the level at which a
    proof is asked; and ten for a member that is behind. Of those ten, the first held keys out; the second
    replaced that by the stop; the third keeps the stop in the state; the fourth keeps it through a replay; the
    fifth makes it the entry's place and hash and has every replay told it; the sixth kept the copy through a
    replay by a lower level; the seventh makes such a replay give no member, and has the readers of a stopped
    member answer for nobody; the eighth has every replay take the saved state, and never give a shorter history
    than it; the ninth has readSignersState take the build's level, and read a state of a higher level stopped;
    the tenth gives a test to each of four guards that no test reached, and says where a stop at the footing lies.
    The vectors are 14,261 lines of JSON that nobody reads by eye: the second reading below checks them by script.
  • Look first at shownEntries: whether an answer of the log can move the footing onto an entry that no signer
    signed, make a member drop an entry that a signer signed, or keep it asking. Then at judge with the caller's
    KeyProof, at the loop of replayEntries with its stop, and at readSignersState.
  • For a member that is behind the claim to check is this: as far as it goes, it has passed over the entries that
    a member which reads everything passes over, and holds the same rows and the same footing; and once it has
    stopped, it places no entry to sign and takes none until a replay takes the entry it stopped at.
  • Once something uses this code, it decides who is in an account. As Signed list of an account's devices and machines: bring the library in, in four pull requests, before anything calls it #3996 says, the library should be reviewed
    before anything depends on it. For this piece the question is less one of cryptography than of a log kept by a
    service that may lie.

Validation

On a branch cut from main 46e93483, Linux x64, Bun 1.4.2 (Node 24 here, where CI has Node 22), with
OVIS_PREVIEW unset.

  • bun run check fast, on another machine of the project's, from this exact tree: every step ok (workflow
    syntax, generated types and themes, typecheck, build) but unit tests, 18,323 pass, 3 fail, 44 skip in 985
    files. The three are scripts/self-hosted-runner.test.ts, "job-started hook, isolated", which fail the same
    way on main on that machine: its own environment, not this branch, which touches only shared/.
  • bun test ./shared/account-list-signers.test.ts ./shared/account-list-entry.test.ts: 338 pass, 0 fail (210
    and 128). bun run typecheck: clean.
  • Every vector at every level from 1 to the highest it names, by a test of the file: 78 runs and 43 pairs of
    levels. As far as a member goes it has passed over what a member of a higher level has, and holds the same
    rows and the same footing; in 10 runs it stops short, each time for a replay.
  • One generated test: 150 histories made from the vectors' own keys with a fixed start, so they are the same in
    every run but for their signatures; a failure names the seed and the case. Two thirds rise in steps: the list
    comes to need level 2, and in half of them level 3, with entries of the levels it needs by then. A third are
    drawn freely: any level from 1 to 3 in any order, by any key. Entries add and end keys, do again what the
    entry before did, or are of the kind whose proof may let a key in; half the keys that a proof lets in are then
    ended and added again. Each history is taken by every level below the one that reads everything: as a replay,
    as answers a few entries at a time, and after loose entries that the log has since replaced.
  • After every step, 1975 in all, the member is held beside the one that reads everything and holds the same
    entries, and neither may answer a power for a key that those entries ended: so the test holds a rule, not only
    two levels against each other. Every member that is not stopped is saved and read back by every lower build:
    stopped at its footing, with the same rows, answering for nobody; that level's replay of it, told the state it
    read, makes no member (81 of 278) or the same history, never a shorter one; and a replay by the member's own
    level, told that state, gives the member back. For each of the 148 members that stopped, 53 of them at a loose
    entry that the log has since replaced, it runs: the saved state read again, also by every lower build, where
    it keeps its stop; answers that show the entry it stopped at, another entry, and the rest of the log; a replay
    at start by the same level and by a higher one; a replay by every lower level (80 of them, 26 of which make no
    member); and the way to go on, with the entry it stopped at and with another entry in that place.
  • It was run once at 2,400 histories, 1,200 from its own seed and 1,200 from another, on another machine of the
    project's: no failure. There, 4,653 times a member that was not stopped was saved and read back by a lower
    build, and each time it was stopped at its footing; that level's replay of it made no member 1,386 times, and
    never a shorter history. With one mistake put back at a time it fails: an ended key that a proof had let in
    added again; signerPower answering while the member is stopped; a replay by a lower level making a member of
    a stopped one; a replay not saying that the member it gives is stopped; a replay by a lower level giving a
    shorter history of a member that is not stopped; a lower build reading a saved state of a higher level as it
    was, not stopped.
  • What the generated test found, as it was at the time: a member that stopped in the place of loose entries of
    its own kept them, which the sixteenth commit mends; and, with its downgrade step, a replay by a lower level
    that cut the member's copy, in 7 of its 150 histories on the module of the sixteenth commit. Each of those
    shapes has a fixed test of its own as well.
  • Each fix has a test that fails on the commit before it (on main, for entryHolds). In the order of the
    commits: an entry whose body or signature reads otherwise the second time; a list id changed while a signature
    was checked; a frozen row whose power read otherwise once the signature was checked; a head that carried its
    fields as getters of its prototype; a member whose footing is entry 0, shown another entry 0, and given a
    place to sign; a proof that wrote over the bytes it was handed; a saved row whose by breaks its rule, and a
    member made for level 0; a key that a proof had let in, ended and added again; a proof asked while behind; an
    entry of another list; three histories in which a member that is behind came to hold other signers than one
    that reads everything; a stop that was returned and not held; a replay that came back not stopped; a replay
    that took another entry in the stopped place, or was told nothing of a stop; a replay by a lower level that
    cut the member's copy; a state from such a replay in which a key that the member's copy had ended was a signer
    again; a replay by a lower level that gave a shorter history of a member that was not stopped; and a saved
    state of a higher level that a lower build read back as it was, not stopped.
  • One test hands every exported function, and entryHolds and firstState, objects behind a Proxy whose fields
    read otherwise at each reading after the first, and from the moment a signature is being checked: 20 calls,
    each giving what it gives for plain frozen data of what was first read. It also checks that each call tells
    the two sets of values apart. That test and three others wrap crypto.subtle.verify to change what the caller
    holds while a signature is checked; each restores the runtime in a finally. Four tests hand in objects whose
    fields a spread does not find. The last test of the file reads again, from its saved form, every state that
    the tests are given by a function that makes one.
  • A second reading of the 51 vectors, by a reader in Python that shares no code with the library: no ECDSA
    library, its own P-256 arithmetic checked first against RFC 6979 A.2.5. It reads one entry by the rules of
    docs/account-list.md. No page states the signers' rules, so it takes those from the sentences of the
    module's comments and of its tests' names, written again as rules. It gave the expected result for 51 of 51
    vectors: what the member did with each entry, its state, for the 20 that show an answer of the log its head,
    where it stopped and whether it is stuck (7 go on, 3 stop, 9 are stuck, 1 asks again), and for the one with a
    replay step what that replay gives. It recomputed 243 of 243 entry hashes, found fields equal to the body's
    fields for all 243, and found each of the 156 keys the vectors name to be one of their own test keys, whose
    private half gives its public point. Twelve altered copies of the folders (an expected code, a character of an
    entry, stuck, a footing, a head, a stop's code, a proof's power, the place that ended a key, a level, the
    hash of a stop, the stop that a replay names, a member where a replay makes none) were each reported as a
    mismatch. The same reader read every vector at every level, 78 runs: in each it came to what the library comes
    to.
  • git rev-parse gives 2861ca0c3f73555a0bade8311ad722674ed454e8 for
    HEAD:shared/account-list-vectors/signers, 8093514e68579f4120548e3a9a9ef5acf10304e6 for unreadable, and
    c92dbc064fbb7eab607cf749177f3382be12f343 for envelope, which is main's.
  • No caller: no import of account-list-signers outside its own test, and none of account-list-entry outside
    the two tests and the signers module. signer_unknown, signer_not_allowed, key_reused, already_out,
    passed_over, cannot_read, needs_replay, ovis-list/1 and entry_malformed are in no file of the built
    dist/ and not in a bundle of server/main.ts (bun build --target=bun), while ovis-account/1, which
    shipped code uses, is in both.
  • Not run: bun run check full (nothing the integration and browser suites run imports this change), and
    nothing on Windows or macOS.

devswha and others added 9 commits November 17, 2026 09:20
… an entry it is shown

shared/account-list-signers.ts keeps, from an entry's adds, power and ends
alone, who may sign the account's signed list; tells what a member of a
given level does with one entry that holds; and takes one answer of the
log entry by entry: loose entries, the footing, going back, and another
history under the footing. Nothing calls it yet. Its test reads the
vectors of the next commit.

Co-authored-by: sisyphus-dev-ai <[email protected]>
49 JSON files, one for each case the test names: 38 in signers/ and 11 in
unreadable/. Each fixes the entries a member holds, what it is shown, and
what it ends with.

Co-authored-by: sisyphus-dev-ai <[email protected]>
…once each

It read each twice before it awaited: once for its size, once to copy it.
An entry whose parts read otherwise the second time was refused, and a
signature of another length then stopped it with signature_invalid where
its form was at fault. Each is now taken once, judged and copied.

Co-authored-by: sisyphus-dev-ai <[email protected]>
…fore a signature is awaited

shownEntries kept the caller's member and answer and read them again
after each signature it awaited. A list id changed meanwhile came back in
the state, though the entries had been checked against the first one, and
an entry signed for the other id was then taken; a footing, a row, the
answer's entries or its head changed meanwhile changed what the member
did. It now copies the member's entries, state and rows and the answer's
entries and head before it awaits, as entryHolds does for an entry and
the entry before it, and builds what comes back from those copies.
replayEntries reads its list id and its proof once.

Co-authored-by: sisyphus-dev-ai <[email protected]>
shownEntries kept a row of the caller's as it was when the row was
frozen. A frozen object may still carry a field as an accessor, and such
a field was read after a signature was awaited: a row whose power read
bound when the answer arrived and full once the signature was checked
let its signer add a key, where the entry is passed over. Each row is
now copied by its four fields into a new frozen row before the first
await, and only the copies are read.

Co-authored-by: sisyphus-dev-ai <[email protected]>
…y a spread

A spread takes an object's own enumerable fields alone, and a place, a
row or a state may carry its fields as getters that are inherited, or
its own and not enumerable. shownEntries copied the answer's head, the
state and its footing with a spread. A head of that kind was copied as
{} and held for no place, so a member that is shown another entry 0
under its footing went on where it must stop, stuck; a state or a
footing of that kind was refused with an error. judgeEntry spread the
state and the row of a key it ends: the state it gave had no level and
no list, and the ended row lost its power. A row that a state's rows
hold as a property of their own that is not enumerable was a row for
signerPower and none for an answer, for judgeEntry's new rows and for
readSignersState.

The head, the state, the footing and each row are now read by the fields
their types name into new frozen objects, before the first await. A
state's rows are listed by every name they are held under, as rowOf
reads them, and a list of texts is copied through the list. No object
spread of a state, a row, a place or a held entry is left. A state that
comes back has its six members alone.

Co-authored-by: sisyphus-dev-ai <[email protected]>
…anded in is read once

signingPlace looked at the place of the head it was shown and never at
its hash. A member whose footing is entry 0 and that was shown another
entry 0 was given a place on its own entry: it could sign on a history
that the log does not show. A head at or under the footing must now be
the member's own entry at that place, or the member places nothing; an
answer stops on the same head as stuck.

readSignersState read the footing's seq and hash several times, so a
footing that read 0 while it was checked and 999 when it was copied came
back as 999. They are read once. So are the held entry's hash in
firstSignersState, the member's entries in listHead, and in judge the
state's members and each row the entry names.

Co-authored-by: sisyphus-dev-ai <[email protected]>
Several functions read a field of a caller's object more than once.
judgeEntry looked up the key an entry adds for the reuse check and again
to write its row, so a key that read otherwise in between had its row
replaced where the entry is passed over. It read the rows a second time
for the state it gives, so a signer could come back ended by an entry
that ended nobody.

One reader for each type (a place, a row, a state and its rows, a list
of texts, a member, an answer, a held entry) now reads each field once,
by its name, into plain frozen data. Every exported function takes what
it is handed through them when it is called, and reads those copies
alone. A proof is handed the copies, and what it answers is read once.
Every state the module gives is frozen, with its footing and its rows.
The rows that an answer or a replay writes are one copy, made when an
entry first writes a row and frozen when the answer or the replay ends.

One test hands every exported function, and entryHolds and firstState,
objects behind a Proxy whose fields read otherwise at each reading after
the first, and from the moment a signature is being checked. Each gives
what it gives for plain frozen data of what they first read.

The comment of shownEntries said that a caller asks after the member's
head or its footing. It now says how an answer that is read in parts
goes on: from the place where the part before ended, which the caller
knows and no result names.

Co-authored-by: sisyphus-dev-ai <[email protected]>
A held entry was copied with its objects and shared its bytes. A proof
could write over the bytes of the entry it was handed, when it was asked
or later, and the entries that came back then held those bytes and not
the ones whose signature was checked. plainHeld now copies each list of
bytes, and a proof is handed a copy of its own.

readSignersState took a saved row whose by cannot be the signer of the
entry that made its key a signer: null at level 1, or a key that was
bound, came in later or was ended before. A member read from such a
state decided otherwise than the member that saved it. The reader now
holds by to that rule. For the rule to hold of every state the module
gives, a proof is asked only above level 1: level 1 defines no kind
that lets a key in.

replayEntries and firstSignersState took a level that readSignersState
refuses, so a member they made could not be read again. A level is a
whole number from 1 for all of them now, and for a state that is handed
in: any other is the caller's mistake, a RangeError.

The last test of the file reads again, from its saved form, every state
that the tests were given by a function that makes one.

Co-authored-by: sisyphus-dev-ai <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • New Features
    • Added support for tracking and evaluating account-list signers, including signer powers, additions, removals, proofs, and replayed entries.
    • Added validation for saved signer states and clear outcomes for entries that cannot be accepted.
  • Bug Fixes
    • Ensured account-list entry content is read consistently, preventing changing values from affecting size checks or copied data.
  • Tests
    • Added extensive coverage for signer-state handling, entry processing, unreadable entries, and edge cases in account-list histories.

The PR adds a shared account-list signer-state module for judging entries, processing shown history, replaying entries, and validating saved state. It adds tests and signed vectors for signer rules and history handling. entryHolds now reads the body and signature properties once.

Changes: Account-list signer state

Layer / File(s) Summary
Stable held-entry reads
shared/account-list-entry.ts, shared/account-list-entry.test.ts
entryHolds captures the body and signature before validation and copying. A test checks entries whose getters return different values on later reads.
Signer state, history, and replay
shared/account-list-signers.ts, shared/account-list-signers.test.ts
The new module defines signer-state data and implements entry judgment, shown-history processing, replay, signing-position checks, and saved-state validation. Tests cover these operations and caller-data snapshots.
Signer-rule and history vectors
shared/account-list-vectors/signers/*
The vectors record expected outcomes and signer states for additions, removals, proofs, footing, loose entries, and divergent histories.
Unreadable-entry and replay vectors
shared/account-list-vectors/unreadable/*
The vectors specify outcomes and resulting states for unreadable entries, key reuse, later entry kinds, and replay.

Estimated code review effort: 4 (Complex) | ~60 minutes

Change: Feature

Possibly related issues

  • devswha/ovis#3996 — The issue lists signer-state processing as one piece of the account-list library plan.

Possibly related PRs

  • devswha/ovis#3997 — This PR adds the account-list entry format and operations used by the signer-state module.
Merge Risk: Minimal · up to db876

This change adds an account-list signer-tracking library that nothing in the application uses yet, along with tests and signed test vectors. It also makes a small hardening change so entry validation reads each field only once. No user-facing or server behavior changes, so the PR is low-risk to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "feat(shared): the account list's signers" names the main change: a new signers module for the account list under shared/. It is short and specific, and it follows a conventional-commit styl…
Description check Passed The description follows the template's two required sections, Change and Validation. The Change section explains the problem context, the new module, the tests and vectors, the entryHolds fix, and the…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "feat(shared): the account list's signers" names the main change: a new signers module for the account list under shared/. It is short and specific, and it follows a conventional-commit style. It does not mention that the module is an unused library, but it identifies the primary change.

Full details: Description check

Explanation

The description follows the template's two required sections, Change and Validation. The Change section explains the problem context, the new module, the tests and vectors, the entryHolds fix, and the caller requirements. It links the agreed issue #3996 as the plan. The Validation section lists the commands run with results, the checks skipped (bun run check full, Windows and macOS), and the environment. The template's HTTP/WS contract-test note does not apply, since the change has no HTTP or WS surface. The description is very long and dense, and parts of it are hard to follow, but it covers every required section with specific information.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 613e518 and db8769b.

Files selected for processing: 6

  • shared/account-list-signers.test.ts
  • shared/account-list-signers.ts
  • shared/account-list-vectors/signers/adds-for-ended-proof-key.json
  • shared/account-list-vectors/signers/loose-same-then-list.json
  • shared/account-list-vectors/unreadable/adds-and-ends-one-key-level-1.json
  • shared/account-list-vectors/unreadable/replay-by-a-lower-level.json

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review.

devswha and others added 12 commits November 17, 2026 13:25
…hind

A key that a proof let in could come back after an ends ended it: an
adds of it was lawful, where an adds of a key that an adds had made is
passed over as key_reused. It came back with the power the adds named
and could add and end keys. An adds of a key that was ended is now
key_reused, whoever made it a signer. A new vector shows it:
adds-for-ended-proof-key.

A member that is behind still asked the proof and let the key in, though
it lets nobody new in then. No proof is asked while it is behind.

judgeEntry took an entry of another list and moved the footing onto it.
That is the caller's mistake: a RangeError.

The comment of readSignersState now says where a saved state must come
from: the member's own store.

Co-authored-by: sisyphus-dev-ai <[email protected]>
A member that is behind does not know every signer: a kind it cannot
read may have let a key in on a proof. When a signer then ended that
key, the member passed the entry over as already_out and kept nothing
of it, so a later adds made the key a signer for it, with full power,
where the member that heard the proof passes that adds over as
key_reused. The key that such an entry adds had the same fault: added
again later, it took the later power.

While it is behind, a member now holds out each key without a row that
is named by an entry it passes over as already_out, the key it ends
and the key it adds: no adds gives it a row after that. The keys are
kept in the state, as `out`, each with the place of that entry; a
state that holds none has no such member. readSignersState reads them
again and holds them to what the module's own states hold.

This is caution, not knowledge. What a signer that the member does not
know did, it cannot know: after an update it replays every entry it
kept by its new level, and that replay says who may sign.

One vector's expected state changes with it: the member of
adds-and-ends-one-key-level-1 is behind when it passes such an entry
over, so its state now holds that key out. A new test takes every
vector at every level from 1 to the highest it names and compares
what the members take.

Co-authored-by: sisyphus-dev-ai <[email protected]>
A member that heard a proof could let a key in while a member of a
lower level was not behind: where no signer had signed an entry of
that level before the key's entry, or where that entry carried v 1.
The lower member then held no row for the key and was not behind, so
it kept nothing when a signer ended the key, and a later adds made
the ended key a signer for it.

A proof is now asked only for an entry of a level above 1 that the
list already needs: one whose v is above 1 and at most what the list
needs before it. A signer of power full has then signed an entry of
that level, so a member that cannot read the key's entry is behind
before the key appears, and holds out what it cannot place.

No vector changes. Five tests asked a proof for an entry of v 1; each
now has a signer's entry of level 2 before it and asks for an entry
of v 2. The comment of the keys a member holds out names the cost of
that caution: a key that never was a signer, ended all the same while
the member was behind, is held out too until the member replays.

Co-authored-by: sisyphus-dev-ai <[email protected]>
A member that is behind went on with what it knew. It could not hear a
proof, so a key that a later kind let in had no row for it, and what
that key did, or what a signer did to it, the member could not place:
it took an adds of a key that had ended itself, kept a signer that the
other members had ended, and so held other signers than they did.
Holding out the keys of an entry it could not place did not mend that:
it kept such a member from a key that the others then added.

Behind, a member now goes on only while it holds what a member that
reads everything holds. One entry alone can part the two: an entry for
which a proof may be asked, of a level above 1 that the list already
needs, with no adds and no ends, by a key that has no row. There a
member that is behind stops, and takes no entry until it replays after
an update: needs_replay, in a replay and in an answer, and `stops` from
judgeEntry. Until then it has passed over what every member passes
over, and its rows and its footing are theirs. The keys it held out
are gone from the state.

A proof is handed a copy of the state of its own, frozen, with rows of
its own: what it keeps or writes changes nothing that the member holds.

Two vectors change. The member of loose-same-then-list is one of level
2 now: a member of level 1 stops before it could hold those entries.
The member of adds-and-ends-one-key-level-1 holds the first two of its
entries and is shown the others: it stops at the key's first entry.

Co-authored-by: sisyphus-dev-ai <[email protected]>
The stop was returned and not held. A later answer could show another
entry in the place where a member that is behind had stopped; it took
that entry, its footing moved on, and it placed an entry to sign there,
on another continuation than a member that reads everything holds.

The stop is a member of the state now: needs_replay, the place of the
entry. It is saved and read again with the state. While it is set, an
answer ends with needs_replay again whatever it shows, judgeEntry gives
`stops`, and signingPlace places nothing. A replay of the member's own
entries starts anew and sets it only where the member stops again.

The expected state of adds-and-ends-one-key-level-1 gains the stop.

Co-authored-by: sisyphus-dev-ai <[email protected]>
A replay of a member's own entries started anew. Those entries end
before the place where the member stopped, so it came back not stopped:
an app that replays at every start could place an entry to sign at that
place again, and take another entry there.

replayEntries is handed the place that the member's saved state holds,
as needs_replay, and keeps it in the state it gives unless the replay
takes the entry at that place. A level that cannot judge that entry
stops there again; a replay of the member's own entries alone leaves
it stopped, by any level. To go on, a member replays its own entries
together with the log's from that place on, by a level that can judge
them. A saved state may so be stopped and behind no more.

Co-authored-by: sisyphus-dev-ai <[email protected]>
The stop that a member keeps held only a place. A replay that took any
entry in that place cleared it: another entry that the log held there
by then, or a loose entry of the member's own, by the same level. The
member could then sign again without having read the entry it stopped
at. And a replay that was told nothing of a stop gave a member that
was not stopped.

The stop is the entry's place and its hash now, in the state and in
its saved form. replayEntries must be told it: the option stop is
required, a place and a hash, or null for a member that had not
stopped. A replay clears the stop only by taking that very entry. The
stop stays where the replay ends, or itself stops, before that place.
Another entry in that place is another history: the replay stops
there with chain_broken, stuck, which a replay's result now says, and
the stop stays. To go on, a member replays its own entries together
with the entry it stopped at, whose text its caller keeps.

A member that stops in an answer drops its own loose entries from
that place on, as it does for any entry that holds there, so its copy
ends before the entry it stopped at. A generated test found that. It
makes 250 histories from the vectors' keys, the same in every run,
and holds each level below the one that reads everything beside it:
as a replay, as answers, and after loose entries that the log has
since replaced. It replaces the random test whose keys were new in
every run.

The expected state of adds-and-ends-one-key-level-1 holds the stop in
its new form.

Co-authored-by: sisyphus-dev-ai <[email protected]>
A replay by a lower level than the one that stopped, told that stop,
may be unable to place an entry before it. It cut the member's copy
there and said it had stopped at that earlier entry, while the state
kept the stop it was told. The entries between the two were gone from
the copy, so no later replay with the entry that the app had kept
could take the member on, by any level.

Such a replay keeps the given entries up to the stop now, each holding
on the one before it, without judging them: took holds what the level
judged, and stopped names the stop it was told, so the entry in that
place is always the one the caller keeps.

The generated test gains that step: a stopped member is replayed by
every lower level, and then by the level that reads everything with
the entry it stopped at. Its lists now come to need level 2, and half
of them level 3, with entries of the proof's kind after each rise, so
that a lower level meets one before the stop. It makes 150 histories.

Co-authored-by: sisyphus-dev-ai <[email protected]>
A replay by a lower level than the one that stopped, told the stop,
kept the member's copy but gave a state of the entries that level
could judge, an earlier place. In that state a key that the member's
own copy had ended was a signer again, and signerPower said so, also
after the state was saved and read again.

Such a replay makes no member now: where its level cannot place an
entry before the stop it was told, member is null, stopped names that
stop, and the caller keeps the member it has saved. So a replay that
is told a stop never gives a state of fewer entries than the member
has judged.

While a member is stopped its readers say so: signerPower answers
null for every key and isBehind is true, also after a replay by a
level that reads everything else. A replay's result names the stop of
a member that it gives and that is stopped still, and says stuck.

judgeEntry refuses an entry at or under the state's footing, as it
refuses one of another list. The comment of replayEntries says what a
stop that is not the member's own yields.

One vector is new, unreadable/replay-by-a-lower-level, with a replay
step that the test and the format of the vectors now know. The
generated test draws a third of its histories freely, ends and adds
again half the keys that a proof lets in, names its seed in every
failure, and holds after every step that no member answers a power
for a key that its copy has ended.

Co-authored-by: sisyphus-dev-ai <[email protected]>
A replay was told only the member's stop. A replay by a level below
the one that made the member, told no stop for a member that was not
stopped, ended at the first entry that level could not place and gave
the member of that shorter history: its footing moved back, and a key
that a proof had let in was gone. Saved, it let another history in
under the place where the member had stood.

replayEntries takes the member's saved state now, required: the state
its store holds, or null for a first replay of a member that has none.
The replay never gives a shorter history than the saved member's, at
any level, stopped or not. It reaches the saved footing, taking the
very entry there, and for a stopped member the place before its stop;
where it would end before that it makes no member, and the caller
keeps the one it has saved. Another entry at the saved footing is
another history: no member either. Entries that end before the saved
member's history, or a saved state that does not read, are the
caller's mistake.

The generated test replays every member that is not stopped by every
lower level, told its saved state: no member, or the same history.

Co-authored-by: sisyphus-dev-ai <[email protected]>
readSignersState read a saved state the same at every level. A build
of a lower level than the one that wrote it got that state back as it
was, and could act on it with its own proofs: judge entries by rules
of a level it does not read, answer for its signers, and sign.

readSignersState takes the build's level now, required. A state that
a higher level wrote is read back stopped at its footing: needs_replay
is the footing's place and hash, unless the state is stopped already,
and then it keeps its stop. So the build takes nothing, judges nothing,
places nothing to sign and answers for no key through it, until a
replay told that state takes the entry at its footing: by the build's
level where it can reach it, or by the level that wrote it. A replay
reads the saved state it is told at its own level.

The generated test saves every member that is not stopped and reads it
back by every lower build: stopped at its footing, with the same rows;
replayed by that level, no member or the same history; replayed by its
own level, the member it was.

Co-authored-by: sisyphus-dev-ai <[email protected]>
Four guards of a replay told the saved state, and of the reader of a
saved state, were reached by no test: each could go and the whole file
still passed. Each has a test now, and with that guard taken out of a
copy of the module, that test goes red:

- a replay that begins with another entry 0 than the saved member's
  makes no member (list_mismatch);
- one in which an entry under the saved footing does not hold makes no
  member: those are not the member's entries;
- one that brings another entry at the saved footing, one that holds,
  makes no member (chain_broken): another history under it;
- a stop at the footing that names another hash does not read.

The comments of listHead and ListStop said that a stopped member's copy
ends before the entry it stopped at. A stop at the footing, which an
older build reads in a newer build's state, lies inside the copy: they
say so now. The state type says in one line that a state from the store
comes only through readSignersState.

Co-authored-by: sisyphus-dev-ai <[email protected]>
@devswha

devswha commented Nov 17, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@devswha
devswha merged commit e3776cd into main Nov 17, 2026
24 of 25 checks passed
@devswha
devswha deleted the feat/account-list-signers branch November 17, 2026 11:39
@devswha

devswha commented Nov 17, 2026

Copy link
Copy Markdown
Owner Author

Merge pass

Merged head db8769b5f001 as e3776cd55e6a on GitHub's checks, with no unresolved review threads.

Reviewer Verdict Note
claude CLEAR
codex CLEAR

Piece 2 of 4 of the relay series: the account list's signers (who may sign the list, with what power, and how a member replays the list's entries to reach that set). Three heads were reviewed; both reviews are clear at db8769b5, with nothing at medium or above. Nothing outside its own test imports the module yet, and nothing is turned on.

Confirmed by runs: a member that is behind stops, and while stopped no exported reader gives a signing power, a signing place or a judgement, including after a downgrade and after a save and reload at a lower or higher level. A generator of 3,072 histories (up to 60 entries, two members, saves and reloads at random levels between every step, a stop at every position; about 1.07 million checks) found no member holding a different signer set from an up-to-date member while neither stopped nor stuck. Piece 1's merged tests pass unchanged and the wire format is the same. Replaying 10,000 entries takes about 1.9 s.

Low notes for the next piece:

  • After a downgrade below the level that placed an entry under the footing, the member can do nothing on that build until the newer build returns; the code says so, the body's Known limits does not.
  • The docs say a member whose saved state is lost must not be replayed as a first one, but not what to do instead.
  • The caller duty "keep the text of the entry the member stopped at" should say: the text whose hash matches the current stop (a member that stops at a second place with the old text kept stays stuck).
  • A doc comment says replaying a stopped member's own entries leaves it stopped at any level; a stop at the footing can be cleared by that replay.

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