Skip to content

Add first step towards a validator - #373

Open
r-ash wants to merge 4 commits into
mainfrom
validator-1
Open

Add first step towards a validator#373
r-ash wants to merge 4 commits into
mainfrom
validator-1

Conversation

@r-ash

@r-ash r-ash commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

This PR will

  1. Create a new python package in the mono-repo which can be used to extract params, run PJNZ and get a simple diff of a single indicator

r-ash and others added 4 commits August 13, 2026 10:33
New leapfrog-validate CLI/library: build-params/run/diff independently
build leapfrogr at a git ref via an isolated worktree, run the model, and
compare a single indicator (total_population) between two refs with the
hybrid atol + rtol*|ref| tolerance formula from the validation-system PRD.
Proves the shape of the wider leapfrog-validation system end-to-end before
the rest (five indicators, Spectrum comparison, PR reporting) gets layered
on top.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Same commands/options/behavior, just typer's type-hint-driven style
(Annotated arguments, a callback for the shared --cache-dir option
instead of a click group context).
…ktree

Both Rscript subprocess calls run with cwd set to the cached per-ref git
worktree (needed for R CMD INSTALL, not for these), so a relative -o path
was resolving there instead of the caller's actual directory -- a file
written with -o some.h5 would silently land in
~/.cache/leapfrog-validate/worktrees/<sha>/some.h5 instead of next to
where the command was run, and a later `run` pointed at that same
relative path would then correctly report it missing.

Resolve pjnz/output/params to absolute paths before handing them to the
subprocess. Adds a regression test for each command exercising a relative
-o path against a worktree with a different cwd.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
R scripts: parse args with docopt::docopt() (matching
leapfrogr/scripts/create_model_output.R's existing convention) instead of
raw commandArgs(); call leapfrog::/leapfrog::: qualified rather than
library(leapfrog).

Ruff: the ignore list was copied wholesale from codegen/pyproject.toml.
Cleared it and re-ran against the real codebase -- only docstring rules
and subprocess S603/S607 actually fired. Added real docstrings to every
flagged public class/function in src/ (16 sites), exempted test functions
from docstring rules per-file (matching leapfrog-py/tests' existing
undocumented-test-function convention), and kept S603/S607 ignored with
a one-line justification -- shelling out to git/R/uv with argument lists
is this tool's whole job, not untrusted input reaching a shell.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant