Skip to content

feat: restore v1 CSV configurations behind content detection - #132

Merged
gavinying merged 2 commits into
v2from
csv-config-compat
Nov 12, 2026
Merged

gavinying merged 2 commits into
v2from
csv-config-compat

Conversation

@gavinying

Copy link
Copy Markdown
Collaborator

Summary

  • --config accepts v1 CSV and WoT TM/TD JSON side by side; the format is detected from the content (first non-whitespace byte {/[ selects JSON), not the filename or URL suffix. Existing v1 commands keep working unchanged, and existing v2 commands passing TM/TD to --config are unaffected.
  • New --thing-model/--tm and --thing-description/--td flags assert the JSON document kind explicitly; a kind mismatch, CSV content under these flags, or duplicate device names is a one-line configuration error with exit code 2.
  • The restored CSV loader keeps v1 row semantics (device/poll/ref rows, space-to-underscore point names, blank access defaulting to r, multiplicative scale, eight-bit bit-table groups) and feeds the same Device/Poller/Point engine as the WoT path. --unit-id overrides the device-row ID; --param remains TM-only.
  • Float rendering stays with the unified default auto precision mode.

This reverses the earlier "CSV runtime support is intentionally removed" boundary (maintainer decision 2026-11-12); docs (configure, csv-migration, v1-compatibility, usage, README, validation record) are updated accordingly. Tracked as POLL-05 in the modiohub master plan.

Verification

  • make check passes (lock, pre-commit, deptry).
  • pytest tests -m "not integration": 210 passed, 58 deselected, including new CSV loader, content-detection, kind-assertion and CLI exit-code tests.
  • End-to-end against a local modsim 2.0.0a8: modpoll --once --config examples/modsim.csv and --config examples/modsim.tm.json both exit 0 and export byte-identical snapshots of all 37 points; poller structures match exactly.

--config accepts v1 CSV and WoT TM/TD JSON side by side; the format is
detected from the content, not the filename. New --thing-model/--tm and
--thing-description/--td flags assert the JSON document kind explicitly.
The CSV loader keeps v1 row semantics (device/poll/ref rows, space-to-
underscore point names, blank access defaulting to r, multiplicative
scale, eight-bit bit-table groups) and feeds the same Device/Poller/Point
engine as the WoT path. Usage mistakes (kind mismatch, --param with CSV,
duplicate device names) exit 2 with one error line. --precision stays in
the default auto rendering mode.
# Conflicts:
#	README.md
#	modpoll/arg_parser.py
#	modpoll/modbus_task.py
@gavinying
gavinying merged commit 3dab2b1 into v2 Nov 12, 2026
6 checks passed
@gavinying
gavinying deleted the csv-config-compat branch November 12, 2026 14:51
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