Skip to content

Commit 1ef21cf

Browse files
d-csclaude
andcommitted
fix(run-ops presenters): batch-list empty-state probe mirrors the scan's client
In passthrough mode (readRoute provided but splitEnabled false) the empty-state probe read runOpsNew while the page scan reads _replica, so a configured-but-read-disabled run-ops DB could make the 'no batches' hint disagree with the page. Gate the probe on splitEnabled first. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 77236dd commit 1ef21cf

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

apps/webapp/app/presenters/v3/BatchListPresenter.server.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,19 +111,24 @@ export class BatchListPresenter extends BasePresenter {
111111
// Empty-state probe. Split on: probe the new run-ops DB first, then the legacy READ REPLICA only
112112
// (never the legacy primary). Split off (single-DB / self-host): one plain `_replica` probe.
113113
async #probeAnyBatch(environmentId: string): Promise<boolean> {
114-
const onNew = await (this.readRoute?.runOpsNew ?? this._replica).batchTaskRun.findFirst({
114+
// Passthrough: probe the SAME client the scan uses (_replica), or the empty-state hint can
115+
// disagree with the page when a run-ops DB is configured but read-split is off.
116+
if (!this.readRoute?.splitEnabled) {
117+
const onReplica = await this._replica.batchTaskRun.findFirst({
118+
where: { runtimeEnvironmentId: environmentId },
119+
});
120+
return Boolean(onReplica);
121+
}
122+
123+
const onNew = await (this.readRoute.runOpsNew ?? this._replica).batchTaskRun.findFirst({
115124
where: { runtimeEnvironmentId: environmentId },
116125
});
117126
if (onNew) {
118127
return true;
119128
}
120129

121-
if (!this.readRoute?.splitEnabled) {
122-
return false;
123-
}
124-
125130
const onLegacy = await (
126-
this.readRoute?.runOpsLegacyReplica ?? this._replica
131+
this.readRoute.runOpsLegacyReplica ?? this._replica
127132
).batchTaskRun.findFirst({
128133
where: { runtimeEnvironmentId: environmentId },
129134
});

0 commit comments

Comments
 (0)