Skip to content

655 missing audio alert needs to be shown in navigation#720

Open
LeviXIII wants to merge 20 commits intomainfrom
655-missing-audio-alert-needs-to-be-shown-in-navigation
Open

655 missing audio alert needs to be shown in navigation#720
LeviXIII wants to merge 20 commits intomainfrom
655-missing-audio-alert-needs-to-be-shown-in-navigation

Conversation

@LeviXIII
Copy link
Copy Markdown
Contributor

@LeviXIII LeviXIII commented Mar 6, 2026

Refactor audio availability handling to compute from disk without document mutation

Replaced revalidation logic with new methods to compute audio availability for cells and attachments directly from the filesystem.
Introduced computeCellAudioAvailabilityFromDisk and computeCellIdsAudioAvailability functions to assess audio state without altering the document.
Updated message handling to send computed audio availability and history to the webview, ensuring accurate UI updates.
Enhanced tests to reflect changes in availability computation and document immutability.


Note

Medium Risk
Touches attachment data model and audio availability computation across provider, migrations, merge/export, and UI progress indicators; regressions could mislabel audio states or skew milestone/nav progress until metadata is fully migrated.

Overview
Replaces the legacy isMissing boolean with a richer persisted audioAvailability field (available-local/available-pointer/missing) and centralizes availability logic in new audioAvailabilityUtils (metadata-only reads plus a write-time determineAttachmentAvailability disk check).

Refactors providers/handlers to stop doing ad-hoc filesystem checks and instead (a) set audioAvailability on new/merged/stream-saved attachments, and (b) compute and message filesystem-checked availability to webviews for visible pages, initial load, and post-sync refresh without mutating the document.

Extends progress reporting with cellsWithMissingAudio and updates editor + navigation UIs to surface missing-audio alerts (including milestone/subsection indicators), while updating migration, merge resolution, exporter filtering, importers, and tests to understand audioAvailability with a deprecated isMissing fallback.

Written by Cursor Bugbot for commit 4c0ecd9. This will update automatically on new commits. Configure here.

LeviXIII added 4 commits March 4, 2026 15:56
…Display and in the MilestoneAccordion.

- Code is set for both front and backend calculations for audio.
…amlined and efficient.

- Have missing audio icon appear in Navigation view as well when there is missing audio in the folder and files.
… of isMissing across the codebase.

- Update related functions and tests to ensure consistent behavior and improve clarity in audio state management.
…l cells in a document, ensuring accurate audio state management.

- Updated CodexCellEditorProvider to utilize the new revalidation function, improving the accuracy of audio availability on initial load and during refresh.
- Enhanced error handling and metadata persistence during the revalidation process.
@LeviXIII LeviXIII linked an issue Mar 6, 2026 that may be closed by this pull request
LeviXIII added 10 commits March 6, 2026 10:20
…ument mutation

- Replaced revalidation logic with new methods to compute audio availability for cells and attachments directly from the filesystem.
- Introduced `computeCellAudioAvailabilityFromDisk` and `computeCellIdsAudioAvailability` functions to assess audio state without altering the document.
- Updated message handling to send computed audio availability and history to the webview, ensuring accurate UI updates.
- Enhanced tests to reflect changes in availability computation and document immutability.
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Fix All in Cursor

Bugbot Autofix prepared fixes for all 3 issues found in the latest run.

  • ✅ Fixed: Inconsistent missing audio count between progress computations
    • Updated buildCorrectedMilestoneProgress to use cellHasMissingAudio directly, matching the logic in calculateMilestoneProgress for consistent missing audio counting.
  • ✅ Fixed: Unused variable ws in selectAudioAttachment handler
    • Removed the unused ws variable that was assigned via getWorkspaceFolder but never referenced after the refactor to metadata-based audio state computation.
  • ✅ Fixed: Missing version gate in revalidateMissingForCell handler
    • Applied applyFrontierVersionGate to the computed state before sending to webview, ensuring consistency with all other filesystem-based audio availability code paths.

Create PR

Or push these changes by commenting:

@cursor push b0ba737937
Preview (b0ba737937)
diff --git a/src/providers/codexCellEditorProvider/codexCellEditorMessagehandling.ts b/src/providers/codexCellEditorProvider/codexCellEditorMessagehandling.ts
--- a/src/providers/codexCellEditorProvider/codexCellEditorMessagehandling.ts
+++ b/src/providers/codexCellEditorProvider/codexCellEditorMessagehandling.ts
@@ -21,7 +21,7 @@
 import { getUnresolvedCommentsCountForCell } from "../../utils/commentsUtils";
 import { toPosixPath } from "../../utils/pathUtils";
 import { computeCellAudioAvailabilityFromDisk, computeCellIdsAudioAvailability } from "../../utils/audioMissingUtils";
-import { computeCellAudioStateWithVersionGate, type AudioAvailabilityState } from "../../utils/audioAvailabilityUtils";
+import { computeCellAudioStateWithVersionGate, applyFrontierVersionGate, type AudioAvailabilityState } from "../../utils/audioAvailabilityUtils";
 import { mergeAudioFiles } from "../../utils/audioMerger";
 import { getAttachmentDocumentSegmentFromUri } from "../../utils/attachmentFolderUtils";
 // Comment out problematic imports
@@ -2484,7 +2484,6 @@
             const cells = Array.isArray(notebookData?.cells) ? notebookData.cells : [];
             const availability: Record<string, AudioAvailabilityState> = {};
             let validatedByArray: ValidationEntry[] = [];
-            const ws = vscode.workspace.getWorkspaceFolder(document.uri);
 
             for (const cell of cells) {
                 const cellId = cell?.metadata?.id;
@@ -3117,7 +3116,8 @@
             if (!workspaceFolder) return;
 
             // Compute availability from disk without mutating or saving the document
-            const state = await computeCellAudioAvailabilityFromDisk(document, workspaceFolder, cellId);
+            const rawState = await computeCellAudioAvailabilityFromDisk(document, workspaceFolder, cellId);
+            const state = await applyFrontierVersionGate(rawState);
 
             safePostMessageToPanel(webviewPanel, {
                 type: "providerSendsAudioAttachments",

diff --git a/src/providers/codexCellEditorProvider/codexCellEditorProvider.ts b/src/providers/codexCellEditorProvider/codexCellEditorProvider.ts
--- a/src/providers/codexCellEditorProvider/codexCellEditorProvider.ts
+++ b/src/providers/codexCellEditorProvider/codexCellEditorProvider.ts
@@ -34,6 +34,7 @@
 import { getAuthApi } from "@/extension";
 import { computeCellAudioStateWithVersionGate, type AudioAvailabilityState } from "../../utils/audioAvailabilityUtils";
 import { computeCellIdsAudioAvailability, computeDocumentAudioAvailability } from "../../utils/audioMissingUtils";
+import { cellHasMissingAudio } from "../../../sharedUtils";
 import {
     getCachedChapter as getCachedChapterUtil,
     updateCachedChapter as updateCachedChapterUtil,
@@ -114,8 +115,8 @@
 
         let missingCount = 0;
         for (let j = startIdx; j < endIdx && j < documentCells.length; j++) {
-            const cellId = documentCells[j]?.metadata?.id;
-            if (cellId && availability[cellId] === "missing") {
+            const cell = documentCells[j];
+            if (cell && cellHasMissingAudio(cell.metadata?.attachments, cell.metadata?.selectedAudioId)) {
                 missingCount++;
             }
         }

This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

  - Applied applyFrontierVersionGate to the computed state before sending to webview, ensuring consistency with all other filesystem-based audio availability code paths.
…itorProvider/codexCellEditorProvider.ts to use the same missing-audio semantics as initial progress, while still honoring filesystem-derived correction
@cursor
Copy link
Copy Markdown

cursor bot commented Mar 16, 2026

You have used all of your free Bugbot PR reviews.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

- Enhance attachment metadata handling by adding revalidation functions.
- Implemented revalidateCellAttachmentAvailability and revalidateDocumentAttachmentAvailability to ensure audio attachment availability is accurately reflected from the filesystem.
- Updated document saving logic to trigger when metadata changes occur, improving consistency in audio history and availability states.
@cursor
Copy link
Copy Markdown

cursor bot commented Mar 17, 2026

You have used all of your free Bugbot PR reviews.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@cursor
Copy link
Copy Markdown

cursor bot commented Mar 18, 2026

You have used all of your free Bugbot PR reviews.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing audio alert needs to be shown in navigation

1 participant