Start and close sync sessions with a disk connection
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 35/100
- Issue-Typ
- Feature
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Bereich
- databases, distributed-systems
Rechercherichtung
Start with morango/sync/syncsession.py and morango/sync/controller.py:44, then review the Connection interface and the blocked issues #370, #373, and #380-#382. Use NetworkSyncConnection.push_signed_client_certificate_chain as the related pattern. Done means the listed lifecycle, certificate, archive cleanup, and session acceptance criteria pass without leaving partial or lock files.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Overview
Hosts can create a disk connection and start a sync session that writes to a new archive file. This issue is part of milestone M6 (disk connection).
Background & Motivation
MorangoProfileController.create_disk_connection is a stub today, and it is missing self. Infrastructure managers of large Kolibri instances need to export facility data to archive files and store them offline.
The Connection interface from #370 defines the session lifecycle for all connection types. DiskSyncConnection implements this lifecycle for an archive. The connection mints an archive certificate, so that the archive acts as a standalone instance with a clear scope.
Design: spec. Plan: implementation plan, Task 22.
User Story
As a Kolibri developer,
I want to open a disk connection to a file path and start a sync session,
So that infrastructure managers can export facility data to an archive for offline storage.
Description & Expected Outcomes
A host calls create_disk_connection(path) and gets a DiskSyncConnection. The connection refuses a path that already exists. Phase 1 supports export to new archives only.
When the host starts a sync session, the connection creates the archive, writes the archive identity, and mints an archive certificate. The archive certificate is a child of the client certificate, with the same scope and no private key. The archive stores the certificate chain, its own sync session, and a manifest. The local database stores a sync session with connection_kind="disk".
If a step fails during sync session creation, the connection discards the archive and raises the error. No partial file or lock remains.
When the host closes the sync session, the connection finalizes the archive only if every transfer session in it completed. Otherwise, the connection discards the archive. Resume is not available for disk connections in Phase 1.
Deliverables & Contracts
The feature delivers these capabilities:
MorangoProfileController.create_disk_connection(path, **kwargs)returns aDiskSyncConnection.DiskSyncConnectionimplements the lifecycle, identity and certificate members ofConnection, as spec §3.6 describes.create_sync_session(client_cert, peer_cert=None, chunk_size=None)creates the archive and both sync session records.close_sync_sessionfinalizes or discards the archive.close()discards an archive that is not finalized.resume_sync_sessionraisesMorangoResumeSyncError.get_remote_certificatesreturns an empty list.
Acceptance Criteria
-
create_disk_connection(path)returns aDiskSyncConnection. - A connection to an existing path raises
MorangoArchiveExists. -
create_sync_session(cert)creates an archiveSyncSessionwithis_server=Trueand the minted certificate asserver_certificate. -
create_sync_session(cert)creates a localSyncSessionwithconnection_kind="disk". - The minted certificate passes
check_certificate(), has no private key, and has the same scope as its parent. - The archive holds the chain plus the minted certificate and their
ScopeDefinition, and the manifest has nofilter. - The archive
SyncSessionis written to the archive alias, and no archive write reachesdefault. - A
peer_certthat is notNoneraisesValueError. - A client certificate without a private key raises
MorangoError, and no.partialor.lockfile remains. - If
ASYNC_OPERATIONSis not inCAPABILITIES,create_sync_sessionraisesMorangoError. -
resume_sync_sessionraisesMorangoResumeSyncError. - Two calls to
close()do not raise. -
close_sync_sessionwithout a completed transfer session discards the archive.
Technical Pointers & Architecture
- Target Components / Context:
morango/sync/syncsession.py(DiskSyncConnection),morango/sync/controller.py:44(create_disk_connection). - Related Patterns:
NetworkSyncConnection.push_signed_client_certificate_chain(morango/sync/syncsession.py:397-433) mints and signs a child certificate. - Data Model & Schema Considerations: Uses existing models and
ArchiveManifestEntryfrom #376. - Resilience & Failure Modes: Every failure in
create_sync_sessiondiscards the archive, then raises the original error.
Notes & Tradeoffs
- Dependencies: Blocked by: #370 (
Connectioninterface), #373 (session context hierarchy), #380 (archive identity), #381 (archive certificates), #382 (archive finalize). Blocks: #384. - Kolibri companion changes: See spec §3.9. Host routers must allow morango migrations on aliases that start with
morango_archive_, and must returnNonefromdb_for_read/db_for_writefor morango models. Kolibri's routers already do both (#362), so Kolibri needs no router change. Kolibri settings overrides must list thePeer*operations. - Tradeoffs & Alternatives Considered: The spec keeps the certificate minting inside the connection layer. It rejects a separate factory, which spreads disk details across modules.
- Compatibility & Migrations: Each export adds one public certificate to the local
Certificatetable. These certificates never go to other devices.
Metadata
- Complexity: High
- 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.
- Vorherrschende Sprache
- Python
- Sterne
- 15
- Forks
- 27
- Ø Merge
- 6 T. 44 Min.
- Gemergte PRs (30 T.)
- 13
Entwicklungsumgebung
- Enthält ein Dockerfile oder eine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus learningequality/morango
-
Document disk export and deprecations in the changelogEvtl. wieder frei @ArpitaSamanta10 hat das vor 14 Tagen übernommen, und es ist kein Pull Request offen. OffenDEV: dev-ops DEV: distributions DOCS: developer
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 78/100
learningequality/morango#387 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
DEV: backend DEV: dev-ops TAG: unit tests
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
learningequality/morango#385 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 54/100
learningequality/morango#425 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 1/100
learningequality/morango#424 ·
Maintainer antworten meist innerhalb von 1 Tag
-
DEV: backend P2 - normal
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
learningequality/morango#416 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in learningequality/morango
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Maintainer antworten meist innerhalb von 1 Tag
-
hermes hooks doctor smoke test never checks the hook exit code — a crashing hook (exit=1) renders ✓ "ran clean" and "All shell hooks look healthy"Evtl. vergeben @cestercian hat das heute übernommen. Offencomp/cli P2 type/bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
NousResearch/hermes-agent#162259 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug enhancement
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 90/100
AOSSIE-Org/PictoPy#1802 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 3 Tagen
-
community-request
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
NVIDIA-NeMo/Run#727 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bot-triaged module: higher order operators module: pickle module: pt2-dispatcher oncall: pt2 triaged
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
pytorch/pytorch#207247 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag