Skip to content

Prove that disk and network peers obey the same Peer protocol #385

Description

@bjester

Overview

The contract suite runs its cases against the disk connection, so that both connection types show the same Peer protocol behavior. This issue is part of milestone M7 (verification).

Background & Motivation

#372 wrote the contract suite and ran it against the network connection. The network connection is the reference implementation. The disk connection copies the order of the server stage steps, and that copy can drift from the server behavior over time.

A run of the same cases against the disk connection catches this drift early. If a case fails, the test identifies the exact protocol behavior that differs.

Design: spec. Plan: implementation plan, Task 24.

Description & Expected Outcomes

A disk subclass of the contract suite runs every contract case with a DiskSyncConnection on a temporary path. The subclass reads the peer records from the archive alias. The contract cases themselves do not change.

If a disk case fails, the fix goes into DiskSyncConnection. The contract case stays as the reference behavior.

Deliverables & Contracts

The feature delivers these capabilities:

  • A disk subclass of PeerProtocolContract in the contract suite.
  • All contract cases pass for the network subclass and the disk subclass.

Acceptance Criteria

  • DiskPeerProtocolTestCase exists and runs all cases of PeerProtocolContract.
  • All seven contract cases pass for both subclasses.
  • No contract case changes in this issue.
  • The contract suite passes in the postgres tox environment.

Technical Pointers & Architecture

  • Target Components / Context: tests/testapp/tests/integration/test_peer_protocol_contract.py.
  • Related Patterns: The network subclass from Contract tests define the Peer protocol against a real server #372 and the second-server harness in tests/testapp/tests/integration/test_syncsession.py.
  • Data Model & Schema Considerations: None.
  • Resilience & Failure Modes: Contract case 6 expects a rejection of records outside the filter. The network raises requests.HTTPError, and the disk connection raises ValidationError.

Notes & Tradeoffs

Metadata

  • Complexity: Low
  • 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions