Skip to content

Testing#12

Merged
MusicMaster4 merged 2 commits into
mainfrom
testing
Jul 9, 2026
Merged

Testing#12
MusicMaster4 merged 2 commits into
mainfrom
testing

Conversation

@MusicMaster4

Copy link
Copy Markdown
Owner

No description provided.

@MusicMaster4 MusicMaster4 merged commit 3e42097 into main Jul 9, 2026
4 checks passed
@greptile-apps

greptile-apps Bot commented Jul 9, 2026

Copy link
Copy Markdown

Greptile Summary

This PR fixes two related bugs in the audio ducking/restore system: unrelated muted tabs could steal pending restore snapshots via process-name fallback, and early restore-complete responses could exhaust follow-up retries before the final 5-minute restore attempt.

  • Process-name fallback guard: Adds GetProcessNamesAllowingFallback in the C# audio controller, which only permits process-name fallback matching when the snapshot count, ducked session count, and total live session count for a process all match exactly — preventing a healthy Chrome tab from blocking restore of a genuinely ducked one.
  • Deferred retry budget: schedulePendingAudioRestores now initialises pendingAudioRestoreFollowupsRemaining to 0 and only sets it to AUDIO_PENDING_RESTORE_FOLLOWUP_MAX inside the onFire callback of the last fixed-delay timer, so follow-up retries are not consumed before the longest scheduled attempt runs.
  • Test coverage: A new self-test case unrelated-muted-tab-skips-process-name-fallback is added to the PS1 self-test suite and its name is registered in test-duck-restore.js.

Confidence Score: 5/5

Focused bug fix with clear test coverage; no regressions apparent in the restore matching or retry-scheduling logic.

Both changes are conservative narrowing of existing behaviour rather than new code paths. The GetProcessNamesAllowingFallback guard uses an exact three-way count match, preventing false positives while leaving all previously-working fast-path matches untouched. The deferred budget change only shifts when pendingAudioRestoreFollowupsRemaining is set — early returns during active capture are already handled by the existing schedulePendingAudioRestores call in releaseCaptureMute. The new self-test exercises the primary failure scenario directly.

No files require special attention.

Important Files Changed

Filename Overview
scripts/system_audio_controller.ps1 Adds GetProcessNamesAllowingFallback guard to prevent unrelated muted tabs from consuming pending snapshots via process-name fallback; new self-test case 5b covers the scenario.
src/main/main.js Defers pendingAudioRestoreFollowupsRemaining budget to the last fixed-delay timer's onFire callback, preventing early restore-complete responses from exhausting retries before the 5-minute attempt.
scripts/test-duck-restore.js Adds 'unrelated-muted-tab-skips-process-name-fallback' to the expected test name list, in sync with the new self-test case.
package.json Version bump from 1.3.042 to 1.3.043, following the required x.x.xxx format.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[MatchSnapshotsForRestore called] --> B[IndexSnapshots]
    B --> C[GetProcessNamesAllowingFallback]
    C --> D{For each process name in snapshots}
    D --> E[snapshotCount == duckedCount == totalLiveCount?]
    E -- Yes --> F[Add to allowedSet]
    E -- No --> G[Excluded from fallback]
    F & G --> H[Pass 1: ducked live sessions]
    H --> I[FindRestoreSnapshotForLive allowFallback=true]
    I --> J{Instance ID match?}
    J -- Yes --> K[Match found]
    J -- No --> L{Session ID match?}
    L -- Yes --> K
    L -- No --> M{Process ID match?}
    M -- Yes --> K
    M -- No --> N{Process in allowedSet?}
    N -- Yes --> O[Process-name fallback match]
    N -- No --> P[No match - stays Pending]
    K & O --> Q[Add to plan.Matches]
    P --> R[Pass 2: identity-only on all live sessions allowFallback=false]
    R --> S[Remaining unmatched - plan.Pending]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[MatchSnapshotsForRestore called] --> B[IndexSnapshots]
    B --> C[GetProcessNamesAllowingFallback]
    C --> D{For each process name in snapshots}
    D --> E[snapshotCount == duckedCount == totalLiveCount?]
    E -- Yes --> F[Add to allowedSet]
    E -- No --> G[Excluded from fallback]
    F & G --> H[Pass 1: ducked live sessions]
    H --> I[FindRestoreSnapshotForLive allowFallback=true]
    I --> J{Instance ID match?}
    J -- Yes --> K[Match found]
    J -- No --> L{Session ID match?}
    L -- Yes --> K
    L -- No --> M{Process ID match?}
    M -- Yes --> K
    M -- No --> N{Process in allowedSet?}
    N -- Yes --> O[Process-name fallback match]
    N -- No --> P[No match - stays Pending]
    K & O --> Q[Add to plan.Matches]
    P --> R[Pass 2: identity-only on all live sessions allowFallback=false]
    R --> S[Remaining unmatched - plan.Pending]
Loading

Reviews (1): Last reviewed commit: "Merge pull request #11 from MusicMaster4..." | Re-trigger Greptile

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.

1 participant