Skip to content

Architecture review: remediate core and recording runtime - #97

Open
Foxpace wants to merge 1 commit into
architecture/39-cleanup-architecture-docsfrom
architecture/40-review-runtime-remediation
Open

Architecture review: remediate core and recording runtime#97
Foxpace wants to merge 1 commit into
architecture/39-cleanup-architecture-docsfrom
architecture/40-review-runtime-remediation

Conversation

@Foxpace

@Foxpace Foxpace commented Aug 23, 2026

Copy link
Copy Markdown
Owner

Summary

Completes the core and recording-runtime half of the architecture review. This PR is stacked on architecture/39-cleanup-architecture-docs; PR 2 will target this branch.

  • Replaces diagnostics with composite file and Logcat routing, seven-calendar-day retention, stale-file pruning, ordered export/clear, explicit locks, and atomic uncaught-handler installation.
  • Splits preferences into onboarding, recording, and display groups without changing persisted keys or defaults.
  • Introduces injectable document/session storage, a shared epoch clock, and an Android activity-recognition platform adapter.
  • Flattens recording preparation and storage flows, surfaces sensor writer failures immediately, and preserves failure propagation from close.
  • Replaces hand-built metadata JSON with serializable models while retaining the existing schema.

Compatibility

  • DataStore keys and defaults are unchanged.
  • Metadata JSON keys and value types are unchanged.
  • Existing AppResult behavior is retained.
  • Public preference access is grouped under onboarding, recording, and display.

Verification

  • ./gradlew test detekt lint
  • git diff --check
  • Focused tests cover diagnostics retention/pruning/routing/concurrency/export/clear/write isolation, preference compatibility and cancellation, document and measurement storage, activity-recognition lifecycle, sensor writer failures, metadata serialization, and early preparation failures.

Inline review disposition

# Original review Disposition
1 PR 14 Implemented explicit file-lock naming.
2 PR 14 Removed redundant volatile.
3 PR 14 Implemented composite file and Logcat diagnostics.
4 PR 14 Implemented explicit handler-lock naming.
5 PR 14 Already implemented; diagnostic errors continue to be copied before locking.
6 PR 14 Duplicate of #3; handled by composite Logcat routing.
7 PR 14 Split preferences by onboarding, recording, and display responsibility.
8 PR 14 Removed unused storage/create parameters.
9 PR 14 Renamed APIs to describe operations instead of getter mechanics.
10 PR 56 Made uncaught-handler installation atomic.
11 PR 56 Retains seven calendar days and prunes older diagnostics.
12 PR 56 Removed explicit cancellation branching; Flow cancellation propagation remains intact.
13 PR 56 Imported MutablePreferences normally.
14 PR 56 Accepted exception: test names already encode GIVEN/WHEN/THEN; redundant comments were not added.
15 PR 57 Flattened GPS preparation with named intermediate operations and early returns.
16 PR 57 Replaced direct calendar access with injectable EpochClock.
17 PR 57 Introduced injectable document and measurement storage.
18 PR 57 Sensor writer failures are logged immediately; close propagates writer failure.
19 PR 58 Injected storage into recording measurements.
20 PR 58 Moved Android activity-recognition work behind an internal platform adapter.
21 PR 58 Replaced manual JSON construction with serializable metadata models.
22 PR 58 Flattened sensor result handling.
23 PR 62 Flattened nested recording/storage control flow.
24 PR 62 Assigned to stacked PR 2: model conversion ownership.
25 PR 62 Assigned to stacked PR 2: complete heart-rate removal.
26 PR 64 Already implemented; workflow-specific view models are retained.
27 PR 64 Assigned to stacked PR 2: conversions moved beside their models.
28 PR 63 Assigned to stacked PR 2: Kotlin datetime formatting.
29 PR 65 Assigned to stacked PR 2: reporting-mode enum and mapper.
30 PR 65 Assigned to stacked PR 2: centralized deterministic formatting.
31 PR 72 Accepted exception in stacked PR 2: Android constructs the Hilt service, so one injected dispatcher field remains.

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