Repository navigation
feat(manager): update Pkl package URIs with a pkl manager and source - #350
Merged
Merged
Conversation
The pkl manager reads the package:// URIs in Pkl amends, extends and import clauses: GitHub release URIs and both pkg.pkl-lang.org forms. Each package is looked up in a new pkl source, named by its URI without scheme and version, whose catalog is the publishing repository's releases narrowed to the package's own tags. Packages of one monorepo, such as apple/pkl-pantry, stay separate packages with branches of their own, and the engine reads each repository's releases once per run for all of its packages. A release URI's two copies of the version are occurrences of one declaration, so an update writes both. Checksum-pinned URIs, other hosts and PklProject dependencies are skipped. The repository's own patchula.pkl is not read. Config loading and the manager share one Pkl import lexer.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
count-patchula | b11b74f | Commit Preview URL Branch Preview URL |
Nov 22 2026, 10:00 AM |
- A batch whose file moved on since the PR moves every copy of the first declaration's value, so a Pkl release URI never gets its tag moved without its @Version. - Pkl packages write the release's exact version: widen no longer proposes a range no URI can hold. - The version placeholder in release URI package names is %version%, which GitHub does not strip from PR bodies as an HTML tag. - Package names and tags take only letters, digits and ._+@-, so dot segments, pipes, control characters and percent-encoded tags are skipped. Overlapping version matches in a tag are skipped too, and versions are checked with the semver scheme's own parser. - Skipped URIs drop their query and checksum and are hidden whenever a password could be present. - Release notes read a Pkl package's own tags only, with its exact spelling, so monorepo neighbours and plain v tags stay out. - The engine test checks each proposal against the recorded tags and counts unbatched first pages; docs list the pkl source in the datasource and release-notes tables.
- The batch fallback moves declarations only when every candidate holds one value. Declarations that disagree, none at the PR's value, are left alone instead of rewriting another line's (or every copy of it), for every manager. - The shared Pkl lexer follows Pkl's escapes: an escape reaches past the character it escapes (`\"""` no longer ends a text block), a custom delimiter changes the escape to `\#` (custom-delimited strings are not raw), and imports inside interpolations count. - A query in a package URI is skipped as no release path, before the checksum check can misread it; pkg.pkl-lang.org/github.com/<name> is not an Apple project; a host-only skipped URI shows no trailing slash. - The release-notes guide says a repository-root changelog is read whole.
The hand-written import lexer shared by config loading and the pkl manager kept drifting from Pkl's grammar: review found exponential backtracking on unterminated interpolations, duplicate imports, paren-depth drift, and missed or invented imports around quoted identifiers, `$` and Unicode identifiers, shebang lines and single-line strings. Two review rounds found the same class, so the lexer is gone. pkl_imports now walks pklr's tokens, the lexer the evaluator itself uses, interpolations included, and returns an error for a module pklr cannot lex instead of a partial list; its interpolation depth limit bounds hostile input. Each import records the byte range of its string's contents only when they are written exactly as they read, so the manager skips an escaped or text-block URI rather than edit the decoded string. An unlexable .pkl file is skipped with a warning; an unlexable config module fails config loading.
- Semicolons between an import keyword, its parenthesis and its string are skipped, as pklr's parser skips them after every token, so `import; "pkl:math"` reaches config loading's local-only check. - An `import(…)` expression counts only when its string closes the parenthesis. - A lex error names the line only: pklr's message can quote the text it failed on. - A skipped package URI that holds anything but printable ASCII after decoding is hidden, so no line break or terminal escape reaches a report. The escaped-URI reason says escapes or a text block, and the stale backslash check on decoded URIs is gone.
…ository .pkl is also Python's pickle extension. A .pkl file only the pkl manager selects is dropped when it is not text and not read over 1 MiB (from the tree's size), with one warning counting those, where any other selected file that cannot be read still refuses the repository.
…nifests Scanner::shared_name now asks the ecosystem about the path, so a pkl files override that selects settings, credential-checked files or YAML manifests reads them as any selected file. Bumps the state and derive versions whose sources the TreeEntry size field changed.
A warning degrades the repository, which stops automerge and branch and PR cleanup for every manager. An oversize .pkl file is now a skipped entry, like pip requirements files, so a large pickle leaves them on.
… modules A Git LFS pointer, or a .pkl file pklr cannot lex that ends with the '.' every pickle ends with, imports nothing and warns nothing, so it leaves auto-merge and cleanup on. A file that lexes is always read, and any other unlexable .pkl file still warns.
…rsize ones silently A .pkl file that never writes package: imports no package, so it is not lexed and never warns, which replaces the Git LFS and pickle-ending guesses. Oversize .pkl files are left out unreported like binary ones, so model pickles add no skipped rows. Namespace no longer derefs to its name, and the Pkl guide covers suffix tags read as prereleases and which names rules match.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
pklmanager, the Count's answer to renovatebot/renovate#47876 (still open upstream).What it reads
package://URIs inamends,extends,importandimport*clauses andimport(…)expressions of*.pklfiles. It does not read the rootpatchula.pkl, whose imports config loading already limits to local modules. Config loading and the manager both read imports throughpatchula_config::pkl_imports, which walks pklr's own tokens.package://github.com/<owner>/<repo>/releases/download/<tag>/<name>@<version><owner>/<repo><tag>package://pkg.pkl-lang.org/github.com/<owner>/<repo>/<name>@<version><owner>/<repo><name>@<version>package://pkg.pkl-lang.org/<project>/<name>@<version>apple/<project><name>@<version>I checked the
pkg.pkl-lang.orgredirects against the live service.Design
pklsource instead ofgithub-releases. A package is named by its URI without scheme and version (pkg.pkl-lang.org/pkl-pantry/pkl.toml; a release URI writes its tag's version as%version%, which GitHub does not strip as HTML and globs read literally). Its catalog is the publishing repository's releases, narrowed to the package's own tags (patchula_config::PklPackage). This keeps the dozens ofapple/pkl-pantrypackages apart. Keyed by(github-releases, apple/pkl-pantry), they would share branch identities,Changejoins, batch overlaps and line computation, andcurrentas a raw tag would not parse as a version ([email protected]would land on8.x).Engine::catalogsadds a Pkl package's repository to the existing release batches and derives every package's catalog from that one fetch. The new recorded engine test asserts thatapple/pkl-pantryis walked once for two of its packages.v2.9.0/[email protected]). Both are occurrences of one declaration, so the report merges them and one update writes both.::sha256:), tags that do not hold the version exactly once, non-semver versions, and escaped or interpolated strings. A skipped URI is shown without its fragment, and hidden entirely when its authority holds a user.<name>@tag matching covers the pantry tags.Other changes
patchula.pklgroupshkfrom mise and pkl, sohk.pkl(still at 2.9.0) moves withmise.toml.Testing
crates/manager/tests/pkl.rs,crates/config/src/pkl_package.rsandcrates/datasource/src/pkl.rs.crates/engine/tests/pkl.rs(cassettefixtures/engine/pkl.json).test:unit, clippy, the docs build and the fixtures scan all pass.patchula lookupon this repository reportshk2.9.0 → 2.13.0 athk.pkl:1 (+1).After review (Gemini 4 Neon, adversarial)
Fixed in ec069a3:
@version.Written::Tag):versions = "widen"no longer proposes2.9.0 || 2.13.0.<version>→%version%(GitHub stripped<version>from PR bodies as an HTML tag).[A-Za-z0-9._+@-], dot segments excluded. Percent-encoded tags and overlapping version matches are skipped, and versions are checked with thesemverparser lookup uses.Namespaceinpatchula-notes).catalog,changelogandnotes-adapterstate rows now listpkl_package.rs. Docs addpklto the datasource and release-notes tables.Second round, fixed in 783b865:
\"""no longer ends a text block. Custom-delimited strings escape with\#(they are not raw). Imports inside\( … )interpolations count. This also affects config loading, which now reads those interpolated imports too.pkg.pkl-lang.org/github.com/<name>is not read as an Apple project. A host-only skipped URI has no trailing slash.Third round, fixed in 0a94777: every finding was in the hand-written import lexer:
$and Unicode identifiers, shebang lines and single-line strings.Round 2 found bugs of the same kind, so instead of patching again the lexer is removed.
pkl_importsnow walks pklr's own tokens, the lexer the evaluator uses, interpolations included, and returns an error instead of a partial list for a module pklr can't lex. pklr's interpolation depth limit bounds hostile input. An import has an editable range only when its string's contents are written exactly as they read, so an escaped or text-block URI is skipped, not edited. An unlexable.pklfile is skipped with a warning, and an unlexable config module fails config loading.Fourth round, fixed in 414890e:
(and its string are skipped, matching pklr's parser, soimport; "pkl:math"reaches config loading's local-only check.import(…)expression counts only when its string closes the parenthesis.Fifth round, fixed in 97ef86f:
.pklis also Python's pickle extension, and a selected file that is not text refused the whole repository. A file onlypklselects (a newEcosystem::shared_namehook) is now left out when it is not text and is not read over 1 MiB, using the tree's blobsize, listed as skipped (round 7). Other managers' selected files still refuse when unreadable. Design per a Fable consult.state-versionshashes after e137533.*/, and only its language reference calls them nestable. pklr agrees, so that follow-up is withdrawn and the test that claimed nesting is corrected (e137533).Sixth round, fixed in b10c412:
shared_nameasked only which managers selected a path, so afilesoverride forpklcovering.npmrc,pip.confor a YAML manifest would skip or drop it. It now holds only for.pklnames and never for registry settings, credential-checked files or tooling manifests.TreeEntrysize field changed the sources of more cached states:not-ours,source-head,tag-catalogandtag-objectstate versions and thegithub-release-headderive version are bumped.Seventh round, fixed in bd45bc4:
.pklwarning degraded the repository, which stops automerge and branch and PR cleanup for every manager. Oversize.pklfiles are now skipped entries, like pip requirements files.Eighth round, fixed in 5392561:
.pklfiles that are not Pkl (Git LFS pointers for models, protocol 0 and 1 pickles) failed to lex and warned, degrading the repository. A Git LFS pointer, and an unlexable.pklfile ending with the.every pickle ends with, now import nothing and warn nothing. A file that lexes is always read; any other unlexable.pklfile still warns, so a broken real module keeps its PRs from being closed as obsolete.Ninth round found nothing of high or medium severity. Its one low finding, Git LFS pointers with CRLF line endings, is fixed in 07addb5.
Final review (Opus 5.5) found nothing to fix before merge. Its simplifications are in b11b74f:
.pklfile that never writespackage:is not lexed and never warns. This replaces the Git LFS pointer and pickle-ending checks of rounds 8 and 9 and covers any other text format named.pkl. A file that writespackage:but does not lex still warns..pklfiles over 1 MiB are left out unreported, like binary ones, so a repository of model pickles gets no skipped rows.Scanner::oversizeis gone.Namespacein crates/notes no longer derefs to its name.v2.12.0-finalunderv%version%) reads as a prerelease, and that rules match thepklsource, notgithub-releases.Follow-ups (not in this PR)
PklProjectdependencies, which also needPklProject.deps.jsonregenerated.<name>@<version>.sha256.apple/pkl-pantrycan be read twice; quota only, never a wrong answer.Ecosystem::shared_nameis a general hook with one user (pkl); fold it into a.pklcheck if no second ecosystem needs it.