Skip to content

fix(packets): preserve captured endpoint names in history - #128

Open
n30nex wants to merge 2 commits into
MeshCore-Beacon:devfrom
n30nex:codex/beacon-historical-names
Open

fix(packets): preserve captured endpoint names in history#128
n30nex wants to merge 2 commits into
MeshCore-Beacon:devfrom
n30nex:codex/beacon-historical-names

Conversation

@n30nex

@n30nex n30nex commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

What this PR does

Closes #127. Packet endpoint names are shown live but disappear from list rows after reload or reconnect. In a dev-feed comparison, all ten matched observations had named live endpoints and none had names on their REST list row.

Store the already-computed endpoint resolution in the existing observation INSERT, then return it through list, reconnect-backfill and detail reads. The snapshot belongs to the observation, preserves names/node references/confidence, and survives later registry changes. Duplicate delivery keeps the original snapshot. Existing filtering, pagination, latest-observer selection and endpoint-matching rules remain unchanged; intermediate hop resolution is unchanged too.

Migration 026 adds a nullable JSONB column without a default or backfill. Older rows keep their current list behavior and detail-time lookup fallback. New empty snapshots retain an absent/unresolved result instead of inventing a later historical name. The detail mapper also handles the packet-before-observation window and a nullable legacy broker field safely.

Type of change

  • Bug fix
  • Tests
  • Docs / config

Checklist

  • go build ./... passes
  • gofmt -l . is empty
  • go vet ./... passes
  • go test ./... passes
  • Migration SQL added; sqlc v1.31.1 and existing MockGen v0.6.0 output regenerated
  • Swagger regenerated with v1.16.6 after updating API documentation
  • No new public response fields or dependencies
  • I have read CONTRIBUTING.md

Testing notes

Five native Pi PostgreSQL runs pass. Temporary fixtures cover global/regional lists, reconnect rows, each observation's snapshot, Unicode names, ambiguous/unknown endpoints, renamed/deleted nodes, legacy/empty data and duplicate delivery. A 50-row history page still makes one database call; captured detail without intermediate hops uses only the packet and observation queries. Capture uses one existing INSERT, with no follow-up UPDATE. Optional enrichment encoding failure does not discard the observation.

The original read regression fails before the change. Full Go checks pass locally and natively, and Windows race checks pass for ingest and DB packages. A separate test database validates migrations without changing the live feed during candidate testing.

The combined preview runs 7f6616eecf3968ff8bb7f5b879b46b5b7f70f8c7, with its exact source offer verified. Startup applied migration 026 without changing the observation table's relation file or populating any pre-migration snapshot. All ten matched named WebSocket observations now have identical endpoints in REST history (10 mismatches before, zero after). One sample whose latest observer changed was excluded from the comparison. Browser scrollback shows the saved names. Ordinary API/burst smoke and fresh dev MQTT ingestion pass.

The initial live sample recorded 237 snapshots, averaging 301.8 bytes per JSONB value with a 1,489-byte maximum. This is a small-feed storage sample, not a bound or production-wide performance claim. The existing frontend already consumes the endpoint fields and was not rebuilt.

This records existing resolver output. The separate use of a repeater-only path resolver for short endpoint hashes needs a focused companion-matching follow-up. Prefix confidence is a candidate match, not authenticated proof of sender identity. Existing rows are not retroactively reconstructed.

AI tools assisted implementation and validation under the contributor's standing approval for this effort.

The endpoint test fixture also exposes the dedicated-resolver entry point used by the companion-matching follow-up, so the two changes remain compatible when combined. This is a test-only addition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Preserve packet endpoint names in historical lists and reconnect backfill

1 participant