Give each archive its own morango instance identity
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 45/100
Rechercherichtung
Start with the Archive and ArchiveDatabase entry points in morango/sync/archive.py, then compare InstanceIDModel.get_current_instance_and_increment_counter in morango/models/core.py:191. Review tests/testapp/tests/sync/test_archive.py and the Default-DB guard; done means the archive rows and counters satisfy the acceptance criteria without querying the default database. This work is blocked by #378.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Overview
An archive gets its own DatabaseIDModel and InstanceIDModel rows, separate from the host instance. This issue is part of milestone M5 (archive).
Background & Motivation
Morango tracks sync state by instance ID. Counters, record max counters, and last_saved_instance all use it. An archive represents a standalone morango instance that received a push, so it needs an identity of its own.
The dequeue step on the archive increments the counter of the current instance. That counter must belong to the archive, not to the host. The host method InstanceIDModel.get_or_create_current_instance reads the host environment and caches its result, so the archive cannot use it.
Design: spec. Plan: implementation plan, Task 19.
Description & Expected Outcomes
When an archive is created, the archive writes one DatabaseIDModel row and one InstanceIDModel row into its own database. The instance row identifies the archive as morango-archive and records the final archive path. The instance ID is sha2_uuid(database_id, system_id, node_id), the same formula that the host instance uses. InstanceIDModel has no calculate_uuid().
Both rows are written with a bulk insert through the archive handle, never with save() or objects.create(). DatabaseIDModel.save sets current=False on every DatabaseIDModel row of the host database, even when the save targets the archive (#362).
The archive database handle knows its own current instance. When code asks the archive handle for the current instance and a counter increment, the handle increments the archive row only. The host instance does not change.
Deliverables & Contracts
The feature delivers these capabilities:
Archive.write_identity()creates the archive instance and returns it.ArchiveDatabase.current_instance_and_increment_counter()increments and returns the archive instance row.- Neither method sends a query to the default database.
Acceptance Criteria
- After
write_identity, the archive alias holds exactly oneDatabaseIDModelrow and oneInstanceIDModelrow. - The archive instance has
platform == "morango-archive"andid == sha2_uuid(database_id, "", ""). - The host current instance is unchanged after
write_identity. - The host current
DatabaseIDModelstill hascurrent=Trueafterwrite_identity. - Two calls to
current_instance_and_increment_counter()return counter values 1 and 2. - All tests pass inside
assert_no_default_db_queries().
Technical Pointers & Architecture
- Target Components / Context:
morango/sync/archive.py(Archive,ArchiveDatabase). - Related Patterns:
InstanceIDModel.get_current_instance_and_increment_counter(morango/models/core.py:191) is the host equivalent. - Data Model & Schema Considerations: No schema change. The rows use the existing morango models in the archive alias.
- Resilience & Failure Modes: If a write fails, the error propagates to
Archive.createorDiskSyncConnection.create_sync_session, which discard the archive.
Notes & Tradeoffs
- Dependencies: Blocked by: #378 (
Archive.create,discard, andArchiveDatabase). Blocks: #383. - Testing Requirements: Unit tests in
tests/testapp/tests/sync/test_archive.pyunder the Default-DB guard. - Tradeoffs & Alternatives Considered: The spec rejects an optional
current_instanceargument on_dequeue_into_store. ANonevalue there acts as a hidden flag. The database handle selects the instance through polymorphism instead. - Compatibility & Migrations: Phase 4 (incremental update) must derive a new archive instance on each update. Two copies of one file otherwise share an instance ID.
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.
- 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
-
[request] gRpc/1.86.0Offenupstream update
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
conan-io/conan-center-index#31597 ·
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