Skip to content

4.0 polish: docs, examples, property tests, stress tests, optimizer fix#696

Merged
gijzelaerr merged 1 commit intomasterfrom
feature/4.0-polish
Apr 16, 2026
Merged

4.0 polish: docs, examples, property tests, stress tests, optimizer fix#696
gijzelaerr merged 1 commit intomasterfrom
feature/4.0-polish

Conversation

@gijzelaerr
Copy link
Copy Markdown
Owner

Summary

Final polish for 4.0 readiness.

Documentation:

  • Logging doc page added to API Reference
  • CHANGES.md updated with all features from recent PRs
  • 3 new s7 examples (basic, symbols, server)

Bug fixes:

  • Optimizer now excludes counter/timer areas from byte-range merging (they use element-based addressing, not byte-based)
  • Fixed float precision loss in set_ltime, set_ltod, set_ldt (integer arithmetic instead of total_seconds() * 1e9)
  • SymbolTable accepts both snap7.Client and s7.Client

Property-based tests (Hypothesis):

  • 20 round-trip tests for all getter/setter pairs
  • Hypothesis found the float precision bug — it generated timedelta(seconds=128, microseconds=72) which lost 1 microsecond through float conversion

Multi-client stress tests:

  • 4 concurrent readers on different DBs
  • Concurrent writer + reader on same DB
  • Rapid connect/disconnect cycles (4 threads x 5 connections each)

Numbers: 1501 tests, 0 mypy errors, ruff clean, Sphinx clean.

Test plan

  • All checks pass locally
  • Wait for CI

🤖 Generated with Claude Code

Documentation:
- Add logging doc page (API/log.rst) to index
- Update CHANGES.md with all recent features (block transfer, array
  helpers, setters, cpu_info fix)
- Add s7 examples (s7_basic.py, s7_symbols.py, s7_server.py)

Optimizer fix:
- Exclude counter (0x1C) and timer (0x1D) areas from byte-range
  merging — they use element-based addressing

SymbolTable:
- Accept both snap7.Client and s7.Client (use Any type hint)

Property-based tests (Hypothesis):
- Round-trip tests for all 20 getter/setter pairs
- Found and fixed float precision bug in set_ltime/set_ltod/set_ldt
  (use integer arithmetic instead of float multiplication)

Multi-client stress tests:
- Concurrent reads from 4 clients
- Concurrent writer + reader on same DB
- Rapid connect/disconnect cycles

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@gijzelaerr gijzelaerr added this to the 4.0 milestone Apr 15, 2026
@gijzelaerr gijzelaerr merged commit 8a0ff08 into master Apr 16, 2026
39 checks passed
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