~/bend-docscommunity

src/lock/plan.bend fails

raw source on the hub · import ezx@1.5.0.0/src/lock/plan.bend as Plan

lock/plan: ez lock as a pure planner. It reads a World (lock/world.bend) and returns either the questions it still needs answered (step) or a Plan: the effects to run and how the command ends (plan). The interpreter (lock/run.bend) loops on step, answering each question by IO, until nothing is left to ask, then executes the plan.

Under --upgrade the upgrade's questions come first (lock/up.bend): what the remote says each selected pin moves to. Once they are answered, the lock is planned exactly as a plain lock is, over the ledger the upgrade leaves rather than ez.toml as it was, and the upgrade's writes go around it in one plan: trees laid, ez.toml written once, .gitignore, the rewritten sources, the committed trees that moved removed, and the lock last.

wants only scans the answers it has for imports; plan checks every package once, so a lock pays for each file's SHA-256 once however deep the import graph is. A package that fails a check may make wants ask for more than the lock needs, which costs a fetch and changes nothing, since plan refuses it.

A named import, import <name>@<version>/..., is a hub package too (EZ-HUB-3). One the project's own sources import must be a dependency ez.toml records by that name, and resolves to the hash ez.toml records beside it; one a package imports resolves the same way when ez.toml names it, then by the lock being rewritten, and only then by asking the hub, once (EZ-HUB-2). The package it resolves to is walked and checked like any hub package, and the lock records every name it resolved under [names].

What a lock decides depends on a World only through W.inputs: the ledger it is made from, the upgrade's refusal if any, the committed sources, and the verdict on every answer. How a tree arrived only decides whether it is laid under BEND_LIB for the build that follows, which is a cache and not something the lock records.

8 imports
import Base
import ./world.bend as W
import ./up.bend as Up
import ./lock.bend as L
import ../ledger/manifest.bend as M
import ../pkg/pkg.bend as K
import ../pkg/path.bend as Path
import ../share/pin.bend as Pin