Repository navigation
Compiler-warning cleanup: redundant operators, AutoMirrored icons, shadows, always-true conditions - #6
Merged
Conversation
added 4 commits
July 7, 2026 14:34
- AiCoach.parseReply: firstChoice is smart-cast non-null after the content guard, so the
finish_reason safe calls were redundant -> plain calls (optString returns non-null).
- CaffeineDecay: `mostRecentActiveHours!!` is redundant inside `x == null || … x` (smart-cast).
- WatchRecovery: `hrvHistory/rhrHistory.map { it as Double? }` -> pass List<Double> straight to
foldHistory(List<Double?>) via List covariance; the casts (and identity map) were unnecessary.
Left as-is: the "unused parameter" warnings on inBedSeconds / nightsElapsed / habitualWakeHour /
day / resp are deliberate Kotlin<->Swift signature-parity mirrors (each exists in the Swift twin),
so removing them would break parity. compileFullDebugKotlin: BUILD SUCCESSFUL, those 4 gone.
…adows All non-behavioural (compile-verified, ingest+data tests 298 pass): - Deprecated Material icons → AutoMirrored variants (import + usage): VolumeUp/VolumeOff/ ArrowForward (BreatheScreen), Send (CoachScreen), DirectionsWalk/DirectionsRun (DashboardCards), MenuBook (HealthScreen, LabBookScreen). - Unnecessary safe calls on smart-cast-non-null receivers: SourceCoordinator (row.model), HealthScreen (day.recovery). - HrvSnapshotScreen: dropped a redundant Elvis (r.rmssd is non-null here). - DataBackup: removed the redundant `else` on an exhaustive `when`. - CsvParser: dropped the redundant `= 0` initializer on `hours` (assigned on every branch). - Name-shadow renames: Backfiller `unix`→`recUnix`, StandardHrSource inner `ch`→`sensorCh`. Left as-is: the remaining "unused parameter" warnings — `data` (WearableExportImporter) is a Swift-parity mirror (isWellnessFile(..., data:) exists in Swift); `batch`/`g` (WhoopBleClient) are Android GATT-helper signature params; `color` (CoachMarkdown.parseInline) is passed by all callers.
All non-behavioural (compile-verified): - Deprecated icons → AutoMirrored: Chat + OpenInNew (NotificationsSettingsScreen), MenuBook (SettingsScreen), DirectionsWalk (StepsCalibrationScreen), BatteryUnknown (TodayScreen). - TodayScreen: removed 5 compiler-proven always-true null sub-conditions (recovery/strain/sleep are non-null there), renamed a shadowed inner `live`→`liveStrain`, deleted an unused `dismissScoringCard` lambda (never referenced). - SleepScreen: renamed shadowed inner `imported`→`importedSessions`. - TrendsReport: dropped a dead assignment (`y = drawMetrics(...)` → `drawMetrics(...)`; y unused after). Left as-is: the "unused parameter" warnings (TodayScreen composable params, TestCentre `vm`, TimeOfDayBackground `w`) — composable/Swift-parity signature params; removing risks parity + churn.
…cons - UpdateStore.fromJson: `o.optString(name, null)` passes null where Android's optString(name, String) wants a non-null fallback (Nothing?-vs-String warning). Use the `if (o.has(name)) o.optString(name) else null` idiom — same result (value or null), no warning. deepLink/restorePayload already had the o.has guard so the inner `, null` was dead; kind gains the guard too. - WorkoutsScreen: deprecated icons → AutoMirrored (ShowChart, MergeType, DirectionsRun x2, DirectionsWalk, DirectionsBike). Non-behavioural; compileFullDebugKotlin BUILD SUCCESSFUL.
DX23876
referenced
this pull request
in DX23876/noop
Jul 22, 2026
Compiler-warning cleanup: redundant operators, AutoMirrored icons, shadows, always-true conditions
xxblyxx
added a commit
to xxblyxx/noop
that referenced
this pull request
Sep 1, 2026
… dropping The re-score storm reduction commits on this branch never got the 15-minute minimum interval between automatic passes the original plan specified for Commit 1 (deferred openly in 59771a0's message, never followed up). A device log pulled 2026-08-25 showed the cost: 5 passes / ~7.9 min re-score CPU in a 44-minute window, versus a <=2 passes / <2 min target, because nothing capped how often an automatic tick or post-offload pass could re-run the same window. New Strand/Data/AnalyzePolicy.swift, shaped like the existing Strand/BLE/BackfillPolicy.swift: a pure enum, an AnalyzeTrigger naming what asked, and a decide() function returning .run or .deferUntil(instant) - deferred, not dropped, since an automatic re-score guards a freshly-synced night's data reaching the dashboard. 900s floor, matching BackfillPolicy.periodicFloorSeconds. .dataChange (every user- or data-driven caller: manual re-score, import, edit, recalibrate, heals) and .background (the BGProcessingTask wake, whose own fingerprint gate is trustworthy while the process is suspended) always bypass. A local-midnight rollover, using the exact AnalyticsEngine.dayString helper analyzeRecent's own scoring loop uses, also always runs, so the first pass after midnight is never floored. IntelligenceEngine.analyzeRecent gains a trigger: AnalyzeTrigger = .dataChange parameter (the default bypasses the floor for every existing caller) and checks the floor FIRST - before the ryanbr#899-A lock guard and before any store read, so a floored trigger costs nothing and never sets pendingForcedRescore. deferredRescoreDueAt publishes the rejected instant. The floor's own watermark (noop.analyze.lastPassEndedAt) is written at completion gated on !Task.isCancelled ONLY, never combined with the stricter !wmKey.isEmpty check the watermark write beside it uses - the same class of bug review finding ryanbr#6 already fixed once for completedPassCount, now avoided here by construction. AppModel wires the post-offload caller (refreshAfterCompletedBackfill) and the 30-minute cadence tick to the floor, and adds a coalesced single-retry Task via a new $deferredRescoreDueAt sink in init() so a floored trigger is never silently lost - it retries once, through refreshAfterCompletedBackfill (inheriting its reentrancy guard and bar teardown), at the deferred instant. The post-offload floor check sits AFTER repo.refresh(days: 120), not before, so a floored pass still surfaces newly-offloaded raw to Trends/streak reads - skipping that would reproduce the ryanbr#1196 flicker shape; only the analyze pass and progress bar are skipped. New StrandTests/AnalyzePolicyTests.swift pins the floor boundary (elapsed >= 900 vs <), the .dataChange/.background bypass, backwards-clock self-healing, and the local-midnight rollover at a non-zero tzOffsetSec. Second of five commits implementing docs/superpowers/plans/2026-08-25-rescore-floor.md. No Kotlin twin: pure iOS scheduling, and Android's analyzeGate is a Mutex with different semantics (blocks-then-runs, not drop-and-rearm) - 066d562 already reverted one attempt to mechanically mirror a Swift scheduling constant into that model. Kotlin cannot be compiled on this machine; nothing was run against it. Verified: full iOS build (xcodegen generate && xcodebuild -scheme NOOPiOS -destination 'generic/platform=iOS' CODE_SIGNING_ALLOWED=NO build) and the macOS test suite (xcodebuild -scheme Strand -destination 'platform=macOS' test, 1221 tests / 0 failures, including all 6 new AnalyzePolicyTests) both pass against the full branch state (this commit plus the two that follow it). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XeGMt5M6bknba8Zm8WFe6L
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Compiler-warning cleanup — all non-behavioral, each commit compile-verified (
compileFullDebugKotlinBUILD SUCCESSFUL; ingest+data unit tests pass on the structural ones).d932b25a— redundant operators: unnecessary safe-calls /!!/as Double?casts (AiCoach, CaffeineDecay, WatchRecovery).5c617dbf— deprecated Material icons → AutoMirrored (BreatheScreen, CoachScreen, DashboardCards, HealthScreen, LabBookScreen); unnecessary safe-calls (SourceCoordinator, HealthScreen); redundant Elvis (HrvSnapshotScreen); exhaustive-whenelse(DataBackup); redundant initializer (CsvParser); name-shadow renames (Backfiller, StandardHrSource).5003222e— more AutoMirrored icons (NotificationsSettingsScreen, SettingsScreen, StepsCalibrationScreen, TodayScreen); 5 compiler-proven always-true null sub-conditions removed + shadow rename + dead lambda (TodayScreen); shadow rename (SleepScreen); dead assignment (TrendsReport).9c52ecbf— UpdateStore null-fallback type mismatches (optString(name, null)→ guarded idiom); WorkoutsScreen AutoMirrored icons.Deliberately not touched
The "unused parameter" warnings (e.g.
inBedSeconds,nightsElapsed,habitualWakeHour,day,resp,data,batch,g,color, TodayScreen composable params) are left as-is — they're Kotlin↔Swift signature-parity mirrors or composable-signature params, so removing them would break parity / churn callers. Accepted as benign noise (policy A).No behavior changes; UI icons only gain automatic RTL mirroring.