fix(FN-1313): use stable mission event ordering

- Replace mission event list sorting fallback from rowid to id for deterministic ordering
- Update latest mission error lookup to order by id instead of rowid when timestamps tie
This commit is contained in:
gsxdsm
2026-04-08 12:36:19 -07:00
parent 686b1e3f8a
commit 134f9d8c23

View File

@@ -405,7 +405,7 @@ export class MissionStore extends EventEmitter<MissionStoreEvents> {
SELECT *
FROM mission_events
WHERE ${whereSql}
ORDER BY timestamp DESC, rowid DESC
ORDER BY timestamp DESC, id DESC
LIMIT ? OFFSET ?
`).all(...params, limit, offset) as any[];
@@ -479,7 +479,7 @@ export class MissionStore extends EventEmitter<MissionStoreEvents> {
SELECT timestamp, description
FROM mission_events
WHERE missionId = ? AND eventType = 'error'
ORDER BY timestamp DESC, rowid DESC
ORDER BY timestamp DESC, id DESC
LIMIT 1
`).get(missionId) as { timestamp: string; description: string } | undefined;