You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(emulator): add configurable lock option for RTU transport (#263)
Add optional `lock` configuration to RTU transport, allowing users to control serial port locking behavior. Defaults to true (exclusive locking enabled) for production security, can be disabled for testing with virtual serial ports.
**Core Implementation:**
- Add lock?: boolean to RtuTransportConfig, EmulatorConfig, and ConfigFile interfaces
- Pass lock option to ServerSerial third parameter with secure default (lock ?? true)
- Wire lock option through full stack: CLI → Config → Emulator → RTU Transport
**CLI & UX:**
- Add --no-lock flag following standard Commander.js pattern
- Consistent with other boolean flags (--verbose, --quiet)
- Support configuration via CLI args, config files, and programmatic API
**Documentation:**
- Add comprehensive documentation to README.md with troubleshooting
- Update virtual-serial-test.md with lock: false examples and "Cannot lock port" troubleshooting
- Enhance config file examples (basic-rtu.yaml, multi-device.yaml) with clear guidance
**Testing:**
- Unit tests: default behavior, explicit true, explicit false, combination with all serial parameters
- Integration tests: full stack passthrough verification (lock: false, lock: true, default)
- Mock consistency: aligned across unit and integration test files
- 1543 tests passing, 95%+ coverage maintained
**Security:**
- Secure by default: lock: true prevents multi-process port conflicts
- Hardware protection: exclusive locking prevents communication corruption
- Explicit opt-out required: users must consciously disable for testing
- Clear documentation distinguishes production vs. testing usage
Closes#251Closes#264Closes#265
0 commit comments