docs(adr): decide how ivi-cli reads SCPI text - #192
Open
ShortArrow wants to merge 1 commit into
Open
Conversation
Three surfaces had grown three unrelated rules for reading SCPI, and a request to assert numerically on a reading could not be answered without settling all of them; recording the script format's reserved-word and comment defects here is what makes the 0.4.0 break worth taking.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three places in this repository read SCPI text, and each had grown its own rule without reference to the others:
NormalizeForMatchstrips a leading:and nothing elseassertvisa lint, completionThe trigger was a request to assert numerically on a reading (
25.3,72.1from a temperature/humidity probe). That could not be answered on its own — whether;separates anything, whetherMEASandMEASureare the same command, and which surface speaks which language turned out to be one decision.What the standard actually requires
Verified against the specification rather than from habit, because two of the decisions rest on it: headers are case-insensitive; a mnemonic has exactly two spellings and nothing between them is valid ("
:FREQuenis not an acceptable form");;leaves the command path where it was, so returning to the root needs;:; optional keywords in brackets apply implicitly.Two of those cannot be honoured generically — optional keywords and default suffixes are properties of one instrument's command tree, and ADR 0032 already declined to carry vendor dictionaries. A third is one-directional: a long-form rule yields its short form mechanically, a short-form rule does not yield its long form.
Decisions
matchin every scenario here is short form and upper case, so this changes no existing behaviour while making the mock accept requests it refused and an instrument would have answered. Short/long equivalence is refused rather than deferred, with the reason recorded:ScpiVocabularyhas root-node pairs, so a partial version is available and tempting — it would acceptMEASure:VOLT?and refuseMEAS:VOLTage?, which looks like conformance and is full of holes.;is not expanded. A compound request matches only as the whole string.;then,; block data stays opaque. The asymmetry with (2) is deliberate — a response carries no path.!values: slots of literal /*/{predicate}, ranges rather than float equality, optional slot names because the failure message is what heterogeneity actually breaks.6. The script format break
Investigating where to put the new directive turned up two defects in the existing format, neither documented:
sleep/assert/echo, otherwise it is SCPI, and there is no escape — an instrument with a vendor extension spelledECHO ONcannot be driven from a script at all.#cannot mark a comment inside a SCPI line. IEEE 488.2 gives#four meanings:#8<len>and#0for block data, and#H/#Q/#Bfor hex/octal/binary.SOUR:VOLT #HFFsets 255. The parser strips from the first#unconditionally, so that line and every block transfer are silently truncated — and the code comment above the strip describes a conditional behaviour the implementation does not have.So the format becomes one rule: a line starting with
!is ivi-cli's; everything else goes to the instrument verbatim. Comments are!#.!is available precisely because a SCPI message begins with a letter,*or:. Trailing comments are dropped rather than rescued — any rule that finds a comment inside a SCPI line must enumerate the meanings of#, and the next edition is free to add a fifth.Migration follows the shape this repository already used twice (
diagnose→doctor, nestedmock scenario scene): 0.3.x accepts both and warns, 0.4.0 removes the unprefixed form, landing alongside the mock-spelling removal users are already told to expect. No.scpifile exists here, so the warning is for scripts written elsewhere.Documentation only; no code changes. Implementation follows in separate PRs.