Merge pull request #73 from yunyingk/codex/fix-approval-style-preferences-post
🧪 CI / 🧪 Test, Type-Check & Build Validation (push) Has been cancelled

Use POST method for approval style preferences endpoint
This commit is contained in:
yunyingk authored and GitHub committed 2026-09-11 11:51:33 +08:00
commit 8db4b87385
2 files changed
+8 -10

No files matched your search

+6 -6
View File
@@ -302,9 +302,9 @@ describe("corps sync-test", () => {
expect(parsed.productionGuarantees.prodRulesStayDraft).toBe(true);
expect(parsed.productionGuarantees.prodVersionPublished).toBe(false);
const patchPref = requests.find((r) => r.method === "PATCH" && r.path.includes("config"));
expect(patchPref).toBeDefined();
expect((patchPref?.body as any).decisionPreferences?.explicitApprove).toBe("Prod approve note");
const postPref = requests.find((r) => (r.method === "POST" || r.method === "PATCH") && r.path.includes("config"));
expect(postPref).toBeDefined();
expect((postPref?.body as any).decisionPreferences?.explicitApprove).toBe("Prod approve note");
const deleteRule = requests.find((r) => r.method === "DELETE" && r.path === "/api/v1/rules/test-rule-old");
expect(deleteRule).toBeDefined();
@@ -402,10 +402,10 @@ function mockSealSyncRequests(options: {
});
}
if (url.pathname === "/api/v1/agent/ai-approval/config" && method === "PATCH") {
if (url.pathname === "/api/v1/agent/ai-approval/config" && (method === "POST" || method === "PATCH")) {
const body = JSON.parse(rawBody || "{}");
options.onMutation?.("PATCH", url.pathname, body);
return jsonResponse({ data: body });
options.onMutation?.(method, url.pathname, body);
return jsonResponse({ data: { success: true } });
}
if (url.pathname === "/api/v1/rules" && method === "GET") {
+2 -4
View File
@@ -274,10 +274,8 @@ export async function updateApprovalStylePreferences(
params: Record<string, unknown>,
endpoint = "api/v1/agent/ai-approval/config"
): Promise<ApprovalStylePreferences> {
return unwrap(
await client.patch(endpoint, { json: params }),
ApprovalStylePreferencesSchema
);
await client.post(endpoint, { json: params });
return getApprovalStylePreferences(client, endpoint);
}
export type WebhookMutationPreview = {