Skip to content

fix(ui): load debug data and artifacts for failed runs too - #148

Open
arminfauland wants to merge 1 commit into
Disane87:mainfrom
arminfauland:fix/load-run-data-also-on-failure
Open

fix(ui): load debug data and artifacts for failed runs too#148
arminfauland wants to merge 1 commit into
Disane87:mainfrom
arminfauland:fix/load-run-data-also-on-failure

Conversation

@arminfauland

Copy link
Copy Markdown

The problem

RunsStore.handleScrapeEnd() only fetches debug data and artifacts when a run finished successfully:

if (status === 'success' && event.scrapeId) {
  this.loadRunData(event.runId, event.scrapeId);
}

A failed run therefore never gets them — which is exactly the case where you want to look at them. Debugging a failure currently means reloading the page or querying the API by hand.

The change

Drop the status === 'success' guard. That is the whole fix.

loadRunData() already handles its own errors and logs a warning if the endpoints do not answer, so a failed run that has no artifacts yet is harmless — it simply logs and moves on.

Tests

Adds runs.store.spec.ts, which did not exist. Six cases around handleScrapeEnd:

  • marks a run without error as success
  • marks a run with error as failed, keeps the error text
  • loads debug data and artifacts after a successful run
  • loads them after a failed run too — the regression this PR fixes
  • does not load when the event carries no scrapeId
  • ignores events without a runId, leaving the run untouched

Full UI suite: 182 tests / 25 files, all passing. nx lint ui clean.

Context

Found while investigating #147 (run details staying empty during a run). That one is a separate, larger question and is deliberately not part of this PR — this is the small, independent piece that stands on its own.

`handleScrapeEnd()` only fetched debug data and artifacts when the run
finished successfully:

    if (status === 'success' && event.scrapeId) {
      this.loadRunData(event.runId, event.scrapeId);
    }

So a failed run never got them — exactly the case where you want to look
at them. Anyone debugging a failure had to reload the page or query the
API directly.

Dropping the `status === 'success'` guard is enough; `loadRunData()`
already handles its own errors and logs a warning if the endpoints do not
answer, so a failed run that has no artifacts yet is harmless.

Adds runs.store.spec.ts covering handleScrapeEnd: success and failure
paths, the regression itself, and the two guard clauses (missing runId,
missing scrapeId).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LixHBPkhb8h5oDdMqSG4se
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant