Skip to content

Add --metadata mode to InteropTest sample for metadata date/time and compression interop#31

Merged
ritchiecarroll merged 2 commits into
developmentfrom
claude/interop-metadata-mode
Jul 15, 2026
Merged

Add --metadata mode to InteropTest sample for metadata date/time and compression interop#31
ritchiecarroll merged 2 commits into
developmentfrom
claude/interop-metadata-mode

Conversation

@ritchiecarroll

@ritchiecarroll ritchiecarroll commented Jul 15, 2026

Copy link
Copy Markdown
Member

Summary

Adds a --metadata mode to the InteropTest-gsf sample so it can act as the C# subscriber side of a cross-language harness that verifies the STTP Python publisher's metadata interop — both XML xs:dateTime serialization and the GZip compression handshake — against the .NET DataSet parser.

Companion to sttp/pyapi#10 (the Python-side fixes + orchestrator).

What changed

src/samples/InteropTest-gsf/Program.cs (existing measurement-export behavior is unchanged when the flag is absent):

  • New InteropTest HOSTNAME PORT --metadata [--gzip] mode. On connect it calls RefreshMetadata(), then:
    • on MetaDataReceived — writes metadata-received.xml, prints every DateTime column value, and exits 0;
    • on ProcessException (a malformed xs:dateTime, or an unexpectedly gzip-compressed payload, makes DataSet.ReadXml throw) — exits non-zero;
    • on a 15 s timeout — exits non-zero.
  • --gzip advertises CompressionModes.GZip (compressed-metadata path). Without it, the .NET-default operational modes are used (CompressMetadata without GZip → uncompressed path) — the path a correctly-behaving publisher must serve uncompressed.

How it was verified

Driven by the harness in sttp/pyapi (test/interop/run_metadata_interop.py) against a live Python publisher, in both compression negotiations:

  • fixed publisher → C# parses DeviceDetail.UpdatedOn = 2033-03-03T03:33:33.123 and exits 0 (uncompressed and GZip);
  • reverted date fix → '2033-03-03T03:33:33.123+00:Z' is not a valid AllXsd value;
  • reverted compression fix (plain negotiation) → hexadecimal value 0x1F, is an invalid character.

Reviewer notes

🤖 Generated with Claude Code

ritchiecarroll and others added 2 commits July 15, 2026 14:43
Adds an "InteropTest HOSTNAME PORT --metadata" mode to the InteropTest-gsf sample
so it can serve as the C# subscriber side of a cross-language harness that verifies
the STTP Python publisher's xs:dateTime metadata serialization interoperates with
the .NET DataSet parser. Existing measurement-export behavior is unchanged when the
flag is absent.

On connect the mode calls RefreshMetadata(), then on MetaDataReceived writes
metadata-received.xml, prints every DateTime column value, and exits 0; on a
ProcessException (a malformed xs:dateTime makes DataSet.ReadXml throw) or a 15s
timeout it exits non-zero.

It requests CompressionModes.GZip so the metadata handshake stays consistent with
the Python publisher, which GZip-compresses metadata whenever the CompressMetadata
operational mode is set.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replace the always-on CompressionModes.GZip request with an optional --gzip flag.
Without it the subscriber uses the .NET-default operational modes (CompressMetadata
without GZip), exercising the uncompressed metadata path; with --gzip the compressed
path is exercised. This lets the interop harness verify a publisher that correctly
compresses metadata only when GZip is negotiated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@ritchiecarroll ritchiecarroll changed the title Add --metadata mode to InteropTest sample for date/time metadata interop Add --metadata mode to InteropTest sample for metadata date/time and compression interop Jul 15, 2026
@ritchiecarroll
ritchiecarroll merged commit ff5cd5e into development Jul 15, 2026
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