Skip to content

Add scoped read completeness reporting - #6

Open
marcomc wants to merge 19 commits into
feat/moneywiz-read-compatibilityfrom
feat/read-completeness
Open

marcomc wants to merge 19 commits into
feat/moneywiz-read-compatibilityfrom
feat/read-completeness

Conversation

@marcomc

@marcomc marcomc commented Sep 27, 2026 •

Copy link
Copy Markdown
Owner

Scoped read completeness

Problem

The API used best-effort parsing and exposed limited record load errors, but did not account for source versus parsed rows or transaction relationship storage. A caller could mistake a partial read for a complete one. Separate manager reloads could also represent different SQLite generations.

What changed

  • Add manager and API completeness reports with source and parsed IDs, counts, status, and identity-only diagnostics for skipped rows.
  • Classify category, refund, and transaction-tag relationship storage as present, absent, or unknown; unknown and malformed layouts cannot report complete.
  • Allow scoped manager loads, refresh previously loaded managers in one read transaction, and invalidate their state if a reload fails.
  • Bind entity and schema-profile caches to an admitted SQLite snapshot and use a read-only connection.

Why this approach

The change keeps the existing managers, model constructors, and supported schema-profile mappings. It adds evidence around their existing best-effort parsing instead of replacing the parsing path. Entity metadata identifies transaction tag storage, avoiding a fixed numeric join-table name; ambiguous layouts fail closed. Existing category and refund table names remain limited to their known layouts. This PR does not add writes or consumer-specific snapshot policy.

This PR targets feat/moneywiz-read-compatibility, the branch behind PR #37, so its diff shows only the read-completeness changes. The latest v1.1.0 release notes include the earlier schema-version work from PR ileodo#40.

Validation

  • The CI type-check failure was in new tests: optional get() results needed existence assertions, and intentional runtime mutation checks needed an explicit type cast. The follow-up changes only those tests.
  • Locally, mypy src tests and the CI unit-test command pass on Python 3.10 and 3.11: 105 tests on each version.
  • Ruff lint and formatting checks pass.

Reject zero-rate transfer reconstructions as recoverable parse failures, cover manager recovery, and format schema compatibility tests.
Thread known profiles through every investment construction path and reject ambiguous schemas without guessing stale aliases.
Model holding and transaction share columns independently and preserve canonical stored amounts for rounded transfers.
- Introduced tests for entity source coverage to validate manager behavior with unknown descendants and unclassifiable entities.
- Added transaction lifecycle tests to ensure correct loading and mutation of transaction data.
- Enhanced investment values tests to verify proper handling of profiled investment records.
- Created tests for read completeness to check for duplicate and unknown rows during loading.
- Implemented relationship completeness tests to validate handling of relationships in various scenarios.
- Developed schema cache binding tests to ensure proper handling of schema changes and metadata remapping.
- Added transaction compatibility tests to verify correct behavior with different transaction types.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-28T13:47:11.032496Z 401c919 Manual request
🔒 Security Review ✅ Completed 2026-09-27T15:48:29.372664Z 847e433 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@marcomc
marcomc changed the base branch from main to feat/moneywiz-read-compatibility September 27, 2026 15:48
Assert optional manager lookups before accessing their fields in scoped-load and schema-cache tests. Cast the intentionally mutated report mappings so the runtime immutability checks remain valid under mypy src tests.
Reject malformed record identity and boolean values before publishing a complete read report. Preserve nullable transaction descriptions and classify invalid descriptions as per-row skips.
@marcomc

marcomc commented Sep 28, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3537b9d4b6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/moneywiz_api/database_accessor.py
Use the existing read admission for record lookups so cached aliases cannot be applied after a schema change. Preserve the scale of finite zero holding quantities and keep record identity validation aligned with the prior contract.
@marcomc

marcomc commented Sep 28, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 401c919c95

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@marcomc
marcomc force-pushed the feat/moneywiz-read-compatibility branch from 3861a8c to c9a257d Compare October 14, 2026 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant