Checklist
Description
After many file operations in a workspace (drag-reorder, inserts at end), the workspace becomes
"empty" in the UI: the files panel shows 0 even though the data still exists in SQLite. Creating new
flows/files in that workspace silently fails (clicking "Flow" in the + menu does nothing).
Root cause
files.display_order converges to float32 MAX = 3.4028234663852886e+38.
- DB schema:
display_order REAL (float64) — packages/db/pkg/sqlc/schema/03_files.sql:15
- Wire spec:
order: float32 — packages/spec/api/file-system.tsp:22
The float32 wire format truncates the float64 DB value. Once display_order approaches float32 MAX
it serializes to +Infinity on the client; the TanStack DB collection then sorts inconsistently and
renders nothing.
The order-generation algorithm seems to use a midpoint between last and MAX_FLOAT when inserting
at the end, which converges to MAX after a handful of inserts.
Expected: the workspace keeps showing files regardless of how many inserts/reorders happen.
Reproduction
- Create a workspace with several folders and many files (HTTP requests, flows). My broken
workspace had ~236 files.
- Repeatedly insert/reorder items via drag-and-drop, or insert items "at end" many times.
- Close and reopen the app.
- The workspace appears in the sidebar but the Files panel shows 0. Right-click → New Flow does
nothing.
Reproduces consistently once display_order has reached float32 MAX. A freshly created workspace
works fine until the threshold is crossed.
Evidence from my SQLite DB
Affected workspace:
- MIN display_order:
-1.0
- MAX display_order:
3.4028234663852886e+38 (10 rows pegged exactly at this value)
- 22 files with display_order >=
2.5e+38
Healthy workspace in the same DB: MAX = 10.0.
Additional context
Workaround
Reset display_order to sequential floats per (workspace_id, parent_id) directly in SQLite:
UPDATE files SET display_order = <seq> WHERE id = <file_id>;
After this, restart the app and all files reappear.
Suggested fix
- Change spec order: float32 → float64 to match the DB type, OR
- Switch to lexorank / string-based fractional indexing.
- Either way, the order-generation algorithm should re-pack values before approaching the type's
MAX, instead of asymptotically converging to it.
Checklist
Description
After many file operations in a workspace (drag-reorder, inserts at end), the workspace becomes
"empty" in the UI: the files panel shows 0 even though the data still exists in SQLite. Creating new
flows/files in that workspace silently fails (clicking "Flow" in the
+menu does nothing).Root cause
files.display_orderconverges tofloat32 MAX = 3.4028234663852886e+38.display_order REAL(float64) —packages/db/pkg/sqlc/schema/03_files.sql:15order: float32—packages/spec/api/file-system.tsp:22The float32 wire format truncates the float64 DB value. Once
display_orderapproaches float32 MAXit serializes to
+Infinityon the client; the TanStack DB collection then sorts inconsistently andrenders nothing.
The order-generation algorithm seems to use a midpoint between
lastandMAX_FLOATwhen insertingat the end, which converges to MAX after a handful of inserts.
Expected: the workspace keeps showing files regardless of how many inserts/reorders happen.
Reproduction
workspace had ~236 files.
nothing.
Reproduces consistently once
display_orderhas reached float32 MAX. A freshly created workspaceworks fine until the threshold is crossed.
Evidence from my SQLite DB
Affected workspace:
-1.03.4028234663852886e+38(10 rows pegged exactly at this value)2.5e+38Healthy workspace in the same DB: MAX =
10.0.Additional context
Workaround
Reset
display_orderto sequential floats per(workspace_id, parent_id)directly in SQLite: