Repository navigation
web: report an incomplete export transfer separately from unreachable - #236
Merged
Merged
Conversation
Wrap mid-body response.blob() failures in IncompleteExportError so an export cut off after 2xx headers tells the operator 'the export did not finish; download it again' without saving a partial file, while preserving typed ApiError refusals and pre-header connection errors across every export caller. Closes #129
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
Primary Issue
Closes #129
Problem And Outcome
downloadExportreads the streamed export response into aBlobbefore saving it so a truncated transfer can never save a partial file. Previously, when a transfer started (200 OK) and then cut off mid-body,response.blob()threw a non-ApiErrorand every caller fell back to"the server could not be reached", telling the operator the wrong cause and wrong next step.downloadExportnow distinguishes all three outcomes through a single error boundary:ApiError) → the server's own message.2xx) and cut off while reading the body (IncompleteExportError) →"the export did not finish; download it again", with no download saved."the server could not be reached".Changes
web/src/lib/api/exports.tsIncompleteExportErrorand wrappedawait response.blob()so mid-transfer read failures throwIncompleteExportErrorbeforeURL.createObjectURLor<a download>runs.describeExportError(err)as the single owning formatter fordownloadExporterrors.web/src/lib/exports/ExportsCard.svelte,web/src/routes/drafts/[id]/+page.svelte,web/src/routes/records/+page.svelte,web/src/routes/enrollments/[id]/+page.sveltecatchblock throughdescribeExportError(err).web/e2e/installation-export.spec.tsconsolebook-servercovering: (1) a200 OKchunked transfer cut off mid-body with no terminal chunk ("the export did not finish; download it again", 0 downloads), (2) a typed503 export_busyrefusal (server message, 0 downloads), (3) a pre-header connection abort ("the server could not be reached", 0 downloads), and (4) an unobstructed retry that downloads and passesconsolebook-server export verify.Why not split:
drafts/[id]/+page.svelteandenrollments/[id]/+page.sveltealready exceed 1,000 lines and this change only replaces their 1-linecatchformatter with the shareddescribeExportErrorhelper without adding new page behavior.Verification
Red-first check (before the fix)
Running
npx playwright test e2e/installation-export.spec.ts -g "cut off mid-transfer"against unfixed code failed on step 1 as expected:Expected: "the export did not finish; download it again"Received: "the server could not be reached"Local proof receipt — passed
caa6f41dd44aabad4ff705cd912360d53b218b4etreeb763a60dcbe5cb2cdda7d2f6eae663d12fcfc9a4; unchanged during run: truecargo xtask proofin/data/dev/src/consolebook87f297e8dad4868f1364b29eb9a45b372ca3dc34e8e205c3505d15883036daa5/home/dev/.cache/ms-playwright/chromium-1254/chrome-linux64/chrome(Google Chrome for Testing 158.0.8127.18)target/debug/consolebook-serversha256c54ae11fa28928868b8dbe95fb68efac379b4cfed55dd58a3a0ebb6588b904878f2232a5faec705e7a046e9e44799d9598806fd4a2434ff424dfe22066c38196f1526d89edc5f2edd98b101ceefa6461d5b0cb8ad39d5f6474e1f8efa3bd20f7scripts/check-guidance-names.sh2b172a8e66c87574(cd web && npm ci && npm run check && npm run build)3c26a20ee8e3046bcargo fmt --checke3b0c44298fc1c14cargo clippy --workspace --all-targets -- -D warningsa521a97fabed0c28cargo test --workspace5ce0737a18d0f116cargo build -p consolebook-serverdd621e9ff7c9eac1(cd web && npx playwright install chromium && npm run e2e)8aaa68537bef2942Review And Merge Notes
IncompleteExportErrorand singledescribeExportErrorformatter across all export callers, with an end-to-end truncated-chunked-stream browser test.