data: add Account & Wallet sur, data model doc#26
Conversation
204daf2 to
e01a235
Compare
ca3f299 to
4baa333
Compare
4baa333 to
366b5a8
Compare
Migration (on-load): - Inline old transaction type as txn-0 to avoid unresolvable type path through transaction-0 sur import chain - Fix ~(run by) gate to accept value only, not [key value] - Fix :* tuple construction (bare faces parsed as separate elements) - Use '' (empty cord) instead of ~ for default account-id Helper core (poke handlers): - Return (quip card _state) instead of _state for =^ compat - Extract nested struct from action before accessing fields (txn.act/wllt.act) since face resolution doesn't descend through named faces like =txn or =wllt
- Add per-operation update variants to sur types ([%add ...], [%edit ...], [%del =id]) - Add JSON encoders for new update variants in lib enjs cores - Emit %give %fact cards on /updates path from all poke handlers - Matches existing frontend TransactionUpdate interface shape
- Align types with backend sur (Wallet, Account, Transaction + account-id) - Add Zustand stores for wallets and accounts (poke/scry/handleUpdate) - Refactor transaction store: hodl-action → transaction-action, /transactions/all → /transactions - Centralize subscription in bootstrap.ts (single /updates sub, dispatch by mark) - Update views: account-id selector on tx form, parseFloat for string amounts - Replace old React Context stores with Zustand, delete store/Wallets + store/Accounts - Add /wallets and /accounts routes
Code ReviewOverall AssessmentThe architecture is sound and the migration approach is clean. The main concern is how the frontend subscription dispatches by mark. Recommendation: REQUEST CHANGES Code Quality & Patterns
Detailed Findings1. Subscription mark dispatch (likely broken)
event: (data: any, mark: string) => {
switch (mark) {
case 'wallet-update': ...
case 'account-update': ...
case 'transaction-update': ...
default:
console.warn('Unknown subscription mark:', mark);
}
}The existing The test plan checks "Subscription facts emitted without errors on all poke operations" but likely only verified no Hoon-side errors, not that the frontend received and applied the updates. Recommend testing that a poke actually updates the UI without a page refresh. One fix: restructure backend updates to wrap in a keyed envelope — e.g. 2.
|
Summary
Add Wallet and Account data models, creating a hierarchy: Wallet → Account → Transaction.
sur/,lib/,mar/files for Account and Wallet types (CRUD actions, JSON serialization)account-idforeign keystate-0tostate-1(addsactsandwltsmaps, backfillsaccount-id)=<with|_)/accounts,/transactions,/wallets)/updatesfor all poke operations (add/edit/del per model)sur/transaction-0.hoonpreserves old types for migrationnotes/data.mddocuments the data modelFixes applied
^- jsoncasts from dejs arms in wallet/transaction libs (otreturns a gate)+.updinstead of full tagged update@tas→@taura mismatch~(run by)migration gate to accept value only:*tuple construction in state migration(quip card _state)for=^compatibilityTest plan
|commit %hodl)gall: booted %hodl)hodl-actiontotransaction-action(pre-existing mismatch)Test commands (dojo on fake ~dev)
Ship setup
CRUD sequence