Session contexts support network and disk peers

Abierto
#373 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
55/100
Tipo de issue
Refactorización
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python

Línea de trabajo

Read morango/sync/context.py, especially NetworkSessionContext at lines 311-351, and the NetworkSessionContextTestCase in tests/testapp/tests/sync/test_context.py. Run the existing context and characterization tests first. Done means both subclasses meet the stated stage, state-update, inheritance, and backoff requirements, with the characterization and full suites passing unchanged.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

DEV: backend DEV: distributions P0 - critical TAG: new feature

Overview

A PeerSessionContext base class holds the peer side of a sync, with one subclass for each connection type. This work is part of milestone M4 (shared operations refactor).

Background & Motivation

Operations select the context that they handle by its type. Today only NetworkSessionContext represents a peer. A shared base class lets one operation handle both network and disk peers. The subclasses let an operation handle one connection type only, when that is necessary.

This task changes no behavior for network syncs.

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

Description & Expected Outcomes

PeerSessionContext gets the body of the current NetworkSessionContext. It holds the connection and keeps the stage state in memory. NetworkSessionContext and a new DiskSessionContext become subclasses of it. DiskSessionContext uses a maximum backoff interval of 1 second.

Deliverables & Contracts

The contexts deliver these capabilities:

  • NetworkSessionContext is a subclass of PeerSessionContext, and its behavior does not change.
  • DiskSessionContext is a subclass of PeerSessionContext, with max_backoff_interval equal to 1.
  • Both subclasses start at stage initializing and update their state in the same way.
Acceptance Criteria
  • issubclass(NetworkSessionContext, PeerSessionContext) is true.
  • DiskSessionContext(connection).stage equals transfer_stages.INITIALIZING.
  • The update_state tests for NetworkSessionContext also pass for DiskSessionContext.
  • The characterization suite passes without edits.
  • The full test suite passes.

Technical Pointers & Architecture

  • Target Components / Context: morango/sync/context.py, NetworkSessionContext at :311-351.
  • Related Patterns: NetworkSessionContextTestCase at tests/testapp/tests/sync/test_context.py:252.
  • Data Model & Schema Considerations: None.
  • Resilience & Failure Modes: None.

Notes & Tradeoffs

  • Dependencies: Blocked by: #370 (Connection interface). Blocks: #374, #383.
  • Testing Requirements: This is a refactor task. The characterization suite from #363 and #364 must pass without edits.
  • Tradeoffs & Alternatives Considered: One context class for all peers makes connection-specific operations impossible. The subclasses keep that option.
  • Compatibility & Migrations: NetworkSessionContext keeps its name, so code that checks for it still works.

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.

Lenguaje dominante
Python
Estrellas
15
Forks
27
Merge medio
6 d 44 min
PR fusionados (30 d)
13

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de learningequality/morango

Todos los issues de learningequality/morango

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.