fix(log): retry transient JSON generation failures - #621
Open
okt-limonikas wants to merge 1 commit into
Open
Conversation
On-demand log JSON can be served while the log server is still writing the file, causing response.json() to fail and leaving the selected test in an error state until navigation retries it. Retry transient HTTP and JSON parsing failures with bounded, abort-aware backoff. Preserve immediate cancellation and non-retryable client errors, and return an actionable error when generation never stabilizes. Issue: ts-factory#573 Signed-off-by: Danil Kostromin <danil.kostromin@icloud.com>
okt-limonikas
force-pushed
the
fix/log-json-fetch-retry
branch
from
August 4, 2026 15:42
fcf1ddd to
fb7693b
Compare
okt-limonikas
added a commit
to okt-limonikas/test-environment
that referenced
this pull request
Aug 4, 2026
On-demand JSON files were written directly to their public paths. Apache could serve a file as soon as it was opened, so concurrent clients sometimes received empty or truncated JSON. Write node files and tree.json to same-directory temporary files and rename them only after a successful close. Preserve output permissions and reap temporary files abandoned by interrupted conversions without disturbing active writers. Link: ts-factory/bublik-ui#573 Link: ts-factory/bublik-ui#621 Signed-off-by: Danil Kostromin <danil.kostromin@icloud.com>
okt-limonikas
added a commit
to okt-limonikas/test-environment
that referenced
this pull request
Aug 4, 2026
Concurrent requests for a missing JSON file could start multiple converters for the same destination. This wasted resources and made the partial-file race more likely. Canonicalize requested paths and serialize generation through a bounded 256-slot lock pool. Recheck the target under the lock so waiters reuse the completed file, return explicit HTTP statuses, and keep generator diagnostics out of client responses. Link: ts-factory/bublik-ui#573 Link: ts-factory/bublik-ui#621 Signed-off-by: Danil Kostromin <danil.kostromin@icloud.com>
okt-limonikas
added a commit
to okt-limonikas/test-environment
that referenced
this pull request
Aug 4, 2026
Concurrent requests for a missing JSON file could start multiple converters for the same destination. This wasted resources and made the partial-file race more likely. Canonicalize requested paths and serialize generation through a bounded 256-slot lock pool. Recheck the target under the lock so waiters reuse the completed file, return explicit HTTP statuses, and keep generator diagnostics out of client responses. Link: ts-factory/bublik-ui#573 Link: ts-factory/bublik-ui#621 Signed-off-by: Danil Kostromin <danil.kostromin@icloud.com>
k0nstantin
approved these changes
Aug 19, 2026
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.
Summary
This PR makes the React log viewer tolerate the short interval in which an
on-demand log JSON resource is not yet complete or temporarily unavailable.
The log JSON fetch now performs a bounded retry with abort-aware backoff for:
Non-transient client errors are still returned immediately, and changing the
selected test aborts the current request and any pending retry delay.
Problem
Loading a test log is a two-stage operation:
The log server generates missing JSON files on demand. Before the accompanying
server fix, the public filename could become visible while the converter was
still writing it. A request could therefore return HTTP 200 with an empty,
truncated, or concurrently corrupted body.
The UI previously called
response.json()once. If parsing failed, the queryremained in its error state and the selected log panel was empty or unavailable.
Selecting a different test and returning to the original test triggered a new
request after generation had completed, so the same log then appeared normally.
Why the failure is intermittent
The result depends on timing:
window.
This explains why the problem is more common for some tests and difficult to
reproduce in a development environment with cached JSON files.
Fix
The JSON fetch helper now makes at most three attempts:
Retries stop immediately when the request is aborted. Stable 4xx responses such
as HTTP 400 and non-transport exceptions are not retried. If all parse attempts
fail, the caller receives a clear
Log is not readyerror instead of a rawSyntaxError.