Skip to content

feat: construct tree and violations - #1653

Merged
megha-narayanan merged 7 commits into
aws:feat/cdk-explorerfrom
megha-narayanan:feat/explorer-web-tree-violations-v2
Jul 1, 2026
Merged

feat: construct tree and violations#1653
megha-narayanan merged 7 commits into
aws:feat/cdk-explorerfrom
megha-narayanan:feat/explorer-web-tree-violations-v2

Conversation

@megha-narayanan

@megha-narayanan megha-narayanan commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Adds two read-only views to the cdk explore web UI.

  • Construct tree (GET /api/tree): the synthesized construct hierarchy. Each
    node is flagged with the highest severity of any policy violation on it, so
    problem areas are visible at a glance.
  • Policy-validation panel (GET /api/policy-validation): violations grouped
    by rule, sorted by severity, labeled with the originating plugin.

The server reads the cloud assembly in cdk.out and returns a wire-stable,
app-relative view. The backend owns the full transform from core construct node
to displayed node, including default-child collapse and the per-node
highest-severity join, so the frontend renders without re-deriving any of it.

Out of scope

  • Navigation between a construct, its synthesized template, and its source. The
    wire model already carries templateFile and sourceLocation, but no
    navigation UI yet.
  • Frontend tests (adds deps, so future PR)

frontend:
Screenshot 2026-07-01 at 11 32 09 AM

Checklist

  • This change contains a major version upgrade for a dependency and I confirm all breaking changes are addressed
    • Release notes for the new version:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

On top of the cloudscape frontend scaffold (aws#1606):

- GET /api/tree + /api/policy-validation (toWebNode, normalizeViolations); assemblyDir plumbing; no-store on the unversioned bundle

- collapseDefaultChildren folds the synthetic Resource/Default leaf into its parent (display only; violations join on the full tree)

- ConstructTree: collapsible, spill-proof rows, friendly type labels, double-click rename with localStorage + revert

- ViolationsPanel: severity-sorted, colored [SEVERITY] prefix, scrollable

- App: uniform Cloudscape Containers, horizontally resizable construct tree
Backend owns the core-node to displayed-node transform: default-child collapse and per-node highest-severity join. The Cloudscape frontend renders without re-deriving it, and severity rules are shared between server and SPA. Read-only; three-way navigation and frontend tests are deferred to follow-ups.
severityRank, severityHexColor, normalize and severityStyle only ever receive a resolved label: displaySeverity always returns a string and the tree guards before calling. The string | undefined params and the ?? fallback were dead, so narrow to string.
…nsError

The cdk-lsp merge into the base folds a failed validation-report load into AssemblyData.warnings and removes the violationsError field. Drop the web reportError plumbing (route body, ViolationsResponse type, ViolationsPanel banner, and its route test) to match the new contract.
…d show app path

- Add `inheritedSeverity` field to WebConstructNode, computed as the
  worst severity from any descendant when the node itself has no direct
  violation. Lets the tree UI color ancestor labels so users can drill
  down to offending constructs without expanding every branch.
- Render inherited severity as a muted colored label (no dot), matching
  the VS Code pattern of distinguishing direct vs propagated diagnostics.
- Add GET /api/info endpoint returning the CDK app directory path.
- Display the app path in the page header description.
- Fix readAssembly type to accept async (Promise<AssemblyReadResult>).
@megha-narayanan
megha-narayanan force-pushed the feat/explorer-web-tree-violations-v2 branch from fc099bb to a83f059 Compare July 1, 2026 16:29
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* label, so a newer or non-conforming report can never produce a wire value
* that violates {@link WebViolationSeverity}.
*/
export function classifyReportSeverity(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think I entirely understand what this function is doing. Is there a possibility that a construct can get assigned a severity and it is not one we recognize? (Error, Fatal, Warning, etc)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Severity comes from the validator plugin, where it's just a free-form string (so it can be anything), and construct annotations, where addWarning/addError/addInfo map to warning/error/info.

@megha-narayanan
megha-narayanan merged commit 01f3ff6 into aws:feat/cdk-explorer Jul 1, 2026
6 of 7 checks passed
@megha-narayanan
megha-narayanan deleted the feat/explorer-web-tree-violations-v2 branch July 1, 2026 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants