@emulates/ecs 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ # Changelog — @emulates/ecs
2
+
3
+ ## 0.1.1 (2026-10-06)
4
+
5
+ Initial release.
6
+
7
+ ### Dependencies
8
+
9
+ - `@emulates/sqlite`
package/DISCOVERY.md ADDED
@@ -0,0 +1,55 @@
1
+ # @emulates/ecs discovery
2
+
3
+ This is the installed-package index for coding agents and tooling. All relative links resolve
4
+ inside `node_modules/@emulates/ecs/`; no repository checkout is needed to discover the emulator's
5
+ supported surface or documented behavior.
6
+
7
+ ## Capability and behavior sources
8
+
9
+ | Question | Authoritative file | What it contains |
10
+ | --- | --- | --- |
11
+ | Behaviour and integration | [`README.md`](README.md) | Routes, state transitions, auth, webhooks, controls, presets and deliberate omissions. |
12
+ | Exact capabilities | [`SUPPORT.md`](SUPPORT.md) | Supported, unsupported and parity-covered operations or commands, including reasons for gaps. |
13
+ | Wire contract | [`openapi.yaml`](openapi.yaml) | Machine-readable paths, methods, schemas, responses and parity annotations. |
14
+ | Public API | [`dist/index.d.ts`](dist/index.d.ts) | The installed package's exact TypeScript exports and signatures. |
15
+ | Package metadata | [`package.json`](package.json) | Runtime/entry-point claims, vendor links, parity scope/tier and `emulates.discovery`. |
16
+
17
+ Read these together: the contract/capability matrix says *what* is available, while the README
18
+ defines stateful behavior, lifecycle rules, test controls, and intentional oracle differences.
19
+ If prose and an executable surface disagree, report a parity mismatch instead of adding a
20
+ consumer-side workaround.
21
+
22
+ ## Parity and oracle
23
+
24
+ - Declared parity surface: **Fargate task acceptance, failures and container overrides**.
25
+ - Parity tier: **cold** (the repository controls when live checks run).
26
+ - Oracle: **Live vendor API or sandbox**.
27
+ - Repository command: `bun run parity:service -- ecs`.
28
+ - Evidence model: Run from an Emulates checkout; credentials come only from .env.local or GitHub Actions secrets. Missing credentials exit 2.
29
+
30
+ The npm package contains evidence summaries and the exact contract, not credentials or the
31
+ repository-only parity harness. Self-parity/property and acceptance tests run in the Emulates
32
+ repository; live parity is an additional oracle check, not a substitute for the packaged matrix.
33
+
34
+ ## Runtime introspection
35
+
36
+ - `GET /__admin/health`
37
+ - `GET /__admin`
38
+ - `GET /__admin/state`
39
+ - `GET /__admin/requests`
40
+ - `GET /__admin/metrics`
41
+ - `GET /__admin/faults/presets`
42
+ - `GET /__admin/ui`
43
+
44
+ For HTTP services, use `x-emulates-namespace` (or the documented credential/path carrier) so
45
+ parallel tests do not share state. Admin state, journal, metrics and fault-preset endpoints are
46
+ designed for assertions and diagnosis by consuming test suites.
47
+
48
+ ## Report a mismatch or missing capability
49
+
50
+ Follow the [agent reporting contract](https://github.com/crvouga/emulators/blob/main/docs/REPORTING_ISSUES.md). Include package version,
51
+ operation/command, a minimal redacted request, actual emulator result, expected oracle result or vendor
52
+ documentation, and whether the mismatch appears in the matrix. Never include keys, tokens,
53
+ customer data, prompts, PHI, card data, or unredacted recordings.
54
+
55
+ Service key: `ecs`.
package/README.md CHANGED
@@ -1,3 +1,77 @@
1
- # Temporary Holding Version
1
+ # @emulates/ecs
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ > Part of [Emulates](https://github.com/crvouga/emulators): high-fidelity, in-process emulators for APIs and databases.
4
+
5
+ WIP AWS ECS Fargate RunTask control-plane emulator. It records task acceptance; it never starts
6
+ containers. Wire contract follows [RunTask](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_RunTask.html).
7
+
8
+ ## Install
9
+
10
+ `bun add @emulates/ecs`
11
+
12
+ ## Usage
13
+
14
+ ```ts
15
+ import { createServer } from "@emulates/ecs/server"
16
+ const server = await createServer()
17
+ // boto3.client("ecs", endpoint_url=server.url, region_name="us-east-1",
18
+ // aws_access_key_id="fixture", aws_secret_access_key="fixture")
19
+ await server.close()
20
+ ```
21
+
22
+ CLI: `emulates-ecs serve --port 12129`. Point the application factory's endpoint_url or
23
+ AWS_ENDPOINT_URL_ECS at the server. POST / with X-Amz-Target
24
+ AmazonEC2ContainerServiceV20141113.RunTask accepts AWS JSON 1.1.
25
+ The default fixtures are cluster default and task definition fixture:1 with container app.
26
+ Send launchType FARGATE, taskDefinition, count (1–10), networkConfiguration.awsvpcConfiguration
27
+ and optional overrides.containerOverrides. Responses separate tasks from failures.
28
+ Cluster name/ARN and task-definition ARN/family:revision/latest active family resolve seeded resources.
29
+ Missing clusters return ClusterNotFoundException; absent definitions return ClientException.
30
+ Overrides are retained only in task state, not the request journal. Use synthetic fixture values only.
31
+
32
+ ## Controls and state
33
+
34
+ Options clusters and taskDefinitions replace the default fixtures. Their records are the exported
35
+ Cluster and TaskDefinition types. The shared /__admin/state routes also seed these collections.
36
+ Read accepted tasks from tasks and request metadata (network configuration, task ARNs, failures)
37
+ from requests. Seed placementFailures with AWS Failure objects to script partial placement:
38
+ each RunTask takes up to count failures in insertion order and accepts the remaining task count.
39
+ Failures persist until deleted/reset; this is a test control, not a capacity simulator.
40
+ Tasks remain PROVISIONING with desiredStatus RUNNING; createdAt uses the emulator clock.
41
+ Identical clientToken retries within a cluster return the same result for 24 hours;
42
+ changed parameters return ConflictException with associated resourceIds. Tokens are resettable state.
43
+
44
+ Shared /__admin provides health, UI, state, reset, Timeline checkpoints, clock, journal and metrics.
45
+ Namespace carriers: x-emulates-namespace, /__admin/ns/name and SigV4 access-key mappings via
46
+ PUT /__admin/credentials. Signature verification and IAM policy evaluation are not performed.
47
+ Journal entries omit bodies and credentials. No webhooks are emitted.
48
+ Presets: access_denied (AWS 400), throttled (400), rate_limited (explicit HTTP 429 test fault),
49
+ internal_error (500), connection_drop. Shared faults also support deterministic latency.
50
+
51
+ ## Verification
52
+
53
+ `bun test` runs acceptance and OpenAPI-driven self-parity with divergence detection.
54
+ `bun scripts/sdk.ts` uses uv to install and run exact boto3 1.43.56 against the served emulator:
55
+ successful RunTask, preserved overrides, idempotency, missing resources and SDK exceptions.
56
+ This proves SDK compatibility, not live AWS equivalence. `bun run parity` exits 2 because this
57
+ package only models a billable compute-creating operation; no live request is issued implicitly.
58
+ Live validation needs an authorized isolated ECS account/cluster and explicit execution approval.
59
+
60
+ ## Deliberately not modelled
61
+
62
+ Real container execution, task lifecycle progression, eventual consistency, network provisioning,
63
+ IAM/signature evaluation, infrastructure deployment, EC2/EXTERNAL/capacity-provider launch modes,
64
+ task-definition or cluster mutations and other ECS operations. Nested overrides outside names,
65
+ commands and environment are passed through, not comprehensively validated. No subnet reachability,
66
+ image validity or resource-capacity simulation. Fargate is the only modeled launch type.
67
+ Task ids and platformVersion LATEST are local stand-ins, not exact AWS-generated ids/resolved versions.
68
+ The idempotency lifetime is 24 hours while emulator tasks remain uncompleted; shorter post-stop expiry
69
+ and task-stop response rewriting are outside this surface.
70
+
71
+ ## API
72
+
73
+ Main runtime exports: ECSAPI, ECS_NAMESPACE, DEFAULT_CLUSTER, DEFAULT_TASK_DEFINITION,
74
+ createRuntime, ECS_PRESETS, document, operationIds, supportedOperationIds.
75
+ Types: Cluster, TaskDefinition, Failure, Task, ECSAPIOptions, ECSRuntimeOptions, ECSRuntime.
76
+ Server entry: createServer, DEFAULT_PORT, serveTarget; type ECSServerOptions.
77
+ CLI entry executes serve and exports no runtime values.
package/SUPPORT.md ADDED
@@ -0,0 +1,11 @@
1
+ # AWS ECS Fargate RunTask — operation support
2
+
3
+ Generated from `openapi.yaml`; do not edit by hand.
4
+
5
+ - operations in spec: **1**
6
+ - supported by the emulator: **1**
7
+ - parity enabled: **1**
8
+
9
+ | operationId | route | emulator | parity | notes |
10
+ | --- | --- | --- | --- | --- |
11
+ | `RunTask` | `POST /` | ✅ supported | ⚠️ unsafe (opt-in) | |