refactor: migrate JSON from sonic to encoding/json/v2 - #253
Conversation
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (20)
Cache: Disabled due to Reviews > Disable Cache setting Knowledge base: Disabled due to 📝 WalkthroughWalkthroughThe change removes optional Sonic JSON initialization and configuration. Proxy caching and webhook validation use ChangesSonic JSON removal
Estimated code review effort: 2 (Simple) | ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
Wire encoding/json/v2 into strutils, drop USE_SONIC_JSON, and keep time.Duration as nanosecond numbers so existing API JSON still round-trips.
Remove the local JSON v2 registration and tests, and use goutils string helpers for proxy cache keys and webhook validation. Update related documentation to reflect the centralized backend. Submodule updates: - refactor(strings): migrate JSON serialization to encoding/json/v2 - chore: update Go base image and wiki documentation - chore(deps): update wiki submodule for json/v2 docs (#18)
|
Note Docstrings generation - SUCCESS |
Docstrings generation was requested by @yusing. The following files were modified: * `agent/pkg/handler/proxy_http.go` * `internal/notif/webhook.go` These files were kept as they were: * `agent/cmd/main.go` * `internal/serialization/serialization.go` These files were ignored: * `internal/homepage/override_config_test.go` These file types are not supported: * `.env.example` * `agent/go.mod` * `agent/pkg/agent/templates/agent.compose.yml.tmpl` * `go.mod` * `goutils` * `internal/dnsproviders/go.mod` * `internal/homepage/integrations/qbittorrent/README.md` * `internal/jsonstore/README.md` * `internal/metrics/README.md` * `internal/metrics/period/README.md` * `internal/metrics/uptime/README.md` * `internal/serialization/README.md` * `rootless.env.example` * `webui`
|



Summary
Stacked on #252 (
feat/go1.27).Replace bytedance/sonic with Go 1.27
encoding/json/v2as the JSON backend wired intostrutils. DropUSE_SONIC_JSONand the SIGILL workaround.Changes
internal/serializationalways registersencoding/json/v2+encoding/json/jsontextonstrutils(setupJSONV2())time.Durationkeeps v1 nanosecond numbers viaencoding/json.FormatDurationAsNano, so health/timeout JSON still round-tripsjson/v2instead ofsonic.MarshalUSE_SONIC_JSONfrom.env.example, rootless env, agent compose template, install script, agent logs, and user-facing wikiNot dropped
Gin still lists
github.com/bytedance/sonicas an indirect module becausegin/codec/jsonhas a//go:build sonicfile. Default gin builds do not use that codec.Docs
Wiki and webui submodule branches:
Summary by CodeRabbit
Improvements
Documentation
Maintenance