Skip to content

[🐞 BUG]: Transcription runs are not sorted by date, causing incorrect "Latest Run" data #1719

@zealot-zew

Description

@zealot-zew

Description 📝

The frontend UI assumes that transcription runs are always sorted by createdAt in descending order. However, the TranscriptionController.js fetches these runs from Firestore without an explicit orderBy clause. Since Firestore returns documents in an unspecified order, the UI frequently identifies the wrong transcription as the "latest," leading to data inconsistency in exports and metadata errors during deletions.

Steps to Reproduce 🔄

  1. Navigate to the Transcription Panel.
  2. Perform several transcription runs over a period of time.
  3. Refresh the page or trigger a deletion of one of the runs.
  4. Attempt to "Export Latest Run" from the Export Panel.
  5. Observe that the exported data or the highlighted "latest" run does not correspond to the most recently created transcription.

Screenshots 📸

Image

Expected Behavior 🤔

The runs array returned by the controller should be strictly sorted by createdAt descending. runs[0] should reliably and consistently represent the most recent transcription.

Actual Behavior 😱

The order of transcriptions is non-deterministic. ExportPanel.vue uses runs.value[0] to fetch the "latest" transcription, but often retrieves older records because the backend does not enforce sorting. Similarly, the latestTranscriptionDocId becomes corrupted during the delete flow.

Environment 🌍

  • Affected Files:

  • src/ai/transcriptions/TranscriptionController.js (Root Cause)

  • src/ux/UserTest/components/transcription/TranscriptionsPanel.vue (Consumer)

  • src/ux/UserTest/components/transcription/ExportPanel.vue (Consumer)

  • Git branch: feature/transcription-ordering-fix

  • OS: Any

  • Browser: Any

Additional Information ℹ️

The fix requires implementing a manual sort within the TranscriptionController.js after the Firestore fetch to ensure that the createdAt field (whether it's a Firestore Timestamp, Date object, or ISO string) is normalized and sorted descending before reaching the UI.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions