Skip to content

test(golden): add WHO=2 automation fixtures and privacy validation suite (#304) - #46

Open
GreenGrassBlueOcean wants to merge 1 commit into
OpenWebNet-HA:masterfrom
GreenGrassBlueOcean:test/golden-samples-who02-automation-issue-304
Open

GreenGrassBlueOcean wants to merge 1 commit into
OpenWebNet-HA:masterfrom
GreenGrassBlueOcean:test/golden-samples-who02-automation-issue-304

Conversation

@GreenGrassBlueOcean

Copy link
Copy Markdown
Contributor

Summary

Follows up on real-world testing from @marcob79 in OpenWebNet-HA/MyHOME#304 on a dual-MH201 setup controlling WHO=2 covers/automation.

This PR adds authentic on-wire golden sample test vectors for WHO=2 automation to OWNd's Golden Corpus and establishes an automated Privacy-First test suite, mirroring the privacy standard in MyHOME.

Changes

1. WHO=2 Automation Golden Fixtures (tests/golden/frames/who02_automation.yaml)

Added 8 new test vectors covering:

  • Leading-zero single-digit address (01):
    • *#2*01## (status request)
    • *2*1*01## (shutter UP)
    • *2*2*01## (shutter DOWN)
    • *2*0*01## (shutter STOP)
  • Two-digit address (11):
    • *#2*11## (status request)
    • *2*1*11## (shutter UP)
    • *2*2*11## (shutter DOWN)
    • *2*0*11## (shutter STOP)
  • Each fixture is validated against official Legrand specifications via openwebnet-mcp, verifies bidirectional roundtrip (OWNMessage.parse), and asserts exact builder parity (OWNAutomationCommand).

2. Runtime Corpus Synchronization (tests/golden/corpus.json)

  • Synchronized via tools/golden/validate_corpus.py (total corpus expanded from 74 to 82 valid fixtures).

3. Privacy-First Validation (tests/test_golden_privacy.py & tools/golden/validate_corpus.py)

  • Zero Household Leaks: Enforces that no private IPv4 addresses (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) can ever be committed to the golden corpus or test fixtures.
  • Synthetic MAC Enforcement: Verifies all MAC addresses in the golden test corpus use synthetic prefixes (00:03:50:00:).
  • Filesystem Privacy: Asserts no local user paths (/home/, C:\Users\) leak into test definitions.
  • Integrated directly into tools/golden/validate_corpus.py so any privacy violation immediately halts validation.

4. Manifest Provenance (tests/golden/SOURCE.yaml)

…ite (#304)

- Add WHO=2 cover status and command fixtures for leading-zero ('01') and two-digit ('11') addresses from physical plant capture in OpenWebNet-HA/MyHOME#304
- Synchronize tests/golden/corpus.json via validate_corpus.py (82 total fixtures)
- Update tests/golden/SOURCE.yaml with privacy-safe community capture provenance
- Add privacy first validation in tools/golden/validate_corpus.py ensuring no LAN IPs or sensitive data leak
- Add tests/test_golden_privacy.py asserting zero private LAN IPs, non-synthetic MACs, or user paths in test tree
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@fedem95 fedem95 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Address 11 is fine: up, down, stop and status all appear in marcob79's log. Address 01 does not. His trace only contains *#2*01## and *2*0*01##*2*1*01## and *2*2*01## are nowhere in it. They are correct frames, but they were inferred, and they carry source: community-plant-capture while SOURCE.yaml promises "authentic on-wire bus frames ... captured from live physical hardware".

Either relabel those two (the 93-address equivalents already live under public-readme), or ask @marcob79 to run that shutter once and capture them. His log also has *#2*02## and *2*0*02## if you want more real leading-zero coverage.

Everything else checks out: all 8 frames parse and round-trip, builder parity holds (raise_shutter("01")*2*1*01##), no duplicates with the existing corpus, full suite green locally (658 passed) and CI is 8/8.

Three small things in the privacy suite:

  • IPV4 is compiled but never used in test_golden_privacy.py.
  • the MAC check covers the frame files and corpus.json but not SOURCE.yaml, which is where a real MAC would most plausibly end up.
  • stray blank line at the end of who02_automation.yaml.

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.

3 participants