Commit Graph
136 Commits
Author SHA1 Message Date
Kgothatso NgakoandClaude Opus 5.5 d2e5fa082d docs: member guarded wallets are built, and the notes they touched say so (Phase 12)
The plan is marked built, with a table of the thirteen places the build
chose differently -- the key notice carrying the key rather than the
signed key state, the request travelling whole inside an inner event,
Put to the group living on the group's page, the wallet screen
following a member's spends while open, and the signet run still to
make before the mainnet gate lifts. The guardians and subgroups notes
point here, and the README says it has been built.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 08:00:46 +02:00
Kgothatso NgakoandClaude Opus 5.5 620cd438a8 docs: plan a guarded wallet a group keeps for one member
The member's device makes a random key, works out every ancestor leaf
and both descriptors, and only then asks the group. The group's quorum
signs a member wallet certificate of its own kind (30334) rather than a
birth certificate, since every reader of 30329 assumes a room. Ancestors
list the wallet as @name, and the group's page opens the member's profile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 07:09:44 +02:00
Kgothatso Ngako 60cb3fa7ae Merge remote-tracking branch 'origin/bennu' into claude/parent-group-wallet-control-5a1540
# Conflicts:
#	composeApp/src/commonMain/kotlin/com/machankura/bennu/compose/database/repository/DatabaseChatRepository.kt
#	composeApp/src/commonMain/kotlin/com/machankura/bennu/compose/repository/ChatRepository.kt
#	composeApp/src/commonMain/kotlin/com/machankura/bennu/compose/ui/view/model/ChatRoomDetailViewModel.kt
#	composeApp/src/commonMain/kotlin/com/machankura/bennu/compose/ui/view/state/ChatRoomDetailUIState.kt
#	composeApp/src/commonTest/kotlin/com/machankura/bennu/compose/text/ProposedEventTest.kt
2026-10-24 06:13:32 +02:00
Kgothatso NgakoandClaude Opus 5.5 e9fae262c8 docs: the subgroup wallet policy is built, and the notes it touched say so (Phase 9)
subgroup-wallet-policy.md is marked built, with a table of where the
build chose differently. group-wallet-guardians.md's "why it is still the
child's choice" becomes "whose choice it is": the parent decides, the
chain still does not enforce it, and an older certificate still leaves it
to the child. subgroups.md gains the wallet tag and the policy as the
second value the coordinator picks for other people.

The three-emulator run is still to do by hand.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 22:11:00 +02:00
Kgothatso NgakoandClaude Opus 5.5 fed7e67c3d docs: plan the parent deciding a subgroup's wallet policy at birth
The coordinator picks guarded or unguarded on the subgroup picker, the
parent's quorum signs the choice into the birth certificate, and the
child's admins agree to it by joining and again when they sign the key
state. Every honest client then offers, signs, derives and watches only
the wallet the certificate allows. An unguarded certificate carries no
guardian keys, and a guarded group can only make guarded subgroups.

Not built: Phase 0's decisions and nine phases.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 21:48:32 +02:00
Kgothatso Ngako 79f2ec3d4d Merge branch 'bennu' into claude/remove-nostr-relays-posts-fc5580
# Conflicts:
#	composeApp/src/commonMain/kotlin/com/machankura/bennu/compose/database/model/ChatMessage.kt
#	composeApp/src/commonMain/kotlin/com/machankura/bennu/compose/database/repository/DatabaseChatRepository.kt
#	composeApp/src/commonMain/kotlin/com/machankura/bennu/compose/nostr/wallet/GroupWallet.kt
#	composeApp/src/commonMain/kotlin/com/machankura/bennu/compose/repository/ChatRepository.kt
2026-10-23 18:28:25 +02:00
Kgothatso NgakoandClaude Opus 5.5 0449293963 fix(marmot): a direct message's envelope is opened, not taken for a signing decline
FrostSigningEvents.DECLINE and MarmotDirectMessage.ENVELOPE_KIND are both
30330. Recognising protocol kinds first (ceremony-creation Phase 6) returned
before the direct-message branch, so every direct message in a
current-profile room was dropped unopened. A 30330 that holds a gift wrap is
an envelope; only one that does not is a decline.

ProtocolKindDispatchJvmTest now opens an envelope through
fromGroupEventResult, which no test did before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 18:13:02 +02:00
Kgothatso NgakoandClaude Opus 5.5 7746f3d17f feat(wallet): offer guarded wallets on mainnet
GroupWalletRollout.GUARDIANS_ON_MAINNET is on, lifted by decision ahead of
the signet run its condition named. The mixed-version risk stays open and
is said so in the gate and the guardians note; guardian spends on mainnet
are held to MAINNET_CAP like every other spend.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 18:06:19 +02:00
Kgothatso NgakoandClaude Opus 5.5 b21f4c4d2c refactor(groups): remove the group's nostr profile, relays and posts
The group's detail screen loses its "Nostr profile", "Relays" and "Posts"
rows, and the six screens behind them go with them: the profile, its
editor, the relay lists, their editor, the posts and the composer. So do
the readers they stood on (GroupNostrProfile, GroupRelayList, GroupPost),
their ChatRepository methods, and 97 strings.

Two things go that were not named, because nothing else reaches them.
BroadcastGroupSignedEventScreen was only opened from those three screens,
so the app no longer sends a group-signed event to a relay, and
EventPublishTransport goes with it. "Propose event" accepted only a
profile, a post or a relay list, so it would refuse every paste;
ProposeGroupEventScreen and GroupEventProposal are removed, and with them
the detail screen's canEditNostrProfile gate. What is left of that block
is the wallet row, shown in Marmot rooms only.

The transcript keeps what it already holds. The three message types stay
as private legacy names in GROUP_IDENTITY_TYPES, as the curated-lists
types did, so rows already written stay system lines. A profile or relay
list arriving in a room now applies to nothing, so a signing session an
older build opened for one ends without a raw-JSON bubble. A kind:1 falls
through to "unsupported", which is what it was before posts existed.
ProposedEvent no longer describes the three kinds.

GroupSignedWorkRowsJvmTest now covers the wallet row and the absence of
the removed rows. The chronicle tests still use a profile, a relay list
and a post as their kinds; they compare GroupSignedEvent rows, which are
unchanged, so only ChronicleTestKinds' account of why is corrected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 17:56:58 +02:00
Kgothatso Ngako 61c6f0b68e Merge remote-tracking branch 'origin/bennu' into claude/taproot-group-hierarchy-spending-7a37ac
# Conflicts:
#	composeApp/schemas/com.machankura.bennu.compose.database.BennuDatabase/27.json
#	composeApp/src/commonMain/kotlin/com/machankura/bennu/compose/database/BennuDatabase.kt
#	composeApp/src/commonMain/kotlin/com/machankura/bennu/compose/database/model/ChatMessage.kt
2026-10-23 17:41:56 +02:00
Kgothatso NgakoandClaude Opus 5.5 4023e9c08b fix(dkg): the creation screen's title before it knows the room's name (Phase 9)
Found on the emulators: refusing a Marmot room left the app bar reading
"Shared key for " and nothing. It reads "Shared key" until the room is
loaded. The plan now records what was checked on the three emulators that
found the bug, and what was not.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 17:12:37 +02:00
Kgothatso NgakoandClaude Opus 5.5 378bb8c800 docs: the ceremony-creation plan is built, and the notes it touched say so (Phase 9)
shared-key-ceremony.md says where a ceremony starts and how one ends early;
subgroups.md points its Phase 10 here; member-chronicle.md says the chronicle
is built and carries nothing; the batch-signing, skipped-keys and Material
notes mark their document examples as removed; the plan records the ten
places the build chose differently.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 17:05:03 +02:00
Kgothatso NgakoandClaude Opus 5.5 30e425f201 docs: plan one place to start a key ceremony, and the removal of the nip30303 documents
Joining a subgroup's ceremony could open a second, whole-room ceremony in the
parent's Marmot room: the shared-key screen showed a ceremony, asked for
approvals and offered to start one from the same button slot. The plan
separates starting from showing, guards proposeRitual, and removes the
unreachable nip30303 document code whose kinds collide with the ceremony's,
keeping the member chronicle as an empty, quiet shell.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 16:17:55 +02:00
Kgothatso NgakoandClaude Opus 5.5 29328b4c5f fix(wallet): settle a spend whose coins another room's transaction took
A guarded wallet's coins have a spender outside the room: a guardian can
take a coin the child's open spend wants, and the child can move one a
guardian's wants. Neither winner is a row in the loser's room, so the loser
sat signed and rebroadcast forever. The watcher now asks the chain, for a
signed spend Electrum has not heard of, which transaction took each coin;
once that one confirms, recordReplaced marks the spend replaced and settles
every other spend of the coin, as recordConfirmed does for the room's own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 16:12:48 +02:00
Kgothatso NgakoandClaude Opus 5.5 f9e2d45ec4 docs(wallet): guardian leaves built, and where the build differed (Phase 9)
The guardians note records what was built against the plan, what is left to
do by hand before the mainnet gate lifts, and the conflicting-spend gap. The
subgroups and wallet notes each change the one sentence the plan said they
would.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 15:40:43 +02:00
Kgothatso NgakoandClaude Opus 5.5 75bdb25783 docs: plan guardian leaves for ancestor groups in a subgroup's wallet
The parent signs a guardian key for the child into its birth certificate,
beside its own ancestors' keys derived one step further, and the child's
guarded wallet puts each in a 12-block leaf.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 15:00:37 +02:00
Kgothatso Ngako 409be6db28 Merge remote-tracking branch 'origin/bennu' into claude/satoshi-amount-group-wallet-a12572
# Conflicts:
#	composeApp/src/commonMain/kotlin/com/machankura/bennu/compose/wallet/GroupOnchainWallet.kt
#	composeApp/src/jvmTest/kotlin/com/machankura/bennu/compose/wallet/GroupOnchainWalletJvmTest.kt
#	docs/README.md
2026-10-23 12:51:52 +02:00
Kgothatso NgakoandClaude Opus 5.5 d56c41ffa4 docs(wallet): send-an-amount checked, and what is left to do by hand (Phase 6)
The audit and the JVM suite ran after every phase. The two-device regtest
walkthrough has not been done; the note lists each of its steps beside
the automated test that comes closest and what that test cannot show.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 12:34:07 +02:00
Kgothatso NgakoandClaude Opus 5.5 95962b724a test(wallet): a spend with change is described by its payment (Phase 5)
Every place a spend is described -- the proposal list and the wallet's
spend rows through ProposedSpend.summarize, the approval screen through
isChange, and the signed and confirmed transcript lines through
amountSent -- already reported the payment rather than payment plus
change. Nothing needed fixing; ProposedSpendTest and the end-to-end
spend test now hold each of them to it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 12:33:38 +02:00
Kgothatso NgakoandClaude Opus 5.5 9a319e1ef1 feat(wallet): the amount field says what can be spent and what is wrong (Phase 4)
The amount field shows its unit, how many sats are confirmed and free to
spend, and on mainnet the cap; a problem with the amount -- not whole,
too large, more than the group has, too small, over the cap -- is said on
the field in its error state instead of under the form. The send-everything
row is one 48dp toggleable target, and turning it off again finds the
amount typed. The wording of every reason is one function shared by the
field and the preview.

GroupSendScreenJvmTest types into the form on regtest and mainnet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 12:31:00 +02:00
Kgothatso NgakoandClaude Opus 5.5 f9e4e049f8 docs: the group wallet's address list is built (Phase 5)
Marks the plan built, with a table of the nine places the build chose
differently, and points the group-chain-wallet note's gap-limit
paragraph and the docs index at it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 12:26:59 +02:00
Kgothatso NgakoandClaude Opus 5.5 8e7782261f feat(wallet): send an amount from the group's wallet on every network (Phase 2)
SEND_AN_AMOUNT kept every network on send-all until a release had shipped
with no mislabelled change, which no release could do while the gate was
closed. It is removed: the send screen always offers the switch and the
amount, and on mainnet the existing 100,000 sat cap bounds what a change
bug could put at risk. Phase 3's end-to-end test is what stands in for
the release the gate was waiting for.

The view model test no longer branches on the constant, and a mainnet
test holds an amount to the cap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 12:26:10 +02:00
Kgothatso NgakoandClaude Opus 5.5 5c77853cfa feat(wallet): change goes to an address the group can find (Phase 3)
Two open spends with change both paid to the first unused change
address, since a spend waiting for signatures has not used it yet.
Change indices are now reserved like coins: reservedChangeIndices reads
the claims of every open spend, and the builder takes the lowest watched,
unused, unheld index. It chooses among generated addresses only, so
change never lands outside the window; CHANGE_LOOKAHEAD rises to 10 and
past it a spend with change returns TooManyOpen.

The change branch not having answered is FindingChange rather than
NothingToSpend, and change too small to send back is reported as
Built.absorbed and said in the preview.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 12:22:32 +02:00
Kgothatso NgakoandClaude Opus 5.5 bc348419bc feat(wallet): read an amount as whole sats, or say why not (Phase 1)
The gated amount field read its text by dropping every non-digit, so
21000.5 became 210,005 sats and 0.0005 became 5. parseSats accepts
thousands grouping and refuses decimals, grouping that groups nothing,
non-ASCII digits and more sats than exist; the preview reports which.
The field shows plain digits grouped and keeps what was typed.

Also plans the rest in docs/group-send-an-amount.md: send-an-amount
opens on every network at once, held on mainnet by the existing cap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 12:15:17 +02:00
Kgothatso NgakoandClaude Opus 5.5 6bf90d9d70 docs: plan a list of the group wallet's addresses
Modelled on Phoenix's swap-in addresses screen: every paid receive
address, the current one, and the two after it, read off the receive
mini-wallet's state with nothing stored and nothing new subscribed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 12:13:37 +02:00
Kgothatso NgakoandClaude Opus 5.5 b8194a4ba3 refactor(wallet): GroupChainWallet is GroupOnchainWallet
And its registry, GroupChainWallets, is GroupOnchainWallets, with the
files, the test and the plan's references following.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 09:52:25 +02:00
Kgothatso NgakoandClaude Opus 5.5 f83fe35a45 feat(wallet): ship behind the rollout gates (Phase 10)
GroupWalletRollout holds the three gates, each with what lifts it. The
flag is on, its condition met. Send-an-amount is off, so the form sends
everything confirmed to one address and says so. A spend proposed from
this device on mainnet may send at most 100,000 sats; test networks
have no cap. The gates are on the composer and nothing else: a device
behind them still accepts, shows and signs what another member
proposes, through every check GroupSpend makes.

The plan is marked built, with its table of where the build chose
differently. Full JVM suite: 1474 tests, none failing; the Android
target compiles; every M3 budget is met.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 08:52:16 +02:00
Kgothatso NgakoandClaude Opus 5.5 0db1fe8fc8 feat(wallet): the group's spends on its wallet screen (Phase 9, part 2)
Every spend the room proposed, newest first, for every member whether
or not they have a node: what it sends and where it has got to --
waiting for signatures, abandoned, signed, sent (reported back by
Electrum, not merely broadcast), confirmed, or replaced by a later
spend. A signed spend Electrum has not reported can be sent again; a
signed, unconfirmed one can be bumped to twice its feerate, a new
session over the same coins that whichever confirms settles. Each row
opens its signing session.

Full JVM suite: 1473 tests, none failing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 08:48:19 +02:00
Kgothatso NgakoandClaude Opus 5.5 b1d5963b53 feat(wallet): a form to propose a spend from the group's wallet (Phase 8, part 2)
GroupSendRoute and GroupSendScreen, behind a Send button on the wallet
screen for a member who holds a share and has a node to see the coins
with. Address, amount or send everything, and a feerate prefilled from
Electrum's six-block estimate. The preview is GroupSpendBuilder over the
same inputs the proposal is built from -- what leaves, the fee, what
comes back as change, or why it cannot be built -- and proposing moves
onto the signing session, replacing the form.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 08:38:19 +02:00
Kgothatso NgakoandClaude Opus 5.5 a24c107b26 feat(wallet): the signing manager signs a spend from the group's wallet (Phase 7)
Kind 30332 opens a session over a PSBT, one item per input, each its own
FROST instance over that input's BIP341 sighash with its own nonce seed
and its own tweak cache. proposeSpend and acceptSpendProposal run the
same GroupSpend checks: every input derives under the account the
room's verified statement gives -- looked up under the ceremony's own
key -- default sighash only, no script-path fields, replaceable, change
only where its claim derives, and a fee under a ceiling. A second
proposal under one id is ignored. completeSpend checks each signature
against its coin's output key and the whole transaction with
correctlySpends before writing it.

An old build does not route 30332, so it never signs a transaction it
cannot show. Resend repeats the PSBT byte for byte. Two-device test:
a quorum spends two coins and both devices hold a transaction that
correctlySpends; each check refuses a hand-built proposal outright.
Full JVM suite: 1458 tests, none failing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 08:28:32 +02:00
Kgothatso NgakoandClaude Opus 5.5 f7a9e05bbc feat(wallet): schema v26 for spends from a group's wallet (Phase 6)
FrostSigningSession.subject, NOT NULL with a default of EVENTS, says
what a session's items are messages of; FrostSigningItem.inputIndex
names the input a transaction item signs, with message and payload as
getters over the existing columns. GroupTransaction holds a spend from
proposal on: the PSBT, written once with IGNORE, the txid fixed before
signing, and the signed transaction, broadcast, seen and confirmed.

AutoMigration(25, 26) is three ADD COLUMNs and a CREATE TABLE -- no
rebuild of either signing table, so no cascade fires.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 08:15:00 +02:00
Kgothatso NgakoandClaude Opus 5.5 24d06d2eee feat(wallet): a screen to open a group's wallet and receive into it (Phase 5)
GroupWalletRoute and GroupWalletScreen, reached from a Group wallet row
on the group's screen. A group that has not opened a wallet gets an
empty state with, for a member who can sign, what opening one asks of
everybody -- including that shares are unencrypted at rest -- and the
button that proposes the statement. An open wallet shows the balance,
confirmed and on the way said apart, the next receive address as a
BIP21 QR code, selectable text and a copy button, the coins, and an
export of the two watch-only descriptors with what they give away.

The wallets are watched on the identity's own Electrum client and made
per PhoenixBusiness in BennuNavHost; a profile with no node sees the
wallet and is told it cannot watch the chain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 08:11:47 +02:00
Kgothatso NgakoandClaude Opus 5.5 4ab47ba432 feat(wallet): watch a group's wallet on the identity's Electrum client (Phase 4)
GroupChainWallet is Phoenix's FinalWallet for a group: two
ElectrumMiniWallets, one per BIP44 branch since a mini-wallet holds one
generator, gap-limited at 10 for receive and 3 for change, on the shared
client. GroupWalletState gives the coins with the derivation that spends
each, the confirmed and pending balances, the next receive address and
change index, and derivationOf -- bounded by the addresses the wallet
has generated, which is how far a check of a claim will look.

Tested against a fake IElectrumClient: a payment moves the receive
address on, change is counted and never offered, and two groups on one
client see only their own coins.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 08:05:28 +02:00
Kgothatso NgakoandClaude Opus 5.5 caddfdc107 feat(wallet): the group opens its wallet by signing a statement (Phase 3)
Kind 30331, inner only: the account xpub, the network, the account
number and both descriptors. A reader believes one only when the room
signed it and the room's threshold key rederives every value it
carries -- GroupWallet.of, used by the repository and by the transcript
arm alike. The broadcast screen refuses the kind twice, at the loader
and in sendToRelays, because the xpub on a relay is the whole balance.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 08:00:59 +02:00
Kgothatso NgakoandClaude Opus 5.5 4330faacd7 feat(wallet): derive a group wallet's keys from its threshold key (Phase 1)
GroupWalletDerivation: a public account step -- a tagged HMAC over the
threshold key, the network and an account number -- gives a depth-0 xpub,
and below it BIP86's own unhardened tail, /<change>/<index>, with the
key-path tweak on top. Each address is computed twice, as points and as
tweaks on a FROST cache, and refused if the two disagree.

Tests: BIP86's published vectors through the cache prove the tail; a
pinned vector freezes the account step; a sweep covers both parities.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 07:55:01 +02:00
Kgothatso NgakoandClaude Opus 5.5 dbbc6c6474 docs: plan a group chain wallet on the group's threshold key
Modelled on Phoenix's final wallet, phased. The path is BIP86's
unhardened tail under a public account step over the ChillDKG key, so
the group can export a standard tr() descriptor; each input is a batch
item with its own tweak cache, and a member checks seven things before
signing a spend. Shares are used as they are at rest, for now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 07:47:25 +02:00
Kgothatso NgakoandClaude Opus 5.5 b75d4b427f Rebrand Curare to Bennu under com.machankura.bennu
Move the packages to com.machankura.bennu.{compose,android,desktop}, the
Android applicationId to com.machankura.bennu.android and the iOS bundle
id to com.machankura.bennu.ios. The root project, launcher label, iOS
product, desktop window, user-facing strings, client tags and the
Curare* classes all say Bennu now.

Left alone on purpose: the mantra/ derivation tags, the `curated` desktop
data directory, the mantra.press relay and the curare.to references.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 13:53:45 +02:00
Kgothatso NgakoandClaude Opus 5 daf8365a6e fix(frost): a resend names the whole room, because the p-tags are its identity
The resend narrowed its NIP-17 p-tags to the members it was for, on the
reasoning that a wrap is sealed per recipient so repeating one for the whole
room wastes wraps. Both halves of that were wrong.

A receiver does not read the p-tags as a recipient list. It hashes them together
with the sender to work out which room the payload belongs to --
`GiftWrapPayload.aggregatedParticipantsPublicKey`, via
`ChatRoom.deriveChatRoomId`, which is what `GiftWrapSeal.decryptGiftWrapPayload`
files an inbound payload under. Leave a member out and the id changes, so the
resend is filed under a room that does not exist; `getOrCreateChatRoom` then
mints that room rather than rejecting it. A repaired session would have become a
phantom two-person conversation in the reader's list, and the session would have
stayed stalled.

There was no saving to trade against it either: `sealGiftWrapPayload` wraps for
every participant of the room it looks up, not for the p-tags it was handed, so
a narrowed payload cost exactly as many wraps as a full one.

Who a resend is for travels in `frost_silent`, which is not part of that hash,
so nothing is lost by naming everybody.

Marmot was never affected -- a group event names nobody and is routed by its
h-tag.

The two tests that asserted the narrowing now assert the opposite, which is the
property worth having: the p-tag set does not change between a publish and its
repeat. The p-tags were the right thing to assert all along; they just mean
something other than what they look like.

Found while answering whether this is backwards compatible with older receivers.
It is -- no new kind, an unknown tag that old builds ignore, and every
duplicate-folding gate in `record` and `acceptProposal` predates this work. This
bug was never a compatibility bug; it broke old and new receivers identically.

1279 tests, no failures. m3Audit: all budgets met.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-10-06 15:22:52 -05:00
Kgothatso NgakoandClaude Opus 5 2edd05f3ca fix(frost): a broadcast that queued nothing records nothing
`broadcast` now says whether it queued anything, and `publishOwn` records the
local copy only when it did. The copy is what stops `advance` from publishing
that message again, so writing one for a message that never went out is a
message the group waits on forever -- the exact opposite of the trade the
queue-then-record order exists to make. The comment on `publishOwn` had that
trade written down in one direction only.

Reachable only through the id-collision guard added with the resend, which
refuses after four tries rather than overwriting a sent row. Four consecutive
seconds of the same message is not something a person with a button can do, but
"unreachable" and "safe when reached" are different claims.

Also brings the docs up to what was built: the resend note is in the index, the
skipped-keys note points at it as the recovery for the failure it describes --
a new message is encrypted at a generation the receiver has not passed, which is
the whole mechanism -- and the plan records the two things landing it turned up,
plus `ask_again` being reused from the catalogue rather than duplicated.

1279 tests, no failures. m3Audit: all budgets met.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-10-06 15:09:57 -05:00
Kgothatso NgakoandClaude Opus 5 7bc00af304 feat(frost): a tag naming the members a resend is for
A proposer can resend what the proposer wrote and nothing else. A nonce or a
refusal relayed by somebody else is filed under the relayer -- `record` keys a
signer's message on the inner event's own pubkey -- and for a refusal that is a
way to manufacture one, which in an n-of-n group abandons a session nobody
refused.

So a resent proposal names the quiet members instead, and their own devices
republish what they already said, under the keys that said it. This is the tag
that names them: `frost_silent`, all-or-nothing like `frost_signers`, because a
list naming the wrong people is worse than no list at all.

Additive on the wire. A build that does not know the tag ignores it and accepts
the proposal it rides on, which is the half of a resend that fixes the common
case -- a member who never saw the proposal because MLS dropped the generation
it arrived at (docs/mls-skipped-keys.md) or a disappearing-message group expired
it off the relay.

Plan: docs/frost-session-resend.md, Phase 1.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-10-06 14:46:18 -05:00
Kgothatso NgakoandClaude Opus 5 79ff9ee1fc fix(chat): the detail pane's view models are the selected room's, not the first one's
In an expanded window the transcript beside the room list showed the
first room opened and stayed there: pick another room and the list
moved on while the pane did not. HomeScreen wraps the pane in
key(chatRoomId), which rebuilds the composition when the selection
changes, but viewModel() does not read composition keys. It scopes to
the nearest ViewModelStoreOwner, and in the pane that is the home
destination's one back stack entry for every room, so the second room's
viewModel(factory = ...) got the first room's ChatRoomMessagingViewModel
and ChatMessageListViewModel back with its factory ignored. A phone never
showed it because a pushed room is its own entry with its own store.

The pane now provides LocalViewModelStoreOwner with
rememberViewModelStoreOwner() under the room key: a store per room,
cleared when the selection moves on, and parked in the home entry's
store so that it survives a rotation. Keying the two viewModel() calls
on the room would have unstuck the pane too, at the price of keeping
every room ever opened -- four DB collectors each -- in the home entry's
store for as long as the home screen lives.

ChatPaneSelectionJvmTest opens two rooms and comes back to the first,
told apart by what was said in them since a name is on the row as well
as the bar; its third case checks the room left behind stops collecting,
which is the case the keyed alternative fails. The conformance doc's
account of the hand-built pair records the trap.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 20:10:13 +02:00
Kgothatso NgakoandClaude Opus 5 de5b2bd4a6 docs(marmot): the v2 plan is built -- where the build chose differently, and where the rollout stands (v2 Phase 9)
docs/marmot-v2.md, Phase 9. The phase has no code in it; it is the rollout,
and the rollout is a flip and a retirement that wait on the people this
app's users invite. What the phase owes the document is the repo's
convention for a plan that has been built: the status paragraph, the table
of where the implementation chose differently, the thing found on the way
that belongs to nobody's phase, and the commit the account was written
against. All four are here now, and the phases themselves are kept as
written, because they are the reasoning and the code reads better against
the argument it came from than against a summary of itself.

The table has twenty-two rows, and the first is the one to read before any
of the code: the plan said the library's engine replaces the app's pipeline,
and the build made a room's profile pick its pipeline instead -- legacy
rooms keep the app's path, comparator and cache included, and retire with
the profile; current-profile rooms go through `MarmotEngine`. The library's
processor has no carve-out for the bare gift wrap a legacy direct message is
carried in, so under it every one of those would have stopped decrypting,
and the legacy pipeline is frozen anyway. Most of the other rows follow from
that one: one store rather than four, no message-id column, the rotation
manager constructed and unused, the engine hanging off the database rather
than an identity's scope. The rest record the smaller turns -- the envelope's
kind, the chronicle cap measured escaped, the KeyPackage not last-resort, the
admin refused before a leave is attempted, captions from the participants
diff rather than a snapshot column, no rename, the two non-chat kinds only,
the four Phase 8 scenarios spread over four tests -- and the three
follow-ups that closed lines the phases' own commits had missed: the
outbound hold while a pass is open, the rejected commit discarded, and the
1210/1009 bubbles.

The thing found on the way is quartz 1.15.2's: its convergence rebuilds a
candidate branch by replaying its commits against the retained parent, and
a member cannot replay a commit it authored, so a fork this device is half
of is scored with its own branch stale and two committers swap branches
rather than agree. Every device that only observed still agrees, which is
the case the app depends on and the first fork test holds; the second pins
the swap and says what to do the day it fails. The paragraph says the
practical exposure is small and why, and that the Phase 5 follow-up on
withdrawing a losing branch's rows waits on the same fix.

Phase 9's own section gains "Where it stands": everything ships built and
unflipped -- `DEFAULT_FOR_NEW_ROOMS` is legacy, both slots are published, no
room is on the current profile unless a caller asked by name -- so the first
of the three one-way doors is behind us and the other two wait on the flip.
The README's row and reading-order paragraph now say the plan has been
built and point at the table's first and last rows.

One code change, a comment: the plan's Phase 5 asked that the two library
gaps the rewrite does not close -- the retained-epoch decrypt without sender
verification, and the skipped keys that do not survive `saveState` -- be
said where the new code is, rather than let the rewrite look like it closed
them. `MarmotEngine`'s class doc now says both.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 00:16:10 +02:00
Kgothatso NgakoandClaude Opus 5 3cdce6a908 feat(marmot): send the canonical app payload, and an envelope for direct messages (v2 Phase 2)
What goes into MLS is now the Marmot app event the spec defines: six members and
no `sig`. The rumor serialised as an Event carried `"sig":""`, which a conformant
decoder refuses outright -- a payload with a signature would be a standalone relay
event, republishable as a signed statement by its author. The id does not move,
because NIP-01 never hashed the signature, so every row filed under an inner
event's id stays valid; and the build already in the field reads the new shape,
because Event.fromJsonOrNull defaults a missing signature. This switch alone needs
no gating and is made everywhere at once. The `encoding` tag comes off the
application kind:445 while here -- transports/nostr.md forbids it on every shape.
docs/marmot-v2.md, Phase 2.

A direct message could not make that switch as it was. Its payload is a NIP-59
wrap signed by a throwaway key, which a conformant peer refuses twice over: for
the sig member and for an author that is not the MLS sender. In a current-profile
room the wrap now travels inside an envelope -- an unsigned app event of kind
30330 authored by the sender, one `p` tag for the recipient, the wrap's JSON as
content. The envelope passes the author check like any payload, so the carve-out
in mip03Rejection that admitted bare wraps is confined to legacy rooms by a new
`legacyRoom` flag: in a current-profile room a bare kind:1059 is refused as every
other conformant client refuses it. Every property the throwaway key was chosen
for survives -- the envelope is unsigned and so a claim rather than a proof, the
wrap inside is still signed by nobody, and the seal-to-leaf binding in classify
still decides who wrote the words. The line for a message this device cannot read
now hangs off the row the payload was filed under (the envelope's id in a
current-profile room), which ChatMessage's foreign key requires.

The envelope is gated, and the gate is the room's profile: an old build renders
it as a raw-JSON bubble, so a legacy room keeps sending the bare wrap, and a
current-profile room -- which admits only leaves carrying an identity proof,
which only a build past Phase 3 can make -- never holds an old build. That is the
flag for every wire change after this one.

A conformant decoder bounds the whole app payload at 64 KiB, and a chronicle page
rides inside one as JSON-escaped content. The new bounds test caught what the
arithmetic missed: dense JSON payloads escape to half again their size, so a 48
KiB page became a 70 KiB app event. The packer now measures a page by
ChronicleEvent.escapedByteSize -- the bytes it will occupy inside the envelope --
against MAX_PAGE_BYTES, lowered from 64 to 48 KiB, and MAX_PAGE_EVENTS drops from
128 to 96 so the count cap still binds under it, as the comment on the two caps
insists. The receiver's raw-bytes check is unchanged and now holds by
construction.

Tests: MarmotMip03CarveOutTest becomes the test that the exemption is confined to
legacy rooms and that an envelope passes the ordinary check; MarmotDirectMessageTest
round-trips the envelope through the strict decoder and opens the wrap inside;
MarmotPayloadBoundsTest asserts the largest chronicle pages and an envelope are
conformant app events, including the dense-content page measured the way the
packer measures it. The ingest test's tamper case flips a decoded byte rather
than the base64 tail, which could change nothing but padding. Full JVM suite:
1,148 tests pass. The direct-message and chronicle notes record the changes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-13 22:32:30 +02:00
Kgothatso NgakoandClaude Opus 5 f304e7d642 docs: the Marmot v2 plan -- bringing the group layer onto the current profile
quartz 1.15.2 implements the restructured Marmot spec, and bumping the version
gives this app almost none of it: the pipeline that reads, forks, publishes and
persists group state is the app's own, driving MlsGroup directly with Room as
the store, while everything v2 lives in the library's managers behind four store
interfaces the app has never implemented. This note is what would have to change,
in the order it can safely change.

Nine rules reach the app, tabled against what it does today: unsigned six-member
payloads, component-based group state with per-leaf identity proofs, a random
routing id, dedup by the Marmot message id, convergence in place of the
created_at-then-event-id rule, publish-before-apply, SelfRemove and derived
captions, NIP-65 KeyPackage relays, no encoding tag. Two constraints shape the
phases: adopt the library's engine rather than re-implement it (convergence is
two thousand lines whose only value is agreeing with every other implementation),
and split the room's derived id -- the group's FROST key, per the derivation
note -- from the routing address v2 says must never be derived.

Nine phases, ordered so that the ones that reach other clients come before the
ones that make the app's own forks settle the way theirs do. Two findings from
the research shaped them: the build already in the field reads a canonical
payload because Event.fromJsonOrNull defaults a missing sig, so the payload
switch needs no gating; and the app picks a peer's KeyPackage by newest
created_at, so the two-slot transition has to stamp the legacy package later or
old builds break on a framed one.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-13 22:04:41 +02:00
Kgothatso NgakoandClaude Opus 5 80735df86a feat(ui): the preview's action is the app's extended FAB
curated gained ExtendedFab while the preview was being built: every screen's
bottom-bar action, with an enabled that borrows the disabled colours, marks the
node disabled and drops the press. The preview had chosen a Button for exactly
the reason that widget removes -- a FAB had no disabled state -- so after the
merge it was the one screen whose primary action was shaped somewhere else.
Now it is that FAB in a bottom bar, the indicator in its icon slot while the
key package is still owed, and the reason line stays in the body above it.
Hidden, bar and all, for a read-only identity.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-13 13:43:20 +02:00
Kgothatso Ngako f4b0347e90 Merge branch 'curated' into claude/chat-creation-profile-preview-ae07be 2026-09-13 13:39:54 +02:00
Kgothatso NgakoandClaude Opus 5 ca6c16beb0 refactor(ui): one extended FAB for every screen's primary action, with a gap in it
Twenty screens end their bottom bar in an `ExtendedFloatingActionButton` --
twenty-one buttons, one screen having two -- and eighteen of those were built
from the content-lambda overload with an `Icon` directly followed by a `Text`.
That overload puts nothing between the two, so the icon touched the label on
every one of them: visible in any render, and unnoticed because every FAB in
the app looked the same. Thirteen of the eighteen also carried the same
twenty-line block for looking disabled, because M3 gives a FAB no `enabled`.

**`ExtendedFab`, once, in widgets/buttons.** A label, an icon slot, `enabled`
and `onClick`. It draws `space150` between icon and label, which is the 12dp
M3 names `ExtendedFabEndIconPadding`; it borrows the disabled colours every
other button in the app uses, marks the node disabled so a screen reader does
not announce a button it is happy to press, and drops the press -- so the
thirteen call sites lose their `if (!canX) return@…` guards along with the
block and the `buttonColors` each of them declared. An icon slot rather than
an image, because two screens put a progress indicator where the icon was
while the action they started is out, and they still do.

**Not M3's `text`/`icon` overload, which would have spaced them for free.**
Its source wraps the label in `clearAndSetSemantics {}`: the label leaves the
merged semantics tree, a screen reader is told only what the icon says, and a
test cannot find the button by what it says -- five screen tests do. The
three FABs that were on that overload move to the widget too, and two of them,
Home's "New chat" and "Start the key ceremony", had a decorative icon beside
the cleared label and so no accessible name at all until now.
`ReadOnlyEntrancesJvmTest` had gone to the unmerged tree to find "New chat"
for this reason; the habit is harmless and stays. Every icon's description is
as it was, since several tests reach their FAB by it.

`ExtendedFabJvmTest` pins the decision: found by its label in the merged tree,
the icon before the label with a gap between, and disabled both announced and
refusing the press. The two docs that recorded the old state -- the
conformance account's "left alone" and the npub plan's unmerged-tree note --
each say what superseded them.

Verified with :composeApp:m3Audit (all budgets met, 0 dp literals in spacing
positions), :composeApp:compileDebugKotlinAndroid and :composeApp:jvmTest
(1088 tests, 3 new).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-13 13:31:47 +02:00
Kgothatso NgakoandClaude Opus 5 b3bcc06047 docs: record what the profile preview plan built, and the places it chose differently
Two strings that already existed, a room rule that follows the old code's
intent rather than its branch, a retry that never takes an open chat back to
checking, the flag the ordering cases asked for, and the test harness the other
view models use.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-13 13:19:51 +02:00
Kgothatso NgakoandClaude Opus 5 db268a53d3 docs: plan a profile preview before a chat, starting from what the button is allowed to do
The "Direct message via npub" option goes straight from a pasted string to an
MLS room. The plan puts a screen between them, keyed by public key because that
is all the dialog has, and keeps the room's creation where it is: four decisions
-- where the preview lives, what "found" means when a row can be a placeholder,
that the button hands over rather than creates, and that it waits for the key
package so the twenty-second dead end is answered before the press -- and four
commit-sized phases with the tests for each.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-13 12:49:41 +02:00
Kgothatso NgakoandClaude Opus 5 29027f2b92 docs: record what the multiple-profiles plan built, and the places it chose differently
Phases 1–8 are implemented, in order, one commit each; Phase 9 is the
rollout and stays as written. The plan's phases are kept as the reasoning,
and the table at the top says where the build chose differently: the
repair reads before it writes and hands the listing its result; one
WalletAttached outcome with two ways in; the node stop and the relay scope
injected for their tests; the default save that cannot crash; a
ProfilesViewModel over flows; a NewProfileWriter and a route flag where the
plan expected the create screen's existing writer to serve; the colliding
id on the outcome rather than on the enum; the DAO's own requests left
unowned because they fetch public kinds; the inbox reopened by re-indexing
each wrap in its own transaction rather than by lifting the unseal branch
out; and the round trip's A made through the create view model with a
never-started PhoenixBusiness for the switch to stop.

Three things found on the way and in no phase are recorded beside the
table: the library's unsynchronised global-preferences cache, reached by
two threads at once for the first time, now behind JvmGlobalPrefs on the
jvm target; the same cache's consequence for tests that construct the
sovereign view model; and the gift wrap seal's link to its wrap, a foreign
key that existed and was never written until the inbox sweep asked the
question it answers.

The README's row and reading order say the note is built, and name
switchToIdentity where they named switchToWallet.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-13 01:57:05 +02:00