refactor(decoder): delegate JSONFormatConfig to spanvalue v0.1.9#582
refactor(decoder): delegate JSONFormatConfig to spanvalue v0.1.9#582
Conversation
Replace the local JSON formatting implementation (106 lines) with a one-line delegation to spanvalue.JSONFormatConfig(). The comprehensive type coverage tests are now maintained in spanvalue; only a smoke test remains here. Also update spantype to v0.3.9 (adds typector type constant functions). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request updates the spantype and spanvalue dependencies to versions 0.3.9 and 0.1.9, respectively. The JSONFormatConfig in the decoder package has been refactored to delegate directly to the spanvalue library, allowing for the removal of redundant local formatting logic and extensive test cases. I have no feedback to provide.
Code Metrics Report📊 View detailed coverage report (available for 7 days)
Details | | main (6f62e81) | #582 (95b7bb8) | +/- |
|---------------------|----------------|----------------|-------|
- | Coverage | 70.9% | 70.8% | -0.2% |
| Files | 78 | 78 | 0 |
| Lines | 7094 | 7075 | -19 |
- | Covered | 5036 | 5014 | -22 |
- | Code to Test Ratio | 1:1.3 | 1:1.3 | -0.1 |
| Code | 16470 | 16419 | -51 |
- | Test | 21619 | 21376 | -243 |
- | Test Execution Time | 1m12s | 1m15s | +3s |Code coverage of files in pull request scope (84.6% → 81.6%)
Reported by octocov |
There was a problem hiding this comment.
Pull request overview
Refactors the decoder’s JSON value formatting to rely on the upstream spanvalue implementation, simplifying local maintenance and aligning JSONL output behavior with the shared library.
Changes:
- Delegate
decoder.JSONFormatConfig()tospanvalue.JSONFormatConfig()(removes local formatting logic). - Replace comprehensive local JSON formatting tests with a minimal smoke test.
- Bump dependencies:
spanvalueto v0.1.9 andspantypeto v0.3.9 (plus correspondinggo.sumupdates).
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| internal/mycli/decoder/jsonvalue.go | Removes local JSON formatting implementation and delegates to spanvalue.JSONFormatConfig(). |
| internal/mycli/decoder/jsonvalue_test.go | Collapses detailed type coverage tests into a single delegation smoke test. |
| go.mod | Updates spanvalue and spantype versions to pick up upstream JSON formatting behavior. |
| go.sum | Updates module checksums to match the dependency bumps. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Cover NULL, STRING, BOOL, JSON pass-through, ARRAY, and STRUCT in addition to INT64 to detect regressions from spanvalue upgrades. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request updates the spantype and spanvalue dependencies to version 0.3.9 and 0.1.9, respectively. The JSONFormatConfig implementation in the decoder package has been refactored to delegate directly to the spanvalue library, allowing for the removal of redundant formatting logic. Additionally, the associated unit tests were simplified by utilizing the gcvctor helper package. I have no feedback to provide.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 4 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@gemini-code-assist /request-summary |
Summary of ChangesThis pull request simplifies the codebase by offloading JSON formatting responsibilities to the Highlights
Activity
|
Summary
Replace the local JSON formatting implementation in
decoder/jsonvalue.go(106 lines of formatting logic) with a one-line delegation tospanvalue.JSONFormatConfig()from spanvalue v0.1.9. The comprehensive type coverage tests (302 lines) are now maintained upstream in spanvalue; only a smoke test remains here.This is a follow-up to #581 which added type-aware JSONL output. The JSON formatting logic was subsequently upstreamed to spanvalue#1 with improvements (ENUM as number, nil Value safety, structpb.MarshalJSON delegation, etc.).
Key Changes
spanvalue.JSONFormatConfig())spanvaluev0.1.8 → v0.1.9,spantypev0.3.8 → v0.3.9Development Insights
Discoveries
isNull,structpb.Value.MarshalJSON()delegation for most typesFormatRowJSONObject,FormatCompactArray,FormatJSONObjectStruct,UnnamedFieldNamerand other building blocks that could simplify future JSONL enhancementsTest Plan
make checkpasses42)