feat(aws): EFS storage mode
EFS storage is Hybrid plus /workspace on a second access point of the user's own file system, rooted at /triple-c-workspaces/<owner_key>/<project> (a sibling of the home roots) and mounted at /workspace. The workspace access point is found by root + owner + project tags or created, waited for before RunTask, recorded store-owned, kept when switching to Hybrid or Ephemeral, and deleted with the home one by a discarding removal. Hybrid and Ephemeral task definitions are byte-identical to before (pinned fingerprints). The entrypoint links home state for efs as for hybrid, warns when /workspace is not mounted, and marks a clone in progress in its own .git/config so a clone a killed task cut short is redone on the next start while existing repositories are still skipped. The EFS segment is enabled in HostSection, with a note when /workspace files remain on an access point after switching away. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
cbaf6209fd
commit
5477c2cea5
20 files changed
+790
-100
No files matched your search
@@ -14,6 +14,14 @@ describe("ConfirmRemoveModal", () => {
|
||||
expect(onConfirm.mock.calls).toEqual([[{ discardData: false }], [{ discardData: true }]]);
|
||||
});
|
||||
|
||||
it("says both access points go when the workspace kept /workspace on EFS", () => {
|
||||
render(
|
||||
<ConfirmRemoveModal projectName="api" aws savedFiles workspaceFiles onConfirm={vi.fn()} onCancel={vi.fn()} />,
|
||||
);
|
||||
expect(screen.getByRole("checkbox", { name: /file-system access points/ })).toBeInTheDocument();
|
||||
expect(screen.getByText(/\/workspace/)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("offers no access-point choice for an Ephemeral AWS workspace", () => {
|
||||
const onConfirm = vi.fn();
|
||||
render(<ConfirmRemoveModal projectName="api" aws onConfirm={onConfirm} onCancel={vi.fn()} />);
|
||||
|
||||
@@ -8,6 +8,8 @@ interface Props {
|
||||
aws?: boolean;
|
||||
/** AWS: the workspace may have an EFS access point (offers removing it). */
|
||||
savedFiles?: boolean;
|
||||
/** AWS: `/workspace` may be on EFS too (EFS storage, now or before). */
|
||||
workspaceFiles?: boolean;
|
||||
onConfirm: (opts: { discardData: boolean }) => void;
|
||||
onCancel: () => void;
|
||||
}
|
||||
@@ -19,6 +21,7 @@ export default function ConfirmRemoveModal({
|
||||
projectName,
|
||||
aws = false,
|
||||
savedFiles = false,
|
||||
workspaceFiles = false,
|
||||
onConfirm,
|
||||
onCancel,
|
||||
}: Props) {
|
||||
@@ -61,11 +64,12 @@ export default function ConfirmRemoveModal({
|
||||
onChange={(e) => setDiscardData(e.target.checked)}
|
||||
/>
|
||||
<span>
|
||||
Also remove the workspace’s file-system access point
|
||||
Also remove the workspace’s file-system access points
|
||||
<span className="block text-xs text-[var(--text-secondary)]">
|
||||
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.
|
||||
The saved files themselves (Claude login, history, SSH keys
|
||||
{workspaceFiles ? ", and the /workspace files" : ""}) stay on your own EFS file
|
||||
system, readable only by your workspace role, until an administrator offboards
|
||||
you.
|
||||
</span>
|
||||
</span>
|
||||
</label>
|
||||
|
||||
@@ -11,7 +11,7 @@ import Button from "../../ui/Button";
|
||||
import OverflowMenu from "../../ui/OverflowMenu";
|
||||
import ConfirmRemoveModal, { ConfirmForgetAwsModal } from "../ConfirmRemoveModal";
|
||||
import StopGuardModal from "../StopGuardModal";
|
||||
import { hasSavedFiles, isAwsProject } from "../../../lib/awsWorkspace";
|
||||
import { hasSavedFiles, hasWorkspaceFiles, isAwsProject } from "../../../lib/awsWorkspace";
|
||||
import { AWS_CONNECTION_MISSING, type RemoveProjectOptions } from "../../../lib/types";
|
||||
import ConfirmResetModal from "../ConfirmResetModal";
|
||||
import MigrateContainerModal from "../MigrateContainerModal";
|
||||
@@ -349,6 +349,7 @@ export default function ProjectHome({ projectId, active }: Props) {
|
||||
projectName={project.name}
|
||||
aws={aws}
|
||||
savedFiles={hasSavedFiles(project)}
|
||||
workspaceFiles={hasWorkspaceFiles(project)}
|
||||
onCancel={() => setConfirmRemove(false)}
|
||||
onConfirm={({ discardData }) => {
|
||||
setConfirmRemove(false);
|
||||
|
||||
@@ -131,7 +131,55 @@ describe("HostSection", () => {
|
||||
p.aws = { ...p.aws!, storage: "ephemeral" };
|
||||
renderHost(p);
|
||||
expect(screen.getByText(/Claude login and history are lost when the workspace stops/)).toBeInTheDocument();
|
||||
expect(screen.getByText(/EFS .* coming later/)).toBeInTheDocument();
|
||||
expect(screen.queryByText(/coming later/)).toBeNull();
|
||||
});
|
||||
|
||||
it("offers EFS storage with what it costs", async () => {
|
||||
const p = awsProject();
|
||||
renderHost(p);
|
||||
const efs = screen.getByRole("radio", { name: "EFS" });
|
||||
expect(efs).not.toBeDisabled();
|
||||
fireEvent.click(efs);
|
||||
await waitFor(() => expect(save).toHaveBeenCalled());
|
||||
expect(save.mock.calls[0][0].aws.storage).toBe("efs");
|
||||
|
||||
p.aws = { ...p.aws!, storage: "efs" };
|
||||
renderHost(p);
|
||||
expect(
|
||||
screen.getByText("Everything in /workspace survives a stop; git and builds are slower over NFS"),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("says /workspace files stay on their access point after switching away from EFS", () => {
|
||||
const p = awsProject();
|
||||
p.aws = {
|
||||
...p.aws!,
|
||||
storage: "hybrid",
|
||||
workspace_access_point_id: "fsap-w",
|
||||
task_arn: null,
|
||||
task_definition_arn: null,
|
||||
access_point_id: null,
|
||||
};
|
||||
renderHost(p);
|
||||
expect(screen.getByRole("note", { name: "EFS files kept" })).toHaveTextContent(
|
||||
/\/workspace files .* stay on their access point until .*Remove AWS resources/,
|
||||
);
|
||||
// It is an AWS resource: removable, and it keeps the project in place.
|
||||
expect(screen.getByRole("button", { name: "Run on this machine instead" })).toHaveAttribute(
|
||||
"aria-disabled",
|
||||
"true",
|
||||
);
|
||||
fireEvent.click(screen.getByRole("button", { name: "Remove AWS resources…" }));
|
||||
const dialog = screen.getByRole("dialog");
|
||||
expect(within(dialog).getByRole("checkbox", { name: /access points/ })).toBeInTheDocument();
|
||||
expect(dialog).toHaveTextContent(/\/workspace/);
|
||||
});
|
||||
|
||||
it("does not show the kept-files note on EFS or without a workspace access point", () => {
|
||||
const p = awsProject();
|
||||
p.aws = { ...p.aws!, storage: "efs", workspace_access_point_id: "fsap-w" };
|
||||
renderHost(p);
|
||||
expect(screen.queryByRole("note", { name: "EFS files kept" })).toBeNull();
|
||||
});
|
||||
|
||||
it("saves repository edits on blur", async () => {
|
||||
|
||||
@@ -3,6 +3,7 @@ import type { AwsWorkspaceConfig, HostConnection, Project, RepoSource } from "..
|
||||
import * as commands from "../../../../lib/tauri-commands";
|
||||
import { useAppState } from "../../../../store/appState";
|
||||
import {
|
||||
EFS_HINT,
|
||||
EPHEMERAL_WARNING,
|
||||
FARGATE_CPUS,
|
||||
defaultAwsWorkspace,
|
||||
@@ -10,6 +11,7 @@ import {
|
||||
formatMemory,
|
||||
memoryError,
|
||||
hasSavedFiles,
|
||||
hasWorkspaceFiles,
|
||||
memoryOptions,
|
||||
nearestMemory,
|
||||
} from "../../../../lib/awsWorkspace";
|
||||
@@ -57,9 +59,19 @@ 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;
|
||||
const hasResources = !!(
|
||||
aws.task_arn ||
|
||||
aws.access_point_id ||
|
||||
aws.workspace_access_point_id ||
|
||||
aws.task_definition_arn
|
||||
);
|
||||
// A removal that kept the saved files keeps their access points stored.
|
||||
const onlyAccessPoint =
|
||||
!!(aws.access_point_id || aws.workspace_access_point_id) &&
|
||||
!aws.task_arn &&
|
||||
!aws.task_definition_arn;
|
||||
// Switched away from EFS: its /workspace files are still on their access point.
|
||||
const keptWorkspaceFiles = aws.storage !== "efs" && !!aws.workspace_access_point_id;
|
||||
// Not `disabled` (which also allows Error): on AWS, Error can mean a live task.
|
||||
const stopped = project.status === "stopped";
|
||||
|
||||
@@ -196,11 +208,9 @@ export default function HostSection({ project, save, disabled }: Props) {
|
||||
segments={[
|
||||
{ value: "ephemeral", label: "Ephemeral", caution: true },
|
||||
{ value: "hybrid", label: "Hybrid" },
|
||||
{ value: "efs", label: "EFS" },
|
||||
]}
|
||||
/>
|
||||
<span className="text-xs text-[var(--text-disabled)]">
|
||||
EFS (everything persists) — coming later
|
||||
</span>
|
||||
</div>
|
||||
{aws.storage === "ephemeral" ? (
|
||||
<p
|
||||
@@ -209,17 +219,36 @@ export default function HostSection({ project, save, disabled }: Props) {
|
||||
>
|
||||
{EPHEMERAL_WARNING} Push your work to a remote before stopping.
|
||||
</p>
|
||||
) : aws.storage === "efs" ? (
|
||||
<p className="mt-1 text-xs text-[var(--text-secondary)]">
|
||||
<span>{EFS_HINT}</span>. The Claude login, history and SSH keys are kept on EFS too.
|
||||
</p>
|
||||
) : (
|
||||
<p className="mt-1 text-xs text-[var(--text-secondary)]">
|
||||
The Claude login, history and SSH keys are kept on EFS between starts; everything
|
||||
else, repositories included, starts fresh.
|
||||
</p>
|
||||
)}
|
||||
{keptWorkspaceFiles && (
|
||||
<p
|
||||
role="note"
|
||||
aria-label="EFS files kept"
|
||||
className="mt-2 px-2 py-1.5 text-xs text-[var(--text-secondary)] bg-[var(--bg-secondary)] border border-[var(--border-color)] rounded-[var(--radius-control)]"
|
||||
>
|
||||
The /workspace files from when this project used EFS storage stay on their access
|
||||
point until “Remove AWS resources” removes it (with the access points
|
||||
option checked). Switching back to EFS picks them up again.
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<Field
|
||||
label="Ephemeral storage (GiB)"
|
||||
hint="The task's local disk: 21 to 200 GiB. Repositories and builds live here."
|
||||
hint={
|
||||
aws.storage === "efs"
|
||||
? "The task's local disk: 21 to 200 GiB. With EFS storage, /workspace is on EFS instead."
|
||||
: "The task's local disk: 21 to 200 GiB. Repositories and builds live here."
|
||||
}
|
||||
>
|
||||
{(id) => (
|
||||
<input
|
||||
@@ -346,7 +375,7 @@ export default function HostSection({ project, save, disabled }: Props) {
|
||||
!stopped
|
||||
? STILL_RUNNING
|
||||
: 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."
|
||||
? "The saved files' access point is still on AWS. Remove the AWS resources with \u201cAlso remove the workspace\u2019s file-system access points\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 })}
|
||||
@@ -422,8 +451,11 @@ function RemoveAwsResourcesModal({ project, onClose }: { project: Project; onClo
|
||||
onChange={(e) => setDiscardData(e.target.checked)}
|
||||
/>
|
||||
<span>
|
||||
Also remove the workspace’s file-system access point
|
||||
Also remove the workspace’s file-system access points
|
||||
<span className="block text-xs text-[var(--text-secondary)]">
|
||||
{hasWorkspaceFiles(project)
|
||||
? "Both go: the one for the saved home files and the one for /workspace. "
|
||||
: ""}
|
||||
The files stay on your own EFS file system (only your workspace role can read
|
||||
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
|
||||
|
||||
Reference in new issue
Block a user