fix: triage jsonmarshalignoredeerror violations and enforce linter in CI#36032
Merged
Conversation
4 tasks
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
- Tier 1: properly handle json.Marshal error in safe_outputs_config_generation.go - Add //nolint:jsonmarshalignoredeerror to all provably-safe sites (string, []string, VSCodeMCPServer, ExperimentConfig marshal calls) - Add nolint directive support to jsonmarshalignoredeerror linter (matching the errstringmatch pattern using internal/nolint package) - Add Suppressed() test case to linter testdata to cover nolint behavior - Enforce linter by adding -jsonmarshalignoredeerror to LINTER_FLAGS in cgo.yml Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Contributor
|
Hey
If you'd like a hand closing out the checklist, you can assign this prompt to your coding agent:
|
Copilot
AI
changed the title
[WIP] Triage and enforce jsonmarshalignoredeerror linter for prod sites
fix: triage jsonmarshalignoredeerror violations and enforce linter in CI
May 31, 2026
pelikhan
approved these changes
May 31, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes and enforces handling for ignored encoding/json marshal errors by propagating the one actionable production error, documenting safe suppressions, and enabling the existing custom analyzer in CI.
Changes:
- Propagates
json.Marshalerrors from safe outputs config generation. - Adds
//nolint:jsonmarshalignoredeerrorsupport and testdata for the custom linter. - Annotates currently safe ignored marshal sites and enables the linter in CI.
Show a summary per file
| File | Description |
|---|---|
pkg/workflow/safe_outputs_config_generation.go |
Propagates marshal failure with contextual error. |
pkg/workflow/repo_memory.go |
Suppresses safe string-slice marshal discard. |
pkg/workflow/mcp_renderer_github.go |
Suppresses safe string marshal discard. |
pkg/workflow/mcp_config_playwright_renderer.go |
Suppresses safe string marshal discards in JSON array rendering. |
pkg/workflow/copilot_logs.go |
Suppresses len-only input-size marshal discard. |
pkg/workflow/compiler_yaml.go |
Suppresses safe string-slice marshal discard. |
pkg/workflow/compiler_pre_activation_job.go |
Suppresses safe string-slice marshal discards. |
pkg/workflow/compiler_experiments.go |
Suppresses safe experiment spec marshal discards. |
pkg/workflow/cache.go |
Suppresses safe string-slice marshal discards. |
pkg/workflow/args.go |
Suppresses safe string marshal discard. |
pkg/linters/jsonmarshalignoredeerror/testdata/src/jsonmarshalignoredeerror/jsonmarshalignoredeerror.go |
Adds a suppression testdata case. |
pkg/linters/jsonmarshalignoredeerror/jsonmarshalignoredeerror.go |
Adds shared nolint directive support. |
pkg/cli/mcp_config_file.go |
Suppresses safe VS Code MCP server config marshal discards. |
.github/workflows/daily-model-inventory.lock.yml |
Updates generated metadata hash. |
.github/workflows/cgo.yml |
Enables jsonmarshalignoredeerror in custom linter CI flags. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 15/15 changed files
- Comments generated: 1
Comment on lines
+59
to
+62
| position := pass.Fset.PositionFor(call.Pos(), false) | ||
| if nolint.HasDirective(position, noLintLinesByFile) { | ||
| return | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
19 production sites across 11 files discarded
json.Marshalerrors with_, causing silentnil-byte writes into generated workflow YAML/JSON. Thejsonmarshalignoredeerrorcustom linter existed but was not enforced and had no//nolintdirective support.Changes
Linter: add
//nolintdirective supportpkg/linters/jsonmarshalignoredeerror/jsonmarshalignoredeerror.go— integratedinternal/nolint(matching theerrstringmatchpattern) so callers can suppress with//nolint:jsonmarshalignoredeerror. Added aSuppressed()test case to testdata.Tier 1 — propagate error (function already returns
error)pkg/workflow/safe_outputs_config_generation.go:198— the surrounding function returns(string, error)but was silently swallowing the marshal failure, yielding""with anilerror:Tier 3 — annotate provably-safe sites (18 sites, 10 files)
All remaining sites marshal types that cannot fail (
string,[]string,*ExperimentConfig/VSCodeMCPServerwith only basic-type fields). Each gets a//nolint:jsonmarshalignoredeerrorcomment with a brief justification, e.g.:CI enforcement
Added
-jsonmarshalignoredeerrortoLINTER_FLAGSin.github/workflows/cgo.yml, locking the guard alongside the 8 previously enforced analyzers.