Test job-profile revocation, completing the routes.ts sweep

The job-profile surface had no API test at all. The DELETE is the one that
matters: without its existence check it answers 200 "revoked" for a job that
never existed, so an operator revoking an agent's access is TOLD it worked
while nothing happened. For a revocation that is the worst available answer.
Revoking twice is asserted too, since a second success is how the false
positive shows itself.

routes.ts now sweeps to zero survivors across all 85 mutants under the
refusal-based selection, up from 30 mutants under the old vocabulary rule.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Vtx94nXDmNgXEeThUZP4QN
This commit is contained in:
thePR0M3TH3ANandClaude Opus 5 committed 2026-08-19 23:11:23 -04:00
1 parent 46638e4b86
commit f487a001a2
1 file changed
+25
+25
View File
@@ -1020,6 +1020,31 @@ describe("totp, config, relays, stats", () => {
await call("POST", "/api/v1/relays/reset");
});
it("revokes a job profile only if there was one to revoke", async () => {
// The whole job-profile surface had no API test. The one that matters is
// the DELETE: without its check it answers 200 "revoked" for a job that
// never existed, so an operator revoking access is TOLD it worked while
// nothing happened — the worst possible answer for a revocation.
expect((await call("DELETE", "/api/v1/agent/job-profiles/never-existed")).status)
.toBe(404);
const created = await call("POST", "/api/v1/agent/job-profiles", {
body: { id: "nightly-backup", query: "label:bank" },
});
expect(created.status).toBe(201);
expect(
(await call("GET", "/api/v1/agent/job-profiles")).text,
).toContain("nightly-backup");
const revoked = await call("DELETE", "/api/v1/agent/job-profiles/nightly-backup");
expect(revoked.status).toBe(200);
expect(revoked.json.revoked).toBe("nightly-backup");
// Revoking it a second time must NOT report success again.
expect((await call("DELETE", "/api/v1/agent/job-profiles/nightly-backup")).status)
.toBe(404);
});
it("reports profile statistics", async () => {
const res = await call("GET", "/api/v1/stats");
expect(res.json.fingerprint).toBe(FINGERPRINT);