Skip to content

Flaky (local-only): route-types-hmr "recovery: helper-file fix after broken-import error re-runs discovery" fails about half the runs and leaves the test-app modified #1040

Closed

Description

@ivogt

recovery: helper-file fix after broken-import error re-runs discovery (packages/rangojs-router/e2e/route-types-hmr.test.ts:809) fails in about half the runs of pnpm --filter @rangojs/router test:hmr-routes-local, and a failed run leaves the test-app's source modified. CI skips this suite, so it only shows locally.

Numbers

Failure

expect(received).not.toContain("\"blog.recovered\"")

on the generated route names file. The runs did not record which of the test's two assertions of that form failed: the sanity check before the edit, or the check that the file is still at last-good while discovery is failing.

A failed run reports "1 failed, 1 flaky, 19 passed": the serial retry then fails in beforeAll.

It leaves the tree dirty

After a failure e2e/test-app/src/urls/blog.handlers.tsx keeps the syntax error the test appended (// recovery-test syntax error and }}}}) and has to be restored with git checkout. The retry then fails in beforeAll, which refuses to start on a dirty tree.

Read from the test, not traced: the test's own finally restores only blog.tsx, and it sits after the two assertions that can fail. The other files are restored by afterEach (line 164), one at a time, waiting for the dev server to apply each. With discovery stuck in its failed state that wait fails on the first file (blog.tsx), so the loop never reaches blog.handlers.tsx.

Hypothesis, not verified

Step 1 writes blog.tsx (a new route) and then blog.handlers.tsx (the syntax error) as two fs.writeFile calls and expects one debounced rediscovery that throws. If the watcher fires between the two writes, a rediscovery succeeds with the new route first, the generated file already holds blog.recovered, and the "still at last-good" assertion fails.

Expected

  • The test passes reliably: break the helper file first and wait for the failure marker before adding the route, or assert on the failure path only.
  • A failure restores every file: write all baselines first, then wait.
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions