fix(rufield-viewer): correct ApiFieldPayload wire schema for live mode - #1
Open
fallen-pc wants to merge 1 commit into
Open
fix(rufield-viewer): correct ApiFieldPayload wire schema for live mode#1fallen-pc wants to merge 1 commit into
fallen-pc wants to merge 1 commit into
Conversation
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.
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
rufield-viewer --source live --upstream <url>never actually worked against a real RuView (wifi-densepose-sensing-server) upstream — the dashboard showedDISCONNECTEDforever, even though every HTTP request to/api/fieldwas succeeding at the network level.Root cause:
ApiFieldPayload(incrates/rufield-viewer/src/live.rs) doesn't match RuView's actual/api/fieldresponse shape (rufield_surface::api_fieldinwifi-densepose-sensing-server):dev_signing_keyis a JSON bool on RuView's wire ("dev_signing_key": s.using_dev_key()), but this crate declared itOption<String>. A type mismatch on decode fails the whole payload —serde_json::from_strerrors before ever touchingevents— so the ring's events were never parsed, on every single poll. This was the fatal one.signer_pubkeydoesn't exist on the wire; RuView sendssigner_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>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)wifi-densepose-sensing-server --source simulatedwith a realWDP_RUFIELD_SIGNING_SEED(ed25519-signed, non-dev key), pointed this crate'srufield-viewerat it.invalid type: booleanfalse, expected a string at line 1 column 24;/api/sourcereportedDISCONNECTEDindefinitely./api/sourcereportsLIVE, and/eventsstreams real events with"verified":true,"fusable":true"— RuCelium's own independent receipt verification passing against RuView's live signed output.