Repository navigation
docs(serializers): make the custom serializer examples cache (LAB-7491) - #458
Conversation
The PydanticSerializer example built SerializationMetadata(format=...), which raises TypeError, so every write failed. The decorator logs the failure and returns the result uncached, and the fence never called the function, so the doc test passed anyway. - pydantic.md: use serialization_format=SerializationFormat.MSGPACK, drop the original_type branch that could never run, and call the function twice over a FileBackend, asserting the second call is a hit. - custom.md: point "Example: Pydantic Serializer" at that example instead of keeping a second broken copy. Fix the Implementation Guide to pass only real SerializationMetadata parameters and to accept the metadata argument the decorator passes to deserialize; state both in Requirements.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 6 minutes. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configurationConfiguration used: Repository: cachekit-io/cachekit-py/.coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Code Review Completed! 🔥The code review was successfully completed based on your current configurations. Kody Guide: Usage and ConfigurationInteracting with Kody
Providing Context (Files & MCPs)Add these hints in your PR description (or a comment) to unlock deeper checks:
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
…vers (LAB-7491) The API Reference documents serializer parameters, not SerializationMetadata fields; link its Serializers section with the wording the sibling pages use.
Code Review Completed! 🔥The code review was successfully completed based on your current configurations. Kody Guide: Usage and ConfigurationInteracting with Kody
Providing Context (Files & MCPs)Add these hints in your PR description (or a comment) to unlock deeper checks:
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
The custom-serializer examples in
docs/serializers/now cache when used, and the Pydantic one is a doc test that fails if they stop.pydantic.md"Advanced: Custom PydanticSerializer" builtSerializationMetadata(format="MSGPACK", ...). The keyword isserialization_formatand takes aSerializationFormat, soserialize()raisedTypeErroron every write. A decorated call logs that failure and returns the result uncached, and the fence never called the function, so the doc test passed.pydantic.md: fixed the keyword and dropped theoriginal_typebranch that could never run (objwas already a dict by then). The fence now calls the function twice over aFileBackendin a temp directory and asserts the second call is a hit, and that a hit returns the dict, not the model.custom.md"Example: Pydantic Serializer" was a verbatim copy of the same broken block. It now links to thepydantic.mdexample.custom.md"Implementation Guide" passedformat="custom"andsize_bytes=, and neither keyword exists. A string format would still fail every write, becauseto_dict()reads.format.value. Itsdeserialize(self, data)had nometadataparameter, but the decorator passes metadata on every read, so a serializer built from the guide never got a hit. Both are fixed, and "Requirements" now states the signatures.custom.md"See Also" said the API Reference covers "SerializationMetadata fields". It does not mention them, so the link now goes to its Serializers section, worded like the sibling pages.The fence fails on the bug
With only the keyword reverted (
serialization_format=back toformat=):With the fix the same command gives 6 passed.
Implementation Guide, run through
@cacheThe guide's class, with
custom_encodeandcustom_decodeset to msgpack, decorated over aFileBackendand called twice:serialization_format="custom"(a string)deserialize(self, data)Checks
uv run pytest --markdown-docs README.md docs/: 132 passeduv run pytest tests/docs/: 70 passedgrep -rn -A4 'SerializationMetadata(' README.md docs/ | grep -E '\bformat=|size_bytes=': no output