MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / reportFor

Function reportFor

e2e/cloud/storage-error-report-shape.test.ts:147–172  ·  view source on GitHub ↗
(traceId: string)

Source from the content-addressed store, hash-verified

145
146/** Find the structured operator report by the ID returned to the caller. */
147const reportFor = (traceId: string) =>
148 Effect.sync(() => {
149 for (const line of readServerLog().split("\n")) {
150 if (!line.startsWith("{")) continue;
151 // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: mixed stdout includes non-JSON records
152 try {
153 const report = decodeReport(JSON.parse(line));
154 if (report._tag === "Some" && report.value.sentry_event_id === traceId) {
155 return {
156 headline: JSON.stringify(report.value.tags),
157 full: line,
158 tags: report.value.tags,
159 };
160 }
161 } catch {
162 /* Other stdout records are not diagnostic envelopes. */
163 }
164 }
165 return undefined;
166 }).pipe(
167 Effect.filterOrFail(
168 (report) => report !== undefined,
169 () => `no error report joined to trace id ${traceId} in the server log`,
170 ),
171 Effect.retry(Schedule.both(Schedule.spaced("500 millis"), Schedule.recurs(40))),
172 );
173
174scenario(
175 "Storage · a rejected write is reported without its SQL or the caller's data",

Calls 3

readServerLogFunction · 0.85
retryMethod · 0.80
syncMethod · 0.65

Tested by

no test coverage detected