Conversation
…ectly
Customer Simon reported that an IAM bucket policy embedded in an
auto-generated manual step was rendering with parts inside the code
block and parts as plain prose. Verified the cause in
RemediationDialog's `TextWithInlineCode`: the previous splitter used
a regex that only handles ONE level of brace nesting
\{[^{}]*"(?:Version|Effect|Statement)"[^{}]*(?:\{[^{}]*\}[^{}]*)*\}
so a CloudTrail bucket policy — which has two-deep nesting via
`Statement[].Principal.{...}` AND `Statement[].Condition.StringEquals.
{...}` — matched only the first Statement object. The outer
`{"Version":...,"Statement":[` wrapper and the second Statement
escaped into prose around the code block.
Replaces the regex with a brace-balanced scan in a new helper
`extract-json-segments.ts`:
- Walks the string counting braces, respecting string literals and
escaped quotes so `"description":"} { inside"` doesn't confuse
the depth counter.
- Validates each candidate via `JSON.parse` before classifying it
as a code block — invalid candidates fall through to text so we
don't render garbage.
- Pure function, no React/DOM, easy to test in isolation.
18 unit tests cover: arbitrary nesting, arrays of objects, multiple
JSONs in one step, escaped quotes, unbalanced braces, the customer-
reported CloudTrail-policy round-trip, and the no-JSON pass-through.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ndering fix(cloud-tests): render nested JSON in manual remediation steps correctly
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
Contributor
|
🎉 This PR is included in version 3.63.2 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
This is an automated pull request to release the candidate branch into production, which will trigger a deployment.
It was created by the [Production PR] action.
Summary by cubic
Fixes nested JSON rendering in Cloud Tests remediation steps so IAM/bucket policies display as one formatted code block. Prevents mixed prose/code caused by the old regex splitter.
extract-json-segmentsthat respects strings/arrays and validates viaJSON.parse.RemediationDialogto use the new helper for inline JSON detection and pretty-printing.Written for commit 30b9e80. Summary will update on new commits. Review in cubic