fix(web): handle missing analytics data on every page - #15
Merged
Merged
Conversation
Queries read parquet files with DuckDB unconditionally, so a missing data directory, an empty one, or a partial set of files threw 'IO Error: No files found that match the pattern' and every web page returned 500. List queries now return [] when their files are missing, detail queries report 'run not found', and a missing test-results or iteration file yields empty sub-results instead of an error. Co-Authored-By: Claude <noreply@anthropic.com>
Remove the 'No such file or directory' matching from the SCIL/ACIL routes; the data layer now returns empty results for missing files. Detail routes map InvalidRunIdError to 404, and an onError handler replaces Hono's plain-text 500 with a JSON body the client can parse. Co-Authored-By: Claude <noreply@anthropic.com>
Add a shared fetchJson helper that checks the response status and falls back to the status text when an error body is not JSON, and use it on all seven pages. The Analytics page now shows an empty-state message instead of zeroed stats when there are no test results. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every data page in skillwalker-web returned a plain-text 500 when the analytics data directory was missing, empty, or only partly populated. The client then showed
SyntaxError: Unexpected token 'I', "Internal S"... is not valid JSONinstead of its empty-state message.Why it broke
IO Error: No files found that match the pattern ....No such file or directory, which DuckDB never produces. The route tests passed only because they mocked that invented message. The test-runs and analytics routes had no guard.onErrorhandler, Hono sent plain text. The pages calledres.json()without checkingres.ok.Changes
packages/data): the queries check which parquet files exist before reading them.[].test-resultsor iteration file gives empty sub-results. Runs without evaluation results now appear with no pass/fail result instead of breaking the page.InvalidRunIdErrornow returns 404.jsonErrorHandleronapp.onErrorreturns{ error }JSON for anything unexpected.fetchJsonhelper checks the status and falls back to the status text for bodies that aren't JSON. All seven pages use it.docs/web.mderror handling and added a missing-parquet section todocs/data.md.Known limits (documented in
docs/data.md)test-run.parquetwithouttest-config.parquetreads as "no data", not as an error.Testing
mainand pass here.fetchJson,jsonErrorHandler, and the invalid-run-ID 404s.make test: 1057 passing.skillwalker-webagainst a data directory that doesn't exist. All list endpoints return200with empty JSON, and the detail endpoints return a JSON404, both for unknown and for malformed run IDs.🤖 Generated with Claude Code