History

add name column to secret_materials table

Add an optional name field to secret materials so users can label their stored credentials. Update the schema model, the postgres provider, and all test fixtures to include the new column.

Rhys Sullivan committed 8 months ago

Commit cbb2d631 parent 54d020a6 files · +9 −0Browse files

Unified · Split

6 files
  1. packages/control-plane/drizzle/20260308140000_secret_materials_name/migration.sql +1 −0
  2. packages/control-plane/src/persistence/control-plane-rows.test.ts +2 −0
  3. packages/control-plane/src/runtime/secret-material-providers.ts +1 −0
  4. packages/control-plane/src/runtime/source-store.test.ts +2 −0
  5. packages/control-plane/src/runtime/workspace-execution-environment.test.ts +2 −0
  6. packages/control-plane/src/schema/models/secret-material.ts +1 −0
packages/control-plane/drizzle/20260308140000_secret_materials_name/migration.sql+1−0
@@ -0,0 +1 @@
1+ALTER TABLE "secret_materials" ADD COLUMN "name" text;
packages/control-plane/src/persistence/control-plane-rows.test.ts+2−0
@@ -82,6 +82,7 @@ const seedWorkspaceCredentialState = (input: { · 81 unmodified lines
8282 });
8383 yield* input.persistence.rows.secretMaterials.upsert({
8484 id: tokenId,
85+ name: null,
8586 purpose: "oauth_access_token",
8687 value: "token",
8788 createdAt: now,
@@ -89,6 +90,7 @@ const seedWorkspaceCredentialState = (input: { · 1 unmodified line
8990 });
9091 yield* input.persistence.rows.secretMaterials.upsert({
9192 id: refreshId,
93+ name: null,
9294 purpose: "oauth_refresh_token",
9395 value: "refresh",
9496 createdAt: now,
packages/control-plane/src/runtime/secret-material-providers.ts+1−0
@@ -243,6 +243,7 @@ const createPostgresSecretMaterialProvider = (): SecretMaterialProvider => ({ · 242 unmodified lines
243243 const id = SecretMaterialIdSchema.make(`sec_${randomUUID()}`);
244244 yield* runtime.rows.secretMaterials.upsert({
245245 id,
246+ name: null,
246247 purpose,
247248 value,
248249 createdAt: now,
packages/control-plane/src/runtime/source-store.test.ts+2−0
@@ -85,6 +85,7 @@ describe("source-store", () => { · 84 unmodified lines
8585
8686 yield* persistence.rows.secretMaterials.upsert({
8787 id: firstTokenId,
88+ name: null,
8889 purpose: "auth_material",
8990 value: "ghp_first",
9091 createdAt: now,
@@ -92,6 +93,7 @@ describe("source-store", () => { · 1 unmodified line
9293 });
9394 yield* persistence.rows.secretMaterials.upsert({
9495 id: secondTokenId,
96+ name: null,
9597 purpose: "auth_material",
9698 value: "ghp_second",
9799 createdAt: now,
packages/control-plane/src/runtime/workspace-execution-environment.test.ts+2−0
@@ -584,6 +584,7 @@ const makeResolver = (persistence: SqlControlPlanePersistence) => · 583 unmodified lines
584584 storeSecretMaterial: () => Effect.fail(new Error("not implemented in test")),
585585 getSourceById: () => Effect.fail(new Error("not implemented in test")),
586586 addExecutorSource: () => Effect.fail(new Error("not implemented in test")),
587+ connectMcpSource: () => Effect.fail(new Error("not implemented in test")),
587588 completeSourceCredentialSetup: () => Effect.fail(new Error("not implemented in test")),
588589 } as RuntimeSourceAuthService,
589590 });
@@ -738,6 +739,7 @@ describe("workspace-execution-environment", () => { · 148 unmodified lines
738739 );
739740 yield* persistence.rows.secretMaterials.upsert({
740741 id: tokenSecretMaterialId,
742+ name: null,
741743 purpose: "auth_material",
742744 value: "ghp_test_token",
743745 createdAt: now,
packages/control-plane/src/schema/models/secret-material.ts+1−0
@@ -14,6 +14,7 @@ export const SecretMaterialPurposeSchema = Schema.Literal( · 13 unmodified lines
1414
1515 const secretMaterialSchemaOverrides = {
1616 id: SecretMaterialIdSchema,
17+ name: Schema.NullOr(Schema.String),
1718 purpose: SecretMaterialPurposeSchema,
1819 createdAt: TimestampMsSchema,
1920 updatedAt: TimestampMsSchema,