← Back to Pull requests

Export a dependency lock file with checksums for offline and reproducible builds #366

Closed
unknown closed this pull request without merging on Oct 13, 2026 15:56 UTC
View on GitHub
unknown unknown commented on Oct 09, 2026 06:26 UTC
Author

Fixes #340

Adds pyronaut lock, which writes pyronaut.lock: every Maven artifact that pyronaut setup, pyronaut install and pyronaut build resolve, 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.lock in the project root, in TOML (builtins.fromTOML in Nix, tomllib in Python; the same family as uv.lock). Entries are sorted by path so diffs stay small:

version = 1

[[artifact]]
coordinates = "io.micronaut:micronaut-core:jar:4.10.7"
path = "io/micronaut/micronaut-core/4.10.7/micronaut-core-4.10.7.jar"
repository = "https://repo1.maven.org/maven2/"
url = "https://repo1.maven.org/maven2/io/micronaut/micronaut-core/4.10.7/micronaut-core-4.10.7.jar"
sha256 = "…"

Recording: all Maven resolution already goes through MavenClasspathResolver in pyronaut-install. When a lock is active, each resolver session gets a RepositoryListener that sees every artifactResolved event. 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 no url: repository = "bundled" for io.micronaut.pyronaut modules 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 lock runs the same resolutions as the other commands, all into one temporary lock that replaces pyronaut.lock only once everything resolved:

  • setup: the native launcher compiler classpaths and the JVM tool runtime (--resolve-tools-only, with descriptors taken from the validated setup manifest), when the wheel requires pyronaut setup

  • install: the build, runtime, development-runtime, test and test-resources-server scopes

  • build: resolves through install, so it is covered by the same entries
  • pyronaut lock --check writes nothing and exits 8 when the lock is missing or stale, for CI.

    Verification on normal resolution: when pyronaut.lock exists, 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 break install. 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, or PYRONAUT_LOCKED=true (for build/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 run pyronaut lock.

  • PYRONAUT_LOCK_REPOSITORY=<dir> / --lock-repository <dir> (implies locked): a directory holding the locked files at their path replaces every configured repository. It works under --offline (allowed through aether.offline.repositories), and checksums are verified against the lock, so it doesn't need .sha1 files. A missing artifact fails resolution with a pointer to the lock repository. A Nix linkFarm of fetchurl { url; sha256; } over the entries is exactly this directory (example in the docs).

  • PYRONAUT_LOCK_FILE / --lock-file selects another lock file.
  • The lock is process-wide (DependencyLock.current()), because each installer (ToolClasspathInstaller, DirectSourceDependencyResolver, ExternalBuildResolver) builds its own MavenClasspathResolver. When recording or locked, ToolClasspathInstaller resolves 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 needs maven-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 a file: 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
    - --locked rejects unlisted artifacts, while non-locked mode accepts them
    - a lock repository resolves --offline into 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-repository values aren't mistaken for direct-source arguments (a bug caught while testing)
    - setup --locked
  • Docs: new guide section "Locking Maven Dependencies" (configuration/dependencyLocking.adoc), plus CLI reference updates for lock, setup --locked, the install options and the env vars.
  • Diff: 650 lines (+487 / -163) across 8 files Reviewer: yawkat Review duration: 6329m
    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
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.5% · Safe to merge
    20.5%