Skip to content

fix: canonicalize the pythonic serializer alias to auto#192

Merged
27Bslash6 merged 1 commit into
mainfrom
fix/167-canonicalize-serializer-aliases
Jun 19, 2026
Merged

fix: canonicalize the pythonic serializer alias to auto#192
27Bslash6 merged 1 commit into
mainfrom
fix/167-canonicalize-serializer-aliases

Conversation

@27Bslash6

@27Bslash6 27Bslash6 commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Summary

auto and pythonic are documented aliases for the same AutoSerializer, but cache_handler only canonicalized std/standarddefault. An entry written with serializer="auto" stored 's':'auto' in the CK frame; a handler configured serializer="pythonic" compared the stored tag against the literal 'pythonic'serializer mismatch → treated as a miss → recompute on every read.

Fix: collapse interchangeable names to one canonical frame tag via a shared _SERIALIZER_NAME_ALIASES map (adds pythonicauto; std/standarddefault unchanged).

Closes #167.

Tests

New tests/unit/test_serializer_alias_canonicalization.py: write-auto/read-pythonic and the reverse round-trip; both aliases resolve to the same stored tag; std/default canonicalization preserved. Full suite: 1854 passed, basedpyright 0 errors.

Fold-in

Small fix: intended to ride into 0.10.1 alongside #155 / #156 / #157.

Summary by CodeRabbit

  • Bug Fixes

    • Improved serialiser alias canonicalisation to ensure cached payloads remain compatible when using equivalent serialiser alias names without mismatch errors.
  • Tests

    • Added comprehensive unit tests verifying serialiser alias canonicalisation consistency across supported alias combinations.

auto and pythonic are documented aliases for the same AutoSerializer, but only std/standard canonicalized to default. An entry written with serializer='auto' stored 's':'auto' in the frame, while a handler configured serializer='pythonic' compared against the literal 'pythonic' — a serializer mismatch that treated every read as a miss and recomputed. Collapse interchangeable names to one canonical frame tag via a shared alias map.

Closes #167.
@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3e268d78-f120-4350-b3d6-bc6ab4bc13a0

📥 Commits

Reviewing files that changed from the base of the PR and between 46a3c3c and 85ade5c.

📒 Files selected for processing (3)
  • .secrets.baseline
  • src/cachekit/cache_handler.py
  • tests/unit/test_serializer_alias_canonicalization.py

Walkthrough

Adds a _SERIALIZER_NAME_ALIASES module-level constant to cache_handler.py mapping pythonicauto and std/standarddefault, then wires it into CacheSerializationHandler._serializer_string_name assignment. Four unit tests verify round-trip and internal-name consistency for all alias pairs. The .secrets.baseline is updated to reflect the shifted line number and a new scan timestamp.

Changes

Serializer Alias Canonicalization

Layer / File(s) Summary
Alias map constant and handler wiring
src/cachekit/cache_handler.py
Introduces _SERIALIZER_NAME_ALIASES dict (pythonicauto, std/standarddefault) and updates _serializer_string_name to resolve through it via .get() with a passthrough default.
Alias canonicalization unit tests
tests/unit/test_serializer_alias_canonicalization.py
Adds module docstring, imports, and four tests covering: autopythonic round-trip serialization, internal name equality for both aliases, and guard for std/default resolving to "default".
Secrets baseline update
.secrets.baseline
Shifts the recorded line_number for the flagged secret in cache_handler.py from 266 to 271 and refreshes the generated_at timestamp.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

Possibly related PRs

  • cachekit-io/cachekit-py#121: Introduced the "pythonic" alias in the serializer registry and AutoSerializer, which is the upstream source of the alias that this PR canonicalises in CacheSerializationHandler.
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description covers the problem, solution, and testing. However, it does not follow the required template structure with all mandatory sections. Restructure the description to match the template: add Description/Motivation sections, mark checkboxes for Type of Change (Bug fix) and Security/Documentation checklists, and verify Backward Compatibility.
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding canonicalization for the pythonic serializer alias to auto, which directly addresses the core bug fix in the PR.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/167-canonicalize-serializer-aliases

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov

codecov Bot commented Jun 19, 2026

Copy link
Copy Markdown

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!

@27Bslash6 27Bslash6 merged commit 666d09c into main Jun 19, 2026
32 checks passed
@27Bslash6 27Bslash6 deleted the fix/167-canonicalize-serializer-aliases branch June 19, 2026 11:50
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.

auto and pythonic serializer aliases are not canonicalized → cache-miss on every read

1 participant