ToolchainVersionRule class
Fail when the dialect binary on PATH is older than the project's
declared toolchain.min_version.
A dialect.yaml teaches both the CLI and an AI agent how the project
works, and some of what it promises is only true of a new enough binary.
The sharp example is sync: before 1.2 it silently deleted keys that
lived only in generated output, reported success, and left check green.
A project that relies on the guard has no way to say so, and the failure
is invisible until data is gone.
Projects used to encode this as a prose "pinned toolchain" comment at the
top of dialect.yaml. That is folklore: nobody re-derives it, it drifts
from the binary it names (real example: a block claiming one version while
its rebuild step checked out a different commit), and it cannot fire. The
CLI already knows its own version, and the project can state its floor —
so this rule closes the loop.
Severity is error, not warning. The consequence of running too old a binary is silent data loss, and a warning is exactly what scrolls past on the day it matters. The fix is always cheap: upgrade the binary, or lower the floor if it was set too high.
Known limitation, by construction: a binary older than the release
that introduced this rule does not contain the rule, so it cannot warn
about itself. The check protects against future skew (a project needing
1.5 while the developer runs 1.3), not against every past version — the
same shape as npm's engines field. That is a real ceiling, not an
oversight: nothing a config file says can make an old binary read it.
Pre-release suffixes on the running version are deliberately ignored, so
1.2.0-dev satisfies a 1.2.0 floor. Strict semver orders a pre-release
below its release, which would make every source build of the current
tip fail against a floor stamped from that same tip — technically correct
and practically useless. A -dev build of 1.2.0 has 1.2.0's behavior,
which is what the floor is actually asking about.
Constructors
- ToolchainVersionRule({String runningVersion = dialectVersion})
-
const
Properties
- defaultSeverity → IssueSeverity
-
Default severity. May be overridden per-issue.
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- name → String
-
Stable rule identifier (snake_case). Used by the report formatter
to group findings and by users to silence/ack via state file
(post-v1.0).
no setteroverride
- runningVersion → String
-
The version of the binary doing the checking. Injectable so the rule
can be tested against floors on both sides without recompiling.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
run(
DialectProject project) → List< Issue> -
Inspect
projectand return findings. May return an empty list. Should NOT throw — turn unexpected conditions into Issues so the report surfaces them rather than crashing.override -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited