Repository navigation
Description
Current status — 2026-10-12
Status: Completed. The audit and safe consolidation are delivered by merged PR #30. The audit distinguishes equivalent domain rules from adapter-specific behavior.
| Audited area | Outcome |
|---|---|
| Web/native validation-state classification | Shared in shared/receipt-validation.ts; equivalent draft completeness, currency warning, and arithmetic rules |
| Web/native confirmed create/update checks | Shared currency-first and balance checks; adapters retain their existing schema parsing and error types |
| UI-facing configuration/history/receipt types | Shared in shared/receipt-api.ts; src/api.ts re-exports them; native imports directly |
| Save/calculation types | Existing schema-derived SaveReceiptRequest and ReceiptCalculations reused |
| Database rows, web extraction/audit projection, transactions, idempotency/conflict ordering | Intentionally remain in their respective adapters |
| Web backup versus Android backup | Separate schemas and recovery paths retained; no migration/format consolidation |
- The inventory and decisions are documented in
docs/ARCHITECTURE.mdanddocs/TESTING.md. - Ten independent expected-outcome fixtures run against both adapters for create/update, including exact quantities/minor units, zero prices, incomplete/discrepant drafts, currency-error priority, excluded positions, review-only flags, failed-update retention, and successful retries.
- PR refactor: isolate receipt review and preserve money input #30 records 48 adapter tests passing before consolidation and 126 full-suite tests afterward; current main passes 143 tests/build.
- Replaceable adapters, untrusted-input validation, browser credential boundaries, and separate storage/backup formats remain intact. No schema migration is required because no schema changed.
Automated evidence: Current main 538b70e passes pnpm check (143 tests in 15 files) and pnpm build; main CI confirms the same revision. Native tests simulate Capacitor boundaries and rendered tests use jsdom.
Closure boundary: This closes the verified audit/consolidation, not #5's server restore or #13's Android acceptance and web-to-Android migration. Future non-equivalent rules must remain adapter-specific.
Goal
Find duplicated validation rules or API types across the web-server and Android adapters, then share only definitions proven semantically equivalent. Avoid creating a premature common abstraction over different backup formats or persistence guarantees.
Scope and acceptance
- Inventory receipt validation and API types in
shared/,src/,server/, andsrc/native/; document exact duplicates versus intentionally different rules. - Consolidate equivalent types/rules only where tests show matching semantics for minor-unit money, decimal-string quantities, draft versus confirmed balance, idempotency, and untrusted input.
- Keep web-server backup and Android backup schemas distinct unless a separately designed migration/compatibility path is implemented under Store receipts and images persistently on Android #13; this issue does not deliver that migration or Restore backups from the user interface #5.
- Preserve replaceable storage/extraction adapters and browser credential boundaries.
- Add focused equivalence/regression tests for any consolidation; run
pnpm checkandpnpm build. - If no safe duplication is found, record the audit and close without speculative refactoring.
Dependencies
Follow stable behavior and characterization around #1, #12, and #13. Do not block product work merely to deduplicate code.
Activity
Kamitoad commentedon Oct 12, 2026
Completion review (2026-10-12): PR #30 (#30) delivers the audit inventory, shared UI-facing types and only equivalent validation rules. docs/ARCHITECTURE.md documents intentionally separate parsing/errors/transactions/storage/backup behavior; tests/receipt-validation-cases.ts characterizes both adapters with independent expected outcomes. The PR records 48 adapter tests before consolidation and 126 full-suite tests afterward. Current main 538b70e passes 143 tests and pnpm build; CI: https://github.com/Kamitoad/itemly/actions/runs/38185220998. Closing this scoped maintenance issue as completed; #5 and #13 restore/migration/device acceptance remain separate.