Skip to content

Low-severity fixes: scroll gate, media cache footprint, preview attribution, dead branch#491

Merged
mubarakcoded merged 7 commits into
masterfrom
low-sev-quick-fixes
Jul 13, 2026
Merged

Low-severity fixes: scroll gate, media cache footprint, preview attribution, dead branch#491
mubarakcoded merged 7 commits into
masterfrom
low-sev-quick-fixes

Conversation

@mubarakcoded

@mubarakcoded mubarakcoded commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Four self-contained low-severity fixes, each in its own commit. All app-side Swift; no engine/binding changes.

  • Transcript non-interactive after a mid-fling chat switch. isActivelyScrolling gates .allowsHitTesting on the transcript but was never reset on a chat switch. The fresh inner ScrollView starts idle without emitting a phase transition, so a flag left true from the previous chat's fling left the new transcript's first tap silently ignored until the next scroll. Reset it in the existing onChange(of: chat.id) block alongside its siblings.
  • Media cache footprint under-count on failed purge. purgeAll swallowed a removal failure and then zeroed trackedFootprint unconditionally. If entries survived on disk, that false zero was never reconciled (only a nil footprint re-seeds from an authoritative scan), so the eviction cap under-enforced indefinitely. Now the footprint is zeroed only when removal actually succeeds and nil'd on failure, matching purgeAccount.
  • Media-only group previews were unattributed. The chat-list preview returned the "Attachment" fallback before the sender-prefix block, so a media-only message from a peer in a group showed a bare "Attachment" with no sender name while a text message from the same peer was attributed. Resolve the body first, then apply the incoming-group sender prefix uniformly to both.
  • Dead branch in moveChatToArchived. The two arms gated on shouldEnrich ran byte-identical code. Collapsed to the single unconditional form; behavior-preserving.

Closes #452
Closes #453
Closes #471
Closes #472


Open in Stage

Summary by CodeRabbit

  • Bug Fixes
    • Chat previews now consistently include the sender’s name, even for attachment-only and unsupported/empty messages.
    • Switching chats no longer leaves scrolling disabled for the newly opened conversation.
    • Moving chats to Archived now preserves enrichment-resolved metadata consistently.
    • Media cache purge now updates tracking correctly based on actual filesystem removal results.
  • Tests
    • Reworked media-disk-cache deletion regression coverage, including cases where sealed metadata cannot be opened.
    • Updated media fallback chat-list preview assertions to include sender attribution.

@stage-review

stage-review Bot commented Jul 13, 2026

Copy link
Copy Markdown

Ready to review this PR? Stage has broken it down into 4 individual chapters for you:

Title
1 Reset scroll gate on chat switch
2 Fix media cache footprint tracking on failure
3 Attribute media-only group previews to senders
4 Collapse redundant branches in chat archiving
Open in Stage

Chapters generated by Stage for commit 2ae2055 on Jul 13, 2026 10:54am UTC.

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5635d318-b65c-4281-b9eb-f4a11033cb9e

📥 Commits

Reviewing files that changed from the base of the PR and between a1d06e6 and 2ae2055.

📒 Files selected for processing (2)
  • whitenoise-mac/Core/MessageMediaDiskCache.swift
  • whitenoise-macTests/whitenoise_macTests.swift
🚧 Files skipped from review as they are similar to previous changes (1)
  • whitenoise-mac/Core/MessageMediaDiskCache.swift

Walkthrough

The changes fix four independent behaviors: sender attribution for attachment previews, cache footprint handling after failed purges, metadata preservation during archive moves, and scroll-state reset when switching conversations.

Changes

Message preview attribution

Layer / File(s) Summary
Build and validate prefixed preview bodies
whitenoise-mac/Core/MarmotMapping.swift, whitenoise-macTests/whitenoise_macTests.swift
Preview fallbacks are constructed before sender-name prefixes are applied, with direct and group chat tests expecting attributed attachment text.

Cache purge accounting

Layer / File(s) Summary
Handle purge removal outcomes
whitenoise-mac/Core/MessageMediaDiskCache.swift, whitenoise-macTests/whitenoise_macTests.swift
Cache removal checks existence and success, resetting trackedFootprint on success or setting it to nil after failure; cache tests cover corrupt metadata deletion behavior.

Archived chat metadata

Layer / File(s) Summary
Preserve resolved archive metadata
whitenoise-mac/Core/WorkspaceState+ChatList.swift
Archived chat moves preserve enrichment-resolved metadata whenever an active chat exists, regardless of shouldEnrich.

Conversation scroll state

Layer / File(s) Summary
Reset scroll interaction state
whitenoise-mac/Views/MessengerShellView.swift
Changing chats now resets isActivelyScrolling for the newly mounted conversation.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related issues

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and matches the four fixes in the changeset.
Linked Issues check ✅ Passed The PR covers the linked fixes for #452, #453, #471, and #472.
Out of Scope Changes check ✅ Passed The changes stay within the four stated bugfix/refactor objectives; tests and comment updates are supporting.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch low-sev-quick-fixes

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@whitenoise-mac/Core/MessageMediaDiskCache.swift`:
- Around line 318-334: Update the purge closure around beginPurge and
trackedFootprint so removalSucceeded starts false, becomes true only when
directoryResolver resolves a root and that root is either absent or successfully
removed, and remains false when resolution fails. Preserve the existing
encryption-key deletion and nil-versus-zero trackedFootprint behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: faaccbf2-dd90-4ca7-aeb2-f469169c36b6

📥 Commits

Reviewing files that changed from the base of the PR and between 0454dbf and 144a328.

📒 Files selected for processing (4)
  • whitenoise-mac/Core/MarmotMapping.swift
  • whitenoise-mac/Core/MessageMediaDiskCache.swift
  • whitenoise-mac/Core/WorkspaceState+ChatList.swift
  • whitenoise-mac/Views/MessengerShellView.swift

Comment thread whitenoise-mac/Core/MessageMediaDiskCache.swift
@mubarakcoded
mubarakcoded merged commit c8d96d9 into master Jul 13, 2026
3 checks passed
@mubarakcoded
mubarakcoded deleted the low-sev-quick-fixes branch July 13, 2026 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment