Skip to content

Upload: failed finalize re-runs createDraftDataset instead of retrying finalize #201

Closed

Description

@neuromechanist

Surfaced by review of #198. Pre-existing control flow, not introduced by that PR.

Problem

In src/pages/upload.astro, the catch-all around the upload flow re-enables the submit form after a finalizeDataset failure. Clicking Submit again re-runs the whole flow from the top — createDraftDataset (upload.astro, around line 570) — rather than retrying finalize against the existing draft.id.

So a user whose finalize fails can create a duplicate draft and re-upload every byte, which is exactly the opposite of what the error message tells them to do. finalizeDataset's own error text says "Files uploaded but finalizing failed. Open your dashboard to check the draft status."

Why it matters more now

#198 gave finalizeDataset a 60s deadline where it previously had none. The backend finalize route is short and explicitly idempotent (nemar-cli routes/datasets/upload.ts: "finalize is idempotent — can be called multiple times"), so retrying finalize itself is safe and cheap. The gap is that the page has no way to do that: its only recovery path is the full re-run.

This makes the bad path reachable via a hang, not only via a genuine failure.

Ask

After a successful upload, keep draft.id in the page's state and offer a retry that calls finalizeDataset(draft.id) directly. Only fall back to a full re-run when there is no draft to finalize. Since finalize is idempotent, the retry needs no new backend support.

Activity

  1. added
    bug
    on Jul 29, 2026
  2. neuromechanist commented on Aug 11, 2026

    @neuromechanist
    ContributorAuthor

    Fixed by PR #237, merged to staging as f537c0f. Finalize failure now keeps the draft id and retries only finalizeDataset (idempotent); full re-run only via explicit reset. Review hardening: finalize calls take the abort signal, reset is locked out while finalize is in flight, and a generation guard prevents stale closures from navigating or clobbering state. Will reach production with the next staging promotion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions