bug(nodes): duplicate ObservedNode rows from a non-atomic get-then-create
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 30/100
Hướng nghiên cứu
Start by reading packets/services/base.py and packets/receivers.py, where the issue identifies the non-atomic get-then-create. Then inspect the models and migrations to map the Meshtastic node number, unique constraint, and foreign keys that the dedupe must preserve; review the 2.2.0 migration for its fail-closed and dry-run approach. Done means preventing concurrent duplicates, safely merging existing rows before adding the partial unique index, and naming the node in the remaining error response.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem
Some Meshtastic node numbers have two or more ObservedNode rows. In pre-prod there are 38 duplicate pairs, and the prod identity backfill on 2026-11-04 reported 8 duplicate rows.
Cause (confirmed by a verifier): the node is created with a non-atomic get-then-create in packets/services/base.py and packets/receivers.py. Two packets from a new node, ingested within milliseconds of each other (0–8 ms apart in the pre-prod pairs), both miss the get and both create a row.
Effects:
- Packet uploads that then look the node up hit
MultipleObjectsReturnedand return 500. The pre-prod bot log had 6 of these on 2026-11-04, and the 400 they produce doesn't name the node. - Ghost rows keep a synthesised
Unknown Node !xxxxxxxxname while the real row has the node's name, so search and the UI can show two nodes. - NodeDB upserts touch
.first(), so it's unpredictable which row they update.
Expected
- Prevent it: make the create atomic, with
get_or_createbacked by a unique constraint and a retry onIntegrityError. - Constraint: add a unique (partial) index on the Meshtastic node number, for example
meshtastic_node_idwhere the protocol is Meshtastic. - Clean up existing rows: a data migration or management command that merges each duplicate set into one row: the one with the most history, or the oldest. It re-points every FK (packets, observations, positions, telemetry, claims, watches, and so on), keeps the best name, and deletes the extras. It needs a
--dry-run, and should run before the unique index is added. - Error message: the remaining 500/400 should name the node.
Notes
- This predates the Meshtastic 2.8 work. The rows date from before 2026-11.
- The dedupe has to run in prod, so it needs the same care as the 2.2.0 migration: fail closed, dry-run first.
- Related: #436 (ingest correctness review), #437 (2.8: identity linking will need one row per node number).
- Ngôn ngữ chính
- Python
- Star
- 1
- Fork
- 0
- Merge trung bình
- 23 giờ 9 phút
- Pull request đã merge (30 ngày)
- 15
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của pskillen/meshflow-api
-
enhancement meshtastic-2.8
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
pskillen/meshflow-api#459 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 55/100
pskillen/meshflow-api#479 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
pskillen/meshflow-api#478 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 73/100
pskillen/meshflow-api#472 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement meshtastic-2.8
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 22/100
pskillen/meshflow-api#464 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của pskillen/meshflow-api
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
FinanceFlash/unvibecode#509 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
FAIRmat-NFDI/nomad-distro-dev#161 ·
-
bug v2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
modelcontextprotocol/python-sdk#3821 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug severity:low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Log-odds calibration uses upper middle score instead of median for even candidate setsCó thể đã có người làm @flysheep-ai đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày