Repository navigation
feat(lint): check the references a run would resolve - #512
Merged
Merged
Conversation
…own steps fail probe lint probe lint now checks the references a run would resolve, without a device or a run. Recipe calls and use statements resolve the way --dry-run resolves them, with the recipes folder from the config. Every step is walked, nested steps included, for selectors that can never match and for <name> placeholders that no example column, recipe parameter, stored value or runtime value defines. A step or recipe call that resolves to nothing, and a selector that can never match, fail the command. A placeholder no value defines, and a use file that does not exist, are warnings. Environment variables are not checked. The recipe loading that --dry-run used moves into loadFileRecipes, so lint and dry-run share it.
…resolve from each file The step `go back to main menu` is read as the built-in `go back` plus a recipe call named `main menu`, so the test failed at run time. probe test --dry-run and probe lint both reported it. The step now inlines the three steps of the recipe it meant: go back, wait 1 seconds, see "Home". Five test files named tests/recipes/common.probe from the project root. A use path resolves relative to the file that contains it, so those paths now name the file from its own location. A follow-up will decide whether a phrase like this should be able to name a recipe.
The lexer writes every call word in lower case, and the runner matches a recipe name exactly. A recipe header with capital letters can therefore never be called, and the Robot converter wrote its keyword recipes in the Robot spelling (`Login As User`), so no converted call matched. The converter now writes keyword recipes in lower case, and a call to a keyword the file defines uses the same spelling, whatever case the body wrote. The checkout golden is regenerated. A new test checks that the converted example defines and calls its recipes in lower case. A follow-up will normalise recipe headers in the runner, so capitalised headers become callable.
go back takes no arguments, so the words after it on the same line are read as a separate step. Lint reported those words as an unknown step, which does not say why. A call on the line of a go back step now gets the reason in its message.
… diagram names the parser The grammar and the syntax page say that go back takes no arguments, and that words after it on the same line are a separate step. The grammar's production is unchanged; only its comment is new. The Studio page now says what the editor's lint marks (parse errors and empty tests), and that probe lint also checks references, selectors and placeholders. Its architecture diagram listed an internal/lint package that does not exist; the Go backend imports internal/parser. The generated ProbeScript dictionary is regenerated, because its source hash covers the grammar page.
Add an example of an error and of a warning from probe lint to the changelog entry, with the exit status for each.
…omposite bodies, and the report Adds tests for the checks that had none: an ordinal selector without a position or text, an id selector without a name, an empty in container, a placeholder defined by read with ai, unknown steps in hook bodies and in composite device blocks, the count and zero-state checks, the order of errors and warnings, and the failure mark with the error count. A temporary mutation check removed the composite walk, the read with ai definition and the zero-state rule; each removal fails the new tests.
…the report example Lint checks hook bodies and composite device blocks, which the dry run skips. The changelog example is the command's output for two sample files, with the colour codes left out. The CLI reference lists the four known limits of the references check, and the MCP lint description says what lint checks beyond the dry run.
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.
Summary
probe lintchecks the references a run would resolve, without a device: each step and recipe call that matches no built-in step and no recipe, each selector that can never match, and each<name>placeholder that no value defines.usefile are warnings and keep the status at 0.linttool description and the CLI reference describe the new checks.probe lintandprobe test --dry-runshare recipe loading.tests/and the case of Robot recipe names in probe-convert.Test plan
go vet ./...andgo test ./...pass locally🤖 Generated with Claude Code