Fix unnecessary warning in tests

This commit is contained in:
Konstantin Wohlwend 2026-02-26 16:23:33 -08:00
parent 9c0d4e058f
commit 3d86512efd
3 changed files with 21 additions and 33 deletions

View File

@ -276,7 +276,7 @@ export const PATCH = createSmartRouteHandler({
const levelConfig = levelConfigs[req.params.level];
const parsedConfig = await parseAndValidateConfig(req.body.config_override_string, levelConfig);
await levelConfig.override({
const newConfig = await levelConfig.override({
projectId: req.auth.tenancy.project.id,
branchId: req.auth.tenancy.branchId,
config: parsedConfig,
@ -285,7 +285,7 @@ export const PATCH = createSmartRouteHandler({
await warnOnValidationFailure(levelConfig, {
projectId: req.auth.tenancy.project.id,
branchId: req.auth.tenancy.branchId,
config: parsedConfig,
config: newConfig,
});
if (req.params.level === "environment" && shouldEnqueueExternalDbSync(parsedConfig)) {

View File

@ -401,57 +401,63 @@ export function setOrganizationConfigOverride(options: {
export async function overrideProjectConfigOverride(options: {
projectId: string,
projectConfigOverrideOverride: ProjectConfigOverrideOverride,
}): Promise<void> {
}): Promise<ProjectConfigOverride> {
// TODO put this in a serializable transaction (or a single SQL query) to prevent race conditions
const oldConfig = await rawQuery(globalPrismaClient, getProjectConfigOverrideQuery(options));
const newConfigUnmigrated = override(
oldConfig,
options.projectConfigOverrideOverride,
);
) as ProjectConfigOverride;
await setProjectConfigOverride({
projectId: options.projectId,
projectConfigOverride: newConfigUnmigrated as ProjectConfigOverride,
projectConfigOverride: newConfigUnmigrated,
});
return newConfigUnmigrated;
}
export async function overrideBranchConfigOverride(options: {
projectId: string,
branchId: string,
branchConfigOverrideOverride: BranchConfigOverrideOverride,
}): Promise<void> {
}): Promise<BranchConfigOverride> {
// TODO put this in a serializable transaction (or a single SQL query) to prevent race conditions
const oldConfig = await rawQuery(globalPrismaClient, getBranchConfigOverrideQuery(options));
const newConfigUnmigrated = override(
oldConfig,
options.branchConfigOverrideOverride,
);
) as BranchConfigOverride;
// setBranchConfigOverride uses upsert and preserves existing source automatically
await setBranchConfigOverride({
projectId: options.projectId,
branchId: options.branchId,
branchConfigOverride: newConfigUnmigrated as BranchConfigOverride,
branchConfigOverride: newConfigUnmigrated,
});
return newConfigUnmigrated;
}
export async function overrideEnvironmentConfigOverride(options: {
projectId: string,
branchId: string,
environmentConfigOverrideOverride: EnvironmentConfigOverrideOverride,
}): Promise<void> {
}): Promise<EnvironmentConfigOverride> {
// TODO put this in a serializable transaction (or a single SQL query) to prevent race conditions
const oldConfig = await rawQuery(globalPrismaClient, getEnvironmentConfigOverrideQuery(options));
const newConfigUnmigrated = override(
oldConfig,
options.environmentConfigOverrideOverride,
);
) as EnvironmentConfigOverride;
await setEnvironmentConfigOverride({
projectId: options.projectId,
branchId: options.branchId,
environmentConfigOverride: newConfigUnmigrated as EnvironmentConfigOverride,
environmentConfigOverride: newConfigUnmigrated,
});
return newConfigUnmigrated;
}
export function overrideOrganizationConfigOverride(options: {
@ -459,7 +465,7 @@ export function overrideOrganizationConfigOverride(options: {
branchId: string,
organizationId: string | null,
organizationConfigOverrideOverride: OrganizationConfigOverrideOverride,
}): Promise<void> {
}): Promise<OrganizationConfigOverride> {
// save organization config override on DB (either our own, or the source of truth one)
throw new StackAssertionError('Not implemented');
}

View File

@ -71,7 +71,7 @@ importers:
version: 14.2.17(eslint@8.30.0)(typescript@5.3.3)
eslint-plugin-import:
specifier: ^2.31.0
version: 2.31.0(@typescript-eslint/parser@6.21.0(eslint@8.30.0)(typescript@5.3.3))(eslint@8.30.0)
version: 2.31.0(@typescript-eslint/parser@6.21.0(eslint@8.30.0)(typescript@5.3.3))(eslint-import-resolver-typescript@3.6.1)(eslint@8.30.0)
eslint-plugin-node:
specifier: ^11.1.0
version: 11.1.0(eslint@8.30.0)
@ -538,9 +538,6 @@ importers:
next:
specifier: 16.1.5
version: 16.1.5(@babel/core@7.28.5)(@opentelemetry/api@1.9.0)(react-dom@19.2.3(react@19.2.3))(react@19.2.3)
next-themes:
specifier: ^0.2.1
version: 0.2.1(next@16.1.5(@babel/core@7.28.5)(@opentelemetry/api@1.9.0)(react-dom@19.2.3(react@19.2.3))(react@19.2.3))(react-dom@19.2.3(react@19.2.3))(react@19.2.3)
posthog-js:
specifier: ^1.336.1
version: 1.336.1
@ -27354,16 +27351,6 @@ snapshots:
transitivePeerDependencies:
- supports-color
eslint-module-utils@2.12.0(@typescript-eslint/parser@6.21.0(eslint@8.30.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint@8.30.0):
dependencies:
debug: 3.2.7
optionalDependencies:
'@typescript-eslint/parser': 6.21.0(eslint@8.30.0)(typescript@5.3.3)
eslint: 8.30.0
eslint-import-resolver-node: 0.3.9
transitivePeerDependencies:
- supports-color
eslint-module-utils@2.12.0(@typescript-eslint/parser@6.21.0(eslint@8.30.0)(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@6.21.0(eslint@8.30.0)(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@6.21.0(eslint@8.30.0)(typescript@5.8.3))(eslint@8.30.0))(eslint@8.30.0))(eslint@8.30.0):
dependencies:
debug: 3.2.7
@ -27450,7 +27437,7 @@ snapshots:
doctrine: 2.1.0
eslint: 8.30.0
eslint-import-resolver-node: 0.3.9
eslint-module-utils: 2.12.0(@typescript-eslint/parser@6.21.0(eslint@8.30.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint@8.30.0)
eslint-module-utils: 2.12.0(@typescript-eslint/parser@6.21.0(eslint@8.30.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@6.21.0(eslint@8.30.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@6.21.0(eslint@8.30.0)(typescript@5.3.3))(eslint@8.30.0))(eslint@8.30.0))(eslint@8.30.0)
hasown: 2.0.2
is-core-module: 2.15.1
is-glob: 4.0.3
@ -27467,6 +27454,7 @@ snapshots:
- eslint-import-resolver-typescript
- eslint-import-resolver-webpack
- supports-color
optional: true
eslint-plugin-import@2.31.0(@typescript-eslint/parser@6.21.0(eslint@8.30.0)(typescript@5.8.3))(eslint-import-resolver-typescript@3.6.3)(eslint@8.30.0):
dependencies:
@ -30353,12 +30341,6 @@ snapshots:
react: 18.3.1
react-dom: 18.3.1(react@18.3.1)
next-themes@0.2.1(next@16.1.5(@babel/core@7.28.5)(@opentelemetry/api@1.9.0)(react-dom@19.2.3(react@19.2.3))(react@19.2.3))(react-dom@19.2.3(react@19.2.3))(react@19.2.3):
dependencies:
next: 16.1.5(@babel/core@7.28.5)(@opentelemetry/api@1.9.0)(react-dom@19.2.3(react@19.2.3))(react@19.2.3)
react: 19.2.3
react-dom: 19.2.3(react@19.2.3)
next-themes@0.3.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1):
dependencies:
react: 18.3.1