Overview
This task (milestone M1) adds characterization tests for network syncs that use ASYNC_OPERATIONS. The tests record the exact HTTP requests and the final state of a push and a pull.
Background & Motivation
Milestones M2 to M4 refactor the sync layer. The refactors must not change what the network sync sends or stores. Today, no test pins the request sequence of a full sync, and the network operations have no direct unit tests.
These tests form the characterization suite. The refactor tasks must pass this suite without edits.
Design: spec. Plan: implementation plan, Task 2.
Description & Expected Outcomes
The tests run a real push and a real pull against the second-server test harness. A spy records each HTTP request that the client sends. For each request, the test records the method, the path, the body keys, and the requested transfer stage.
The tests compare the recorded list with a fixed expected list. Generated IDs are normalized, so the lists are stable between runs. The tests also assert the final local transfer session fields and the local data.
Deliverables & Contracts
The task delivers:
- A new test module
tests/testapp/tests/integration/test_network_characterization.py.
- One test for a full push and one test for a full pull.
Acceptance Criteria
Technical Pointers & Architecture
- Target Components:
morango/sync/session.py (SessionWrapper.request), morango/sync/syncsession.py (NetworkSyncConnection, TransferClient).
- Related Patterns:
LiveServer, second_environment, and PushPullClientTestCase in tests/testapp/tests/integration/test_syncsession.py:56-219.
- Data Model & Schema Considerations: None.
- Resilience & Failure Modes: The spy must pass each call through to the real method, so that retries and errors behave as today.
Notes & Tradeoffs
Metadata
- Complexity: Medium
- Target Branch: release-v0.9.x
AI Usage
Drafted with Claude (Claude Code) from the approved design spec and implementation plan. The author reviewed the requirements, and the code references were checked against the release-v0.9.x codebase.
Overview
This task (milestone M1) adds characterization tests for network syncs that use
ASYNC_OPERATIONS. The tests record the exact HTTP requests and the final state of a push and a pull.Background & Motivation
Milestones M2 to M4 refactor the sync layer. The refactors must not change what the network sync sends or stores. Today, no test pins the request sequence of a full sync, and the network operations have no direct unit tests.
These tests form the characterization suite. The refactor tasks must pass this suite without edits.
Design: spec. Plan: implementation plan, Task 2.
Description & Expected Outcomes
The tests run a real push and a real pull against the second-server test harness. A spy records each HTTP request that the client sends. For each request, the test records the method, the path, the body keys, and the requested transfer stage.
The tests compare the recorded list with a fixed expected list. Generated IDs are normalized, so the lists are stable between runs. The tests also assert the final local transfer session fields and the local data.
Deliverables & Contracts
The task delivers:
tests/testapp/tests/integration/test_network_characterization.py.Acceptance Criteria
records_total,records_transferred,transfer_stage,transfer_stage_status, andactiveon the local transfer session.Bufferrows remain for the transfer session.Storerow count for the filter.Technical Pointers & Architecture
morango/sync/session.py(SessionWrapper.request),morango/sync/syncsession.py(NetworkSyncConnection,TransferClient).LiveServer,second_environment, andPushPullClientTestCaseintests/testapp/tests/integration/test_syncsession.py:56-219.Notes & Tradeoffs
Metadata
AI Usage
Drafted with Claude (Claude Code) from the approved design spec and implementation plan. The author reviewed the requirements, and the code references were checked against the
release-v0.9.xcodebase.