Repository navigation
Add cirrus plan resolve and the requirePackages step: resolve a plan artifact from a checkout, and check an org before installing - #22
Merged
Conversation
… said Two halves of one thing: what a customer is told when an install cannot proceed. `requirePackages` is a step kind that checks the org for packages that have to be there already, and never installs them. It answers from the two queries the already-installed check was making anyway, so it costs no new API surface. The case it exists for is a product depending on a third-party stack. Salesforce *accepts* a `PackageInstallRequest` whose dependencies are missing and only reports ERROR minutes later, so a customer whose org was never eligible watched a progress bar first and learned why second. Worse, installing that dependency ourselves is not the fix: a pinned version we do not own becomes an upgrade of somebody else's licensed package inside a customer's production org. One step covering several packages rather than one each, because five checks in front of a one-step product read as a six-step install. The message names each package the way Salesforce does, which is what the admin reading it sees under Installed Packages, and falls back to the id when the org will not say. A missing name never fails the step; the check answering wrongly is the only outcome worse than it not answering. The second half: a failing install said `Prose failed to install.` and nothing else. Salesforce's own text - the part naming the missing dependency, the unsupported edition, the privilege that was short - was put in `detail`, which a caller reading the protocol has no reason to surface, and the step message a customer does see said only that something went wrong. It carries that text now, for both the refused request and the failed one, and keeps its own words for when Salesforce gave none.
Publishing a version meant hand-writing the artifact and copying `04t` ids between files, which is the one mistake in this system that reaches every customer at once. `plan resolve` reads the checkout and writes the artifact: no org, no Dev Hub, no network, so it runs anywhere the repository can be cloned. Latest is compared as a version and not as a string. Prose's aliases hold both `Prose@0.1.0-4` and `Prose@0.1.0-33`, and lexical order picks `-4` - a wrong package version, published silently, which is the failure this command exists to prevent rather than to have. **A repository that names no plans has one derived**: install the package it builds, require everything that package depends on. That is safe by construction, because a derived plan can never install a package the repository did not build, and it means a repository needs no cirrus.yaml at all to be publishable. `plans:` is for when that reading is wrong - most often a dependency you do build and want installed. `--list` reports which of the two a repository is without resolving anything, so a caller can put the choice in front of somebody before it is made rather than picking one quietly. `resolvedFrom` records the repo, the commit and which plan was used, or that it was derived, so "why does this install check for Fonteva" is answerable from the artifact alone a year later. Verified against both real repositories. Given a `plans:` block, resolving prose emits the two steps already installed in production, byte for byte. Resolving neverlapse-app, which has no cirrus.yaml, emits a check over its five Fonteva dependencies and installs only NeverLapse - and that artifact then installed into a real Fonteva org, and was refused in seconds by an org without it. Not here, and deliberately: the Dev Hub query that would tell a promoted version from a beta. Resolve picks the highest built version, which is right while a product has no released version to pick, and wrong the moment one does.
cesarParra
force-pushed
the
plan-resolve
branch
from
September 14, 2026 00:11
d753493 to
47e5b60
Compare
Ten findings, of which the first two would have reached a customer. **A refused query was read as a missing package.** The installed-packages lookup returned null both for "the org has no such row" and for "the query was refused", and `requirePackages` put that null straight into the absent list. A transient 500 or a governor limit therefore failed an install with "Fonteva is not installed" against an org that has Fonteva - and the step already kept a separate `unanswerable` bucket for exactly this, while `_installedVersion`'s own comment said a broken query is not evidence of absence. The query helper now says whether it was answered, and only a real empty result counts as absent. **A derived plan required dependencies of packages it does not install.** Dependencies were collected from every `packageDirectories` entry rather than the one whose package is being installed, so a repository with a second directory for an internal test package would require that package's dependencies from every customer - failing installs on something the shipped product never touches. Four more where cirrus could produce a plan cirrus cannot run, each discovered at the customer's install rather than at resolve. `packages:` entries were never checked to be `04t` ids, and neither was whatever a packageAlias happened to map to; both are parsed at the boundary now. An artifact whose version could not be determined was published with `"version": ""` rather than refused. The schema's `installPackage` branch forbade `requirePackages` but not `packages`, so an editor blessed a step the parser throws on. The rest: plan names skipped the command-line name check that commands, flows and orgs get, which is the drift the schema-pinning tests exist to catch. `requirePackages` never passed the step's installation key, so a key-protected required package answered nothing and reported as unanswerable even when the org had it. And the package name was looked up on the satisfied path too - a third of the API calls on the happy path, for a message nobody sees. Re-verified against both orgs: the Fonteva org passes the check and reports NeverLapse already installed, and a scratch org without Fonteva is still refused in seconds. The prose golden is still byte-identical to what is in production.
Bumped with the script, so pubspec.yaml, package.json and version.dart agree and the binary reports the version it is.
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.
Two commands' worth of change, both aimed at the same gap: publishing a version meant hand-writing
the plan artifact and copying
04tids between files.cirrus plan resolveReads a checkout and writes the artifact. No org, no Dev Hub, no network.
A repository that names no plans has one derived: install the package it builds, require
everything that package depends on. Safe by construction — a derived plan can never install a
package the repository did not build — so a repository needs no
cirrus.yamlat all to bepublishable. The new
plans:section is for when that reading is wrong, most often a dependencyyou do build and want installed.
--listreports which of the two a repository is without resolving anything, so a caller can putthe choice in front of somebody instead of picking one quietly.
Latest is compared as a version, not as a string: Prose's aliases hold both
Prose@0.1.0-4andProse@0.1.0-33, and lexical order picks-4. Publishing the wrong package version is the onemistake here that reaches every customer at once.
requirePackagesA step kind that checks the org for packages that must already be there, and never installs them.
It answers from the two queries the already-installed check was making anyway.
Salesforce accepts a
PackageInstallRequestwhose dependencies are missing and reportsERRORminutes later, so a customer whose org was never eligible watched a progress bar first and learned
why second. Installing the dependency ourselves is not the fix: a pinned version we do not own
becomes an upgrade of somebody else's licensed package inside a customer's org.
Names come from the org, so they match what an admin sees under Installed Packages, and fall back
to the id when the org will not say.
And a failing install now says what Salesforce said
Prose failed to install.was the whole message a customer saw. Salesforce's own text — the missingdependency, the unsupported edition — went into
detail, which nothing surfaced. It is in themessage now, for both the refused request and the failed one.
Verified against real repositories and real orgs
plans:block, resolvingproseemits the two steps already installed in production,byte for byte.
neverlapse-app, which has nocirrus.yamland gained no file, emits a check over itsfive Fonteva dependencies and installs only NeverLapse.
refused in seconds by a scratch org without Fonteva, with no
PackageInstallRequestmade.220 tests,
dart analyzeclean. The schema and README are updated; the existing test that holds theschema and the parser together covers the two new levels.
Not here, deliberately
The Dev Hub query that would tell a promoted version from a beta. Resolve takes the highest built
version, which is right while a product has no released version to pick and wrong the moment one
does.