Skip to content

Commit d46aab2

Browse files
d-csclaude
andcommitted
fix(run-ops split): make passthrough assertEnvExists a no-op in single-DB
The passthrough resolver runs single-DB, so a run and its environment share one database and there is no cross-seam FK to replace (matches main, which dropped the TaskRun env FK). Skip the always-on hot-path findFirst; the split-aware resolver still enforces env existence when the split makes a DB-level FK impossible. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 58f9232 commit d46aab2

2 files changed

Lines changed: 6 additions & 11 deletions

File tree

internal-packages/run-engine/src/engine/controlPlaneResolver.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -180,15 +180,9 @@ export class PassthroughControlPlaneResolver implements ControlPlaneResolver {
180180
};
181181
}
182182

183-
async assertEnvExists(environmentId: string): Promise<void> {
184-
const env = await this.#prisma.runtimeEnvironment.findFirst({
185-
where: { id: environmentId },
186-
select: { id: true },
187-
});
188-
189-
if (!env) {
190-
throw new Error(`Environment not found: ${environmentId}`);
191-
}
183+
async assertEnvExists(_environmentId: string): Promise<void> {
184+
// No-op: passthrough is single-DB, so run and env share one database and there is
185+
// no cross-seam FK to replace (matches main, which dropped the TaskRun env FK).
192186
}
193187

194188
async resolveWorkerVersion(args: {

internal-packages/run-engine/src/engine/tests/controlPlaneResolverInjectability.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,14 @@ describe("RunEngine controlPlaneResolver injectability", () => {
9797
"deployment" in setup ? setup.deployment.id : undefined
9898
);
9999

100-
// assertEnvExists resolves for a present env and rejects for a missing one.
100+
// The default passthrough resolver is single-DB, so assertEnvExists is a no-op:
101+
// it resolves for both a present and a missing env (nothing to assert).
101102
await expect(
102103
engine.controlPlaneResolver.assertEnvExists(environment.id)
103104
).resolves.toBeUndefined();
104105
await expect(
105106
engine.controlPlaneResolver.assertEnvExists("env_does_not_exist")
106-
).rejects.toThrow();
107+
).resolves.toBeUndefined();
107108
} finally {
108109
await engine.quit();
109110
}

0 commit comments

Comments
 (0)