Receiver helpers work against a chosen database
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 52/100
Rechercherichtung
Start with morango/sync/utils.py:72 and morango/models/core.py at update_fsics and calculate_filter_specific_instance_counters, then review the SyncDatabase pattern from #365. Run the characterization suites from #363 and #364 while checking the queries identified at core.py:690-705, 735, and 775. Done means the listed helpers honor an optional handle, pinned default2 tests avoid default, and existing callers and validation errors retain their behavior.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Overview
This task (milestone M2) lets the public receiver helpers run against a database that the caller names. The helpers are buffer validation and the two counter (FSIC) functions.
Background & Motivation
The archive receives records the same way that a network server does. It validates incoming buffers, computes its counters, and updates its counters after dequeue. These helpers are public, and hosts call some of them. Thus each helper needs an optional database parameter. If a caller gives no database, the helper keeps the current behavior.
Design: spec. Plan: implementation plan, Task 6.
Description & Expected Outcomes
Each helper takes db=None. If the caller gives no handle, the helper uses the routed default handle, so existing callers see no change. If the caller gives a handle, all queries and writes in the helper go to that database.
The dequeue function from #366 passes its handle to the counter update.
Deliverables & Contracts
The task delivers an optional db parameter on these helpers:
validate_and_create_buffer_data.DatabaseMaxCounter.update_fsics.DatabaseMaxCounter.calculate_filter_specific_instance_counters.
Acceptance Criteria
- With a handle pinned to
default2, buffer validation createsBufferandRecordMaxCounterBufferrows indefault2and updatesrecords_transferred. - With a handle pinned to
default2, the counter update writesDatabaseMaxCounterrows indefault2. - On an empty
default2, the counter calculation for a receiver in v2 format returns an empty result withsubandsuperkeys. - No test above makes a query to
default. The tests run withoverride_settings(DATABASE_ROUTERS=[]). - Callers that give no handle see today's behavior.
- The characterization suite passes without edits.
Technical Pointers & Architecture
- Target Components:
morango/sync/utils.py:72(validate_and_create_buffer_data; it readstransfer_session.sync_session.profileat:97and callstransfer_session.save(...)at:147, and both must use the handle),morango/models/core.py:655(update_fsics),:727(calculate_filter_specific_instance_counters), and the queries at:690-705,:735, and:775. - Related Patterns:
SyncDatabasefrom #365. - Data Model & Schema Considerations: None.
- Resilience & Failure Modes: Validation errors keep their current types.
Notes & Tradeoffs
- Dependencies: Blocked by: #366 (Dequeue transferred records into a chosen database). Blocks: #384.
- Testing Requirements: The test app's
TestingRoutersends instance saves and foreign-key reads todefault, so tests with a pinned handle clear the routers (#362). This is a refactor. The characterization suite from #363 and #364 must pass without edits. - Tradeoffs & Alternatives Considered: Private functions take a required handle. Public helpers take an optional handle, so that host code keeps working.
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.
- Vorherrschende Sprache
- Python
- Sterne
- 15
- Forks
- 23
- Ø Merge
- 4 T. 1 Std.
- Gemergte PRs (30 T.)
- 7
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
-
DEV: dev-ops DEV: distributions DOCS: developer
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 78/100
learningequality/morango#387 ·
-
DEV: backend DEV: dev-ops TAG: unit tests
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
learningequality/morango#385 ·
-
DEV: backend P0 - critical TAG: tech update / debt TAG: unit tests
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
learningequality/morango#364 ·
-
dependencies DEV: dev-ops TAG: dependencies
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 25/100
learningequality/morango#399 ·
-
Scope filters should list read-write partitions lastEvtl. vergeben @bjester hat das vor 8 Tagen übernommen. OffenDEV: backend P0 - critical TAG: tech update / debt
learningequality/morango#398 · 1 zugewiesene Person ·
Alle Issues in learningequality/morango
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Graphify-Labs/graphify#4860 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
:bug: Bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
scikit-image/scikit-image#8377 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Ingredient import validation accepts negative nutrient values and NaNEvtl. vergeben @LukeSekai hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
wger-project/wger#2564 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
apache/ponymail-foal#351 ·
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 68/100
Maintainer antworten meist innerhalb von 4 Tagen