Skip to content

Harden diagnostics PII redaction - #99

Merged
Quick104 merged 3 commits into
mainfrom
fix/diagnostics-pii-redaction
Jul 22, 2026
Merged

Quick104 merged 3 commits into
mainfrom
fix/diagnostics-pii-redaction

Conversation

@Quick104

@Quick104 Quick104 commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Restrict diagnostic bundles to the typed, allowlisted diagnostics ring instead of harvesting general OSLog entries.
  • Redact credentials, quoted JSON secrets, server and signed URLs, and body-bearing HTTP errors; omit stable device names and identifiers.
  • Rotate identity-bound evidence on profile, account, server, and sign-out transitions, and expire retained playback session references.
  • Remove sensitive values from audited public OSLog and stdout paths.

Testing

  • 64 selected Diagnostics tests passed on iPhone 17 Pro Simulator.
  • SiloTV built successfully for Apple TV 4K Simulator.
  • Final branch-mode autoreview against origin/main reported no accepted or actionable findings.

Summary by CodeRabbit

  • Privacy & Security
    • Diagnostic logs/snapshots now redact sensitive URL/host/IP data, credentials/tokens, and secrets in JSON more reliably.
    • Diagnostic snapshots no longer include device names or stable device identifiers.
    • Network, playback, pairing, downloads, and artwork logging avoid exposing URLs, server details, response bodies, and personal data.
  • Diagnostics
    • Diagnostics bundles/snapshots are built from the typed diagnostics ring only; stale session and breadcrumb evidence is purged more aggressively.
    • Recent diagnostic sessions now expire based on a retention window.
  • Bug Fixes
    • Improved privacy-safe HTTP/error representation and redaction behavior.
  • Tests
    • Added coverage for redaction guarantees and session retention/persistence behavior.

@coderabbitai

coderabbitai Bot commented Jul 22, 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: c2e22d6a-6cdc-430f-9110-9a6ef1897259

📥 Commits

Reviewing files that changed from the base of the PR and between 2912e3c and 022c072.

📒 Files selected for processing (3)
  • iosApp/Tests/DiagnosticsReviewFixesTests.swift
  • iosApp/iosApp/ContentView.swift
  • iosApp/iosApp/Shared/Diagnostics/DiagnosticsCoordinator.swift
🚧 Files skipped from review as they are similar to previous changes (2)
  • iosApp/iosApp/ContentView.swift
  • iosApp/iosApp/Shared/Diagnostics/DiagnosticsCoordinator.swift

📝 Walkthrough

Walkthrough

Diagnostics snapshots and artifacts now omit device identifiers and general OSLog entries. Redaction covers additional URL and JSON secret formats, HTTP errors use safe descriptions, recent sessions expire, and application logs remove sensitive values.

Changes

Diagnostics redaction and retention

Layer / File(s) Summary
Diagnostics redaction and retention
iosApp/iosApp/Shared/Diagnostics/*, iosApp/Tests/DeviceSnapshotBuilderTests.swift, iosApp/Tests/DiagnosticsPIIRedactionTests.swift, iosApp/Tests/DiagnosticsReviewFixesTests.swift
Diagnostic snapshots and artifacts use typed ring logs, redact expanded secret formats, remove device identity fields, retain recent sessions within the configured interval, and clear state across binding and authentication transitions. Tests cover these behaviors.

Privacy-safe logging and metadata cleanup

Layer / File(s) Summary
Privacy-safe logging and metadata cleanup
iosApp/iosApp/Networking/*, iosApp/iosApp/Pairing/*, iosApp/iosApp/Screens/Player/*, iosApp/iosApp/Downloads/*, iosApp/iosApp/Components/MediaRow.swift, iosApp/iosApp/ContentView.swift, iosApp/iosApp/Control/iOS/SiloControlClient.swift
Application diagnostics no longer emit server URLs, stream URLs, device or TV names, profile data, identifiers, paths, credentials, or error bodies; control flow remains unchanged.

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

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 23.53% 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 clearly summarizes the main change: tightening diagnostics PII redaction and log sanitization across the app.
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 fix/diagnostics-pii-redaction

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

- Remove URLs, identifiers, credentials, and response bodies from logs and snapshots
- Limit diagnostic bundles to the allowlisted ring and purge stale session data
- Add coverage for secret formats, IPv6 URLs, device identity, and expiry

@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

🧹 Nitpick comments (2)
iosApp/Tests/DeviceSnapshotBuilderTests.swift (1)

47-48: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use the failable UTF-8 conversion required by SwiftLint.

Proposed fix
-        let encoded = String(decoding: data, as: UTF8.self)
+        let encoded = try XCTUnwrap(String(data: data, encoding: .utf8))
🤖 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/DeviceSnapshotBuilderTests.swift` around lines 47 - 48, Update
the encoded string conversion in the snapshot encoding test to use Swift’s
failable UTF-8 initializer instead of String(decoding:as:). Preserve the
existing encoded data flow and handle the initializer’s failure appropriately
within the test.

Source: Linters/SAST tools

iosApp/iosApp/Screens/Player/AVPlayerRoute/AVPlayerBackend.swift (1)

1431-1436: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Clamp firstFrameMs to non-negative for consistency with PlayerCore.swift.

PlayerCore.swift clamps the equivalent first-frame elapsed time with max(0, ...) at the call site (line 5364), but this callback path does not. Since both feed the same onFirstFrame contract and the same [CMP-TTFF]-style telemetry, an unclamped negative value here (e.g., from a load-anchor edge case) would produce an inconsistent/confusing log line even though the downstream reportProtocolV3FirstFrame clamps it before emitting the V3 event.

🩹 Proposed fix
-        let firstFrameMs = ttffElapsedMs()
+        let firstFrameMs = max(0, ttffElapsedMs())
🤖 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/Screens/Player/AVPlayerRoute/AVPlayerBackend.swift` around
lines 1431 - 1436, Clamp the elapsed value assigned to firstFrameMs in the
AVPlayer first-frame callback to a minimum of zero, matching the existing
PlayerCore.swift behavior. Pass this clamped value to onFirstFrame and use it in
the [CMP-TTFF] telemetry log.
🤖 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/Screens/Player/PlaybackSessionBridge.swift`:
- Around line 431-441: Update the capability-probe error handling in
startProtocolV3IfAvailable so failures other than HTTP 404/405 also return nil
and allow startSession to continue through the legacy /playback/start path.
Treat unexpected errors as unavailable for the current attempt, while leaving
protocolV3Available unresolved so a later retry can probe again.

In `@iosApp/iosApp/Screens/Player/ProtocolV3/ApplePlaybackV3Capabilities.swift`:
- Line 59: Resolve the redundant ternary in the capabilities construction by
confirming whether mpeg2video needs a distinct decoder value; if not, replace
the codec-dependent expression with the literal "VideoToolbox". Update the
decoderName assignment in the relevant Apple playback capability code while
preserving the intended reported decoder.

---

Nitpick comments:
In `@iosApp/iosApp/Screens/Player/AVPlayerRoute/AVPlayerBackend.swift`:
- Around line 1431-1436: Clamp the elapsed value assigned to firstFrameMs in the
AVPlayer first-frame callback to a minimum of zero, matching the existing
PlayerCore.swift behavior. Pass this clamped value to onFirstFrame and use it in
the [CMP-TTFF] telemetry log.

In `@iosApp/Tests/DeviceSnapshotBuilderTests.swift`:
- Around line 47-48: Update the encoded string conversion in the snapshot
encoding test to use Swift’s failable UTF-8 initializer instead of
String(decoding:as:). Preserve the existing encoded data flow and handle the
initializer’s failure appropriately within the test.
🪄 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: 1f14c81e-0a35-477b-9b95-c1a4d9a2b108

📥 Commits

Reviewing files that changed from the base of the PR and between 9425957 and d8107f0.

⛔ Files ignored due to path filters (6)
  • iosApp/Tests/Fixtures/v3_h264_aac.m4v is excluded by !**/*.m4v
  • iosApp/Tests/Fixtures/v3_h264_aac.mkv is excluded by !**/*.mkv
  • iosApp/Tests/Fixtures/v3_h264_aac.mov is excluded by !**/*.mov
  • iosApp/Tests/Fixtures/v3_h264_aac.mp4 is excluded by !**/*.mp4
  • iosApp/Tests/Fixtures/v3_mpeg4_mp3.avi is excluded by !**/*.avi
  • iosApp/Tests/Fixtures/v3_vp9_opus.webm is excluded by !**/*.webm
📒 Files selected for processing (39)
  • iosApp/Tests/DeviceSnapshotBuilderTests.swift
  • iosApp/Tests/DiagnosticsPIIRedactionTests.swift
  • iosApp/Tests/DiagnosticsReviewFixesTests.swift
  • iosApp/Tests/Fixtures/v3_h264_aac.m2ts
  • iosApp/Tests/Fixtures/v3_h264_aac.m3u8
  • iosApp/Tests/Fixtures/v3_h264_aac.ts
  • iosApp/Tests/Fixtures/v3_hls_00.ts
  • iosApp/Tests/Fixtures/v3_hls_01.ts
  • iosApp/Tests/PlaybackMediaFixtureTests.swift
  • iosApp/Tests/PlaybackProtocolV3Tests.swift
  • iosApp/iosApp/Components/MediaRow.swift
  • iosApp/iosApp/ContentView.swift
  • iosApp/iosApp/Control/iOS/SiloControlClient.swift
  • iosApp/iosApp/Downloads/DownloadFilePaths.swift
  • iosApp/iosApp/Downloads/DownloadManager.swift
  • iosApp/iosApp/Networking/ContinuumAPI.swift
  • iosApp/iosApp/Networking/HTTPClient.swift
  • iosApp/iosApp/Networking/ServerRegistry.swift
  • iosApp/iosApp/Pairing/Companion/CompanionPairingCoordinator.swift
  • iosApp/iosApp/Pairing/Receiver/ReceiverPairingCoordinator.swift
  • iosApp/iosApp/Screens/Detail/Phone/PhoneHeroMetadata.swift
  • iosApp/iosApp/Screens/Player/AVPlayerRoute/AVPlayerBackend.swift
  • iosApp/iosApp/Screens/Player/AVPlayerRoute/LoopbackSegmentStore.swift
  • iosApp/iosApp/Screens/Player/CoreMedia/PlayerCore.swift
  • iosApp/iosApp/Screens/Player/NowPlayingController.swift
  • iosApp/iosApp/Screens/Player/PlaybackSessionBridge.swift
  • iosApp/iosApp/Screens/Player/PlayerViewModel.swift
  • iosApp/iosApp/Screens/Player/ProtocolV3/ApplePlaybackV3Capabilities.swift
  • iosApp/iosApp/Screens/Player/ProtocolV3/ApplePlaybackV3PlanAdapter.swift
  • iosApp/iosApp/Screens/Player/ProtocolV3/PlaybackProtocolV3Models.swift
  • iosApp/iosApp/Shared/Diagnostics/DeviceSnapshotBuilder.swift
  • iosApp/iosApp/Shared/Diagnostics/DiagnosticsCoordinator.swift
  • iosApp/iosApp/Shared/Diagnostics/Logging/DiagLog.swift
  • iosApp/iosApp/Shared/Diagnostics/RecentSessionTracker.swift
  • iosApp/iosApp/tvOS/Screens/Detail/TVDetailHero.swift
  • iosApp/iosApp/tvOS/Screens/Detail/TVExpandableSynopsis.swift
  • iosApp/iosApp/tvOS/Screens/Detail/TVMovieDetailView.swift
  • iosApp/iosApp/tvOS/Screens/Detail/TVSeasonDetailView.swift
  • iosApp/iosApp/tvOS/Screens/Detail/TVSeriesDetailView.swift
💤 Files with no reviewable changes (5)
  • iosApp/iosApp/Shared/Diagnostics/DeviceSnapshotBuilder.swift
  • iosApp/iosApp/Screens/Detail/Phone/PhoneHeroMetadata.swift
  • iosApp/iosApp/tvOS/Screens/Detail/TVSeriesDetailView.swift
  • iosApp/iosApp/tvOS/Screens/Detail/TVSeasonDetailView.swift
  • iosApp/iosApp/tvOS/Screens/Detail/TVMovieDetailView.swift

Comment on lines +431 to +441
if protocolV3Available == nil {
do {
let capability = try await ContinuumAPI.shared.playbackV3Capability()
protocolV3Available = capability.enabled
&& capability.protocolVersions.contains(PlaybackProtocolV3.version)
&& capability.features.contains(PlaybackProtocolV3.planFeature)
} catch let error as HTTPError where error.statusCode == 404 || error.statusCode == 405 {
protocolV3Available = false
}
}
guard protocolV3Available == true else { return nil }

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 | 🟠 Major | ⚡ Quick win

Capability-probe failures other than 404/405 abort playback instead of falling back to legacy.

The catch only handles 404/405. Any other failure (e.g. a transient .network error, 5xx, timeout) propagates out of startProtocolV3IfAvailable and out of startSession, so the legacy /playback/start path below (Line 361+) is never reached. On a V3-capable server, a transient blip on /playback/capability will hard-fail a playback start that the legacy path could have served. Consider treating unexpected probe failures as "V3 not available for this attempt" (return nil, leaving protocolV3Available unresolved for a later retry) rather than propagating.

🤖 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/Screens/Player/PlaybackSessionBridge.swift` around lines 431 -
441, Update the capability-probe error handling in startProtocolV3IfAvailable so
failures other than HTTP 404/405 also return nil and allow startSession to
continue through the legacy /playback/start path. Treat unexpected errors as
unavailable for the current attempt, while leaving protocolV3Available
unresolved so a later retry can probe again.

videoDecode: videoCodecs.map { codec in
PlaybackV3VideoDecodeCapability(
codec: codec,
decoderName: codec == "mpeg2video" ? "VideoToolbox" : "VideoToolbox",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Redundant ternary — both branches return "VideoToolbox".

codec == "mpeg2video" ? "VideoToolbox" : "VideoToolbox" evaluates to the same value regardless of the condition. Either the intended branch value differs (e.g. mpeg2video reported with a distinct/nil decoder) or this should be simplified to a literal. Please confirm the intent.

🔧 Simplify if no distinct decoder was intended
-                    decoderName: codec == "mpeg2video" ? "VideoToolbox" : "VideoToolbox",
+                    decoderName: "VideoToolbox",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
decoderName: codec == "mpeg2video" ? "VideoToolbox" : "VideoToolbox",
decoderName: "VideoToolbox",
🤖 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/Screens/Player/ProtocolV3/ApplePlaybackV3Capabilities.swift` at
line 59, Resolve the redundant ternary in the capabilities construction by
confirming whether mpeg2video needs a distinct decoder value; if not, replace
the codec-dependent expression with the literal "VideoToolbox". Update the
decoderName assignment in the relevant Apple playback capability code while
preserving the intended reported decoder.

@Quick104
Quick104 force-pushed the fix/diagnostics-pii-redaction branch from d8107f0 to 581252e Compare July 22, 2026 16:05
@Quick104 Quick104 changed the title Add playback protocol V3 and harden diagnostics redaction Harden diagnostics PII redaction Jul 22, 2026

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

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

return PlaybackExecutionPlan(
delivery: delivery,
engine: engine,
startMode: .absolutePosition(max(0, plan.timeline.playerStartSeconds)),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve remux manifest offsets in V3 plans

When a V3 server_remux_hls plan starts from a resume/seek anchor, the session carries the movie-time mapping in timelineOffsetSeconds, but the VM only applies that offset for remuxed AVPlayer HLS when the plan start mode is .startOfManifest. This unconditional .absolutePosition(...) makes the initial V3 remux load drop the offset, so UI time/progress reporting and subsequent seeks start around 0 instead of the resumed source position. Use .startOfManifest for V3 remux-HLS plans, or update the offset calculation to honor V3 remux offsets.

Useful? React with 👍 / 👎.

Comment on lines +536 to +537
sessionId = resolvedSessionId
currentSession = session

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Adopt V3 sessions through the common session path

For V3 starts this assigns sessionId/currentSession directly instead of going through adoptSession. When diagnostics capture is enabled, that helper is the only path that records the recent playback session and emits the playback-session breadcrumb, so V3 playback sessions are omitted from manual/crash diagnostics while legacy sessions still appear. Please adopt the synthesized V3 session through the same helper after activeProtocolV3 is set.

Useful? React with 👍 / 👎.

Comment on lines +445 to +450
let protocolV3SubtitleTrackIndex = subtitleTrackIndex.flatMap {
ApplePlaybackV3PlanAdapter.serverCombinedSubtitleIndex(
ffmpegStreamIndex: $0,
in: selectedVersion
)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve explicit subtitle-off in V3 start requests

When the detail screen passes -1 for “Off”, this mapping feeds it through serverCombinedSubtitleIndex, producing nil, and the request then sends the same nil used for “Auto”. On V3-capable servers that means playback start can still apply saved/default subtitles, or even choose a burned-in subtitle plan, despite the user explicitly selecting Off. Keep the off sentinel distinct from nil/auto when building the V3 start request.

Useful? React with 👍 / 👎.

retryable: false
)
case .playable(let plan, let resolvedSessionId):
try ApplePlaybackV3PlanAdapter.validate(plan)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Stop allocated V3 sessions when plan validation throws

If the server returns a playable V3 envelope but validate rejects the plan (for example an unsupported runtime correction or client transform), this throw skips the stopPlayback cleanup that the later missing-version path performs. In that invalid-plan scenario playback fails locally while the newly allocated server session remains until idle expiry, consuming a concurrency slot; wrap validation so resolvedSessionId is stopped before rethrowing.

Useful? React with 👍 / 👎.

hdrDetails: output.hdrDetails,
subtitles: directSubtitles,
features: ["apple_native_direct", "apple_local_loopback", "apple_playercore"],
authHeaderRefresh: true,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Don't advertise header refresh until it is implemented

This advertises authHeaderRefresh: true (and the other V3 engines do the same), and the validator accepts plans with headerRefresh == "session", but the client never reads headerRefreshUrl or refreshes stream headers after the initial makeStreamRequest merge. When a V3 server relies on expiring session headers, long HLS/direct playback can keep using stale headers and fail mid-stream; either advertise no refresh support or wire the refresh path before accepting those plans.

Useful? React with 👍 / 👎.

@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: 2912e3c40f

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1078 to +1081
RecentSessionTracker.shared.purge(binding: binding)
}
purgeBreadcrumbJournal()
DiagLog.ring.clear()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve crash evidence across the startup auth gate

On tvOS cold launch after an abnormal exit, ContentView first runs its auth-state task while the router is still .loading, which calls activeProfileWillChange() before the authenticated path calls captureLeftoverIfNeeded(). With these new purges, that startup gate deletes the previous run's persisted breadcrumbs and recent playback session IDs before the leftover marker is captured, so the abnormal-exit report is saved without the failed-run evidence it was meant to preserve; only clear this data for an actual server/profile boundary or after the leftover capture has had a chance to read it.

Useful? React with 👍 / 👎.

let ringSnapshot = DiagLog.ring.snapshot()
let candidateLines = ringSnapshot.lines + harvestOSLogLines(since: start)
let lines = Self.logLines(candidateLines, forRunID: runID, since: start)
let lines = Self.logLines(ringSnapshot.lines, forRunID: runID, since: start)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Write an abnormal-exit log sentinel when the ring is empty

For a real tvOS abnormal-exit capture this code runs on the relaunch, but DiagLog.ring is process-local and the runID being filtered is from the crashed process, so this usually produces no lines after OSLog harvesting was removed. Returning nil here leaves no logs.jsonl artifact, and buildBundle later falls back to the current relaunch's live ring instead of freezing an empty failed-run log set; persist the typed logs across runs or at least write an empty logs artifact when no crashed-run lines are available.

Useful? React with 👍 / 👎.

@Quick104
Quick104 merged commit 485d444 into main Jul 22, 2026
1 check was pending
@Quick104
Quick104 deleted the fix/diagnostics-pii-redaction branch July 22, 2026 16:49

@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: 022c072dcd

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1087 to +1091
if let binding = currentDiagnosticsBinding {
RecentSessionTracker.shared.purge(binding: binding)
}
purgeBreadcrumbJournal()
DiagLog.ring.clear()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Purge profile-scoped evidence on the actual profile-change path

Putting the new purge only in activeProfileWillChange() misses the normal profile-switch flow: I checked AuthService.profileId and selectProfile, and they call DiagnosticsCoordinator.activeProfileDidChange() without first calling this method. In that common path, the previous profile's recent playback sessions, breadcrumbs, and ring entries remain under the same account binding, so a manual or crash report created after switching profiles can still include evidence from the profile that was just left; move/duplicate the purge onto the profile setter/activeProfileDidChange path before the async eligibility re-check.

Useful? React with 👍 / 👎.

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