fix(aws): keep the access point id when a removal keeps the saved files
remove_aws_resources cleared access_point_id even without discard_data, though the access point stays; the project could then move hosts and orphan it. The id is now kept, so a later start reuses it, a later removal with "Also remove the access point" deletes it, and moving the project is refused until then (the message and the Host section say so). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
be2825d344
commit
c467308513
3 files changed
+65
-5
No files matched your search
@@ -165,6 +165,21 @@ describe("HostSection", () => {
|
||||
await waitFor(() => expect(removeAwsResources).toHaveBeenCalledWith(p.id, true));
|
||||
});
|
||||
|
||||
it("keeps a project whose kept files' access point remains on AWS until it is removed", () => {
|
||||
const p = awsProject();
|
||||
p.aws = { ...p.aws!, access_point_id: "fsap-1", task_arn: null, task_definition_arn: null };
|
||||
renderHost(p);
|
||||
const move = screen.getByRole("button", { name: "Run on this machine instead" });
|
||||
expect(move).toHaveAttribute("aria-disabled", "true");
|
||||
expect(move).toHaveAccessibleDescription(/access point is still on AWS/);
|
||||
expect(screen.getByRole("button", { name: "Remove AWS resources…" })).not.toHaveAttribute(
|
||||
"aria-disabled",
|
||||
"true",
|
||||
);
|
||||
fireEvent.click(screen.getByRole("button", { name: "Remove AWS resources…" }));
|
||||
expect(within(screen.getByRole("dialog")).getByText(/access point\s+stays too/)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("keeps the AWS resource buttons locked while the project is in Error (its task may live)", () => {
|
||||
const p = awsProject({ status: "error" });
|
||||
p.aws = { ...p.aws!, task_arn: "arn:task" };
|
||||
|
||||
@@ -58,6 +58,8 @@ export default function HostSection({ project, save, disabled }: Props) {
|
||||
const saveAws = (patch: Partial<AwsWorkspaceConfig>) => save({ aws: { ...aws, ...patch } });
|
||||
|
||||
const hasResources = !!(aws.task_arn || aws.access_point_id || aws.task_definition_arn);
|
||||
// A removal that kept the saved files keeps their access point stored.
|
||||
const onlyAccessPoint = !!aws.access_point_id && !aws.task_arn && !aws.task_definition_arn;
|
||||
// Not `disabled` (which also allows Error): on AWS, Error can mean a live task.
|
||||
const stopped = project.status === "stopped";
|
||||
|
||||
@@ -343,7 +345,9 @@ export default function HostSection({ project, save, disabled }: Props) {
|
||||
unavailableReason={
|
||||
!stopped
|
||||
? STILL_RUNNING
|
||||
: "Remove the workspace's AWS resources first, so nothing is left running or billed."
|
||||
: onlyAccessPoint
|
||||
? "The saved files' access point is still on AWS. Remove the AWS resources with \u201cAlso remove the workspace\u2019s file-system access point\u201d first."
|
||||
: "Remove the workspace's AWS resources first, so nothing is left running or billed."
|
||||
}
|
||||
onClick={() => void save({ host_id: null, aws_placement: null, aws: null })}
|
||||
>
|
||||
@@ -421,7 +425,9 @@ function RemoveAwsResourcesModal({ project, onClose }: { project: Project; onClo
|
||||
Also remove the workspace’s file-system access point
|
||||
<span className="block text-xs text-[var(--text-secondary)]">
|
||||
The files stay on your own EFS file system (only your workspace role can read
|
||||
them) until an administrator offboards you.
|
||||
them) until an administrator offboards you. Left unchecked, the access point
|
||||
stays too: the next start here reuses it, and the project can’t move to
|
||||
another host until it is removed.
|
||||
</span>
|
||||
</span>
|
||||
</label>
|
||||
|
||||
Reference in new issue
Block a user