Skip to content

V2 record fileformat#88

Open
arun1729 wants to merge 1 commit into
masterfrom
v4.0.0
Open

V2 record fileformat#88
arun1729 wants to merge 1 commit into
masterfrom
v4.0.0

Conversation

@arun1729
Copy link
Copy Markdown
Owner

No description provided.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Codecov Report

❌ Patch coverage is 77.27273% with 65 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.48%. Comparing base (8b09a18) to head (a12cfd5).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
cog/codec.py 74.19% 64 Missing ⚠️
cog/core.py 97.36% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread cog/codec.py
Comment thread cog/core.py Outdated
# @profile
def load_from_store(cls, position: int, store):
record = cls.unmarshal(store.read(position))
record = store.codec.decode_record(store.read(position))
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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)

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread cog/codec.py Outdated
Comment thread cog/codec.py Outdated
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