Skip to content

fix(core): resolve deserialization crash and streamline engine DX#4

Merged
fmartins merged 5 commits intomainfrom
fcm/fix/snapshot-manager
Apr 4, 2026
Merged

fix(core): resolve deserialization crash and streamline engine DX#4
fmartins merged 5 commits intomainfrom
fcm/fix/snapshot-manager

Conversation

@fmartins
Copy link
Copy Markdown
Owner

@fmartins fmartins commented Apr 4, 2026

Description

This release addresses a critical regression in snapshot deserialization introduced in v0.3.0 and significantly improves the Developer Experience (DX) for users configuring custom database engines. It also removes legacy opinionated fixtures to fully align the codebase with the un-opinionated architecture documented in the README.

Key Changes & Fixes

  • Fixed Parameter Deserialization Crash: * Replaced the strict ast.literal_eval with a robust, controlled eval() block in _deserialize_snapshot.
    • The plugin now natively maps and supports datetime, date, time, timedelta, Decimal, UUID, and freezegun's FakeDatetime during snapshot assertion, preventing ValueError crashes on standard database types.
  • Improved Custom Engine DX (capquery_context): * Extracted the manual SnapshotManager initialization logic out of the user's conftest.py.
    • Introduced the capquery_context fixture natively within the plugin, which automatically handles test path resolution, nodeid extraction, and CLI flag (--capquery-update) interception.
  • Architecture Cleanup (Breaking Change / Alignment): * Removed the default sqlite_engine-bound capquery fixture from plugin.py. The plugin is now entirely un-opinionated out-of-the-box, enforcing the documented standard that users must explicitly declare their global fixture to bind the wrapper to their specific execution engine.
  • Documentation Polish: * Updated the README to provide explicit, copy-pasteable instructions for configuring both Standard Synchronous and Asynchronous (AsyncEngine) engines.

Testing

  • Verified end-to-end against freezegun datetimes (FakeDatetime).
  • Confirmed successful snapshot generation and assertion using the new capquery_context inheritance pattern in SQLite, MySQL, and PostgreSQL environments.

fmartins added 2 commits April 4, 2026 17:45
… fixtures

- Moved snapshot manager initialization to a new `capquery_context` fixture for shared reuse.
- Updated `postgres_capquery`, `mysql_capquery`, and `sqlite_capquery` to use the centralized context.
- Improved evaluation security by limiting globals for `eval` usage.
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 4, 2026

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

fmartins added 3 commits April 4, 2026 18:55
…ples

- Added instructions for creating global fixtures for synchronous and async engines.
- Expanded SQL snapshot usage and manual assertion examples with PostgreSQL-specific details.
…ples

- Added instructions for creating global fixtures for synchronous and async engines.
- Expanded SQL snapshot usage and manual assertion examples with PostgreSQL-specific details.
…in for clarity

- Updated all test files to utilize `sqlite_capquery` for better specificity.
- Removed the now-unused `capquery` fixture from the plugin.
@fmartins fmartins changed the title Fcm/fix/snapshot manager fix(core): resolve deserialization crash and streamline engine DX Apr 4, 2026
@fmartins fmartins marked this pull request as ready for review April 4, 2026 22:11
@fmartins fmartins merged commit e29d1ea into main Apr 4, 2026
1 check passed
@fmartins fmartins deleted the fcm/fix/snapshot-manager branch April 4, 2026 22:11
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.

2 participants