Skip to content

Commit 4a56fa9

Browse files
committed
chore: Update workout worker docs
1 parent c7a8788 commit 4a56fa9

1 file changed

Lines changed: 6 additions & 25 deletions

File tree

docs/WorkoutWorker.md

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ When a workout is in progress, there are certain responsibilities that sit outsi
44

55
- Persistent notifications
66
- Timers that must continue while the app is backgrounded
7-
- Integration with platform-specific system UI (e.g. Dynamic Island–style affordances on iOS, foreground notifications on Android)
7+
- Integration with platform-specific system UI (e.g. foreground notifications on Android)
88

99
These responsibilities are **inherently platform-dependent**, both in _how_ they are executed and _what_ they integrate with.
1010

@@ -79,30 +79,24 @@ When the app broadcasts an event:
7979

8080
### External representation (cross-platform)
8181

82-
For cross-platform communication (JS ↔ native, and parity with iOS), workout messages are serialized using **protobuf**.
83-
84-
Protobuf is used strictly as a **wire format**:
85-
86-
- Defines the cross-language contract
87-
- Enables versioning and forwards compatibility
88-
- Allows binary transport where appropriate
82+
For cross-platform communication (JS ↔ native, and parity with iOS), workout messages are serialized using **json** via the json schema we generate.
83+
JSON schemas are generated from our types via (in ./app dir) `npm run json-schema`. This will generate schemas in the docs directory.
8984

9085
---
9186

9287
### Translation boundary
9388

9489
A dedicated translation layer is responsible for converting between:
9590

96-
- Protobuf `WorkoutMessage` messages
91+
- Json Schema `WorkoutMessage` messages
9792
- Internal domain `WorkoutMessage` objects (events and commands)
9893

9994
This translation layer:
10095

10196
- Lives on the JS side of the bridge
10297
- Encapsulates versioning, defaults, and backward compatibility
103-
- Is the only place where protobuf schema knowledge exists in application code
10498

105-
The native bridge receives protobuf bytes directly and uses generated protobuf classes for parsing. The React Native module is responsible only for transport and service lifecycle.
99+
The native bridge receives a json string directly and uses generated classes for parsing. The React Native module is responsible only for transport and service lifecycle.
106100

107101
---
108102

@@ -111,7 +105,7 @@ The native bridge receives protobuf bytes directly and uses generated protobuf c
111105
### App → Worker (Events)
112106

113107
1. The main app broadcasts a `WorkoutMessage` (event)
114-
2. The message is serialized using protobuf
108+
2. The message is serialized using json
115109
3. The broadcast immediately echoes the event back to all JS listeners
116110
4. The native bridge forwards the message to the platform worker
117111
5. The message is dispatched through the worker's in-process message channel
@@ -131,16 +125,3 @@ The native bridge receives protobuf bytes directly and uses generated protobuf c
131125
- `WorkoutStartedEvent` explicitly starts the worker
132126
- `WorkoutEndedEvent` explicitly stops the worker
133127
- Messages outside an active workout lifecycle are ignored
134-
135-
---
136-
137-
## Non-goals
138-
139-
The `WorkoutWorker` explicitly does **not**:
140-
141-
- Persist workout state
142-
- Attempt crash recovery
143-
- Resume workouts after process death
144-
- Act as a domain state machine
145-
146-
These concerns remain the responsibility of the main application.

0 commit comments

Comments
 (0)