Skip to content

[codex] Refactor source location JSON builder#3630

Merged
bobzhang merged 1 commit into
mainfrom
codex/source-loc-json-builder
May 25, 2026
Merged

[codex] Refactor source location JSON builder#3630
bobzhang merged 1 commit into
mainfrom
codex/source-loc-json-builder

Conversation

@bobzhang
Copy link
Copy Markdown
Contributor

Summary

  • Refactor SourceLocRepr::to_json_string to use the StringBuilder interpolation append form.
  • Preserve the existing compact JSON output exactly, including escaped filenames and numeric location fields.

Review notes

During local review, the initial refactor emitted extra JSON whitespace and failed the source location snapshots. I adjusted the interpolation literal to keep the previous output stable.

Validation

  • moon fmt
  • moon info (no .mbti changes)
  • moon test builtin/source_loc_wbtest.mbt
  • moon check
  • moon test (6502 passed)

@coveralls
Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 4496

Coverage decreased (-0.002%) to 94.076%

Details

  • Coverage decreased (-0.002%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 15851
Covered Lines: 14912
Line Coverage: 94.08%
Coverage Strength: 207346.47 hits per line

💛 - Coveralls

@bobzhang bobzhang marked this pull request as ready for review May 25, 2026 13:48
Copilot AI review requested due to automatic review settings May 25, 2026 13:48
@bobzhang bobzhang enabled auto-merge (rebase) May 25, 2026 13:49
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Refactors SourceLocRepr::to_json_string in builtin/autoloc.mbt to use the StringBuilder interpolation append form while preserving the exact compact JSON output format (including escaped filenames and numeric fields).

Changes:

  • Replaced a sequence of write_string calls with a single sb <+ $|... interpolated append.
  • Kept filename escaping behavior by continuing to delegate to StringView::escape_to.
  • Maintained field order and compact formatting to avoid snapshot/test diffs.

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

@bobzhang bobzhang merged commit a6f01f3 into main May 25, 2026
15 checks passed
@bobzhang bobzhang deleted the codex/source-loc-json-builder branch May 25, 2026 13:50
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.

3 participants