Skip to content

Add state_validity/unknown_state to MonitorPoint for state-machine strings - #24

Merged
mpound merged 2 commits into
mainfrom
feature/monitorpoint-state-validity
Aug 18, 2026
Merged

Add state_validity/unknown_state to MonitorPoint for state-machine strings#24
mpound merged 2 commits into
mainfrom
feature/monitorpoint-state-validity

Conversation

@mpound

@mpound mpound commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds state_validity (dict mapping state name → GOOD/WARNING/ERROR or a full Validity member name) and unknown_state (default "ERROR") constructor params to MonitorPoint, for string points whose values are named states in a sequence (e.g. receiver tuning: locking → WARNING, tuned → GOOD, failed → ERROR) rather than a flat set of valid/invalid strings.
  • When state_validity is set, _string_validity() delegates to the new _state_machine_validity(); when unset, behavior is unchanged (falls through to the existing err_low/err_high/warn_low/warn_high/valid_strings membership logic).
  • Coerces the looked-up value to str before the dict lookup, since a real smax_pull() result is a smax.smax_data_types.SmaxStr — a dataclass with default eq=True, which makes __hash__ = None and so isn't usable as a dict key directly even though it compares equal to a plain str.
  • First phase of the monitor-subsystem compute engine work (docs/monitorsystem_writer_design.md); feature/monitor-compute-engine is stacked on top and uses these schema fields.

Test plan

  • uv run pytest src/slama/monitor/test/test_monitorpoint.py -v — new TestStateValidity cases pass (listed GOOD/WARNING/ERROR states, unlisted-state default, custom unknown_state, full Validity member name acceptance, legacy-path regression, real SmaxStr hashability regression)
  • uv run ruff check src/slama/monitor/monitorpoint.py — clean

🤖 Generated with Claude Code

mpound and others added 2 commits August 17, 2026 13:24
…rings

Some string points represent a sequence (e.g. receiver tuning) where
intermediate values mean VALID_WARNING and terminal values mean
VALID_GOOD or VALID_ERROR. The legacy string path only offered
membership-based err/warn lists (yielding meaningless _LOW/_HIGH
variants) with an unlisted value silently falling through to
VALID_ERROR. state_validity gives an explicit state->validity map with
a configurable default (unknown_state) for unlisted states, while the
legacy path is preserved unchanged when state_validity is not set.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mpound
mpound merged commit 4d05699 into main Aug 18, 2026
6 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