feat: abandonAll, explicitly, instead of replacing a session on start

Ending a session breaks every reference and pending answer that lives
only in it, so it takes its own update method rather than happening as
a side effect of start. A second start traps again; the clients take
--abandon-all to end the session a previous run left open.

Generated-by: Claude Code (claude-opus-5-5)
This commit is contained in:
dckc committed 2026-11-18 06:43:15 -06:00
1 parent 9db91b1b9c
commit 6c437ec2f1
9 files changed
+73 -26

No files matched your search

+5 -3
View File
@@ -19,6 +19,8 @@ icp canister install counter --mode upgrade -y
node client/counter.mjs http://127.0.0.1:4960 $ID alice.key use c1 incr value
```
A principal has one CapTP session at a time. Here the upgrade ended Alice's; without one, her next run needs `--abandon-all`, which ends her open session and breaks every reference and pending answer that lived only in it.
The output shows each update call and each answer; after the upgrade, Alice's counter picks up where it left off:
```
@@ -48,8 +50,8 @@ With another key file, `use c1` breaks: that home is someone else's. `icp networ
shop() { node client/shop.mjs http://127.0.0.1:4960 $ID "$@"; }
shop alice.key mint # moola: 10 into Alice's wallet; issuer on the board
shop bob.key open # widgets: 1 in stock; shop on the board at 3 moola
shop alice.key buy
shop alice.key buy # sold out: the payment goes back to the wallet
shop alice.key buy --abandon-all
shop alice.key buy --abandon-all # sold out: the payment goes back to the wallet
icp canister install counter --mode upgrade -y
shop alice.key balances
shop bob.key balances
@@ -98,7 +100,7 @@ Homes, counters, and the canister's CapTP identity live in a [Loam](https://gith
## Known gaps
- **The entropy is not secret** from the subnet's nodes, nor from whoever installs; nothing rests on it but the CapTP keys. A real deployment would draw it from `raw_rand` in a first call after install.
- **One session per principal.** A new `start` from a caller closes the caller's old session.
- **One session per principal.** A second `start` traps until the caller's `abandonAll` or an upgrade ends the first.
- **Not offer-safe.** A buyer hands over a payment and trusts the shop's code, which is right here because it's in the same vat; across vats this needs Zoe's escrow. The board is init-only, but anyone may post any name first.
- **No removal or collection.** A home holds 8 names and can't drop one; spent payments keep their records; Loam garbage collection never runs.
- **The canister pays for every call** and admits any signed caller; it should refuse strangers before doing work (`canister_inspect_message`).