Skip to content

feat(lookup): group a Pkl package with its repository's other dependencies - #360

Merged
sweepies merged 4 commits into
mainfrom
feat/pkl-repo-groups
Nov 22, 2026
Merged

sweepies merged 4 commits into
mainfrom
feat/pkl-repo-groups

Conversation

@sweepies

@sweepies sweepies commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

What changed

A Pkl package now shares a PR with the other dependencies its GitHub repository ships. Examples: the hk mise tool with hk's Pkl package, or the github.com/apple/pkl-go Go module with pkl.golang. Their updates get the group owner/repo (jdx/hk) on patchula/jdx-hk / patchula/major-jdx-hk. Titles collapse as before (update hk to 2.11.0).

  • crates/lookup/src/repository.rs: declared_repository(&Dependency) reads a lowercased owner/repo from the declaration only:

    • pkl: PklPackage::parse
    • go: a github.com/<owner>/<repo> prefix (no vanity fetch)
    • mise: a tool without options whose compiled-in registry backends name exactly one repository, or an explicit go:github.com/<owner>/<repo>/… tool such as pkl-gen-go
    • github-releases / github-tags: owner/repo
    • anything else: None

    Groups holds the static membership table, built from extraction.

  • Evaluator::new(config, Context { locked_workflows, dependencies }): the evaluator now receives the repository's extracted dependencies. Both real callers pass them (engine lookup and plan/batch_plan); tests keep Default::default().

  • Effective::apply keeps Some(""), so an explicit "no group" can be told apart from "unset". proposal() still drops "" from Update.group.

  • effective() = rules (ruled()), then, if no group is set, the built-in repository group. crates/update grouping code is unchanged; the group shows up in Update.group like any other group.

  • Dogfood: the hk rule in patchula.pkl is removed. Its open patchula/hk PR will close and patchula/jdx-hk will open once.

  • Docs: PatchulaConfig.pkl Policy and group docs, guide/managers.md (new Pkl subsection), guide/pull-requests.md branch table, guide/configuration.md, renovate/compatibility.md pkl row, renovate/departures.md (new entry and the explicit-defaults line).

  • State versions: extract/files 22, config/config-files 19, catalog/catalog-controls 23 (plan.rs, config, PatchulaConfig.pkl). changelog 12, because github_segment (made private in refactor(manager): simplify the role taxonomy, proposal facts and registry readers #355) is exported again from pkl_package.rs for the owner/repo check.

Membership

Repository R forms a group only when the repository declares at least one pkl-source dependency of R and at least one non-pkl dependency of R. So pkl-pantry packages alone stay separate, and so do a Go module and its mise tool without a Pkl package. For a given update kind, a dependency joins only when both of these hold:

  • it is not ignored, is active and has no group from defaults or rules ("" included);
  • at least one partner on the other side (Pkl vs non-Pkl) meets the same conditions and has the same commitPrefix.

So group = "" on either side is a complete off switch, and the default never triggers the "conflicting commitPrefix" hold. Pins never group (existing plan rule). Majors go to the major- branch. A user group literally named jdx/hk shares the branch; the docs give that as the way to add something to the group.

Security properties and how they hold

  • Explicit group always wins. The built-in group is a fallback applied only when policy.group is None after defaults and rules. Some("") now survives apply, so defaults.group = "", a rule's group = "" and the reference-data rule all keep a dependency out.
  • Advisory fixes get their own PR. I checked the order: security.apply is layered by its callers (secure(), the fix paths) after effective(), so its group = "" overrides the fallback. Test: an_advisory_fix_keeps_its_own_pull_request.
  • Identity never comes from a registry response, and only for public dependencies. declared_repository returns None unless dep.id().is_public(), and it only parses the declaration text or the compiled-in mise registry snapshot. It reads no npm/PyPI/crates metadata, no Go vanity page, no image labels, no mise release_url, and not notes::source_repository. A registry-qualified pkl dependency (for example from a custom extractor's registry) that claims jdx/hk does not join (tests at both levels). A mise tool with options (which could point anywhere) does not join.

Tests

  • crates/lookup/src/repository.rs: table test for declared_repository, plus registry-qualified dependencies naming nothing.
  • crates/lookup/tests/repository_groups.rs covers:
    • hk pair; pkl-go pair; pkl-gen-go via go:
    • pantry-only, and Go+mise without Pkl: no group
    • "" on either side frees both
    • defaults.group empty and non-empty wins
    • a member grouped elsewhere leaves its partner alone
    • a user group named jdx/hk joins
    • an inactive or ignored partner leaves no group
    • a registry-qualified Pkl package does not join
    • a mise tool with options does not join
    • mismatched commitPrefix does not join
    • groups are decided per update kind
    • an advisory fix stays alone
  • crates/update/src/plan/planning.rs: hk mise tool + hk Pkl package give one plan on patchula/jdx-hk titled chore(deps): update hk to 2.11.0.
  • Corpus: mise run corpus:snapshot leaves both TSVs unchanged (the corpus evaluates single dependencies with no repository context).

Deviations from the design

  • Instead of adding a positional dependencies argument, Evaluator::new's second parameter became a Context struct (locked_workflows + dependencies). This keeps the ~110 test call sites on Default::default().
  • pkl-gen-go as a mise go:github.com/apple/pkl-go/cmd/pkl-gen-go tool is supported; the design left it optional.
  • The plan-side evaluator gets the dependencies too, for consistency. It doesn't read groups (grouping comes from Update.group set at lookup).

Follow-ups

  • pkl-swift is out of scope: there is no Swift manager.
  • After merge, the dogfood run closes patchula/hk and opens patchula/jdx-hk once.

View guided diff Turn on auto-fix

After review

An adversarial review found six defects; all are fixed in 15be858.

  1. commitPrefix holds and branch churn. The planner puts minor, patch and digest updates on one non-major branch, so deciding groups per update kind could still produce "group has conflicting commitPrefix policies". Two ways: a patch-only prefix rule, or two prefixes within one kind. It could also move a member between patchula/jdx-hk and patchula/hk-2.x from patch to minor. Groups are now keyed by (repository, track), where the track is majors, or minors+patches+digests.
    • A dependency is a member only if it is a candidate (not ignored, active, no explicit group) for every kind on the track.
    • The group forms only if both sides (Pkl and non-Pkl) have members, and all members share exactly one commitPrefix across the track's kinds.
    • Membership doesn't depend on which kind an update happens to be, so the branch stays the same from patch to minor.
    • Tests: lookup tests for the cross-kind and the two-prefix scenarios and for whole-track membership; a planning test showing no Blocked hold and two separate branches.
  2. Pins never group. Update::Pin gets no built-in group. Tests: a mise latest pin and an unpinned github-tags action digest pin next to hk's Pkl package.
  3. mise_repository:
    • A tool failing patchula_mise::check names no repository. Such a tool is never looked up, and its options may have been dropped while reading it.
    • The derived owner/repo goes through the same github_segment validation as the other sources.
    • Explicit github:/ubi: backends must name exactly owner/repo.
    • Table tests cover github:jdx/hk/sub@1, go:…/pkl-gen-go@1, github:jdx/.., github:jdx/hk?x=1, github:jdx/hk/sub, ubi:jdx/hk/sub and -hk.
  4. Cache versions. catalog-controls is the only code-versioned state whose stored keys depend on branch identity. Its sources now also list crates/mise/src/ and crates/mise/registry.json; crates/config/src/ (pkl_package) and crates/lookup/src/ (repository.rs) were already there. Rehashed. All bumped rows stay one above main.
  5. Report-only dependencies (Edits::ReportOnly, i.e. Copier) are never candidates, so they count as no partner.
  6. Docs:
    • the grouping subsection now sits at the end of ## Pkl;
    • the example rule's note matches its selector;
    • the mise row tells explicit backends apart from registry shorthands;
    • it now describes per-track membership and pins;
    • reference/report.md Update.group mentions the built-in group;
    • getting-started and renovate/migrating.md note the exception to "one PR per update".

crates/update now enables lookup's testing feature in dev-dependencies for the planning tests. Clippy is clean across the workspace; the lookup, update, engine, config and mise tests pass, as do parity and the docs build.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
count-patchula 15be858 Commit Preview URL

Branch Preview URL
Nov 22 2026, 09:38 PM

…ncies

A Pkl package and the other dependencies its GitHub repository ships (the
hk mise tool and hk's Pkl package; the pkl-go Go module and pkl.golang)
now share the group `owner/repo` when nothing set a group for them, on the
branch `patchula/jdx-hk`.

The repository comes only from declarations, for public dependencies:
Pkl package URIs, github.com Go module paths, mise tools without options
whose registry backends name one repository (or `go:github.com/...`), and
github-releases/github-tags packages. A group forms only when a repository
declares both a Pkl package and another dependency of that repository, and
a dependency joins only when a partner on the other side is active, has no
group set and shares its commitPrefix. An explicit group, `""` included,
always wins, and security.apply keeps advisory fixes in their own PR.

The dogfood hk rule is removed in favour of the built-in group.
@sweepies
sweepies force-pushed the feat/pkl-repo-groups branch from 2142044 to 352d71e Compare November 22, 2026 21:03
… pins

The planner puts minors, patches and digests on one branch, so a group
decided per update kind could still hold that branch for conflicting
commit prefixes, or move a member between branches from patch to minor.
Groups are now keyed by track (majors, or minors/patches/digests): a
dependency is a member only when it is a candidate for every kind on the
track, and the group forms only when both sides have members that all
share one commit prefix. Pins never group.

A mise tool the Count refuses to look up names no repository, and the
derived owner/repo goes through the same validation as the other sources;
explicit github:/ubi: backends must name exactly owner/repo. Report-only
dependencies (Copier) are no partners. catalog-controls now versions the
mise sources the grouping reads.
@sweepies
sweepies merged commit f05b39b into main Nov 22, 2026
13 checks passed
@sweepies
sweepies deleted the feat/pkl-repo-groups branch November 22, 2026 21:49
@sweepies-ops sweepies-ops Bot mentioned this pull request Nov 22, 2026
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