Skip to content

Fix Home rows after watched and dismissal actions - #84

Merged
Quick104 merged 2 commits into
mainfrom
codex/homeviewmodelmutation
Jul 10, 2026
Merged

Quick104 merged 2 commits into
mainfrom
codex/homeviewmodelmutation

Conversation

@Quick104

@Quick104 Quick104 commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • move Continue Watching dismissal and watched-state mutations into HomeViewModel
  • update visible Home sections and the shared cache after successful mutations
  • remove completed items immediately from Continue Watching, In Progress, and Next Up, then reconcile replacement episodes from the server
  • invalidate stale in-flight Home requests and roll back card state when a watched update fails
  • share the behavior across iOS and tvOS Home feeds

Testing

  • xcodebuild test -project Silo.xcodeproj -scheme Silo -destination 'platform=iOS Simulator,id=5AEC2DBA-2CA4-4AA0-8EC8-333376BA51BC' -only-testing:SiloTests/HomeSectionsMutationTests CODE_SIGNING_ALLOWED=NO (9 tests passed)
  • xcodebuild build -project Silo.xcodeproj -scheme Silo -destination 'platform=iOS Simulator,id=5AEC2DBA-2CA4-4AA0-8EC8-333376BA51BC' CODE_SIGNING_ALLOWED=NO
  • xcodebuild build -project Silo.xcodeproj -scheme SiloTV -destination 'platform=tvOS Simulator,id=462E76D9-A6F7-4CBA-B8A8-1274FB2CB00B' CODE_SIGNING_ALLOWED=NO
  • installed and launched the resulting iOS build on Silo Validation iPhone

Summary by CodeRabbit

  • New Features
    • Enabled Continue Watching item dismissal and watched/unwatched updates across iOS and tvOS Home.
    • Actions now optimistically update the UI and keep Home in sync after server reconciliation.
    • Added user-facing alert when an item action can’t be completed.
  • Bug Fixes
    • Reverted UI state when watched/dismiss actions fail.
    • Prevented older Home section responses from overwriting newer updates.
  • Tests
    • Added unit/async coverage for removal, watched-state changes, duplicates, and failure/edge cases.

@coderabbitai

coderabbitai Bot commented Jul 10, 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 Plus

Run ID: c19c8059-9cda-4aec-b821-1bfe624aa9a4

📥 Commits

Reviewing files that changed from the base of the PR and between e29a29d and 2bb4223.

📒 Files selected for processing (1)
  • iosApp/iosApp/Screens/Home/SectionRow.swift
🚧 Files skipped from review as they are similar to previous changes (1)
  • iosApp/iosApp/Screens/Home/SectionRow.swift

📝 Walkthrough

Walkthrough

Home item dismissal and watched-state updates now use injected async actions, local section/cache mutations, error reporting, and stale-fetch invalidation. Home rows and media cards propagate the new callback contract, while tests cover successful and failed mutations.

Changes

Home item actions

Layer / File(s) Summary
Mutation contracts and state dependencies
iosApp/iosApp/Screens/Home/HomeSectionsMutation.swift, iosApp/iosApp/Screens/Home/HomeViewModel.swift
Adds pure section-removal helpers and dependency-injected action closures, pending-action tracking, and error-state handling.
Action execution and stale-fetch protection
iosApp/iosApp/Screens/Home/HomeViewModel.swift, iosApp/iosApp/Startup/StartupContentPrefetcher.swift
Dismissal and watched actions update local sections and cached responses; Home fetch generations prevent stale responses from being applied.
Async watched callbacks and Home wiring
iosApp/iosApp/Components/*, iosApp/iosApp/Screens/Home/HomeView.swift, iosApp/iosApp/Screens/Home/SectionRow.swift, iosApp/iosApp/tvOS/Components/TVSkylineSectionFeed.swift
Propagates async watched callbacks through Home rows and media cards, applies optimistic state, reverts failed updates, and displays action errors.
Mutation and action tests
iosApp/Tests/HomeSectionsMutationTests.swift
Tests section filtering, count updates, cache synchronization, callback inputs, failure preservation, and action errors.

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

Sequence Diagram(s)

sequenceDiagram
  participant HomeView
  participant HomeViewModel
  participant ContinuumAPI
  participant ResponseCache
  HomeView->>HomeViewModel: Start dismissal or watched update
  HomeViewModel->>ContinuumAPI: Execute injected action
  ContinuumAPI-->>HomeViewModel: Return success or failure
  HomeViewModel->>ResponseCache: Apply successful section mutation
  HomeViewModel-->>HomeView: Return result and update error state
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main change: Home row behavior after watched and dismissal actions was fixed.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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 codex/homeviewmodelmutation

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

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e29a29d38b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@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: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
iosApp/iosApp/Components/EpisodeThumbCard.swift (1)

317-336: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Double-tap can clobber optimistic playedOverride state.

HomeViewModel.setWatched dedups by contentId and returns false immediately for a second concurrent call on the same item — not because the mutation failed, but because it's a duplicate in-flight request. Since this button has no pending/disabled state, a rapid double-tap starts a second Task that gets succeeded == false from the dedup guard and resets playedOverride = nil, which can stomp the correct optimistic state set by the first (possibly still-succeeding) tap.

Consider disabling the control (or short-circuiting locally) while a request for this item is already in flight.

🔧 Proposed guard against re-entrant taps
     `@State` private var playedOverride: Bool?
+    `@State` private var isTogglingWatched = false
         if let onSetWatched {
             Button {
+                guard !isTogglingWatched else { return }
                 let played = !isPlayed
                 Task { `@MainActor` in
+                    isTogglingWatched = true
                     playedOverride = played
                     let succeeded = await onSetWatched(played)
                     if !succeeded {
                         playedOverride = nil
                     }
+                    isTogglingWatched = false
                 }
             } label: {
🤖 Prompt for 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.

In `@iosApp/iosApp/Components/EpisodeThumbCard.swift` around lines 317 - 336,
Prevent re-entrant watched-state requests in the contextActions control: track
whether the item’s onSetWatched operation is in flight, disable the Button or
return early while pending, and clear the pending state when the request
completes. Ensure a duplicate tap cannot reset playedOverride based on the
deduplication result from HomeViewModel.setWatched.
🧹 Nitpick comments (1)
iosApp/Tests/HomeSectionsMutationTests.swift (1)

142-180: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Cover the played == false branch.

All watched-update assertions use played: true, so regressions in the non-removal path and the propagated callback value would go undetected. Add a successful unplayed test asserting the item remains in the relevant sections/cache and the callback receives false.

🤖 Prompt for 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.

In `@iosApp/Tests/HomeSectionsMutationTests.swift` around lines 142 - 180, Add a
successful `setWatched` test alongside
`testSuccessfulWatchedUpdateRemovesItemFromNextUpAndCache` using `played:
false`; configure cached sections and a callback, then assert the item remains
unchanged in the relevant view-model sections and `ResponseCache`, the callback
receives the expected content ID and `false`, and the operation succeeds without
an action error.
🤖 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 `@iosApp/iosApp/Components/MediaCard.swift`:
- Around line 97-106: In the onSetWatched closure, ensure the failure-path
assignment playedOverride = nil after await handler(played) executes on the main
actor, either by wrapping it in MainActor.run or isolating the closure
appropriately; preserve the existing success behavior and return value.

In `@iosApp/Tests/HomeSectionsMutationTests.swift`:
- Around line 96-97: Update all four cache-backed tests, including the test
using ResponseCache.shared.set for CacheKey.homeSections, to snapshot the
existing cache entry before mutation and restore that exact entry in defer
teardown instead of unconditionally removing it; preserve the prior value when
present and remove the key only when no prior entry existed.

---

Outside diff comments:
In `@iosApp/iosApp/Components/EpisodeThumbCard.swift`:
- Around line 317-336: Prevent re-entrant watched-state requests in the
contextActions control: track whether the item’s onSetWatched operation is in
flight, disable the Button or return early while pending, and clear the pending
state when the request completes. Ensure a duplicate tap cannot reset
playedOverride based on the deduplication result from HomeViewModel.setWatched.

---

Nitpick comments:
In `@iosApp/Tests/HomeSectionsMutationTests.swift`:
- Around line 142-180: Add a successful `setWatched` test alongside
`testSuccessfulWatchedUpdateRemovesItemFromNextUpAndCache` using `played:
false`; configure cached sections and a callback, then assert the item remains
unchanged in the relevant view-model sections and `ResponseCache`, the callback
receives the expected content ID and `false`, and the operation succeeds without
an action error.
🪄 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 Plus

Run ID: 3fcc94ae-f493-424a-820f-0a1a77a2bb08

📥 Commits

Reviewing files that changed from the base of the PR and between 9d09528 and e29a29d.

📒 Files selected for processing (10)
  • iosApp/Tests/HomeSectionsMutationTests.swift
  • iosApp/iosApp/Components/EpisodeThumbCard.swift
  • iosApp/iosApp/Components/MediaCard.swift
  • iosApp/iosApp/Components/MediaRow.swift
  • iosApp/iosApp/Screens/Home/HomeSectionsMutation.swift
  • iosApp/iosApp/Screens/Home/HomeView.swift
  • iosApp/iosApp/Screens/Home/HomeViewModel.swift
  • iosApp/iosApp/Screens/Home/SectionRow.swift
  • iosApp/iosApp/Startup/StartupContentPrefetcher.swift
  • iosApp/iosApp/tvOS/Components/TVSkylineSectionFeed.swift

Comment on lines 97 to 106
onSetWatched: onSetWatched.map { handler in
{ played in
playedOverride = played
handler(played)
let succeeded = await handler(played)
if !succeeded {
playedOverride = nil
}
return succeeded
}
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

Swift non-isolated async closure resumes on main actor after await MainActor function

💡 Result:

In Swift, a non-isolated async closure does not automatically resume execution on the MainActor after an await MainActor function call [1][2]. When an asynchronous function or closure is non-isolated (which is the default for @Sendable closures), it runs on a generic, non-actor executor [1]. If it calls an await expression targeting a MainActor function, the task suspends, hops to the MainActor to execute that function, and then—upon completion of the await—the task resumes execution [1][2]. Crucially, the task resumes on the same executor it was using before the suspension point [1]. Because the closure itself is non-isolated, it will resume on a generic executor, not the MainActor [1]. This behavior is a fundamental aspect of Swift concurrency's executor model, where execution context is tied to the isolation of the function or closure rather than the preceding await call [1][2]. If you require code to continue running on the MainActor after an await call, the closure itself must be marked with @MainActor or wrapped in a MainActor.run { ... } block [3][4]. Note that recent updates, such as those discussed in SE-0461, have refined how non-isolated async functions inherit isolation from their caller in certain contexts, but the fundamental rule remains that a non-isolated closure does not inherently "stick" to an actor just because it awaited a call to one [5][6][1].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Show the relevant portion of the file with line numbers
sed -n '1,260p' iosApp/iosApp/Components/MediaCard.swift | cat -n

printf '\n==== onSetWatched occurrences ====\n'
rg -n "onSetWatched" iosApp/iosApp -S

printf '\n==== MediaCard definition outline (if supported) ====\n'
ast-grep outline iosApp/iosApp/Components/MediaCard.swift --view expanded || true

Repository: Silo-Server/silo-apple

Length of output: 14616


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Read the relevant section around the cited lines with line numbers
nl -ba iosApp/iosApp/Components/MediaCard.swift | sed -n '80,125p'

printf '\n==== onSetWatched references ====\n'
rg -n "onSetWatched" iosApp/iosApp -S

printf '\n==== MediaCard outline ====\n'
ast-grep outline iosApp/iosApp/Components/MediaCard.swift --view expanded || true

Repository: Silo-Server/silo-apple

Length of output: 200


🏁 Script executed:

#!/bin/bash
set -euo pipefail

nl -ba iosApp/iosApp/Components/MediaCard.swift | sed -n '80,125p'
printf '\n==== onSetWatched references ====\n'
rg -n "onSetWatched" iosApp/iosApp -S
printf '\n==== MediaCard outline ====\n'
ast-grep outline iosApp/iosApp/Components/MediaCard.swift --view expanded || true

Repository: Silo-Server/silo-apple

Length of output: 200


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
from pathlib import Path

path = Path('iosApp/iosApp/Components/MediaCard.swift')
lines = path.read_text().splitlines()

def show(start, end):
    for i in range(start, min(end, len(lines)) + 1):
        print(f"{i:4d}: {lines[i-1]}")

print("==== MediaCard.swift lines 430-540 ====")
show(430, 540)

print("\n==== MediaCard.swift lines 540-620 ====")
show(540, 620)
PY

printf '\n==== FocusableMediaCard references ====\n'
rg -n "FocusableMediaCard|Task \\{ `@MainActor`|MainActor" iosApp/iosApp/Components/MediaCard.swift -S

Repository: Silo-Server/silo-apple

Length of output: 5813


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
from pathlib import Path

path = Path('iosApp/iosApp/Components/MediaCard.swift')
lines = path.read_text().splitlines()

for start, end in [(430, 540), (540, 620)]:
    print(f"==== MediaCard.swift lines {start}-{end} ====")
    for i in range(start, min(end, len(lines)) + 1):
        print(f"{i:4d}: {lines[i-1]}")
    print()
PY

printf '\n==== FocusableMediaCard references ====\n'
rg -n "FocusableMediaCard|Task \\{ `@MainActor`|MainActor" iosApp/iosApp/Components/MediaCard.swift -S

Repository: Silo-Server/silo-apple

Length of output: 5814


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
from pathlib import Path

lines = Path('iosApp/iosApp/Components/MediaCard.swift').read_text().splitlines()
for start, end in [(430, 540), (540, 620)]:
    print(f"==== MediaCard.swift lines {start}-{end} ====")
    for i in range(start, min(end, len(lines)) + 1):
        print(f"{i:4d}: {lines[i-1]}")
    print()
PY

printf '\n==== FocusableMediaCard references ====\n'
python3 - <<'PY'
from pathlib import Path
for i, line in enumerate(Path('iosApp/iosApp/Components/MediaCard.swift').read_text().splitlines(), 1):
    if 'FocusableMediaCard' in line or 'Task { `@MainActor`' in line or 'MainActor' in line:
        print(f"{i:4d}: {line}")
PY

Repository: Silo-Server/silo-apple

Length of output: 5825


Keep the failure-path playedOverride revert on the main actor. The closure starts on the Task { @mainactor in ... } call site, but after await handler(played) it can resume off-main because handler is non-isolated. That makes the playedOverride = nil branch a background @State mutation; wrap that write in MainActor.run or isolate the closure.

🤖 Prompt for 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.

In `@iosApp/iosApp/Components/MediaCard.swift` around lines 97 - 106, In the
onSetWatched closure, ensure the failure-path assignment playedOverride = nil
after await handler(played) executes on the main actor, either by wrapping it in
MainActor.run or isolating the closure appropriately; preserve the existing
success behavior and return value.

Comment on lines +96 to +97
ResponseCache.shared.set(SectionsResponse(sections: sections), for: CacheKey.homeSections)
defer { ResponseCache.shared.remove(CacheKey.homeSections) }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Map the test file and nearby symbols first.
ast-grep outline iosApp/Tests/HomeSectionsMutationTests.swift --view expanded || true

# Show the file with line numbers, but only the relevant range.
sed -n '1,260p' iosApp/Tests/HomeSectionsMutationTests.swift | nl -ba | sed -n '1,260p'

# Find ResponseCache and CacheKey.homeSections usages in tests.
rg -n "ResponseCache\.shared|CacheKey\.homeSections|played:\s*false|played:\s*true" iosApp/Tests iosApp -g '*.swift' || true

# Inspect test configuration for parallelization hints.
rg -n "parallel|concurrent|testing" . -g '*.swift' -g 'Package.swift' -g '*.xcscheme' -g '*.xcconfig' -g '*.plist' || true

Repository: Silo-Server/silo-apple

Length of output: 820


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== HomeSectionsMutationTests.swift =="
sed -n '1,260p' iosApp/Tests/HomeSectionsMutationTests.swift | cat -n

echo
echo "== ResponseCache and CacheKey definitions/usages =="
rg -n "struct ResponseCache|class ResponseCache|enum CacheKey|homeSections" iosApp -g '*.swift' || true

echo
echo "== Parallelization / test execution hints =="
rg -n "parallel|concurrent|disabl|enabled" . -g '*.swift' -g 'Package.swift' -g '*.xcscheme' -g '*.xcconfig' -g '*.plist' || true

Repository: Silo-Server/silo-apple

Length of output: 50378


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== HomeSectionsMutationTests.swift (relevant lines) =="
sed -n '1,260p' iosApp/Tests/HomeSectionsMutationTests.swift | cat -n | sed -n '1,260p'

echo
echo "== ResponseCache definition =="
rg -n "ResponseCache" iosApp -g '*.swift' || true

echo
echo "== CacheKey.homeSections usages =="
rg -n "CacheKey\.homeSections" iosApp -g '*.swift' || true

echo
echo "== Test scheme/config parallel hints =="
rg -n "parallel|concurrent|disableParallel|enabledParallel" . -g '*.xcscheme' -g '*.plist' -g '*.xcconfig' -g 'Package.swift' -g '*.swift' || true

Repository: Silo-Server/silo-apple

Length of output: 29566


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
from pathlib import Path
p = Path('iosApp/Tests/HomeSectionsMutationTests.swift')
for i, line in enumerate(p.read_text().splitlines(), 1):
    if 1 <= i <= 260:
        print(f"{i:4d}: {line}")
PY

echo
echo "== ResponseCache definition =="
rg -n "ResponseCache" iosApp -g '*.swift' || true

echo
echo "== CacheKey.homeSections usages =="
rg -n "CacheKey\.homeSections" iosApp -g '*.swift' || true

echo
echo "== Test scheme/config parallel hints =="
rg -n "parallel|concurrent|disableParallel|enabledParallel" . -g '*.xcscheme' -g '*.plist' -g '*.xcconfig' -g 'Package.swift' -g '*.swift' || true

Repository: Silo-Server/silo-apple

Length of output: 29274


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
from pathlib import Path
p = Path('iosApp/Tests/HomeSectionsMutationTests.swift')
for i, line in enumerate(p.read_text().splitlines(), 1):
    if 80 <= i <= 200:
        print(f"{i:4d}: {line}")
PY

echo
echo "== Definitions/usages of ResponseCache and related cache key =="
rg -n "ResponseCache|CacheKey\.homeSections" iosApp -g '*.swift' || true

echo
echo "== Any test parallelization settings or config references =="
fd -a -t f '.+' . | rg 'xcscheme|xcconfig|Package\.swift|plist$' || true

Repository: Silo-Server/silo-apple

Length of output: 20013


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
from pathlib import Path
p = Path('iosApp/Tests/HomeSectionsMutationTests.swift')
for i, line in enumerate(p.read_text().splitlines(), 1):
    if 80 <= i <= 205:
        print(f"{i:4d}: {line}")
PY

echo
echo "== ResponseCache / CacheKey locations =="
rg -n "ResponseCache|CacheKey\.homeSections" iosApp -g '*.swift' || true

echo
echo "== test scheme / parallel execution hints =="
rg -n "parallel|concurrent|disableParallel|enabledParallel" . -g '*.xcscheme' -g '*.xcconfig' -g 'Package.swift' -g '*.plist' || true

Repository: Silo-Server/silo-apple

Length of output: 19522


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
from pathlib import Path
p = Path('iosApp/Tests/HomeSectionsMutationTests.swift')
text = p.read_text().splitlines()
for start, end in [(1, 85), (86, 140), (141, 205), (206, 260)]:
    print(f"\n--- lines {start}-{end} ---")
    for i in range(start, min(end, len(text)) + 1):
        print(f"{i:4d}: {text[i-1]}")
PY

Repository: Silo-Server/silo-apple

Length of output: 11097


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
from pathlib import Path
p = Path('iosApp/Tests/HomeSectionsMutationTests.swift')
for i, line in enumerate(p.read_text().splitlines(), 1):
    if 85 <= i <= 205:
        print(f"{i:4d}: {line}")
PY

echo
echo "== Search for cache mutation patterns in tests =="
rg -n "set\\(SectionsResponse\\(|remove\\(CacheKey\\.homeSections\\)|get\\(CacheKey\\.homeSections\\)" iosApp/Tests -g '*.swift' || true

Repository: Silo-Server/silo-apple

Length of output: 7929


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
from pathlib import Path
p = Path('iosApp/Tests/HomeSectionsMutationTests.swift')
for i, line in enumerate(p.read_text().splitlines(), 1):
    if 85 <= i <= 205:
        print(f"{i:4d}: {line}")
PY

echo
echo "== ResponseCache definition and methods =="
rg -n "final class ResponseCache|class ResponseCache|struct ResponseCache|func set\\(|func remove\\(|func get\\(" iosApp -g '*.swift' || true

Repository: Silo-Server/silo-apple

Length of output: 7379


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the cache implementation for locking / global-state behavior.
sed -n '1,220p' iosApp/iosApp/Networking/ResponseCache.swift | cat -n

echo
echo "== XCTest setup/teardown or cache resets in tests =="
rg -n "setUp\\(|tearDown\\(|clearAll\\(|removeAll\\(|ResponseCache\\.shared\\.clearAll|ResponseCache\\.shared\\.remove\\(" iosApp/Tests -g '*.swift' || true

echo
echo "== Scheme/test-plan files mentioning XCTest parallelization =="
fd -a -t f . iosApp | rg 'xcscheme$|xctestplan$|xcworkspace$|xcodeproj$|Package\.swift$'

Repository: Silo-Server/silo-apple

Length of output: 8351


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
from pathlib import Path
p = Path('iosApp/iosApp/Networking/ResponseCache.swift')
for i, line in enumerate(p.read_text().splitlines(), 1):
    if 1 <= i <= 220:
        print(f"{i:4d}: {line}")
PY

Repository: Silo-Server/silo-apple

Length of output: 6632


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
from pathlib import Path
p = Path('iosApp/iosApp/Screens/Home/HomeViewModel.swift')
for i, line in enumerate(p.read_text().splitlines(), 1):
    if 90 <= i <= 180:
        print(f"{i:4d}: {line}")
PY

Repository: Silo-Server/silo-apple

Length of output: 4148


Restore the previous homeSections cache entry in teardown. ResponseCache.shared is process-wide, so remove(CacheKey.homeSections) can wipe out an existing value for the rest of the test run. Snapshot and restore the old entry instead; apply the same cleanup to the other three cache-backed tests.

🤖 Prompt for 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.

In `@iosApp/Tests/HomeSectionsMutationTests.swift` around lines 96 - 97, Update
all four cache-backed tests, including the test using ResponseCache.shared.set
for CacheKey.homeSections, to snapshot the existing cache entry before mutation
and restore that exact entry in defer teardown instead of unconditionally
removing it; preserve the prior value when present and remove the key only when
no prior entry existed.

@Quick104
Quick104 merged commit 0a44dfa into main Jul 10, 2026
1 check passed
@Quick104
Quick104 deleted the codex/homeviewmodelmutation branch July 10, 2026 18:50
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