fix: run the pinned version from a flow version's page

Merged
BU
2d ago
+7-3

What does this PR do?

A run's details link its flow version (the Hash field) to that version's page, which says "Viewing pinned version N" and shows that version's inputs and graph. Pressing Run there, or Cmd+Enter, started the latest deployed version instead: the job's Hash showed the newer version and its result came from the newer code, while the page had shown the older one.

runFlow in FlowDetail.svelte always called runFlowByPath. This PR calls runFlowByVersion when the page is pinned to a version, with the same arguments, schedule, tag and visibility options. The latest flow page still runs by path. One function in FlowDetail.svelte (7 lines added, 3 removed). An older script version already runs by hash on its own page, so the two pages now behave the same.

Reproduced on main at 18d0a78 (backend CE v1.875.0).

flowchart TD
    A[User opens a pinned flow version from a run] --> B[User presses Run]
    B -->|Before| C[The latest deployed version runs]
    B -->|After| D[The pinned version runs]

Narrated recording, before then after (sound on):

https://github.com/user-attachments/assets/6f834d6e-d86a-45e8-bea5-b184b6d93490

The recording is the real app (frontend dev server from this checkout against the main backend image). The flows, the script and the earlier run were created through the API before recording. Waits on page loads are shortened, and the run and version links open in the same tab; nothing else is edited.

Edge cases and unchanged behaviour checked

All checked in the running app, on this branch:

  • Cmd+Enter on a pinned version runs that version.
  • A flow in a folder, opened at its older version, runs that version.
  • Unchanged: the latest flow page runs the latest version.
  • Unchanged: an older script version's page runs that version.

Checks run

  • npm run lint (oxlint): passes.
  • prettier --check on the changed file: passes.
  • Not run: npm run check (svelte-check needs about 8 GB here) and npm run check:fast (no bun on this machine).
  • No test added: docs/validation.md asks for none on pure UI changes.

Related issue

None filed. Found while rerunning an older run's flow version from its version link.

AI tools (Claude Code) assisted with this change; the bug was reproduced on main and the fix verified in the running app as shown.


Summary by cubic

Fixes running from a pinned flow version's page so it runs that pinned version instead of the latest deployed one.

The Run button and Cmd+Enter previously started the latest version even while the page showed a pinned version's inputs and graph. The run call now uses runFlowByVersion when a version is pinned, and keeps using runFlowByPath with the same schedule, tag, and visibility options otherwise.