Repository navigation
[pkgdef 5/6] feat(pkgdef): support the initial package set - #3035
mikeland73 wants to merge 11 commits into
Conversation
Implement what the initial package definitions need:
- Platforms a version is not published for: a 404 from a checksum file
or index, a checksum list without the file, a jq expression that
matches nothing or a GitHub release without the asset is ErrNoArtifact.
Lock leaves those systems out and fails only when none has an artifact;
installing on a left-out system is an error naming where the version is
available.
- install.lookup reads the artifact URL and checksum from a JSON index
(python-build-standalone via uv's index, Temurin, zig).
- install.version_overrides apply partial installs to versions matching a
constraint such as "<11" (pnpm, yarn, deno).
- versions may be a list of sources (yarn 1 and 2+ are different npm
packages). github_releases and http_json URLs with {{.Page}} paginate
lazily, stopping at the first page with a match.
- Versions with +build metadata (21.0.5+11) compare and prefix-match.
- sha512 digests and SRI strings, a sha512_url checksum type, and a
github_release type that reads GitHub's asset digests. devbox.lock gets
an omitempty sha512 per system.
- binaries are made executable after extraction and must exist after
install. post_install hooks run with /bin/sh and /usr/bin:/bin on PATH.
- Metadata requests are memoized per client, so locking four systems
fetches an index once. Install fingerprints include the version, since
overrides can make versions install differently.
- ensureStateIsUpToDate reloads plugin configs after installing, so a
version changed in devbox.json gets its definition's env and init hook
in the same run instead of the next one.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
[Medium impact] The PR appears safe to merge, with no outstanding actionable findings.
|
…age-support # Conflicts: # internal/devbox/pkgdef.go # internal/pkgdef/client_test.go # internal/pkgdef/definition.go # internal/pkgdef/install.go # internal/pkgdef/version.go # internal/pkgdef/versions.go
|
@greptileai review Generated by Claude Code |
1 similar comment
|
@greptileai review Generated by Claude Code |
- Validate rejects `binaries` entries that are not plain file names, so makeBinariesExecutable cannot chmod files outside the install root. - An http_json checksum endpoint that 404s now reports ErrNoArtifact, so Lock skips that platform instead of failing every platform. - http_json checksum selects that produce an array of digests are flattened one level again, matching runJQ. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Bqy92nAJeXk9DPbkjEddqY
…age-support Resolve conflicts with the Greptile fixes from lower in the stack: runJQValues now takes a context and enforces jqResultLimit (runJQ and queryJSON pass ctx through); install strips an archive-supplied marker before making binaries executable; keep both new definition validation cases. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Bqy92mV11RTGiKeSuiHtuV
The missing-binaries check runs after post_install, so hooks may create listed binaries (bun's bunx). Entries must be plain file names. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Bqy92nAJeXk9DPbkjEddqY
- A lookup select that yields null now means "no artifact" for that system, as the spec says for an expression that produces nothing, instead of failing the whole lock. - The URL a lookup index returns is checked against the remote file:// ban at lock time, so a remote definition cannot write one into devbox.lock. - Spec: http_json checksums flatten array results one level; lookup null results and file:// URLs are documented. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Bqy92nAJeXk9DPbkjEddqY
…versions - Validate checks each version override combined with the definition's system overrides, in InstallFor's order, so a version override's lookup with a system override's checksum is rejected instead of the checksum being silently dropped. - Version-override constraints must contain valid version strings. - Spec: document pagination detection and the page-0 404 error, the lookup/checksum rules, constraint validation, that install fails on a missing binary after post_install, github_releases skipping tags without strip_prefix, and sha256_url's "*" prefix and dir/filename matching. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Bqy92nAJeXk9DPbkjEddqY
|
@greptileai review Generated by Claude Code |
Stack (merge in order):
internal/pkgdeflibraryDEVBOX_FEATURE_PKG_DEFS)Summary
Fifth PR of the package definitions stack. Implements the format features from #3034 that the initial package set needs, and fixes a wiring bug the package tests found.
Platforms a version isn't published for. Any of these means
ErrNoArtifact:null);Lockleaves that system out and fails only when no platform has an artifact. Installing on a system the lock entry leaves out is a user error that names the platforms the version is available for.New format features:
install.lookup: read the URL and checksum from a JSON index with a jq expression. Used by python, java and zig.install.version_overrides: partial installs for versions matching a constraint (<11,>=2, <4). They apply before system overrides, and a version override can carry its own system overrides.versionsas a list of sources, combined.Lazy pagination:
github_releasesreads 100 per page, andhttp_jsonpaginates when its URL contains{{.Page}}. Resolution stops at the first page with a match, solatestcosts one request.Versions with
+buildmetadata compare correctly and prefix-match (21.0.12matches21.0.12+101). Build metadata containing letters is not a pre-release.Checksums:
sha256:/sha512:prefixes and SRI digests;sha512_urltype;github_release, which reads GitHub's asset digests through the authenticated API.devbox.lockgets anomitemptysha512per system.binariesmust be plain file names; they are made executable after extraction and must exist after install (checked afterpost_install, so hooks may create them).post_installruns through/bin/sh, with/usr/bin:/binappended toPATH.Template function
splitList.Other library changes:
Wiring fix. After a version was changed in
devbox.json, the firstdevbox runresolved and installed it but ran without the definition's env and init hook (JAVA_HOME,RUSTUP_TOOLCHAIN, the python venv). Plugin configs are built at config load, before the lock entry exists.ensureStateIsUpToDatenow reloads includes after installing when the project has package definitions.Audit fixes carried into the new features:
file://ban coversinstall.lookupURLs (and the URL a lookup index returns), version-override URLs, and every paginated version URL.Validatechecks each version override combined with the definition's system overrides (the orderInstallForapplies them), so a version override'slookupwith a system override'schecksumis rejected instead of silently dropping the checksum. Version-override constraints must contain valid version strings.Test plan
http_jsonchecksums: a 404 for one platform skips it, and array-valued selects ([... | .sha256]) workgithub_releasedigests (with token, null digest, missing asset)binarieschmod, the missing-binary error, and rejecting names that are not plain file names; hooks with an emptyPATHhttp_jsonand GitHub releases (stops early, stops at a 404 or a short page)file://rejection for lookup (including afile://URL returned by the index) and version overrides; a lookup that yieldsnulltestscripts/pkgdef: editingdevbox.jsonto a version not yet indevbox.lockapplies env and init hook in the same run. This fails without the fix.go test ./internal/pkgdef/... ./internal/lock/...and gofmt clean after the review fixes (golangci-lint/gofumpt were clean before them; not re-run since)https://claude.ai/code/session_01Bqy92oAnwydcLrbSE7nkVH
Generated by Claude Code