Skip to content

feat: decode errors that are safe to log - #96

Merged
Makisuo merged 4 commits into
MapleTechLabs:mainfrom
artile:feat/safe-decode-errors
Nov 2, 2026
Merged

Makisuo merged 4 commits into
MapleTechLabs:mainfrom
artile:feat/safe-decode-errors

Conversation

@artile

@artile artile commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Closes #78

The error now carries dialect, collection, column and the Schema
path, kind and expected type of each issue. The Schema error moves
from cause to a non-enumerable schemaError property, so message,
toString, JSON, inspect and Cause.pretty print no row values.
Adds formatDecodeError with an opt-in verbose flag.
@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You'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 48 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f9f79e0c-c913-40e7-a307-1373b9f00e2b
Commits

Reviewing files that changed from the base of the PR and between b57faf1 and 1b2ccc2.

Files selected for processing: 13
  • .changeset/safe-decode-errors.md
  • docs/decoding-results.md
  • docs/reference.md
  • docs/troubleshooting.md
  • src/ch/compile.ts
  • src/ch/decode-error.test.ts
  • src/ch/decode-error.ts
  • src/core.ts
  • src/database/database.test.ts
  • src/database/database.ts
  • src/docs-examples.test.ts
  • src/sqlite/d1.test.ts
  • src/sqlite/sqlite.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@artile
artile marked this pull request as ready for review October 25, 2026 15:02
@Makisuo

Makisuo commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Merge-readiness pass (head 1b2ccc2):

Changed

  • Merged main with no conflicts. On main every CompiledQueryDecodeError is built through decodeErrorFromCause in compile.ts and Database.query, so the SQLite and D1 dialects get the safe error without further code.
  • Tests: the SQLite decode-failure test now checks dialect: "sqlite", collection and column. The D1 "integer past 2^53" test checks dialect: "d1" and that Cause.pretty of the failure does not contain the stored number.

For the maintainer to decide

  • Path segments go into issues, message and formatDecodeError unredacted. For column aliases that is right. For a Schema.Record inside a JSON column, though, a path key is row data (an email used as a key, for example). Consider either dropping non-struct keys or documenting it.
  • This is a breaking change for anyone who read error.cause or built the error by hand. The changeset says so; it is a minor bump at 0.x.

Verified

  • bun run typecheck, then bun run test with a live ClickHouse 26.8: 74 files, 1436 tests, plus doc checks, all green.
  • FUZZ_SCALE=0.3 vitest run tests/fuzz: 269 passed.
  • CI run 41472967231 failed only on the known fuzz flakes that test(fuzz): fix three flaky generated-data properties #131 fixes: Postgres "division by zero" in "generated fixtures: union/query results agree (postgres)", and ClickHouse "Division by zero" in "union results agree (clickhouse)". Every other job passed.

@Makisuo
Makisuo merged commit 0f7183a into MapleTechLabs:main Nov 2, 2026
1 of 3 checks passed
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.

Decode errors that are safe to log

2 participants