fix (ornith-35): watchlistRepository double-encoding bug — single JSON.stringify, 13/13 tests pass

This commit is contained in:
Investor Flow Build
2026-06-30 17:54:01 -04:00
parent 97607e0bd4
commit 1007ab4ed5
62 changed files with 11617 additions and 34 deletions
+21
View File
@@ -0,0 +1,21 @@
# ADR-0001: Local-first, multi-tenant architecture
Date: 2026-06-27
Status: Accepted (design phase)
## Context
Investor Flow must serve many beginner users (not just the operator) while honoring "store locally, run reports, avoid rate limits." Single-user local SQLite does not fit once multiple users exist.
## Decision
One shared Bun + SQLite backend (Docker Compose), local-first (not cloud). Per-user logical isolation inside one DB:
- Tier A (shared market cache): price, options, filings, 13F/13G/4 snapshots, sector map.
- Tier B (shared content): X/Reddit thread mirrors, adapter backoff state.
- Tier C (per-user, ownerId): watchlists, portfolios, journal, reports, alerts, trusted accounts, saved posts.
- Tier D (system): users, sessions.
Adapter queue dedupes: User A and B both requesting NVDA price within staleness window triggers ONE fetch; result shared.
## Consequences
- Multi-tenant + local-first coexist via shared public cache, private user rows.
- Most LLM summaries are free for second-and-later users (deterministic by prompt-hash).
- Operator runs admin tooling for user management, GDPR export, queue health.