Skip to content

fix(snapshot): recognize PEP 604 optional SQLite types - #173

Merged
codeasier merged 1 commit into
mainfrom
fix/issue-165-pep604
Oct 3, 2026
Merged

codeasier merged 1 commit into
mainfrom
fix/issue-165-pep604

Conversation

@codeasier

Copy link
Copy Markdown
Owner

📝 Description

Recognize types.UnionType alongside typing.Union in SQLite type mapping, so T | None uses the same affinity as Optional[T]. Update the helper/column annotations to accept PEP 604 unions.

Replace the existing strict xfail with regression coverage for all five supported scalar types, reversed optional order, ambiguous unions and unsupported types. An in-memory SQLite test verifies generated column affinities, numeric ordering and nullable value round trips. Append the local modification to snapshot provenance.

🔗 Related Issue

Refs #165. Partially addresses its PEP 604 mapping item; keep the umbrella issue open. Independent of lifecycle PR #171 and based directly on main at c85a357.

🧪 Testing

  • Tests added/updated
  • Reproduced before fixing: 5 failures / 19 passes in the expanded SQLite suite
  • Fixture provenance: 7 passed before runtime tests
  • Focused SQLite suite after fixing: 24 passed
  • Full pytest on Python 3.13.11: 1037 passed, no xfails
  • Ruff, Black and git diff --check: passed
  • basedpyright: 0 errors, 831 existing warnings
  • Tests loaded this worktree source via PYTHONPATH; no shared editable installation changed

✅ Checklist

  • Code follows project guidelines
  • Documentation updated (append-only runtime provenance)
  • No new type warnings introduced
  • Changes tested locally

Snapshot Runtime Provenance

  • Snapshot provenance evaluation completed when snapshot runtime files change
    Snapshot provenance decision: updated

📋 Additional Notes

Multiple non-None union members and unsupported types retain the existing TEXT fallback. Existing databases are not migrated. The remaining coverage, type-warning and CLI refactoring items in #165 are separate work.

@codeasier
codeasier merged commit 16f0046 into main Oct 3, 2026
6 checks passed
@codeasier
codeasier deleted the fix/issue-165-pep604 branch October 3, 2026 19:18
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