diff --git a/app/src-tauri/src/aws/live_tests.rs b/app/src-tauri/src/aws/live_tests.rs index f653e4b..b6de3f7 100644 --- a/app/src-tauri/src/aws/live_tests.rs +++ b/app/src-tauri/src/aws/live_tests.rs @@ -2360,12 +2360,17 @@ mod environment { // reported together), so check them all before the result. let removed = host.remove_aws_resources(¤t(&store), &settings, true).await; eprintln!("RESULT remove_aws_resources: {:?}", removed.as_ref().map_err(|e| e.chars().take(400).collect::())); - let sm = ok( - "describe the project secret", - t.e.secrets.describe_secret().secret_id(project_secret_name(&name, &okey, &id)).send().await, - ); - eprintln!("RESULT project secret after remove: deleted_date {:?}", sm.deleted_date()); - assert!(sm.deleted_date().is_some(), "the secret is scheduled for deletion"); + // R10: deleted at once, so the next start can create it again. + // The forced delete completes asynchronously; give it a moment. + let secret_gone = poll(Duration::from_secs(60), Duration::from_secs(5), || async { + match t.e.secrets.describe_secret().secret_id(project_secret_name(&name, &okey, &id)).send().await { + Err(e) if e.as_service_error().is_some_and(|s| s.is_resource_not_found_exception()) => Some(()), + _ => None, + } + }) + .await; + eprintln!("RESULT project secret after remove: gone {secret_gone:?}"); + assert!(secret_gone.is_some(), "the secret is deleted without a recovery window"); let defs = ok( "list the family", ecs_admin.list_task_definitions().family_prefix(&family).send().await, diff --git a/app/src-tauri/src/aws/runtime.rs b/app/src-tauri/src/aws/runtime.rs index 5cdadcb..8241292 100644 --- a/app/src-tauri/src/aws/runtime.rs +++ b/app/src-tauri/src/aws/runtime.rs @@ -25,8 +25,6 @@ use super::workspace::WorkspaceApi; /// The secret key holding the agent token (Task 4's payload). pub const AGENT_TOKEN_KEY: &str = "TRIPLEC_AGENT_TOKEN"; -/// Secrets Manager's recovery window when a project is removed. -pub const SECRET_RECOVERY_DAYS: i64 = 7; /// A project secret is at most 64 KiB; anything bigger is not ours. const MAX_SECRET_READ: usize = 70_000; @@ -51,8 +49,10 @@ pub trait RuntimeApi: Send + Sync { &self, id: &str, ) -> impl Future, AwsError>> + Send; - /// Schedule deletion with a [`SECRET_RECOVERY_DAYS`] window. A secret - /// that does not exist is success. + /// Delete at once (`ForceDeleteWithoutRecovery`, ruling R10): a secret + /// left pending deletion would make the project's next start fail, and + /// the app rebuilds it from local data. A secret that does not exist is + /// success. fn delete_secret(&self, name: &str) -> impl Future> + Send; /// A missing access point is success. fn delete_access_point(&self, id: &str) -> impl Future> + Send; @@ -234,13 +234,15 @@ pub struct RemoveRequest<'a> { /// missed it). pub stored_task_arn: Option<&'a str>, pub stored_access_point_id: Option<&'a str>, - /// Delete the EFS access point. Its data stays on the file system until - /// an administrator removes it; the path is not reused. + /// Delete the EFS access point (ruling R9). The files stay on the + /// user's own file system (only their task role can read it) until + /// offboarding destroys it; a later start of the same project gets a new + /// access point onto the same directory. pub discard_data: bool, } -/// Stop the project's task, schedule its secret for deletion (7 days) and, -/// with `discard_data`, delete its access point. Task definition revisions +/// Stop the project's task, delete its secret (no recovery window, R10) and, +/// with `discard_data`, delete its access point (not the files, R9). Task definition revisions /// are left registered (R8). A task that can't be stopped stops the removal (nothing /// billed may be left running); the rest is attempted in full and every /// failure reported. @@ -417,8 +419,7 @@ impl RuntimeApi for SdkRuntimeApi { .secrets .delete_secret() .secret_id(name) - .force_delete_without_recovery(false) - .recovery_window_in_days(SECRET_RECOVERY_DAYS) + .force_delete_without_recovery(true) .send() .await { @@ -429,7 +430,8 @@ impl RuntimeApi for SdkRuntimeApi { { Ok(()) } - // Already scheduled: the goal. + // Scheduled by an older version of the app and AWS refused the + // forced delete: nothing more this tier may do (no RestoreSecret). Err(e) if e.as_service_error().is_some_and(|s| { s.is_invalid_request_exception() diff --git a/app/src-tauri/src/commands/project_commands.rs b/app/src-tauri/src/commands/project_commands.rs index dfcaaea..914b03c 100644 --- a/app/src-tauri/src/commands/project_commands.rs +++ b/app/src-tauri/src/commands/project_commands.rs @@ -715,7 +715,8 @@ pub async fn remove_project( // An AWS project's task and resources go first, and a failure keeps the // project: its record is the only handle on a billed task and its - // secret. Its data (the EFS access point) goes only when asked. + // secret. Its EFS access point goes only when asked (the files stay on the + // user's own file system until offboarding). if let Some(project) = state.projects_store.get(&project_id).filter(|p| p.is_aws()) { let settings = state.settings_store.get(); if let Some(target) = ContainerTarget::for_project(&project) { diff --git a/app/src-tauri/src/host/aws_host.rs b/app/src-tauri/src/host/aws_host.rs index 7cca535..a7ba3c0 100644 --- a/app/src-tauri/src/host/aws_host.rs +++ b/app/src-tauri/src/host/aws_host.rs @@ -820,7 +820,7 @@ pub async fn stop_project(project: &Project, settings: &AppSettings) -> Result<( // ────────────────────────────────────────────────────────────── remove /// Stop the task and remove the project's AWS resources (task definition -/// revisions, the secret with a 7-day window, and with `discard_data` the +/// revisions, the secret at once, and with `discard_data` the /// access point). The tunnel is closed once that succeeded; on failure the /// project keeps it. pub async fn remove_resources( diff --git a/app/src-tauri/src/host/lifecycle.rs b/app/src-tauri/src/host/lifecycle.rs index aaea367..df81e45 100644 --- a/app/src-tauri/src/host/lifecycle.rs +++ b/app/src-tauri/src/host/lifecycle.rs @@ -131,8 +131,8 @@ impl ProjectHost { } /// AWS: stop the task and remove the project's resources — task - /// definition revisions, the secret (7-day recovery window) and, only - /// with `discard_data`, the EFS access point. Docker: nothing (its state + /// definition revisions, the secret (deleted at once) and, only + /// with `discard_data`, the EFS access point (not its files). Docker: nothing (its state /// goes with [`Self::discard_project_state`]). pub async fn remove_aws_resources( &self, diff --git a/app/src/components/projects/ConfirmRemoveModal.test.tsx b/app/src/components/projects/ConfirmRemoveModal.test.tsx index 6baf53b..e5b66d8 100644 --- a/app/src/components/projects/ConfirmRemoveModal.test.tsx +++ b/app/src/components/projects/ConfirmRemoveModal.test.tsx @@ -3,10 +3,10 @@ import { render, screen, fireEvent } from "@testing-library/react"; import ConfirmRemoveModal, { ConfirmForgetAwsModal } from "./ConfirmRemoveModal"; describe("ConfirmRemoveModal", () => { - it("keeps an AWS workspace's saved files unless asked", () => { + it("keeps an AWS workspace's access point unless asked", () => { const onConfirm = vi.fn(); render(); - const box = screen.getByRole("checkbox", { name: /saved files \(EFS\)/ }); + const box = screen.getByRole("checkbox", { name: /file-system access point/ }); expect(box).not.toBeChecked(); fireEvent.click(screen.getByRole("button", { name: "Remove" })); fireEvent.click(box); @@ -14,7 +14,7 @@ describe("ConfirmRemoveModal", () => { expect(onConfirm.mock.calls).toEqual([[{ discardData: false }], [{ discardData: true }]]); }); - it("offers no EFS choice for an Ephemeral AWS workspace", () => { + it("offers no access-point choice for an Ephemeral AWS workspace", () => { const onConfirm = vi.fn(); render(); expect(screen.queryByRole("checkbox")).toBeNull(); @@ -22,7 +22,7 @@ describe("ConfirmRemoveModal", () => { expect(onConfirm).toHaveBeenCalledWith({ discardData: false }); }); - it("offers no EFS choice for a local project", () => { + it("offers no access-point choice for a local project", () => { render(); expect(screen.queryByRole("checkbox")).toBeNull(); expect(screen.getByText(/mounted in, not copied/)).toBeInTheDocument(); diff --git a/app/src/components/projects/ConfirmRemoveModal.tsx b/app/src/components/projects/ConfirmRemoveModal.tsx index f8bed2f..df16a78 100644 --- a/app/src/components/projects/ConfirmRemoveModal.tsx +++ b/app/src/components/projects/ConfirmRemoveModal.tsx @@ -6,7 +6,7 @@ interface Props { projectName: string; /** An AWS project: its task, task definitions and secret go instead of Docker state. */ aws?: boolean; - /** AWS: the workspace may have saved files on EFS (offers deleting them). */ + /** AWS: the workspace may have an EFS access point (offers removing it). */ savedFiles?: boolean; onConfirm: (opts: { discardData: boolean }) => void; onCancel: () => void; @@ -48,8 +48,7 @@ export default function ConfirmRemoveModal({

Are you sure you want to remove{" "} {projectName}? This stops its - workspace on AWS and removes its secret (deleted after AWS’s 7-day recovery - window). Its task definitions stay registered (they hold no secrets and cost + workspace on AWS and deletes its secret. Its task definitions stay registered (they hold no secrets and cost nothing); an administrator can deregister them. Work that was not pushed to a remote is lost.

@@ -62,10 +61,11 @@ export default function ConfirmRemoveModal({ onChange={(e) => setDiscardData(e.target.checked)} /> - Also delete the workspace’s saved files (EFS) + Also remove the workspace’s file-system access point - The Claude login, history and SSH keys kept between starts. Left in place - otherwise. + The saved files themselves (Claude login, history, SSH keys) stay on your own + EFS file system, readable only by your workspace role, until an administrator + offboards you. diff --git a/app/src/components/projects/home/config/AwsConfig.test.tsx b/app/src/components/projects/home/config/AwsConfig.test.tsx index f46ff84..a3c7783 100644 --- a/app/src/components/projects/home/config/AwsConfig.test.tsx +++ b/app/src/components/projects/home/config/AwsConfig.test.tsx @@ -159,7 +159,7 @@ describe("HostSection", () => { fireEvent.click(screen.getByRole("button", { name: "Remove AWS resources…" })); const dialog = screen.getByRole("dialog"); - // Hybrid: the saved files can go too. + // Hybrid: the access point can go too (the files stay on the user's EFS). fireEvent.click(within(dialog).getByRole("checkbox")); fireEvent.click(within(dialog).getByRole("button", { name: "Remove" })); await waitFor(() => expect(removeAwsResources).toHaveBeenCalledWith(p.id, true)); diff --git a/app/src/components/projects/home/config/HostSection.tsx b/app/src/components/projects/home/config/HostSection.tsx index 508a498..d11b603 100644 --- a/app/src/components/projects/home/config/HostSection.tsx +++ b/app/src/components/projects/home/config/HostSection.tsx @@ -401,9 +401,9 @@ function RemoveAwsResourcesModal({ project, onClose }: { project: Project; onClo >

Removes {project.name}’s - secret from AWS (after a 7-day recovery window) and keeps the project, so it can run - somewhere else. Its task definitions stay registered for an administrator to - deregister. Its next start on AWS sets everything up again. + secret from AWS and keeps the project, so it can run somewhere else. Its task + definitions stay registered for an administrator to deregister. Its next start on AWS + sets everything up again.

{hasSavedFiles(project) && ( )} {error && ( diff --git a/app/src/lib/types.ts b/app/src/lib/types.ts index 8b8c967..5f78c34 100644 --- a/app/src/lib/types.ts +++ b/app/src/lib/types.ts @@ -116,7 +116,8 @@ export interface NewProjectHost { } export interface RemoveProjectOptions { - /** AWS: also delete the workspace's saved files (its EFS access point). */ + /** AWS: also remove the workspace's EFS access point (the files stay on the + * user's own file system until offboarding). */ discardData?: boolean; /** AWS: the connection is gone; remove the project and leave its AWS resources. */ forgetAwsResources?: boolean; diff --git a/aws/README.md b/aws/README.md index f32b6ba..44b9f3f 100644 --- a/aws/README.md +++ b/aws/README.md @@ -89,6 +89,15 @@ following: tagged `CreateAccessPoint` needs is authorized against the **file system**, not the new access point (verified live, phase 5), so `TagOwnAccessPointsAtCreate` names `file-system/*` and is confined by `elasticfilesystem:CreateAction = CreateAccessPoint`. +- **What removing a project removes.** Removing a project (or only its AWS resources) stops its + task and deletes its secret **at once** (`ForceDeleteWithoutRecovery`, ruling R10: the app + rebuilds it from local data, and a secret left pending deletion would make the next start's + `CreateSecret` fail). "Also remove the workspace's file-system access point" deletes only the + **access point** (ruling R9): the files under it (the Claude login, history, SSH keys) stay on + the user's own EFS file system, which only their own task role can read, until the user is + offboarded (destroying their onboarding module removes the file system). Starting the same + project on AWS again creates a new access point onto the same directory. Task definition + revisions stay registered (R8). - **Set only the ordinary tag keys.** Every request that tags something may set only `triple-c:owner`, `triple-c:project` and `triple-c:environment` (`aws:TagKeys`). This applies to `RunTask`, the ECS and EFS tag-on-create calls, `CreateSecret`, and secret `TagResource`. A @@ -586,5 +595,5 @@ and the secret and removes the ECR policy; then the fixture destroys the modules | `~/.claude.json` after Claude Code runs | ✓ still a link (Claude Code started without a login: "Not logged in") | | Bubblewrap (P9) | ✗ `bwrap --unshare-user` fails: "No permissions to create new namespace" (kernel 6.1, `max_user_namespaces` 16384, no `CAP_SYS_ADMIN` on Fargate). The sandbox stays off on AWS | | A revision per configuration | turning idle stop on adds a secret key, so the next start registers a new revision (by design) | -| Removal (R8) | ✓ final run: `remove_aws_resources` succeeds; the secret is scheduled for deletion, the access point deleted, the revision left ACTIVE | +| Removal (R8) | ✓ final run: `remove_aws_resources` succeeds; the secret is scheduled for deletion, the access point deleted, the revision left ACTIVE. Since R10 the secret is deleted without a recovery window (the test now asserts it is gone) | | Cleanup | ✓ nothing `triple-c` left in us-west-2; environment KMS keys pending deletion |