Skip to content

Handle unknown chunk types gracefully - #46

Closed
mpicciolli wants to merge 9 commits into
mainfrom
fix/skip-unknown-chunk-types
Closed

Handle unknown chunk types gracefully#46
mpicciolli wants to merge 9 commits into
mainfrom
fix/skip-unknown-chunk-types

Conversation

@mpicciolli

Copy link
Copy Markdown
Collaborator

Summary

  • Skip unknown chunk types instead of aborting the whole read when parsing CDB files
  • Bump version to 0.2.1

Test plan

  • npm test (78 tests passed)
  • npm run build

mpicciolli and others added 8 commits July 15, 2026 10:16
readChunk() threw on any chunk type it didn't recognize. A future PCM
version adding a new chunk type to the save format would make this
library unable to read those saves at all, even for tables/chunks it
otherwise understands. Since every chunk header carries its own
chunkSize, an unknown chunk can be skipped by byte count (with a
warning) instead of aborting, preserving forward compatibility.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 21, 2026 02:02
@mpicciolli mpicciolli closed this Jul 21, 2026
@mpicciolli
mpicciolli deleted the fix/skip-unknown-chunk-types branch July 21, 2026 02:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the CDB binary parser to tolerate unknown chunk types so parsing can continue (instead of failing fast), and adds tests to validate the new behavior. It also updates package version metadata.

Changes:

  • Update CDBReader.readChunk() to warn and consume bytes for unknown chunk types rather than throwing.
  • Add Vitest coverage for unknown-chunk handling (including invalid-size error behavior).
  • Bump package version fields in package.json / package-lock.json (note: version differs from PR description).

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/reader.ts Implements unknown-chunk handling by warning and returning raw bytes instead of throwing.
test/reader.test.ts Adds tests ensuring unknown chunks are tolerated and invalid unknown chunk sizes still error.
package.json Updates package version metadata.
package-lock.json Keeps lockfile version metadata in sync with package.json.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread package.json
{
"name": "cdb-converter",
"version": "0.2.0",
"version": "0.3.0",
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.

2 participants