Skip to content

fix(rufield-viewer): correct ApiFieldPayload wire schema for live mode - #1

Open
fallen-pc wants to merge 1 commit into
ruvnet:mainfrom
fallen-pc:fix/api-field-payload-schema-mismatch
Open

fix(rufield-viewer): correct ApiFieldPayload wire schema for live mode#1
fallen-pc wants to merge 1 commit into
ruvnet:mainfrom
fallen-pc:fix/api-field-payload-schema-mismatch

Conversation

@fallen-pc

Copy link
Copy Markdown

Summary

rufield-viewer --source live --upstream <url> never actually worked against a real RuView (wifi-densepose-sensing-server) upstream — the dashboard showed DISCONNECTED forever, even though every HTTP request to /api/field was succeeding at the network level.

Root cause: ApiFieldPayload (in crates/rufield-viewer/src/live.rs) doesn't match RuView's actual /api/field response shape (rufield_surface::api_field in wifi-densepose-sensing-server):

  • dev_signing_key is a JSON bool on RuView's wire ("dev_signing_key": s.using_dev_key()), but this crate declared it Option<String>. A type mismatch on decode fails the whole payload — serde_json::from_str errors before ever touching events — so the ring's events were never parsed, on every single poll. This was the fatal one.
  • signer_pubkey doesn't exist on the wire; RuView sends signer_pubkey_hex. This one was silently absorbed by #[serde(default)] (it's an informational field, never read downstream after decode), so it only caused quiet data loss, not a decode failure — but worth fixing alongside the fatal one since we're already here.

Change

  • dev_signing_key: Option<String>Option<bool>
  • signer_pubkey: Option<String>#[serde(rename = "signer_pubkey_hex")] signer_pubkey: Option<String>
  • Updated the one existing test (api_payload_deserializes_verifies_and_renders) that had encoded the old, wrong shape — it now doubles as the regression test for this exact bug.

Test plan

  • cargo test -p rufield-viewer — 26/26 passing (no regressions)
  • Live-verified against a real RuView instance: ran wifi-densepose-sensing-server --source simulated with a real WDP_RUFIELD_SIGNING_SEED (ed25519-signed, non-dev key), pointed this crate's rufield-viewer at it.
    • Before the fix: every poll failed with invalid type: boolean false, expected a string at line 1 column 24; /api/source reported DISCONNECTED indefinitely.
    • After the fix: /api/source reports LIVE, and /events streams real events with "verified":true,"fusable":true" — RuCelium's own independent receipt verification passing against RuView's live signed output.

live-mode `/api/field` polling never actually worked against a real
RuView `wifi-densepose-sensing-server` upstream - the banner stayed
DISCONNECTED forever even when every HTTP request was succeeding.

Root cause: ApiFieldPayload didn't match RuView's real response shape
(rufield_surface::api_field in wifi-densepose-sensing-server):

- dev_signing_key is a JSON bool in RuView's response; this crate
  declared it Option<String>. A type mismatch on decode fails the
  WHOLE payload (serde_json::from_str errors out before touching
  `events`), so the ring's events were never parsed at all - this was
  the fatal one.
- signer_pubkey doesn't exist on the wire; RuView sends
  signer_pubkey_hex. This one was silently absorbed by
  #[serde(default)] (informational field, never read downstream), so
  it only caused quiet data loss, not a decode failure.

Confirmed via a live test against a running RuView instance (real
ed25519-signed events, real WDP_RUFIELD_SIGNING_SEED): before this fix,
GET /api/field decode failed on every poll with "invalid type: boolean
`false`, expected a string at line 1 column 24"; after, events decode,
verify (`is_fusable`), and fuse correctly, and the dashboard shows
LIVE instead of DISCONNECTED.

Updated the one existing test that had encoded the old (wrong) shape
so it now doubles as the regression test.
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.

1 participant