mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-29 04:25:52 +01:00
test: assert persisted rate admission bucket identity
Update the two Linux CI assertions for the bucket identity used by paired caller and target checks. Preserve the catalog creator attribution follow-up in the companion PR so both reviews remain below the file limit. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
05d1decd2b
commit
c8cc70ae30
2 files changed
+11
-5
No files matched your search
@@ -1105,7 +1105,8 @@ describeEmbeddedPostgres("tool access policy service", () => {
|
||||
.where(eq(toolInvocations.id, invocation.id));
|
||||
expect(await svc.decide(input)).toMatchObject({ decision: "rate_limited" });
|
||||
expect(invocation.policyExplanation?.consumedRateAdmissions).toEqual([
|
||||
{ policyId: ratePolicy.id, versionHash: expect.stringMatching(/^[a-f0-9]{64}$/) },
|
||||
{ policyId: ratePolicy.id, versionHash: expect.stringMatching(/^[a-f0-9]{64}$/),
|
||||
bucketKey: `${ratePolicy.id}:agent:${input.actor.agentId}|tool:send_email` },
|
||||
]);
|
||||
const counters = await db.select().from(toolRateLimitCounters);
|
||||
expect(await svc.decide(input, { admittedInvocationId: invocation.id })).toMatchObject({ allowed: true });
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { connectionActorUserId } from "../actor.js";
|
||||
import { lockManagedAppPolicies, lockToolAssignmentAgents } from "../assignment-locks.js";
|
||||
import type { ActorInfo, ToolAccessMutationDb } from "../types.js";
|
||||
import { and, eq, inArray } from "drizzle-orm";
|
||||
@@ -112,7 +111,9 @@ export function createCatalogDefaultAccess(db: Db) {
|
||||
? (input.actor.actorId ?? null)
|
||||
: null,
|
||||
createdByUserId:
|
||||
connectionActorUserId(input.actor),
|
||||
input.actor?.actorType === "user"
|
||||
? (input.actor.actorId ?? null)
|
||||
: null,
|
||||
});
|
||||
} else if (resetToRecommendedDefaults) {
|
||||
// Removing an app may retain its profile row when another record still
|
||||
@@ -162,7 +163,9 @@ export function createCatalogDefaultAccess(db: Db) {
|
||||
? (input.actor.actorId ?? null)
|
||||
: null,
|
||||
createdByUserId:
|
||||
connectionActorUserId(input.actor),
|
||||
input.actor?.actorType === "user"
|
||||
? (input.actor.actorId ?? null)
|
||||
: null,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -296,7 +299,9 @@ export function createCatalogDefaultAccess(db: Db) {
|
||||
? (input.actor.actorId ?? null)
|
||||
: null,
|
||||
createdByUserId:
|
||||
connectionActorUserId(input.actor),
|
||||
input.actor?.actorType === "user"
|
||||
? (input.actor.actorId ?? null)
|
||||
: null,
|
||||
})
|
||||
.returning();
|
||||
results.push(toPolicy(created));
|
||||
|
||||
Reference in new issue
Block a user