Repository navigation
Description
Problem
In standing-PR mode, an internal dependency that a selected package needs can be unticked on its own. The dependent then publishes against a version of the dependency that was never released, and nothing warns.
The pieces that combine to cause it:
- Prerequisites are only resolved when there are explicit targets:
resolvePrerequisites(packages/core/src/prerequisites.ts) runs from the targeted set.standing-pr.ts:834notes thatrelease:with-prerequisiteshas no effect without a target. On an ordinary standing-PR run no update getsrole: 'prerequisite', so a changed dependency renders as its own orphan row instead of nesting under the unit that needs it. - An orphan untick is honoured as-is. The held-back package is passed to the write step as
exclude(standing-pr.ts:1375), so it isn't bumped at all. - Dependent requirements are only raised when the dependency bumps, so an excluded dependency leaves its dependents' requirement where it was.
selectionWarnings(selection-region.ts:653-658) has exactly the right message ("unticking it publishes it against an unreleased dependency"), but it keys offupdate.prerequisiteOf, which is only set on the targeted path. So it never fires here.
Concrete cases
From goosewobbler/zubridge (releasekit.config.jsonc): primary @zubridge/tauri in a fixed group with tauri-plugin-zubridge (cargo), where the plugin has a versioned path dependency on zubridge-core, an ungrouped crate.
- Cargo. Core and the plugin both have changes. Untick core and leave Tauri ticked. The plugin is published still requiring the old core. CI is green because the workspace build resolves core by path, but downstream builds get the old crate from crates.io and fail to compile if the plugin uses anything new. If core has never been published, crates.io rejects the plugin outright, after the rest of the release may already have gone out.
- npm.
@zubridge/taurihas@zubridge/typesand@zubridge/utilsas runtimedependencies(workspace:*). Unticktypesand leave Tauri ticked. Tauri publishes withworkspace:*rewritten to the oldtypesversion.
The realistic way to hit this is holding back a shared dependency's unfinished work (say, a second consumer of the crate is mid-development) while shipping a fix to one of its existing dependents.
Expected
In standing-PR mode with primaryPackages, a changed internal dependency of a releasing unit can't be held back while that unit releases. That should hold for npm (dependencies + peerDependencies, matching workspaceGraph.ts) and for Cargo path dependencies.
Proposed fix
Resolve prerequisites for standing-PR runs too, using each releasing primary unit's members as the targets. Changed dependencies then nest under the unit as read-only ↳ prerequisite rows through the existing computeHierarchy / cascadeDeselection path:
- Shared dependencies are already reference-counted: a child releases while any owner does, and is held back only when every owner is. So a crate shared by two units works without new logic.
- Unticking the owning primary still cascades to the dependency, which is the coherent way to hold it back.
Things to check while doing it:
- Group members.
prerequisiteOfrecords the group-expanded target that pulls the dependency in (heretauri-plugin-zubridge, not the primary@zubridge/tauri), whilechildrenOfmatchesprerequisiteOf.includes(p)against the primary. Match against the unit's members, or a dependency of a non-primary group member stays an orphan. - Dependencies that are themselves primaries. A dependency that is a declared primary stays a top-level peer (
computeHierarchyalready excludes declared primaries from children). Unticking it while a dependent unit releases is the same bug, so it either needs theselectionWarningswarning to fire or the untick to be refused. - Behaviour change. Packages that today get their own orphan row (in zubridge,
typesandutils) start nesting under the unit that depends on them at runtime, and release only when that unit does. That's correct, but it should go in the changelog. A package that only lists them indevDependencies(zubridge's Electron bundles them) isn't an owner, which is what we want. - Warning as backstop. If any path can still leave a dependency held back while a dependent releases,
selectionWarningsshould catch it. That means computing dependents from the graph rather than fromprerequisiteOf.
Tests: Cargo path dependency of a group member, npm runtime dependency of a primary, a dependency shared by two primaries (one ticked, one not), and the dependency-is-a-primary case.
Alternatives considered
- Leaving it as a documented rule ("don't untick X while Y releases"). That's what zubridge does today, and it depends on whoever edits the standing PR knowing the rule.
- A per-repo pre-publish guard in the release workflow. It works, but every consumer would have to write their own, and releasekit already has the graph and the hierarchy.
Related: #657 (lockstep groups split under streamlined selection). It's the same class of problem: a selection that ships an incoherent set.
Activity