Skip to content

armgit / qm

Public Imported from GitHub
0

Multiplayer agent harness for work.

Cover the deployment marker, drop source-text and single-process cap tests, and document shadowed rows

Josh Francef1a18dd8405b
diff --git a/docs/deployment-broker-credentials.md b/docs/deployment-broker-credentials.md
index 410fa414f..986b47ca3 100644
--- a/docs/deployment-broker-credentials.md
+++ b/docs/deployment-broker-credentials.md
@@ -43,12 +43,12 @@ error naming the entry. Errors never include secret values.
## Behaviour
- **Who can use them:** every conversation whose participants all belong to the org, as if the credential
- had an org-wide grant. Published apps can't use them.
+ had an org-wide grant. Admins can't narrow that. Published apps can't use them.
- **Delivery:** broker only. They are never injected into sandbox environments.
- **Precedence:** a deployment slug is reserved. Lookups return the deployment credential even if the
settings database still holds one with the same slug, and admins can't create, edit or delete a stored
credential with that slug.
-- **Not for decision providers:** a decision provider can't name a deployment credential.
+- **Broker only, everywhere:** decision providers and skill-pack Git auth can't use a deployment credential.
- **Usage:** broker calls are logged and summarised in Settings like any other credential.
## Operating
@@ -57,3 +57,6 @@ error naming the entry. Errors never include secret values.
2. Set `BROKER_CREDENTIALS` to the JSON array and restart the core.
3. To rotate a key, change the secret's env var and restart. To remove a credential, drop its entry and
restart.
+4. If the settings database already holds a credential with the same slug, the core logs a warning at startup
+ and the stored one is ignored. Delete the stored one before adding the env entry; otherwise it becomes
+ active again if the env entry is later removed.
diff --git a/plugins/admin/test/default-view.test.ts b/plugins/admin/test/default-view.test.ts
index fd1c05403..9d7da5217 100644
--- a/plugins/admin/test/default-view.test.ts
+++ b/plugins/admin/test/default-view.test.ts
@@ -1,4 +1,3 @@
-import { readFileSync } from "node:fs";
import { SettingsState, load as loadSettings, states as settingsStates } from "../ui/settings.ts";
import { CredentialState } from "../ui/settings-credentials.ts";
import { GovernanceState, load, states } from "../ui/governance-state.ts";
@@ -374,9 +373,6 @@ test("governance credential editor previews effective capability and uses an in-
assert.match(html, new RegExp(`id="${id}"`));
}
assert.match(html, /function renderServiceCredentialCapability\(\)/);
- const credentialsSource = readFileSync(new URL("../ui/settings-credentials.ts", import.meta.url), "utf8");
- assert.match(credentialsSource, /deployment\s*\?\s*html`<div class="credential-actions hint">Read-only<\/div>`/);
- assert.match(credentialsSource, /badge\("Supplied by deployment", "info"\)/);
assert.match(html, /expectedUpdatedAt: c\.updatedAt/);
assert.match(html, /function refreshServiceCredentialConflict\(\)/);
assert.match(html, /credentialState.version = scEditVersion/);
diff --git a/test/credential-broker.test.ts b/test/credential-broker.test.ts
index 7fff6b7a7..2fdca8ad8 100644
--- a/test/credential-broker.test.ts
+++ b/test/credential-broker.test.ts
@@ -504,16 +504,3 @@ test("a capped credential refuses closed when no usage ledger can count its call
const capped = { reader: reader({ slug: "x-firehose", allowedPathPrefixes: ["/2/"], maxRequestsPerDay: 3 }) };
assert.equal((await brokerCredentialCall(base(capped))).status, 503);
});
-
-test("concurrent calls cannot overshoot a daily cap", async () => {
- const cap = captureFetch();
- const usage = createCredentialUsageSink();
- const capped = base({
- fetchImpl: cap.fetch,
- usage,
- reader: reader({ slug: "x-firehose", allowedPathPrefixes: ["/2/"], maxRequestsPerDay: 3 }),
- });
- const results = await Promise.all(Array.from({ length: 8 }, () => brokerCredentialCall(capped)));
- assert.equal(results.filter((r) => r.status === 200).length, 3);
- assert.equal(cap.calls.length, 3);
-});
diff --git a/test/deployment-broker-credentials.test.ts b/test/deployment-broker-credentials.test.ts
index 4a961849e..c97e72c5c 100644
--- a/test/deployment-broker-credentials.test.ts
+++ b/test/deployment-broker-credentials.test.ts
@@ -76,7 +76,7 @@ test("BROKER_CREDENTIALS fails fast on any malformed entry without echoing secre
[[{ ...entry, host: "backend.composio.dev" }], /Composio/],
[[{ ...entry, secretEnv: "lower" }], /secretEnv/],
[[{ ...entry, secretEnv: "MISSING_KEY" }], /MISSING_KEY is unset or empty/],
- [[{ ...entry, allowedMethods: ["FETCH"] }], /allowedMethods is invalid/],
+ [[{ ...entry, allowedMethods: ["get"] }], /allowedMethods is invalid/],
[[{ ...entry, allowedPathPrefixes: ["search"] }], /allowedPathPrefixes is invalid/],
[[{ ...entry, maxRequestsPerDay: 0 }], /maxRequestsPerDay/],
[[{ ...entry, maxRequestsPerDay: 1.5 }], /maxRequestsPerDay/],
@@ -147,6 +147,8 @@ test("deployment credentials win lookups in their org and reserve their slugs ag
assert.doesNotMatch(JSON.stringify(listed), new RegExp(KEY));
assert.equal(listed[0]!.deployments, false);
assert.equal((await store.getServiceCredentialSecret(ORG, "search"))?.secret, KEY);
+ assert.equal((await store.getServiceCredentialSecret(ORG, "search"))?.source, "deployment");
+ assert.equal((await store.getServiceCredentialSecret(ORG, "stored"))?.source, undefined);
assert.equal((await store.getServiceCredentialSecret(ORG, "stored"))?.secret, "db-secret");
assert.equal((await store.getServiceCredentialSecret("org:other", "search"))?.secret, "db-secret");
assert.equal((await store.listServiceCredentials("org:other")).length, 2);