Skip to content

Commit c5b209d

Browse files
d-csclaude
andcommitted
fix(webapp): use shared deserialiseMollifierSnapshot in logs download
The buffered-run placeholder branch of the logs download route parsed the snapshot payload with raw `JSON.parse`, diverging from every other read-side module (`RunStreamPresenter`, `syntheticRedirectInfo`, etc.) that goes through the webapp wrapper `deserialiseMollifierSnapshot`. The contract comment in `mollifierSnapshot.server.ts` documents the single-deserialisation-path requirement: callers using the wrapper won't drift if the snapshot encoding ever changes. No behavioural change today (both end up calling `JSON.parse` under the hood) — pure consistency fix. Devin follow-up on PR #3757. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent c2eadb3 commit c5b209d

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

apps/webapp/app/routes/resources.runs.$runParam.logs.download.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { getTaskEventStoreTableForRun } from "~/v3/taskEventStore.server";
1010
import { TaskEventKind } from "@trigger.dev/database";
1111
import { getEventRepositoryForStore } from "~/v3/eventRepository/index.server";
1212
import { getMollifierBuffer } from "~/v3/mollifier/mollifierBuffer.server";
13+
import { deserialiseMollifierSnapshot } from "~/v3/mollifier/mollifierSnapshot.server";
1314

1415
export async function loader({ params, request }: LoaderFunctionArgs) {
1516
const user = await requireUser(request);
@@ -52,7 +53,14 @@ export async function loader({ params, request }: LoaderFunctionArgs) {
5253
if (member) {
5354
let taskIdentifier: string | undefined;
5455
try {
55-
const snapshot = JSON.parse(entry.payload) as { taskIdentifier?: unknown };
56+
// Use the shared webapp wrapper rather than raw JSON.parse so
57+
// every read-side module shares a single deserialisation path
58+
// (see contract comment in `mollifierSnapshot.server.ts` and
59+
// `syntheticRedirectInfo.server.ts`). Keeps behaviour
60+
// consistent if the snapshot encoding ever changes.
61+
const snapshot = deserialiseMollifierSnapshot(entry.payload) as {
62+
taskIdentifier?: unknown;
63+
};
5664
if (typeof snapshot.taskIdentifier === "string") {
5765
taskIdentifier = snapshot.taskIdentifier;
5866
}

0 commit comments

Comments
 (0)