Skip to content

fix(formatter): stringify bigint values in JSON diagnostics#6546

Open
xianjianlf2 wants to merge 1 commit into
Effect-TS:mainfrom
xianjianlf2:fix/inspectable-stringify-bigint-4662
Open

fix(formatter): stringify bigint values in JSON diagnostics#6546
xianjianlf2 wants to merge 1 commit into
Effect-TS:mainfrom
xianjianlf2:fix/inspectable-stringify-bigint-4662

Conversation

@xianjianlf2

@xianjianlf2 xianjianlf2 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Fixes #4662

Summary

  • stringify BigInt values with an n suffix in Formatter.formatJson instead of letting JSON.stringify throw
  • add regression coverage for both formatJson and Inspectable.toStringUnknown
  • add a patch changeset for the runtime behavior change

Tests

  • pnpm test packages/effect/test/Formatter.test.ts
  • pnpm lint-fix
  • pnpm check

Summary by CodeRabbit

  • Bug Fixes
    • Improved JSON diagnostics formatting to safely handle BigInt values without errors.
    • BigInt values are now displayed as strings with an n suffix, including when nested in arrays.
    • Updated formatting documentation to clarify BigInt serialization and indentation behavior.

@changeset-bot

changeset-bot Bot commented Jul 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 376aad8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 27 packages
Name Type
effect Patch
@effect/opentelemetry Patch
@effect/platform-browser Patch
@effect/platform-bun Patch
@effect/platform-node-shared Patch
@effect/platform-node Patch
@effect/vitest Patch
@effect/ai-anthropic Patch
@effect/ai-openai-compat Patch
@effect/ai-openai Patch
@effect/ai-openrouter Patch
@effect/atom-react Patch
@effect/atom-solid Patch
@effect/atom-vue Patch
@effect/sql-clickhouse Patch
@effect/sql-d1 Patch
@effect/sql-libsql Patch
@effect/sql-mssql Patch
@effect/sql-mysql2 Patch
@effect/sql-pg Patch
@effect/sql-pglite Patch
@effect/sql-sqlite-bun Patch
@effect/sql-sqlite-do Patch
@effect/sql-sqlite-node Patch
@effect/sql-sqlite-react-native Patch
@effect/sql-sqlite-wasm Patch
@effect/openapi-generator Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-project-automation github-project-automation Bot moved this to Discussion Ongoing in PR Backlog Jul 23, 2026
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: bcbc9394-ce37-41e3-80fb-d41fd7dbba41

📥 Commits

Reviewing files that changed from the base of the PR and between 4e0be58 and 376aad8.

📒 Files selected for processing (3)
  • .changeset/brown-glasses-thank.md
  • packages/effect/src/Formatter.ts
  • packages/effect/test/Formatter.test.ts

📝 Walkthrough

Walkthrough

formatJson now safely serializes BigInt values as strings with an n suffix. Documentation, regression tests for formatter and inspectable output, and a patch changeset were added.

Changes

BigInt JSON formatting

Layer / File(s) Summary
Safe BigInt serialization and regression coverage
packages/effect/src/Formatter.ts, packages/effect/test/Formatter.test.ts, .changeset/brown-glasses-thank.md
formatJson converts redacted BigInt values to suffixed strings, documents the behavior, and tests formatter and Inspectable.toStringUnknown output.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested labels: bug

Suggested reviewers: gcanti

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The BigInt serialization fix and regression tests address the logging failure caused by JSON.stringify in Inspectable output.
Out of Scope Changes check ✅ Passed All changes support the BigInt serialization fix, test coverage, or release metadata, with no unrelated code changes.

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot added the bug Something isn't working label Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Discussion Ongoing

Development

Successfully merging this pull request may close these issues.

Handle BigInt safely in Inspectable.stringifyCircular

1 participant