Repository navigation
Releases
v0.13.0
Added
scorer_failure_scored(IEBP012) flags broad exception handlers that turn grader or sandbox failures into fixed results. It checks scorer functions and the package helpers they call. Grader failures are reported as errors and sandbox failures as warnings. The hints recommend letting errors propagate, withScore.unscored(...)reserved for grader replies without a usable verdict (#56).grader_model_under_test(IEBP013) reports an error when scorer code usesget_model()to select the model under evaluation and generate a grading response. It covers omitted model arguments,state.model, and parameters that default toNone. Reading model metadata is allowed, and calls withrole=remain covered by IEBP002. The rule documentation lists supported forms and limitations (#61).fence_tolerant_json(IECQ008) warns whenjson.loads,model_validate_jsonorvalidate_jsonparses a model completion generated in the same function without allowing code fences. Models can wrap JSON in fences even when asked for bare JSON or given a response schema. The hint recommendsinspect_evals.utils.code.strip_json_fence, and the rule runs only where that helper is available (#92).dockerfile_locking(IEBP007) accepts Git repositoryADDinstructions pinned to a full commit using#<commit>or--checksum=<commit>. Branches, tags and short hashes are reported as unpinned. The hint for an unpinnedgit clonenow includes these BuildKit alternatives (#99).verdict_parse_anchored(IEBP015) reports errors for verdict substrings and unanchored verdict regexes that can mistake text in a judge's reasoning for its final verdict. Word boundaries and lookarounds still allow matches anywhere in the response and are also flagged. The rule warns on whole-response searches for labelled numbers, which can match quoted text. Output read fromstate.outputis excluded because it belongs to the model under evaluation (#57).
Fixed
dockerfile_locking(IEBP007) accepts agit clonefollowed in the sameRUNby a checkout, switch or hard reset to a full commit in the cloned directory. It also acceptsgit clone --revision=<commit>andgit checkout FETCH_HEADafter fetching a full commit. Branches, tags, short hashes and checkouts in a different directory still warn (#99).- Ruff pre-commit hooks use the project's locked development dependency, keeping them in sync with tests when Dependabot updates Ruff (#101).
v0.12.0
IESC001 now applies the mount checks that inspect_ai's Docker sandbox enforces in releases after 0.3.279, so a Compose file the sandbox would refuse fails the lint first. This can fail a package that passed 0.11.0. Any writable host bind mount fails, even an allowlisted one, and so does any volumes_from. Before moving a pin, add :ro to bind mounts the sandbox only reads, or set the x-inspect_docker_sandbox.unsafe_allow_writable_host_mounts opt-out and allowlist it after review. The JSON report schema is unchanged. IETS008 now also accepts the packaged pytest_inspect_evals.metrics helper, and --explain works from a wheel without mdformat.
Changed
custom_metric_tests(IETS008) now accepts the packaged epoch helper by default. A test counts when it importspytest_inspect_evals.metricsor the deprecatedtests/utils/metric_epochs.pyshim. Before, onlymetric_epochscounted, so a test written the recommended way was still warned about.helper-modulenow takes a list as well as one name. A dotted name must appear as consecutive parts of the import path:pytest_inspect_evals.metricsmatchesfrom pytest_inspect_evals import metricsbut notfrom inspect_evals.foo import metrics. Before, a dotted name matched by its last part alone.sandbox_privileges(IESC001) now also reports the mounts that inspect_ai's Docker sandbox refuses by default in releases after 0.3.279: writable host bind mounts, read-only binds, configs or secrets in a service that could remount them writable, shared bind propagation, writable submounts, anyvolumes_from, and named volumes or mount types whose host access cannot be verified. These findings have no allowlist key, because an allowlist entry cannot make inspect_ai accept the mount. Upgrading can fail a package that passed before, including one whose writable bind mount orvolumes_fromis allowlisted. Fix the mount, usually by adding:ro, or set the top-levelx-inspect_docker_sandbox.unsafe_allow_writable_host_mounts: trueopt-out. The rule reports the opt-out for review under that key. A non-boolean opt-out value is an error, since inspect_ai refuses it too.
Fixed
--explainno longer fails withModuleNotFoundError: No module named 'mdformat'when the package is installed from a wheel. It ran the rule's page through mdformat, which is only a docs dependency. The page is now printed as written, which renders the same in the terminal; thedocfield of--output-format jsoncan differ fromdocs/rules/<code>.mdin whitespace and table rules.
v0.11.0
Added
readme_task_args(IEFS007) checks the-T name=valuearguments in the README'sinspect evalandinspect eval-setcommands, in fenced code blocks and inline code, with or withoutuv runand across line continuations. Each task the command names is resolved against the package's@taskfunctions as<namespace>/<task>, a bare<task>orpath/to/file.py@task, and every-Tname must be a parameter of every resolved task. Inspect drops an argument the task does not take and only logs a warning, so the command runs with the default. Tasks that do not resolve to the package, such as placeholders and other packages' tasks, and tasks that take**kwargsare not checked. A README generator that rewrites a generated parameter list does not read the hand-written examples around it, which is how these drift. Findings are errors (#59).readme_dependency_groups(IEFS008) checks the extras and dependency groups the README's commands install. In auvcommand,--extra Xmust name an extra under[project.optional-dependencies]and--group Xa group under[dependency-groups]. In apip install(alsopip3,python -m pipanduv pip) oruv addcommand,project[X]must name an extra when the project is the repository's own or.. Names are compared in normalised form. The governingpyproject.tomlis the repository's, or the evaluation's own<isolated-packages-dir>/<name>/pyproject.tomlwhen it has one, and the message names it. Other projects' extras, placeholders,uvcommands with--project,--directoryor--package, and commands after acdin the same code block are not checked. Apyproject.tomlthat is not valid TOML skips the rule. A name that exists as the other kind gets a hint to switch flags. Findings are errors (#60).metric_epoch_safety(IEBP014) checks custom metrics against the scores Inspect actually hands them. By default the epoch reducer runs before every metric, even atepochs=1:valuecan be an epoch mean such as 0.667, andanswer,explanationandreasonareNoneunless every epoch agrees. The rule reads each@metricfunction, including the function it returns and helpers nested in it, and each@score_reducer. It reports an error for.as_int(),.as_bool()orint(...)of anything computed from a score value in a metric, but notint(len(...))orint()of a comparison. It warns on a single-typeisinstance(v, int)orisinstance(v, float)applied directly to a score value;(int, float)and theisnanguard are not flagged. It reports an error for reading<x>.score.answer,.explanationor.reasonin a metric, and for an attribute or subscript assignment into the scores a metric or reducer was handed. Names are followed in statement order, so rebinding one to a deep copy ends it, and a store into a field that a shallowmodel_copy()shares with the original is flagged.@metric(scores="unreduced")metrics see raw epoch scores, so only the last check applies to them. The hints recommend converting each value with the functionvalue_to_float()returns, asaccuracy()andmean()do, which holds under every reducer exceptcollect.Score.as_float()raises on"C", and a type filter drops samples undermodeormax. Nothing is followed into plain helper functions or other files (#58).shared_code_extraction(IECQ006) warns where an evaluation extracts code from a completion with its own fence pattern instead ofinspect_evals.utils.code.extract_code_block. It flags a string literal holding a triple-backtick fence, or a regex quantifier for three backticks, passed as the pattern tore.compile,search,findall,finditer,match,fullmatchorsub, or as a tag toextract_from_tags. As the separator tosplit,replace,find,partitionorstartswithit counts only with a language label, so a bare fence toggle while reading markdown does not warn. F-strings,+concatenations and names bound to a literal in the same function or at module level count, including a name inside a concatenation. There is one warning per function, and one for a file's module-level patterns. A pattern whose fences are all labelledjsonis left alone, and so is a bare closing fence beside one in the same function. A(?:json|python)?alternation still warns. Test files and the helper's own module are not read. The rule applies only where the helper is available: a helper package definesextract_code_block(inspect_evals itself), or the rootpyproject.tomldeclaresinspect-evalsoutsidedev. Elsewhere it is skipped. The docs say a migration needs a task version bump, and that an evaluation whose upstream benchmark takes a different block should suppress with a reason (#62).ruff_rules_enabled(IECQ007) warns when the ruff configuration governing a package does not enable a rule in a curated set of ruff rules that matter for evaluations. The set starts withPLW1514(unspecified-encoding); each entry carries its justification on the rule page. The check asks ruff rather than parsing its configuration: it lints a snippet the rule reports as though it were a file in the package, soselectprefixes,extend-select,ignore,extend,per-file-ignores,previewandexplicit-preview-rulesapply as ruff applies them. A preview rule selected by a prefix while preview is off counts as not enabled. A repository with no ruff configuration gets ruff's defaults, which enable none of the set. The message names the configuration file and how many violations ruff would report under the source root with the rule on. The rule uses theruffpackage installed alongside the linter, elseruffonPATH, and skips when there is neither; ruff is not a runtime dependency. It also skips, with ruff's reason, when ruff cannot load the configuration, and a failing ruff is tried once per configuration in a run. A repository declines an entry with a reason under[tool.inspect-evals-lint.ruff_rules_enabled] declined, and the finding is then reported as suppressed (#64).custom_metric_tests(IETS008) warns about each custom@metricthat no test runs through the real epoch reducer. A test counts when it imports the epoch helper module,metric_epochsby default (tests/utils/metric_epochs.pyin inspect_evals and the evaluation template), and names the metric as a whole word, or the name given in@metric(name=...). A hand-written test that runseval()withepochs=is not counted. A unit test that hands a metric hand-built scores misses the reducer, which turns"C"into1.0even atepochs=1and two passes in three epochs into 0.667. The helper module can be renamed with[tool.inspect-evals-lint.custom_metric_tests] helper-module, which takes a bare or dotted module name. It is a warning, and a presence check only.
Changed
- A rule can mark a diagnostic as
sharedwhen it is about something several packages share, such as a repository-wide configuration file. A run lists an identical shared diagnostic once, under the first package that reports it, and each other package records askipfor the rule naming that package. The mechanism is opt-in: onlyruff_rules_enableduses it, and every other diagnostic stays with its package even when its text matches another package's, so no other results change. - The documentation pages that list every rule are built with the documentation site instead of committed: the rule index, the front page,
llms.txt,llms-full.txtandrules.json. Every new rule changed them, so any two pull requests that added rules conflicted on them.mkdocs serverebuilds them when a rule or the README changes.docs/rules/and the README's configuration table are still generated and committed.docs/CHECKS.mdstays as a pointer to the site's rule index, because releases up to 0.10.0 link to it. - The CLI's "More info about these checks" link goes to the site's rule index instead of
docs/CHECKS.mdon GitHub.
v0.10.0
New checks for model-controlled input run on the host (IESC002) and for unseeded shuffles (IEBP010, IEBP011), and IEBP003 now also checks FieldSpec-built samples. Each can fail a package that passed 0.9.0. Suppression comments should now give a reason, and suppressed findings count as met. Before moving a pin: JSON reports are now schema_version: 3, because suppressed rules count as passing. A consumer that recomputes or checks scores must accept version 3. The inspect_evals docs dashboard and the inspect-evals-actions register publisher already do.
Added
host_code_execution(IESC002) reports model-controlled input that reaches code execution on the host instead of in the sandbox. The sources are tool arguments, model output (.completion,.messages,.tool_calls,.arguments,.output.message,.output.choices,state.output,.generate(...)results,ModelOutputparameters) andsandbox()read_file()/exec()results. The sinks are code execution (exec,eval,compile,__import__,runpy.run_path,runpy.run_module), shell commands, processes with a tainted program (subprocess,asyncio.create_subprocess_exec,os.exec*,os.spawn*,os.posix_spawn,pty.spawn), unsafe deserialisation (pickle,marshal,dillandcloudpickleloads,joblib.load,pandas.read_pickle,numpy.loadwithallow_pickle, unsafeyamlloads,torch.loadwithoutweights_only=True) and a taintedimportlib.import_module.inspect_ai.util.subprocessis a shell command when its payload is written as a string and a process when it is a list or tuple literal; any other payload is judged likesubprocess.run(cmd). Taint is traced within a file, through one level of same-file calls. A traced flow is an error, allowlisted aspath/within/package.py:sink. Every other shell, code or deserialisation sink in host code is a warning, so a reviewer sees each one once. Imports resolve per scope, so importingevalfrominspect_aiexempts onlyeval, and only where the import is in force. Files matched byexcludecount as sandbox code and are not read (#12).- The
excludedocumentation now defines host code: every Python file outside its globs. - Suppression comments take a reason after
--:# inspect-evals-lint: ignore[sample_ids] -- ids are row numbers.suppression_syntax(IECQ005) warns about a comment that suppresses something without one. The suppression still applies, and a warning counts as passing, so no score changes. The reason runs to the end of the line and is never read for other markers.--followed by another tool's comment, a second--, or an unfilled<reason>placeholder does not count as a reason. The rule's pass message now says every comment has a reason. shuffle_choices_seeded(IEBP010) fails eachshuffle_choices=that resolves toTrue, which shuffles the answer choices without a seed and so changes each sample's option order and target letter between builds. An int is a seed and is accepted.shuffle_seeded(IEBP011) warns on eachshuffle=that resolves to true with noseed=, or aseed=that resolves toNone, since the order decides which samples--limitpicks. It asks for a seed, not for the shuffle to go: a dataset whose records come grouped by category or subject needs a shuffle for a--limitrun to span it. A call to inspect_evals'shuffle_and_seed(shuffle)is read asshuffle_choicesis, soshuffle: bool | int = 42passes and= Truewarns. Both rules also read a dataset's.shuffle()and.shuffle_choices()methods, and skip a call inside anifthat the defaults never enter, such asif shuffle:withshuffle=False. A dataset helper passedshuffle_choices=Truewith aseed=is taken to be seeded, but a known loader is not, since itsseed=orders the samples, not the choices. Both read any call passing the argument by keyword, so a task's call to its own dataset helper counts, andshuffleandseedpassed positionally to the known loaders. A value is read literally, through the enclosing function's parameter default, or through a module constant the file binds once. A value that can't be resolved, including a parameter the function body reassigns, is not flagged. When the value comes from a parameter default the diagnostic points at the default, and calls reading one default report it once. On inspect_evals main IEBP010 fails 6 sites inlab_bench,sadandtruthfulqa. IEBP011 warns at 41 sites in 30 evaluations; 3 of them (mmlutwice,scbench) call a helper that seeds internally (#53).- A comment can no longer suppress
suppression_syntaxfindings, which are about the comments themselves.per-file-ignoresstill can. - Every suppression the tool suggests now includes
-- <reason>: the CLI's failure summary, the footer on each rule page, thellms.txtintro, and the hints for legacy, malformed and past-header markers.
Changed
sample_ids(IEBP003) also checks samples built from aFieldSpec. AFieldSpec(...)withoutid=fails unless every loader it is passed to assample_fields=setsauto_id=True. A name passed assample_fieldsis resolved by Python's scoping rules, andsample_fieldsandauto_idpassed positionally to Inspect's and inspect_evals' loaders are read. An evaluation whose samples all come fromFieldSpecnow passes or fails instead of skipping. On inspect_evals main this fails at four sites:air_bench,lingolyand both SimpleQA tasks (#52).- Suppressed findings count as met. A suppression is a decision recorded in the repository, and pylint, ruff, mypy, Biome and ESLint all leave suppressed findings out of their counts. In
Score,passingis nowpass+warn+suppressed. Thesuppressedcount is shown beside the score, e.g.**16/17 checks met** (2 by suppression)in the Markdown headline. A package whose only unmet rules were suppressed now scores 100%, where it scored less on 0.9.0. - JSON reports use
schema_version: 3, becausepassingandscoreadd up differently. Fields and statuses are unchanged. A consumer that recomputes or checks the score must countsuppressedas passing for version 3, and must be updated before any pin moves to this release. There are two: the register publisher in inspect-evals-actions, and the inspect_evals docs dashboard (docs/_scripts/register-lint.mjs), which checkspassingagainst its parts. - The Markdown list's summary line counts the rules it holds by kind, e.g.
1 not met · 1 with warnings · 2 met by suppression.by_suppression(score)is exported for consumers that build their own headline. - The package builds with
uv_buildinstead of hatchling, and its version is set once inpyproject.toml;inspect_evals_lint.__version__reads it from the installed metadata. The wheel holds the same files and metadata as before, apart from__init__.py's version lookup. The sdist now holds only the package source,README.md,LICENSEandpyproject.toml, not the whole repository.
Fixed
- The console's "Failures by check" and "Warnings by check" tables no longer read messages, hints and locations as Rich markup, which dropped bracketed text such as
ignore[<rule>]in a hint. - A second marker on the same line, before any reason, is now read. Before, only the first marker on a line took effect.
v0.9.0
What's Changed
- feat: include per-rule statuses in the json document by @apurv-1 in #45
- Add sandbox privilege checks and a security category by @MattFisher in #47
- Release 0.9.0 by @MattFisher in #48
New Contributors
Full Changelog: v0.8.0...v0.9.0
v0.8.0
What's Changed
- main_file: find
@taskfunctions in any module; warn, not fail, on an unconventional name by @MattFisher in #37 - Treat
@agentas a model-resolving component in get_model_location and custom_solver_tests by @MattFisher in #38 - Tests rules: accept any mockllm/ model and a decorator's registered name= by @MattFisher in #39
- Skip tests_init under the flat (single-evaluation) test layout by @MattFisher in #40
- external_dependencies: count transitive core requirements; make the per-eval group a monorepo option by @MattFisher in #41
- Infer the preset from the source root when nothing names one by @MattFisher in #42
- Name presets for their layout (multi-eval, single-eval, monorepo); deprecate template and register by @MattFisher in #43
- Release 0.8.0 by @MattFisher in #44
Full Changelog: v0.7.0...v0.8.0
v0.7.0
What's Changed
- feat(rules): duplicate_filter_acknowledged (IEBP008) and known_broken_reported (IEBP009) by @MattFisher in #34
- Docs site: follow the reader's system light/dark setting by @MattFisher in #33
- Bump basedpyright from 1.40.0 to 1.40.1 in the python group by @dependabot[bot] in #31
- Release 0.7.0 by @MattFisher in #35
Full Changelog: v0.6.0...v0.7.0
v0.6.0
What's Changed
- Point each rule at the Inspect documentation for its convention by @MattFisher in #28
- GitHub output: name the location in every message and write the job summary by @MattFisher in #29
- Release 0.6.0 by @MattFisher in #30
Full Changelog: v0.5.0...v0.6.0
v0.5.0
What's Changed
- Lint by task file, score rules once, render Markdown; prepare 0.5.0 by @MattFisher in #25
Full Changelog: v0.4.3...v0.5.0
v0.4.3
What's Changed
- Ship a py.typed marker, prepare 0.4.3 by @MattFisher in #24
Full Changelog: v0.4.2...v0.4.3