//! F34 — wire-byte trace of a captured `PublishResponse`. //! //! `tests/fixtures/publish-response-with-value.bin` is the verbatim //! S→C bytes the .NET probe (`MxAsbClient.Probe --subscribe`) saw on //! its first `Publish` poll against the local AVEVA install on //! 2026-05-06, captured via `examples/asb-relay.rs` middleman with //! `--via=net.tcp://127.0.0.1:8088/...`. The .NET probe extracted //! `preview:99` from this exchange — the value bytes //! `[63 00 00 00]` (= 99 in LE i32) are visible at file offset 0x110. //! //! Test goal: dump `decode_envelope` + `decode_publish_response` //! output so we can see exactly where our value-extraction diverges //! from .NET's (F34 hypotheses). //! //! Frame layout: 3-byte NMF SizedEnvelope header (`06 ae 02`, //! varint length = 302) + 302-byte SOAP envelope. #![allow( clippy::unwrap_used, clippy::expect_used, clippy::indexing_slicing, clippy::panic )] use mxaccess_asb::{decode_envelope, decode_publish_response}; use mxaccess_asb_nettcp::nbfx::DynamicDictionary; #[test] fn publish_response_capture_decoder_trace() { let raw = std::fs::read( std::path::Path::new(env!("CARGO_MANIFEST_DIR")) .join("tests/fixtures/publish-response-with-value.bin"), ) .expect("read fixture"); assert_eq!(raw.len(), 305, "frame length sanity check"); // Strip 3-byte NMF SizedEnvelope header. let envelope = &raw[3..]; assert_eq!(envelope.len(), 302); let mut dict = DynamicDictionary::new(); let decoded = decode_envelope(envelope, &mut dict).expect("decode_envelope succeeds"); eprintln!("=== body tokens ({} total) ===", decoded.body_tokens.len()); for (i, tok) in decoded.body_tokens.iter().enumerate() { eprintln!(" body[{i}]={tok:?}"); } let response = decode_publish_response(&decoded.body_tokens) .expect("decode_publish_response succeeds"); eprintln!("=== decoded PublishResponse ==="); eprintln!(" status_count: {}", response.status.len()); eprintln!(" values_count: {}", response.values.len()); eprintln!(" result_code: {:?}", response.result_code); eprintln!(" success: {:?}", response.success); // The .NET probe extracted 1 value with preview:99 from the same // wire bytes. If our decoder reports 0 values, the test fails and // the eprintln body-token dump above shows where the gap is. assert_eq!( response.values.len(), 1, ".NET sees 1 value (preview:99) from the same bytes; our decoder reads {}", response.values.len(), ); }