From a93a8135be1657a41059f77d0879dfc11efd8129 Mon Sep 17 00:00:00 2001 From: Josh Knapp Date: Tue, 17 Nov 2026 12:16:55 -0800 Subject: [PATCH] fix(aws): settings layout and deploy for anyone who can Hosts settings live in a 224-320px sidebar; nowrap buttons and long ARNs, policy names and run summaries overflowed it. Button and StatusIndicator get an opt-in wrap prop; host, environment, progress and policy rows wrap with min-w-0 children; policy copy buttons sit in an auto-fill grid; pre blocks scroll; the Modal footer wraps. Deploy a new environment and self-join are offered to anyone after a scan. When the permission check didn't confirm environment-admin rights a note says AWS has the last word, and the policies and environment request sit under a 'Not an admin?' disclosure. The boundary note shows whenever the boundary is missing. AWS refusals show AWS's message (awsErrorMessage now names the denied action) and offer the admin bundle: in the deploy and join modals, and under a failed deploy/join run whose output reads as denied. The backend already had no tier check on onboard_aws_user; its comment is corrected. Co-Authored-By: Claude Opus 5.5 --- .../src/commands/environment_commands.rs | 7 +- app/src/components/settings/HostsSettings.tsx | 26 +-- .../settings/hosts/AdminBundleModal.tsx | 2 +- .../settings/hosts/DeployEnvironmentModal.tsx | 19 +- .../settings/hosts/DeployProgress.test.tsx | 28 ++- .../settings/hosts/DeployProgress.tsx | 23 +- .../settings/hosts/Ec2CapacityFields.tsx | 1 + .../settings/hosts/EnvironmentsPanel.test.tsx | 176 ++++++++++++++- .../settings/hosts/EnvironmentsPanel.tsx | 202 ++++++++++++------ .../settings/hosts/JoinEnvironmentModal.tsx | 30 ++- .../settings/hosts/NetworkFields.tsx | 1 + .../components/settings/hosts/PolicyFiles.tsx | 48 +++-- .../settings/hosts/environmentFormat.ts | 4 + app/src/components/ui/Button.test.tsx | 19 ++ app/src/components/ui/Button.tsx | 14 +- app/src/components/ui/Modal.tsx | 2 +- app/src/components/ui/StatusIndicator.tsx | 5 +- app/src/lib/aws-error.test.ts | 19 +- app/src/lib/aws-error.ts | 13 ++ 19 files changed, 498 insertions(+), 141 deletions(-) diff --git a/app/src-tauri/src/commands/environment_commands.rs b/app/src-tauri/src/commands/environment_commands.rs index 736a346..71d6e9a 100644 --- a/app/src-tauri/src/commands/environment_commands.rs +++ b/app/src-tauri/src/commands/environment_commands.rs @@ -374,9 +374,10 @@ pub(crate) fn ec2_collision_refusal( /// Everything a self-onboarding apply needs settled before it starts: the /// caller's record, the capacity ([`resolve_ec2`]), the module variables /// and, with EC2 capacity, the name check ([`ec2_collision_refusal`]). -/// Check-then-apply leaves a narrow race (another admin creating the same -/// names in between); only admins apply, and the module would then fail on -/// create rather than adopt. +/// Check-then-apply leaves a narrow race (someone else creating the same +/// names in between); the module would then fail on create rather than +/// adopt. Anyone may start this: there is no tier check in the app, and AWS +/// refuses (mapped to `AccessDenied`) what the caller isn't permitted. pub(crate) async fn prepare_onboarding( api: &A, env: &str, diff --git a/app/src/components/settings/HostsSettings.tsx b/app/src/components/settings/HostsSettings.tsx index b1653d9..9a70a49 100644 --- a/app/src/components/settings/HostsSettings.tsx +++ b/app/src/components/settings/HostsSettings.tsx @@ -64,7 +64,7 @@ function ErrorLine({ }) { return (
- {awsErrorMessage(failure.error)} + {awsErrorMessage(failure.error)} {failure.error.kind === "sso_expired" && !onSignIn && ( Sign in with aws sso login --profile {failure.error.profile} and try again. @@ -124,7 +124,7 @@ function PermissionReportView({ report }: { report: PermissionReport }) { > {badge} - + {report.identity.arn} · {report.region}
@@ -154,8 +154,8 @@ function PermissionReportView({ report }: { report: PermissionReport }) {
    {t.results.map((r) => ( -
  • - {r.action} — {r.verdict} +
  • + {r.action} — {r.verdict} {r.note && ( <> {" "} @@ -263,7 +263,7 @@ function ConnectionRow({ host }: { host: HostConnection }) {
  • {editing ? (
    @@ -273,7 +273,7 @@ function ConnectionRow({ host }: { host: HostConnection }) { setRegion(e.target.value)} /> )} -
    +
    @@ -283,16 +283,16 @@ function ConnectionRow({ host }: { host: HostConnection }) {
    ) : ( -
    +
    -
    {host.name}
    -
    +
    {host.name}
    +
    {auth.method === "profile" ? `Profile: ${auth.name}` : "Access keys"} {" · "} {host.kind.default_region}
    -
    +
    @@ -309,7 +309,7 @@ function ConnectionRow({ host }: { host: HostConnection }) { )} {confirmRemove && (
    - Remove {host.name}? Its stored credentials are deleted. + Remove {host.name}? Its stored credentials are deleted. @@ -501,7 +501,7 @@ function AddConnectionForm() { {busy ? "Adding…" : "Add connection"} {signedInAs && ( -

    +

    Signed in as {signedInAs}

    )} @@ -516,7 +516,7 @@ export default function HostsSettings() { const { appSettings } = useSettings(); const hosts = appSettings?.hosts ?? []; return ( -
    +

    Where project environments run. AWS connections check what your credentials can do, and find, deploy and join environments.

    diff --git a/app/src/components/settings/hosts/AdminBundleModal.tsx b/app/src/components/settings/hosts/AdminBundleModal.tsx index 59719e4..6a852e2 100644 --- a/app/src/components/settings/hosts/AdminBundleModal.tsx +++ b/app/src/components/settings/hosts/AdminBundleModal.tsx @@ -177,7 +177,7 @@ export default function AdminBundleModal({ Saved to {saved}

    From that folder, run:

    -
    +            
                   {COMMANDS}
                 
    -
    {boundaryError && ( -

    +

    {awsErrorMessage(boundaryError)}

    )} @@ -149,6 +153,7 @@ export default function DeployEnvironmentModal({

    +
    + )}
    )} diff --git a/app/src/components/settings/hosts/DeployProgress.test.tsx b/app/src/components/settings/hosts/DeployProgress.test.tsx index 0e4e17c..99c4065 100644 --- a/app/src/components/settings/hosts/DeployProgress.test.tsx +++ b/app/src/components/settings/hosts/DeployProgress.test.tsx @@ -1,6 +1,6 @@ import { describe, it, expect, vi, beforeEach } from "vitest"; -import { act, renderHook } from "@testing-library/react"; -import { runKey, useDeployRuns } from "./DeployProgress"; +import { act, render, renderHook, screen } from "@testing-library/react"; +import DeployProgressView, { runKey, useDeployRuns } from "./DeployProgress"; import type { DeployProgress } from "../../../lib/types"; import { progress, tofuEvent } from "./testkit"; @@ -75,3 +75,27 @@ describe("useDeployRuns", () => { expect(result.current.runs).toEqual({}); }); }); + +describe("DeployProgress layout", () => { + it("wraps its header and a long failure summary", () => { + render( + , + ); + const header = screen.getByTestId("deploy-progress-header"); + expect(header.className).toContain("flex-wrap"); + expect(header.firstElementChild?.className).toContain("min-w-0"); + expect(screen.getByRole("status").firstElementChild?.className).toContain("whitespace-normal"); + }); +}); diff --git a/app/src/components/settings/hosts/DeployProgress.tsx b/app/src/components/settings/hosts/DeployProgress.tsx index bd51d1b..f2008e4 100644 --- a/app/src/components/settings/hosts/DeployProgress.tsx +++ b/app/src/components/settings/hosts/DeployProgress.tsx @@ -146,7 +146,7 @@ function EventLine({ e }: { e: TofuEvent }) { return (
  • {(e.resource || e.action) && ( - + {e.resource && {e.resource}} {e.action && {e.action}} @@ -154,10 +154,10 @@ function EventLine({ e }: { e: TofuEvent }) { {isError ? ( <> Error: -
    {e.message}
    +
    {e.message}
    ) : ( - {e.message} + {e.message} )}
  • ); @@ -205,14 +205,14 @@ export default function DeployProgress({ return (
    -
    -
    - {run.label} +
    +
    + {run.label} {status && }
    -
    +
    {!run.done && ( +
    + )} +
    + ); + }; const envRow = (found: EnvironmentScan, e: DetectedEnvironment) => { const at = found.region; @@ -349,10 +386,10 @@ export default function EnvironmentsPanel({ data-testid={`env-${e.name}`} className="border border-[var(--border-color)] rounded-[var(--radius-control)] p-2 space-y-1.5" > -
    -
    -
    - {e.name} +
    +
    +
    + {e.name} {onboarding === "joined" && } {onboarding === "in_progress" && } @@ -407,11 +444,11 @@ export default function EnvironmentsPanel({ })()}
    )} - {!isAdmin && isWaiting && onboarding !== "joined" && ( + {isWaiting && onboarding !== "joined" && (
    Waiting for an admin to onboard you
    )}
    -
    +
    {has("join") && onboarding !== "joined" && onboarding !== "in_progress" && ( )} {has("join") && onboarding === "joined" && ( )} {mine("follow") && ( @@ -548,7 +586,7 @@ export default function EnvironmentsPanel({
    {rowError && ( -

    +

    {awsErrorMessage(rowError)}

    )} @@ -560,14 +598,14 @@ export default function EnvironmentsPanel({ const nothingFound = !!current && current.environments.length === 0; return ( -
    +
    {open && ( -
    -
    +
    +
    {(id) => (