Export a dependency lock file with checksums for offline and reproducible builds #366
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #366"
general
weight: 0.35
yawkat
Fixes #340
Adds
pyronaut lock, which writespyronaut.lock: every Maven artifact thatpyronaut setup,pyronaut installandpyronaut buildresolve, with its coordinates, repository URL, download URL and SHA-256. Every later resolution is checked against it, and a locked mode can resolve from nothing but the locked artifacts, offline. That lets Nix, Bazel and air-gapped CI fetch each artifact by URL and checksum instead of pinning one hash over~/.pyronaut+~/.m2.Design
File:
pyronaut.lockin the project root, in TOML (builtins.fromTOMLin Nix,tomllibin Python; the same family asuv.lock). Entries are sorted by path so diffs stay small:Recording: all Maven resolution already goes through
MavenClasspathResolverinpyronaut-install. When a lock is active, each resolver session gets aRepositoryListenerthat sees everyartifactResolvedevent. That covers JARs, the POMs/parent POMs/BOMs read while the graph is collected, and artifacts served from the local repository. The event names the origin repository from_remote.repositories. An artifact in the local repository with no recorded origin gets nourl:repository = "bundled"forio.micronaut.pyronautmodules seeded from the SDK wheel,repository = "local"otherwise. Fetchers skip these entries; locked resolution takes them from the local repository and still verifies the checksum. Source and Javadoc JARs (editor support only) are not locked.Phases covered:
pyronaut lockruns the same resolutions as the other commands, all into one temporary lock that replacespyronaut.lockonly once everything resolved:--resolve-tools-only, with descriptors taken from the validated setup manifest), when the wheel requirespyronaut setupbuild,runtime,development-runtime,testandtest-resources-serverscopesinstall, so it is covered by the same entriespyronaut lock --checkwrites nothing and exits 8 when the lock is missing or stale, for CI.Verification on normal resolution: when
pyronaut.lockexists, every resolved artifact the lock lists must match its SHA-256, whether it was downloaded or already cached. A mismatch fails with the coordinates, both checksums and the file. Unlisted artifacts are accepted, so a stale lock doesn't breakinstall. The lock file and mode are part of the install cache key, so changing either resolves again.Locked / offline mode:
pyronaut install --locked,pyronaut setup --locked, orPYRONAUT_LOCKED=true(forbuild/dev/test, which install on demand) also fail on any artifact the lock doesn't list. The error names each one and tells you to runpyronaut lock.PYRONAUT_LOCK_REPOSITORY=<dir>/--lock-repository <dir>(implies locked): a directory holding the locked files at theirpathreplaces every configured repository. It works under--offline(allowed throughaether.offline.repositories), and checksums are verified against the lock, so it doesn't need.sha1files. A missing artifact fails resolution with a pointer to the lock repository. A NixlinkFarmoffetchurl { url; sha256; }over the entries is exactly this directory (example in the docs).PYRONAUT_LOCK_FILE/--lock-fileselects another lock file.The lock is process-wide (
DependencyLock.current()), because each installer (ToolClasspathInstaller,DirectSourceDependencyResolver,ExternalBuildResolver) builds its ownMavenClasspathResolver. When recording or locked,ToolClasspathInstallerresolves the tool artifacts even if its cached layout is complete, so nothing skips the lock. Recording also bypasses the install manifest cache, but without--refresh's re-download.Not covered (documented): GraalVM JDK, GraalPy and native-launcher downloads, which setup already verifies against published checksums; Python packages, which belong in
uv.lock; Maven/Gradle projects, which should use their own locking (locked mode rejects them); direct-source projects; SNAPSHOTs and version ranges in a lock repository, which needsmaven-metadata.xml.Related: #344 (reproducibility), #345 (relocatable state), #343 (home dir). The lock records repository-relative paths and URLs only, with no local absolute paths.
Tests
DependencyLockTest(Java, against afile:remote repository):- the lock records JARs and POMs with repository, URL and checksum, and re-recording is stable
- a tampered checksum fails, even with a fresh local repository
-
--lockedrejects unlisted artifacts, while non-locked mode accepts them- a lock repository resolves
--offlineinto a fresh local repository after the original repository is deleted, and fails with a clear message when an artifact is missing- format/path validation; env var handling
lock_test.py(CLI):- the lock is written only after the installer succeeds
-
--check- SDK + project recording into one lock
- Maven/Gradle projects are rejected
-
--lock-file/--lock-repositoryvalues aren't mistaken for direct-source arguments (a bug caught while testing)-
setup --lockedconfiguration/dependencyLocking.adoc), plus CLI reference updates forlock,setup --locked, theinstalloptions and the env vars.