No description
  • TypeScript 98.7%
  • JavaScript 0.9%
  • Dockerfile 0.4%
Find a file
Chris Harrington 43f441b330
All checks were successful
server / check (push) Successful in 29s
[WSAPI-13] Include household-visible accounts (Sarah's RRSP) in the balances sync (#12)
Plane: WSAPI-13

## Summary
Adds household-visible Wealthsimple accounts (Sarah's RRSP, `rrsp-ZFgB7yct0Q`) to the nightly `sync/balances`, tagged `scope: 'household'`, merged with own accounts by id (own wins, no double-counting — Chris's TFSA is not household-shared).

- **Holdings:** `FetchIdentityPositions` with `accountScope: HOUSEHOLD` (new `lib/wealthsimple/household`).
- **Cash:** `FetchAccountsWithBalance` 500s for household accounts, so cash = latest daily net liquidation value (`FetchIdentityHistoricalFinancials`) − holdings, priced with the same merged quote map used for valuation. Non-CAD / stale / unparseable NLV and non-CAD quotes fall back to cash 0 with a warning.
- **Status:** new `householdBalances` job on `/status`; a household failure never fails the own-account sync, but `SessionDeadError` still halts it.
- **Carry-forward:** if the household step fails, the previous cache's household accounts are reused (their own-only securities priced from the previous cache; own holdings never get stale prices), stamped with `householdSyncedAt`, and dropped after 7 days without a fresh sync.
- **API:** `scope` and `householdSyncedAt` exposed on `/positions`, `/accounts`, `/balance`.

Limitation: a household account holding only cash (no positions) isn't discovered.

## Verification
- `bun test`: 455 pass, 0 fail; type-check, lint, format:check clean.
- Three pre-PR review rounds (Opus); all confirmed findings addressed (`bb91c7a`, `59ba6c2`, `8d65534`).
- No live Wealthsimple calls from the branch; household query shapes were verified live by read-only probes before implementation.

## Follow-up
HOMELAB-151 — home-assistant-api counts household accounts ("RRSP (Sarah)") and flags stale household data.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Reviewed-on: #12
2026-09-27 09:33:14 -06:00
.forgejo/workflows [WSAPI-2] Bootstrap bun/TypeScript service scaffold + Docker stack (#1) 2026-09-08 12:44:02 -06:00
bearer-auth [WSAPI-5] Internal API endpoints + shared-secret auth (#4) 2026-09-10 13:21:55 -06:00
create-app [WSAPI-11] Add total investments-balance endpoint (cash + priced positions) (#9) 2026-09-21 10:16:59 -06:00
docs [WSAPI-2] Bootstrap bun/TypeScript service scaffold + Docker stack (#1) 2026-09-08 12:44:02 -06:00
error-handler [WSAPI-5] Internal API endpoints + shared-secret auth (#4) 2026-09-10 13:21:55 -06:00
lib [WSAPI-13] Include household-visible accounts (Sarah's RRSP) in the balances sync (#12) 2026-09-27 09:33:14 -06:00
routes [WSAPI-13] Include household-visible accounts (Sarah's RRSP) in the balances sync (#12) 2026-09-27 09:33:14 -06:00
scripts [WSAPI-3] Port Wealthsimple authentication & session management (#2) 2026-09-09 07:50:41 -06:00
sync [WSAPI-13] Include household-visible accounts (Sarah's RRSP) in the balances sync (#12) 2026-09-27 09:33:14 -06:00
.dockerignore [WSAPI-2] Bootstrap bun/TypeScript service scaffold + Docker stack (#1) 2026-09-08 12:44:02 -06:00
.env.example [WSAPI-8] Add rolling-hour rate ceiling + 401/429 cooldown (#10) 2026-09-21 13:13:22 -06:00
.gitignore [HOMELAB-141] Move Mongo data from named volume to bind mount 2026-09-26 14:10:12 -06:00
.prettierrc [WSAPI-2] Bootstrap bun/TypeScript service scaffold + Docker stack (#1) 2026-09-08 12:44:02 -06:00
bun.lock [WSAPI-6] Scheduled sync jobs — activity feed and positions/cash (daily) (#5) 2026-09-11 09:36:20 -06:00
CLAUDE.md [WSAPI-13] Include household-visible accounts (Sarah's RRSP) in the balances sync (#12) 2026-09-27 09:33:14 -06:00
docker-compose.yml [HOMELAB-141] Move Mongo data from named volume to bind mount 2026-09-26 14:10:12 -06:00
Dockerfile [WSAPI-2] Bootstrap bun/TypeScript service scaffold + Docker stack (#1) 2026-09-08 12:44:02 -06:00
eslint.config.js [WSAPI-2] Bootstrap bun/TypeScript service scaffold + Docker stack (#1) 2026-09-08 12:44:02 -06:00
index.ts [WSAPI-6] Scheduled sync jobs — activity feed and positions/cash (daily) (#5) 2026-09-11 09:36:20 -06:00
package.json [WSAPI-6] Scheduled sync jobs — activity feed and positions/cash (daily) (#5) 2026-09-11 09:36:20 -06:00
tsconfig.json [WSAPI-2] Bootstrap bun/TypeScript service scaffold + Docker stack (#1) 2026-09-08 12:44:02 -06:00