Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #88 +/- ##
==========================================
- Coverage 84.45% 83.48% -0.98%
==========================================
Files 16 17 +1
Lines 3037 3228 +191
==========================================
+ Hits 2565 2695 +130
- Misses 472 533 +61 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Code Review
This pull request introduces a new V2 on-disk format for CogDB, featuring a binary header, msgpack payloads, and per-record int64 nanosecond timestamps. The serialization logic has been refactored into a pluggable Codec system that supports both legacy (v0/v1) and the new V2 format, with the Store class now automatically detecting the file format upon initialization. Review feedback identified a bug in the _read_exactly helper where requesting zero bytes incorrectly returns None instead of an empty byte string, which would break zero-length payload handling. Additionally, a potential TypeError was noted in load_from_store when handling truncated files, necessitating a null check for data returned from the store.
| # @profile | ||
| def load_from_store(cls, position: int, store): | ||
| record = cls.unmarshal(store.read(position)) | ||
| record = store.codec.decode_record(store.read(position)) |
There was a problem hiding this comment.
store.read(position) can return None if the store file is truncated. Passing None to decode_record will cause a TypeError when it attempts to unpack or index the input. A check should be added to handle this case gracefully.
raw_bytes = store.read(position)
if raw_bytes is None:
return None
record = store.codec.decode_record(raw_bytes)There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a7c417792a
ℹ️ 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".
No description provided.