Skip to content

armgit / qm

Public Imported from GitHub
0

Multiplayer agent harness for work.

Accept retained AWS coordinates for bundled service hosts (#1075)

Regan Bella1573419e5fa
diff --git a/cli/src/backends/registry.ts b/cli/src/backends/registry.ts
index 96245a651..d550d1858 100644
--- a/cli/src/backends/registry.ts
+++ b/cli/src/backends/registry.ts
@@ -329,7 +329,7 @@ const aws: HostingProvider = {
}
}
for (const name of Object.keys(config.aws.services)) {
- if (!workloads.has(name)) {
+ if (!workloads.has(name) && !workloads.has(serviceHost(name))) {
errors.push({
clause: "config.v1",
message: `contract aws.services.${name}: coordinates do not match an enabled service or discovered plugin`,
diff --git a/cli/test/check.test.ts b/cli/test/check.test.ts
index 0e578a316..1fc62bfd6 100644
--- a/cli/test/check.test.ts
+++ b/cli/test/check.test.ts
@@ -219,6 +219,42 @@ test("AWS requires exact ECS/ECR coordinates for discovered plugins", () => {
}
});
+test("AWS accepts retained bundled coordinates only when their host is enabled", () => {
+ const d = deployment(() => {}, {
+ target: "aws",
+ services: ["core", "web-ui", "admin", "portal", "auth"],
+ aws: {
+ accountId: "123456789012",
+ region: "us-west-2",
+ cluster: "acme",
+ deployRoleArn: "arn:aws:iam::123456789012:role/deploy",
+ secretsPrefix: "acme/",
+ imageLabel: "release",
+ networking: { cloudMapNamespace: "acme.internal" },
+ services: Object.fromEntries(
+ ["core", "web-ui", "admin", "portal", "auth"].map((name) => [
+ name,
+ { ecrRepository: name, ecsService: `acme-${name}`, cpu: 512, memory: 1024 },
+ ]),
+ ),
+ },
+ });
+ try {
+ assert.doesNotThrow(() => check(d));
+ delete d.config.aws!.services["web-ui"];
+ assert.throws(() => check(d), /aws\.services\.web-ui/);
+ d.config.services = ["core"];
+ delete d.config.aws!.services.portal;
+ assert.throws(() => check(d), /aws\.services\.(admin|auth)/);
+ delete d.config.aws!.services.admin;
+ delete d.config.aws!.services.auth;
+ d.config.aws!.services.unused = { ecrRepository: "unused", ecsService: "unused", cpu: 512, memory: 1024 };
+ assert.throws(() => check(d), /aws\.services\.unused/);
+ } finally {
+ rmSync(d.dir, { recursive: true, force: true });
+ }
+});
+
test("optional plugin secrets remain in the computed contract without becoming required", () => {
const optional: QmConfig = {
...CONFIG,