Skip to content

test: record the trajectories, the environment and the fingerprint of the solves (#314, phase A) - #417

Merged
ocots merged 4 commits into
mainfrom
feat/314-record-trajectories
Nov 7, 2026
Merged

ocots merged 4 commits into
mainfrom
feat/314-record-trajectories

Conversation

@ocots

@ocots ocots commented Nov 7, 2026

Copy link
Copy Markdown
Member

Plan: #314 phase A — the crons record trajectories, environment and fingerprint

Conventions: ct-conventions v0.11.0; ct-agents v0.4.0. Plan of #314 agreed in #314 (comment) (four phases, one PR each; this is A).

What and why

The documentation will draw the solutions in the browser from data published by the crons (decision 1 of the plan), say whether a result is up to date (fingerprint, decision 3) and show the environment of the run (Reproducibility block). This PR makes the tests record them; phase B publishes them on the results branch.

What changes

File After
src/OptimalControlProblems.jl, Project.toml _problem_files(problem) and _fingerprint(problem): SHA-256 of the metadata, description and model files of a problem, relative paths with /, line endings read as \n (same on Windows); SHA (stdlib) added. One function, used by the tests and later by the documentation
test/common/status.jl Result gets fingerprint and an optional trajectory; trajectory(x) reads an OptimalControl solution or a solved JuMP model with the accessors they share (time grid at most 501 nodes, state, control, costate by component, variable, 8 significant digits; nothing with a warning if unreadable, the solve is still reported); write_report also writes <name>-trajectories.toml and <name>-env/ (Project.toml, Manifest.toml, versioninfo.txt, status.txt, status-manifest.txt, without the temporary path of the environment); results.tsv gets a fingerprint column (read by name by the tools)
test/cron/*/test_convergence.jl pass trajectory=TestStatus.trajectory(sol) (or of the JuMP model)
test/Project.toml InteractiveUtils (stdlib), for versioninfo in core, which runs under the restricted LOAD_PATH of Pkg.test
tests core: fingerprint (stable, changes with content and path, not with CRLF), fingerprint column, trajectories file, environment files; comparison: the trajectory of a JuMP model and of its OptimalControl solution match the accessors

The first commit only formats (JuliaFormatter, blue) the three files as they are on main, so that the second shows only the changes.

The costate is recorded as the solver gives it: for JuMP its sign is the opposite of OptimalControl's (#326).

Verification

  • Pkg.test(; test_args=["core"]): 776 passed, 1 broken (existing).
  • Pkg.test(; test_args=["comparison", "OptimalControl", "JuMP", "convergence", "problem=beam"]): passed. Files written: OptimalControl-trajectories.toml (72 KB, two configurations), JuMP-trajectories.toml (36 KB), *-env/ with the five files; the same fingerprint in the trajectories and in the .tsv, 501 time points. About 3 MB per full cron run.
  • The CRLF check catches a broken fingerprint (without the normalization): broken: same fingerprint with CRLF: false / _fingerprint: … true.
  • tools/cron/test, tools/ci/test: 66 passed (the extra column is read by name).

The cron workflow already uploads test/reports/ as the artifact: the new files reach the publish job without change; publishing them is phase B.

Labels

run ci github-runner.

Refs #314

🤖 Generated with Claude Code

ocots and others added 2 commits November 7, 2026 16:56
JuliaFormatter (blue), no change of content, so that the next commit shows
only what it changes.

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

Phase A of #314. A result carries the fingerprint of its problem (SHA-256 of
the files that define it, OptimalControlProblems._fingerprint) and, from the
convergence tests, the trajectory of its solution: time grid (at most 501
nodes), state, control, costate by component, and variable. Each report
writes <name>-trajectories.toml and <name>-env/ (Project.toml, Manifest.toml,
versioninfo, Pkg.status) next to the results; results.tsv gets a fingerprint
column. The publication on the results branch is phase B.

Refs #314

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 7, 2026
ocots and others added 2 commits November 7, 2026 17:22
…igits

The trajectories key the components by name, in a dictionary that loses the
order of the model (Julia's TOML writer, then the JSON of the publish job,
sort them): `names` records it, for the state, the control and the variable.
Values are rounded to 6 significant digits instead of 8: enough to draw, and
stable from one run to the next, so the copies the documentation publishes do
not change every week. The check of the comparison follows (rtol 1e-5).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ocots
ocots merged commit b349b49 into main Nov 7, 2026
11 checks passed
@ocots
ocots deleted the feat/314-record-trajectories branch November 7, 2026 22:10
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