fix(ci): Resolve double JSON.parse in redirect chain lint workflow#18705
Open
s1gr1d wants to merge 1 commit into
Open
fix(ci): Resolve double JSON.parse in redirect chain lint workflow#18705s1gr1d wants to merge 1 commit into
JSON.parse in redirect chain lint workflow#18705s1gr1d wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| try { | ||
| const jsonString = JSON.parse(lintResultJsonString); | ||
| lintResult = JSON.parse(jsonString); | ||
| lintResult = typeof lintResultRaw === 'string' ? JSON.parse(lintResultRaw) : lintResultRaw; |
Contributor
There was a problem hiding this comment.
Bug: The lint_result output is a JSON-encoded string. A single JSON.parse is not enough to convert it into an object, causing the script to fail silently.
Severity: MEDIUM
Suggested Fix
The lintResultRaw variable is a JSON-encoded string that needs to be parsed twice to become a usable JavaScript object. Restore the double JSON.parse call, which will first unescape the string and then parse the resulting JSON string into an object.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: .github/workflows/lint-redirect-chains.yml#L74
Potential issue: The `steps.lint.outputs.lint_result` variable is a string containing
JSON. The `toJSON()` function in the GitHub workflow escapes this string, creating a
JSON-encoded string. The code then uses a single `JSON.parse` on this value. This only
reverses the `toJSON()` escaping, resulting in `lintResult` being a string of JSON, not
a JavaScript object. Consequently, attempts to access properties like
`lintResult.redirectChains` and `lintResult.contentLinkIssues` return `undefined`. This
causes the script to silently fail and not post the linting results as a PR comment.
Did we get this right? 👍 / 👎 to inform future reviews.
aldy505
approved these changes
Jul 14, 2026
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.
Fix a regression in CI (breaks on every new PR right now)
Workflow added in: #18620
Fix
SyntaxError: "[object Object]" is not valid JSONin the redirect chain lint CI step by removing redundant double-parse of the lint result output.