1import { Task } from "@/AWS/ECS/Task.ts";
2import * as Effect from "effect/Effect";
3import { isolatedProject } from "../../../IsolatedProject.ts";
4
5/**
6 * The isolated consumer project this task is bundled from (see
7 * `test/IsolatedProject.ts`): `main` lives outside the repository, so the
8 * bundle `cwd` resolves none of alchemy's dependencies — the bun bootstrap's
9 * own imports (`@distilled.cloud/aws/*`, `@effect/platform-bun`, …) must be
10 * anchored by the bundler, not found by accident from the project root.
11 */
12export const project = isolatedProject("ecs-task", import.meta.filename);
13
14/**
15 * Regression fixture for the generated bun bootstrap's imports: before the
16 * virtual-entry plugin anchored them, an isolated project left them
17 * `[UNRESOLVED_IMPORT]` / external and the container died at boot with
18 * `Cannot find module …`.
19 *
20 * The `{ run }` impl logs a marker and completes, so a successful boot is
21 * observable as the Fargate task stopping with container exit code 0.
22 */
23export class IsolatedProjectTask extends Task<IsolatedProjectTask>()(
24 "EcsIsolatedProjectTask",
25) {}
26
27export default IsolatedProjectTask.make(
28 {
29 main: project.main,
30 // Docker Hub's `oven/bun`; the public.ecr.aws default mirror rate-limits
31 // anonymous pulls during local builds (see fixtures/task.ts).
32 image: "oven/bun:1",
33 cpu: 256,
34 memory: 512,
35 // Build/run on ARM64 so an image built on an Apple Silicon host matches
36 // the Fargate runtime architecture (Graviton).
37 runtimePlatform: {
38 cpuArchitecture: "ARM64",
39 operatingSystemFamily: "LINUX",
40 },
41 taskName: "alchemy-test-ecs-isolated-project",
42 },
43 Effect.gen(function* () {
44 return {
45 // One-shot entry: log the marker and exit 0.
46 run: Effect.log("alchemy-isolated-project-ran"),
47 };
48 }),
49);