docs/test-implementation-plan.md
Build enough deterministic, adversarial, integration, and device-level coverage that the Android client can be rewritten from scratch without silently changing its wire behavior, security properties, delivery semantics, lifecycle behavior, or user-visible workflows.
The canonical compatibility requirements are documented in client-rewrite-contracts.md. This plan describes how to turn those requirements into a complete, continuously enforced test program.
| Milestone | Status | Progress | Depends on |
|---|---|---|---|
| 0. Compatibility baseline | Complete | 100% | — |
| 1. Coverage and deterministic test infrastructure | Not started | 0% | 0 |
| 2. Adversarial protocol and parser testing | Not started | 0% | 1 |
| 3. Noise, cryptography, and identity testing | Not started | 0% | 1 |
| 4. BLE, Wi-Fi Aware, and transport lifecycle testing | Not started | 0% | 1, 3 |
| 5. Sync, routing, and store-and-forward testing | Not started | 0% | 1, 4 |
| 6. Nostr and Tor integration testing | Not started | 0% | 1, 3 |
| 7. Android lifecycle and permission testing | Not started | 0% | 1, 4 |
| 8. Persistence, migration, and recovery testing | Not started | 0% | 1, 3 |
| 9. UI, media, and accessibility testing | Not started | 0% | 1, 7, 8 |
| 10. Physical-device and cross-client release gate | Not started | 0% | 2–9 |
Milestone completion is currently 1 of 11 milestones (9%). This is milestone-based progress, not line or branch coverage. Milestone 1 will establish measured coverage baselines and trends.
| Level | Purpose | Expected execution |
|---|---|---|
| Pure JVM unit tests | Protocols, state machines, crypto vectors, parsing, routing, and deterministic utilities | Every pull request |
| Property and fuzz tests | Malformed inputs, boundary exploration, invariants, and crash resistance | Bounded set on every pull request; extended corpus nightly |
| Robolectric tests | Android services, lifecycle, broadcasts, permissions, persistence, and process recreation | Every pull request where stable |
| Instrumented emulator tests | Compose semantics, navigation, database/filesystem integration, and permission flows | Main branch and release candidates |
| Physical-device tests | BLE, Wi-Fi Aware, radios, background execution, and manufacturer-specific behavior | Nightly where devices are available; mandatory release gate |
| Cross-client interoperability | Android/iOS and old/new client wire compatibility | Mandatory release gate |
./gradlew clientRewriteContractTest.Status: Complete
Progress: 100%
Establish executable rewrite contracts for the most important deterministic wire formats and reuse the existing regression suite as a single acceptance gate.
codex/client-rewrite-contract-tests branch.clientRewriteContractTest as the complete rewrite acceptance task.main workspace remains unchanged.Status: Not started
Progress: 0%
Make coverage measurable and provide reusable deterministic seams so later milestones test behavior without real time, radios, network access, or flaky scheduling.
mesh, noise, nostr, service,
services, sync, model, protocol, identity, and ui.Status: Not started
Progress: 0%
Prove that all wire decoders preserve canonical behavior, reject unsafe input, and never crash or allocate unreasonable memory for attacker-controlled data.
BitchatMessage.fromBinaryPayload.IdentityAnnouncement.decode.AuthenticatedPeerState.decode.PrivateMessagePacket.decode.NoisePayload.decode.BitchatFilePacket.decode.FragmentPayload.decode.RequestSyncPacket.decode.Status: Not started
Progress: 0%
Prove confidentiality, authenticity, identity binding, replay behavior, session replacement, rekeying, and recovery across the complete secure-channel lifecycle.
Status: Not started
Progress: 0%
Verify connection state machines and packet delivery across unreliable Android transports without requiring real radios for the majority of cases.
Status: Not started
Progress: 0%
Verify eventual delivery, bounded resource usage, correct routing, and duplicate suppression during partitions, topology changes, and reconnects.
Status: Not started
Progress: 0%
Verify relay communication, subscriptions, event validation, NIP-17 delivery, and Tor-mode behavior under realistic network failures.
Status: Not started
Progress: 0%
Verify the app behaves correctly under Android process, service, permission, Bluetooth, battery, and background-execution rules.
Status: Not started
Progress: 0%
Ensure identities, settings, aliases, favorites, bookmarks, messages, and capability pins survive upgrades and fail safely when storage is incomplete or corrupt.
Status: Not started
Progress: 0%
Protect user-visible behavior and media workflows while keeping most assertions at ViewModel/state boundaries and reserving Compose instrumentation for genuine interaction and rendering contracts.
Status: Not started
Progress: 0%
Validate the behavior that JVM, Robolectric, and emulator tests cannot prove: real radios, background limits, device interoperability, and compatibility with released clients.
clientRewriteContractTest.When work lands:
The test program is complete when: