Skip to content

Commit 17dbcd0

Browse files
refactor(webapp): modularize reconciliation logic and move tests to conventional location
1 parent 80c5baf commit 17dbcd0

File tree

3 files changed

+3
-38
lines changed

3 files changed

+3
-38
lines changed

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -220,16 +220,6 @@ export class RunPresenter {
220220
let nDuration = n.data.duration;
221221
let nIsError = n.data.isError;
222222

223-
// NOTE: Clickhouse trace ingestion is eventually consistent.
224-
// When a run is marked finished in Postgres, we reconcile the
225-
// root span to reflect completion even if telemetry is still partial.
226-
// This is a deliberate UI-layer tradeoff to prevent stale or "stuck"
227-
// run states in the dashboard.
228-
if (isRoot && runData.isFinished && nIsPartial) {
229-
nIsPartial = false;
230-
nDuration = Math.max(nDuration ?? 0, postgresRunDuration);
231-
nIsError = isFailedRunStatus(runData.status);
232-
}
233223

234224
//only let non-debug events extend the total duration
235225
if (!n.data.isDebug) {

apps/webapp/test/RunPresenter.test.ts renamed to apps/webapp/app/presenters/v3/reconcileTrace.server.test.ts

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,5 @@
1-
import { vi, describe, it, expect } from "vitest";
2-
3-
vi.mock("../app/env.server", () => ({
4-
env: {
5-
MAXIMUM_LIVE_RELOADING_EVENTS: 1000,
6-
},
7-
}));
8-
9-
vi.mock("../app/db.server", () => ({
10-
prisma: {},
11-
$replica: {},
12-
$transaction: vi.fn(),
13-
}));
14-
15-
vi.mock("../app/v3/eventRepository/index.server", () => ({
16-
resolveEventRepositoryForStore: vi.fn(),
17-
}));
18-
19-
vi.mock("../app/v3/taskEventStore.server", () => ({
20-
getTaskEventStoreTableForRun: vi.fn(),
21-
}));
22-
23-
vi.mock("../app/utils/username", () => ({
24-
getUsername: vi.fn(),
25-
}));
26-
27-
import { reconcileTraceWithRunLifecycle } from "../app/presenters/v3/reconcileTrace.server";
1+
import { describe, it, expect } from "vitest";
2+
import { reconcileTraceWithRunLifecycle } from "./reconcileTrace.server";
283
import { millisecondsToNanoseconds } from "@trigger.dev/core/v3";
294

305
describe("reconcileTraceWithRunLifecycle", () => {

apps/webapp/vitest.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import tsconfigPaths from "vite-tsconfig-paths";
33

44
export default defineConfig({
55
test: {
6-
include: ["test/**/*.test.ts"],
6+
include: ["test/**/*.test.ts", "app/**/*.test.ts"],
77
globals: true,
88
pool: "forks",
99
},

0 commit comments

Comments
 (0)