Skip to content

feat(tools): a linter of the problems (T3 of #449) - #467

Merged
ocots merged 4 commits into
mainfrom
feat/problem-lint
Nov 20, 2026
Merged

ocots merged 4 commits into
mainfrom
feat/problem-lint

Conversation

@ocots

@ocots ocots commented Nov 20, 2026

Copy link
Copy Markdown
Member

Refs #449 (T3). Conventions: ct-conventions v0.14.0, ct-agents v0.5.0.

Summary

A deterministic linter of the problems, for whoever adds one (an agent, later, in particular): what every problem must have, checked the same way for every problem, and a report that says what it checks, what other tools check and what is left to check by hand.

  • tools/lint/ProblemLint.jl, julia --project tools/lint/problems.jl [--verbose] [problems]: a Markdown report in the style of release.jl audit; exits 1 on a failure.
    • ✅/❌: the files and a status per model file; the outline and the sources of the description; :parameter_info (exactly the parameters, a meaning each); in each model file the method and its keywords, the draft warning, parameters_data, _initial_guess, _problem, the parameters it reads (all used, all of the problem), no bound written in the code; every parameter read by a model or by the metadata.
    • ☑️ what other tools check, with the tool.
    • ℹ️ what no tool checks, as a checklist to paste in the pull request.
  • test/suite/core/test_lint.jl: the collection has no failure, and an example problem with one injected defect per check. The checks of test_consistency.jl it replaces are removed (outline, sources, parameter info, status ↔ file).
  • T3 fixes found by the linter, the problems unchanged:
    • bounds from the parameters: brachistochrone (u_min, u_max, tf_l, tf_u), balanced_field (v_min, α_min, h_min, tf_min; v_max unused, removed), the defaults being the values used so far;
    • dead reads removed: mountain_car tf_start, space_shuttle α_s, β_s (and the parameter α_t0), ModelingToolkit chain and jackson t0;
    • the references of balanced_field, brachistochrone, space_shuttle regenerated by tools/references/update.jl (values unchanged).
  • AGENTS.md: adding a problem follows ext/README.md, lints before testing, and pastes the ℹ️ checklist in the pull request. ext/README.md: a "Lint it" step.

Left from T3: bryson_denham JuMP components x1/x2 (separate PR), MOD4 in OptimalControlModels.jl/JuMPModels.jl and the cart_pendulum comment (maintainer's call). Next: a generator of the skeleton of a new problem, whose output passes this linter.

Test plan

  • julia --project tools/lint/problems.jl: 22 problems, 1057 checks, no failure.
  • core: 1262 passed.
  • JuMP, OptimalControl, OptimalControlScalarized, comparison on brachistochrone, balanced_field, mountain_car, space_shuttle: 1266 passed.
  • ModelingToolkit on chain, jackson: passed.
  • CI.

🤖 Generated with Claude Code

ocots and others added 4 commits November 20, 2026 14:54
`julia --project tools/lint/problems.jl [problem…]` checks, for every
problem, what the template of `ext/README.md` asks: the description and
a status for each model file, the outline and sources of the
description, `:parameter_info`, and in each model file the method and
its keywords, the draft warning, `parameters_data`, `_initial_guess`,
the parameters it reads (all used, all of the problem), no bound written
in the code; and that every parameter is read somewhere. Its report says
what it checks (✅/❌), what other tools check (☑️) and what is left to
check by hand (ℹ️).

`test_lint` runs it on the collection (no failure allowed) and on an
example problem, one defect per check. The checks of the descriptions
and of `:parameter_info` move from `test_consistency` into it.

Refs #449

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What the linter reported, the problems unchanged:
- brachistochrone: the bounds of u and tf are read from the parameters
  (`u_min`, `u_max` now ±1.57, the values the models used; `tf_l`, `tf_u`
  added).
- balanced_field: `α_min` (now 0), `v_min` (now 1), `h_min` and `tf_min`
  (added) bound the models; `v_max`, never read, removed.
- mountain_car (`tf_start`) and space_shuttle (`α_s`, `β_s`): only the
  initial guess of the metadata reads them, the models no longer do;
  space_shuttle's `α_t0`, used nowhere, removed.
- ModelingToolkit chain and jackson: `t0` no longer read.

The reference files of the three problems whose default parameters
changed are written again by tools/references/update.jl, from the cron
runs 44015064560 (JuMP), 44235205662 (OptimalControl), 44455617205
(OptimalControlScalarized) and 42387115100 (robustness): same values.

Refs #449

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… and description hold

Refs #449

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the pull request

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ocots ocots added the run ci github-runner Trigger the CI workflow on GitHub-hosted runners label Nov 20, 2026
@ocots
ocots merged commit 9d1454f into main Nov 20, 2026
17 of 18 checks passed
@ocots
ocots deleted the feat/problem-lint branch November 20, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run ci github-runner Trigger the CI workflow on GitHub-hosted runners

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant