Skip to content

Add cirrus plan resolve and the requirePackages step: resolve a plan artifact from a checkout, and check an org before installing - #22

Merged
cesarParra merged 5 commits into
mainfrom
plan-resolve
Sep 14, 2026
Merged

cesarParra merged 5 commits into
mainfrom
plan-resolve

Conversation

@cesarParra

Copy link
Copy Markdown
Owner

Two commands' worth of change, both aimed at the same gap: publishing a version meant hand-writing
the plan artifact and copying 04t ids between files.

cirrus plan resolve

Reads a checkout and writes the artifact. No org, no Dev Hub, no network.

cirrus plan resolve                              # in a checkout
cirrus plan resolve --plan install -o plan.json
cirrus plan resolve --list                       # what this repository offers

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.yaml at all to be
publishable. The new plans: section 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 instead of picking one quietly.

Latest is compared as a version, 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. Publishing the wrong package version is the one
mistake here that reaches every customer at once.

requirePackages

A 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 PackageInstallRequest whose dependencies are missing and reports ERROR
minutes 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.

{"event":"step.failed","step":0,"message":"This org is not ready: Spark, Engage, Charge, Assemble and Fonteva Services are not installed."}

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 missing
dependency, the unsupported edition — went into detail, which nothing surfaced. It is in the
message now, for both the refused request and the failed one.

Verified against real repositories and real orgs

  • 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 and gained no file, emits a check over its
    five Fonteva dependencies and installs only NeverLapse.
  • That artifact installed into a real Fonteva org — the check passed in 2s naming all five — and was
    refused in seconds by a scratch org without Fonteva, with no PackageInstallRequest made.

220 tests, dart analyze clean. The schema and README are updated; the existing test that holds the
schema 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.

… 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.
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.
@cesarParra
cesarParra merged commit eb087b6 into main Sep 14, 2026
2 checks passed
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