feat: storage schema — import sessions, canonical transactions, merchant tables#93
Merged
kayodebristol merged 2 commits intomainfrom Mar 25, 2026
Merged
Conversation
…tests Co-authored-by: kayodebristol <3579196+kayodebristol@users.noreply.github.com> Agent-Logs-Url: https://github.com/plures/FinancialAdvisor/sessions/46375503-56ac-4c74-8ffc-2a6e81cafd96
Copilot
AI
changed the title
[WIP] Implement storage schema for import sessions and transactions
feat: storage schema — import sessions, canonical transactions, merchant tables
Mar 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the full persistence schema described in the issue: nine database-aligned tables with in-memory stores (PluresDB/SQLite-ready via migration hooks), enforcing the core invariants of immutable raw data and append-only audit trail.
New package:
packages/storageSchema types (
schema.ts) — onereadonlyinterface per table, amounts as integer cents throughout:ImportSessionRecord,RawTransactionRecord,CanonicalTransactionRecord,MerchantRecord,MerchantAliasRecord,AccountRecord,PostingRecord,RecurringSeriesRecord,ReviewDecisionRecordStore implementations — one class per table:
RawTransactionStore—insert()-only; throws on duplicate id. Noupdate/deleteexposed.ReviewDecisionStore—record()-only; throws on duplicate id. Full history queryable by entity.ImportSessionStore— secondary index onfileHashfor idempotent re-import detection.CanonicalTransactionStore—update()for reviewer decisions (reviewed,category,merchantId,confidence); raw-tx uniqueness enforced.MerchantAliasStore— supportsexact | prefix | contains | regexmatch types.PostingStore— date-range and canonical-transaction lookups.RecurringSeriesStore— status/merchant/account filters with partialupdate().Migration layer
MigrationRunnertracks applied versions and runs them in order, skipping already-applied ones.SCHEMA_MIGRATIONSships v1 (all 9 tables) as a no-op for in-memory — theapply()hook is the integration point for future DDL:Factory
createStorageSchema()runs migrations then returns all stores as a typedStorageSchema— one instance per logical DB context.Build wiring
packages/storageadded tobuild:packages(afterdomain) and to all test copy/mkdir steps in rootpackage.json.Original prompt
📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.