fix(apps): preserve grant and approval defaults

Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
DottaandCodex committed 2026-08-20 22:11:52 +00:00
1 parent fda25be6b1
commit 13dd4c1eae
12 files changed
+27 -15

No files matched your search

@@ -366,6 +366,9 @@ describeEmbeddedPostgres("generic remote MCP connections", () => {
// this connection cannot be depending on gallery metadata for anything.
expect(connection!.config).not.toHaveProperty("sourceTemplateKey");
expect(connection!.config).not.toHaveProperty("connectionMethodKey");
await expect(service.listConnectionGrants(result.connectionId, company.id)).resolves.toMatchObject({
grants: [expect.objectContaining({ kind: "organization", isDefault: true, credentialSecretRefs: [] })],
});
const [profile] = await db.select().from(toolProfiles).where(eq(
toolProfiles.profileKey,
`app:${result.connectionId}`,
+3
View File
@@ -4585,6 +4585,7 @@ export function toolAccessService(db: Db, options: ToolAccessServiceOptions = {}
})
.where(eq(toolConnections.id, existing.id))
.returning();
await ensureDefaultOrganizationGrant(updated);
await syncCredentialBindings(updated);
await ensureRuntimeSlot(updated);
return { row: updated, created: false };
@@ -4605,6 +4606,7 @@ export function toolAccessService(db: Db, options: ToolAccessServiceOptions = {}
credentialRefs: [],
credentialSecretRefs: [],
}).returning();
await ensureDefaultOrganizationGrant(created);
await syncCredentialBindings(created);
await ensureRuntimeSlot(created);
return { row: created, created: true };
@@ -6568,6 +6570,7 @@ export function toolAccessService(db: Db, options: ToolAccessServiceOptions = {}
createdByUserId: actor?.actorType === "user" ? actor.actorId ?? null : null,
}).returning();
}
await ensureDefaultOrganizationGrant(connectionRow);
await syncCredentialBindings(connectionRow);
await ensureRuntimeSlot(connectionRow);