summaryrefslogtreecommitdiff
path: root/scripts/.claude/ct-remove-mock-tidal.yaml
blob: 86d4e763ccb54702794246af7a0a96ddbc876853 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: "Remove MockTidalCurrentGenerator"
description: "LocationService generates random fake tidal current arrows near a hardcoded Solent coordinate (50.8, -1.3) every 60 seconds regardless of boat position. Remove the mock generator; leave the layer empty until a real tidal API is integrated."
agent:
  model: "sonnet"
  working_dir: "/workspace/nav"
  instructions: |
    Context
    -------
    In LocationService.onCreate() there is a coroutine loop:
        (android-app/app/src/main/kotlin/org/terst/nav/LocationService.kt, lines ~113-119)

        serviceScope.launch {
            while (true) {
                val currents = MockTidalCurrentGenerator.generateMockCurrents()
                _tidalCurrentState.update { it.copy(currents = currents) }
                kotlinx.coroutines.delay(60000)
            }
        }

    MockTidalCurrentGenerator.generateMockCurrents() produces 10 TidalCurrent objects with:
        - Random speedKnots (0–5 kn)
        - Random directionDegrees (0–360°)
        - Positions scattered within 0.05° of lat=50.8, lon=-1.3 (Solent, UK)
    regardless of actual boat position.
        (android-app/app/src/main/kotlin/org/terst/nav/MockTidalCurrentGenerator.kt)

    TidalCurrentState has an isVisible flag (defaults false) and a currents list.
    MapHandler.updateTidalCurrents() respects isVisible — when false it clears the layer.

    Goal
    ----
    1. Remove the mock generator loop from LocationService.onCreate()
    2. Delete MockTidalCurrentGenerator.kt
    3. Ensure _tidalCurrentState starts with isVisible=false and empty currents (the default)
    4. Remove the import of MockTidalCurrentGenerator from LocationService

    Do NOT remove TidalCurrentState, _tidalCurrentState, or the tidalCurrentState public flow —
    those are needed when a real tidal API is added later.
    Do NOT remove ACTION_TOGGLE_TIDAL_VISIBILITY handling in onStartCommand — keep the
    visibility toggle working for future use.

    Step 1 — Remove the mock loop from LocationService
    ---------------------------------------------------
    In android-app/app/src/main/kotlin/org/terst/nav/LocationService.kt:

    Delete the entire block (including the comment):
        // Mock tidal current data generator
        serviceScope.launch {
            while (true) {
                val currents = MockTidalCurrentGenerator.generateMockCurrents()
                _tidalCurrentState.update { it.copy(currents = currents) }
                kotlinx.coroutines.delay(60000) // Update every minute
            }
        }

    Remove the import:
        import org.terst.nav.MockTidalCurrentGenerator

    Step 2 — Delete MockTidalCurrentGenerator.kt
    ---------------------------------------------
    Delete android-app/app/src/main/kotlin/org/terst/nav/MockTidalCurrentGenerator.kt

    Step 3 — Build
    --------------
    cd android-app && ANDROID_HOME=/opt/android-sdk ./gradlew assembleDebug 2>&1 | tail -5
    Confirm BUILD SUCCESSFUL with no references to MockTidalCurrentGenerator remaining.

    Step 4 — Commit and push
    ------------------------
    git add -A
    git commit -m "chore: remove MockTidalCurrentGenerator

    The mock generator was producing 10 random tidal current arrows near a
    hardcoded Solent coordinate (50.8, -1.3) every 60 seconds regardless of
    boat position. Remove it entirely. The tidal overlay infrastructure
    (TidalCurrentState, mapHandler.updateTidalCurrents) is retained for when
    a real tidal current API is integrated."
    git push github main && git push local main
timeout: "15m"
tags:
  - "cleanup"
  - "tidal"
  - "mock-data"