Skip to content

Commit ac4c20e

Browse files
committed
fix(webapp): don't crash the test page when a dev worker version isn't numeric
The dev task list sorted workers by casting their version to an int array, which failed with a database error if any worker's version isn't dot-numeric. Non-numeric versions now fall back to creation order instead of erroring.
1 parent 35476fe commit ac4c20e

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

apps/webapp/app/presenters/v3/TestPresenter.server.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,16 @@ export class TestPresenter extends BasePresenter {
4343
>`WITH workers AS (
4444
SELECT
4545
bw.*,
46-
ROW_NUMBER() OVER(ORDER BY string_to_array(bw.version, '.')::int[] DESC) AS rn
46+
-- Only dot-numeric versions ("20260724.3") sort numerically; anything else
47+
-- (e.g. seeded/simulated workers with arbitrary version strings) would fail the
48+
-- int[] cast, so those fall back to creation order instead of erroring.
49+
ROW_NUMBER() OVER(
50+
ORDER BY
51+
(CASE WHEN bw.version ~ '^[0-9]+([.][0-9]+)*$'
52+
THEN string_to_array(bw.version, '.')::int[]
53+
END) DESC NULLS LAST,
54+
bw."createdAt" DESC
55+
) AS rn
4756
FROM
4857
${sqlDatabaseSchema}."BackgroundWorker" bw
4958
WHERE "runtimeEnvironmentId" = ${envId}

0 commit comments

Comments
 (0)