Skip to content

Commit f4cca48

Browse files
committed
docs(core): clarify bulk env var delete skips and the branch-only filter
Says in the API reference, the request schema and the client param type that a key is also skipped when its value changed while the delete ran, and that onlyShadowingParent only takes effect when the request addresses a preview branch. Adds a test for the padded row list path and matches the docs page title to its siblings.
1 parent 79d2942 commit f4cca48

5 files changed

Lines changed: 34 additions & 6 deletions

File tree

‎apps/webapp/test/environmentVariablesRepository.test.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,4 +1078,19 @@ describe("EnvironmentVariablesRepository value deletes", () => {
10781078
expect(await variableKeys()).toEqual([]);
10791079
expect((await secretRows(branch.id)).store).toEqual([]);
10801080
});
1081+
1082+
postgresTest("deletes three of four keys through a padded row list", async ({ prisma }) => {
1083+
const { project, branch, repository, write, ownKeys, secretRows } =
1084+
await createBranchWithParent(prisma);
1085+
await write(branch.id, { A: "a", B: "b", C: "c", D: "d" }, vercel);
1086+
1087+
expect(
1088+
await repository.deleteValues(project.id, { environmentId: branch.id, keys: ["A", "B", "C"] })
1089+
).toEqual({ deleted: ["A", "B", "C"], skipped: [] });
1090+
expect(await ownKeys(branch.id)).toEqual(["D"]);
1091+
expect(await secretRows(branch.id)).toEqual({ store: ["D"], references: ["D"] });
1092+
expect(await repository.getEnvironmentVariables(project.id, branch.id)).toEqual([
1093+
{ key: "D", value: "d" },
1094+
]);
1095+
});
10811096
});
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
2-
title: "Bulk delete env vars"
2+
title: "Bulk Delete Env Vars"
33
openapi: "v3-openapi POST /api/v1/projects/{projectRef}/envvars/{env}/bulk-delete"
44
---

‎docs/v3-openapi.yaml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2192,7 +2192,7 @@ paths:
21922192
post:
21932193
operationId: bulk_delete_project_envvars_v1
21942194
summary: Bulk delete environment variables
2195-
description: Delete up to 1000 environment variables from a specific project and environment in one request. Keys that have no value in the environment, or that the filters exclude, are returned as skipped.
2195+
description: Delete up to 1000 environment variables from a specific project and environment in one request. Keys that have no value in the environment, that the filters exclude, or whose value changed while the delete ran are returned as skipped.
21962196
requestBody:
21972197
required: true
21982198
content:
@@ -2230,7 +2230,7 @@ paths:
22302230
required: ["type", "integration"]
22312231
onlyShadowingParent:
22322232
type: boolean
2233-
description: On a preview branch, only delete values whose key also has a value on the parent environment, so the branch falls back to the shared value.
2233+
description: Only delete values whose key also has a value on the parent environment, so the branch falls back to the shared value. Takes effect only when the request addresses a preview branch, via the `x-trigger-branch` header or the SDK client's `previewBranch` option; on an environment with no parent every key is skipped.
22342234
default: false
22352235
required: ["keys"]
22362236
responses:
@@ -2248,7 +2248,7 @@ paths:
22482248
type: string
22492249
skipped:
22502250
type: array
2251-
description: Keys that were left untouched, because the environment had no value for them or a filter excluded them.
2251+
description: Keys that were left untouched, because the environment had no value for them, a filter excluded them, or their value changed while the delete ran. A skip caused by a concurrent change is transient and a retry can delete the key.
22522252
items:
22532253
type: string
22542254
required: ["deleted", "skipped"]

‎packages/core/src/v3/apiClient/types.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ export type BulkDeleteEnvironmentVariablesParams = {
3535
keys: string[];
3636
/** Only delete values that were last written by this source. */
3737
onlyWrittenBy?: EnvironmentVariableSource;
38-
/** Only delete values on a branch whose key also has a value on the parent environment. */
38+
/**
39+
* Only delete values whose key also has a value on the parent environment. Takes effect only
40+
* when the request addresses a preview branch (`x-trigger-branch` header or the API client's
41+
* `previewBranch` option); on an environment with no parent every key is skipped.
42+
*/
3943
onlyShadowingParent?: boolean;
4044
};
4145

‎packages/core/src/v3/schemas/api.ts‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1626,7 +1626,11 @@ export const BulkDeleteEnvironmentVariablesRequestBody = z.object({
16261626
keys: z.array(z.string().min(1).max(256)).min(1).max(1000),
16271627
/** Only remove values last written by this source. */
16281628
onlyWrittenBy: EnvironmentVariableSource.optional(),
1629-
/** Only remove values whose key also has a value on the parent environment. */
1629+
/**
1630+
* Only remove values whose key also has a value on the parent environment. Takes effect only
1631+
* when the request addresses a preview branch (`x-trigger-branch` header or the API client's
1632+
* `previewBranch` option); on an environment with no parent every key is skipped.
1633+
*/
16301634
onlyShadowingParent: z.boolean().optional(),
16311635
});
16321636

@@ -1635,7 +1639,12 @@ export type BulkDeleteEnvironmentVariablesRequestBody = z.infer<
16351639
>;
16361640

16371641
export const BulkDeleteEnvironmentVariablesResponseBody = z.object({
1642+
/** Keys whose value was removed from the environment. */
16381643
deleted: z.array(z.string()),
1644+
/**
1645+
* Keys left untouched: the environment had no value for them, a filter excluded them, or their
1646+
* value changed while the delete ran. A skip caused by a concurrent change is transient.
1647+
*/
16391648
skipped: z.array(z.string()),
16401649
});
16411650

0 commit comments

Comments
 (0)