Skip to content

fix(observers): preserve advert pages with missing origin keys - #138

Open
n30nex wants to merge 2 commits into
MeshCore-Beacon:devfrom
n30nex:codex/beacon-observer-advert-null
Open

n30nex wants to merge 2 commits into
MeshCore-Beacon:devfrom
n30nex:codex/beacon-observer-advert-null

Conversation

@n30nex

@n30nex n30nex commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

What this PR does

Closes #106. A NULL packets.origin_pubkey makes ListObserverAdverts fail when sqlc scans the encoded value into a Go string, so one incomplete advert breaks the entire page.

Return explicitly typed, non-null text for that field. Unknown-origin adverts remain in the page with an empty nodePublicKey; known keys and ID-based pagination are preserved. The query and sqlc output are regenerated together. No schema or API type changes.

Type of change

  • Bug fix
  • Tests

Checklist

  • go build ./... passes
  • gofmt -l . is empty
  • go vet ./... passes
  • go test ./... passes
  • SQL changes regenerated with sqlc 1.31.1
  • I have read CONTRIBUTING.md

No new dependency or Swagger contract change.

Testing notes

The real HTTP/Store/PostgreSQL regression reproduces the reported cannot scan NULL into *string and HTTP 500 before the fix. It now returns both missing-origin and known-origin adverts and continues correctly through the numeric cursor. Fixtures use temporary tables and roll back.

Built and ran the full suite natively on the Pi 5 with PostgreSQL enabled, based on merged dev at e15f873. The merged migration-recovery PostgreSQL test also ran without skipping. The broader preview upgrade is validated separately from this one-query bug fix.

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

The Pi preview now serves b3682b8 with current web e43de48f. An actual missing-origin advert loaded successfully, both feeds are advancing, and the paired activity/telemetry APIs and charts pass. Merged migrations were tested on a private 27,086-observation preview copy; those timings do not represent analyzer production scale.

@n30nex

n30nex commented Sep 13, 2026

Copy link
Copy Markdown
Contributor Author

@MrAlders0n please review this change with your Claude agent as part of the September 13 Beacon review batch. The current candidate is b3682b8e5551; validation and Pi evidence are in the PR description.

Please check NULL-origin advert rows, known-key preservation and cursor behavior. This PR is linked to issue #106 for closure on merge.

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.

ListObserverAdverts 500s when origin_pubkey is NULL

1 participant