carlos / platform Public

store write credential phase 2: answer Astra round 1

P1: a floor read that fails at the swap, after the early check passed,
no longer poisons the untried build. Active recovery undoes its rollback
capture; adoption under root history settles its history attempt with no
refusal. Witnesses fail the second read only, run root's resume and
retry the same build.

P2: the guard follows live-link paths through locals, aliased imports,
directory descriptors and helpers to any depth. P2: no-floor controls
for the D1 and held witnesses; the held restore is reached through a
failed second bind.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev de257ed92947d796c89aeb0b36b0baecf226a5f3 parent 55b6953
8 files changed, +755 −107
  • docs/superpowers/specs/2026-11-25-store-write-credential-design.md +34 −9
  • internal/host/consolefloor_recovery_test.go +124 −0
  • internal/host/namedrecovery_active.go +14 −1
  • internal/host/rootrollback.go +20 −0
  • internal/release/adopt.go +11 −0
  • internal/release/consolefloor_guard_test.go +444 −93
  • internal/release/consolefloor_paths_test.go +98 −4
  • internal/release/roothistory_pass.go +10 −0
diff --git a/docs/superpowers/specs/2026-11-25-store-write-credential-design.md b/docs/superpowers/specs/2026-11-25-store-write-credential-design.md
index 1d9bc1cc4..e2a8376c1 100644
--- a/docs/superpowers/specs/2026-11-25-store-write-credential-design.md
+++ b/docs/superpowers/specs/2026-11-25-store-write-credential-design.md
@@ -645,7 +645,17 @@ Paths that do not repoint, checked:
admitted rollback) runs the same build.
**What a refusal leaves.** A refused forward repoint leaves the box on what
-it runs, as §10 says. A refused rollback leaves the writer-aware build
+it runs, as §10 says, and counts as never tried (Astra phase 2 round 1,
+finding 1). Two paths ask the floor early and then again at the swap, with
+an attempt recorded in between: adoption under root history begins a
+history attempt (whose `Prepare` captures root's rollback attempt), and
+active named-unit recovery captures a rollback attempt. If the floor read
+at the swap fails after the early check passed, nothing was published, so
+adoption settles its history attempt with no refusal
+(`RootHistoryPass.abandon`) and recovery puts the rollback journal back as
+it was and drops the attempt's capability (`abandonRollbackCapture`).
+Root's resume then has nothing to settle as a recovery, and the next pass
+tries the same build. A refused rollback leaves the writer-aware build
linked and its unit down, the state a rollback that cannot repoint already
reaches (`could not roll the symlink back`); the next pass asks again, and
promoting a writer-aware build is the way out. A box already running a
@@ -655,21 +665,36 @@ what is pointed live, as §10 defines it.
**The guard.** `TestEveryRepointPassesTheConsoleFloor`
(`internal/release/consolefloor_guard_test.go`) reads every non-test Go file
in the module and fails on any use of `pointLive` outside `PointLive`, and
-on any function that names a live link (`LiveLink`, `liveDir`, `liveLink`
-or a `live` path segment) and makes, renames or replaces a link
-(`os.Symlink`, `os.Rename`, `os.Link`, their `unix` and `syscall` forms,
-`instancefs.RenameBetween*`), outside `pointLive`. Today nothing else does.
+on any call that puts a live-link path (an expression naming `LiveLink`,
+`liveDir`, `liveLink` or a `live` path segment, a local assigned from one,
+or a path derived from one by concatenation, a path call, a conversion or
+its directory's descriptor) where a link or file is written: the
+destination of `os.Symlink`, `os.Rename`, `os.Link`, their `unix` and
+`syscall` forms or `instancefs.RenameBetween*`, or a parameter of any
+module function that carries its argument to one, through any number of
+helpers (summarised to a fixpoint across the module). Imports resolve
+through their local names; calls resolve by name, a method within its
+package. `release.PointLive` is the sanctioned path. The one function it
+flags today is `instancectl`'s `ensureExe`, an isolated instance's own
+`live/` linking to the host's live link, allowed by name with that reason.
+Its self-test covers a write inline, through a local, an aliased `os`, a
+directory descriptor, a helper, a method and another package's helper.
**Witnesses**, each with a floor and a console build from before it, a
floor read that fails, and (host) a no-floor control:
`TestPointLiveIsTheConsoleFloor`, `TestAdoptionForwardFloorReadFailureRefuses`,
`TestBoxRefusesAPreFloorConsole`, `TestD1RollbackMeetsTheConsoleFloor`,
-`TestRollbackGroupMeetsTheConsoleFloor`, `TestHeldStageMeetsTheConsoleFloor`
-(release), and `TestNamedRepairMeetsTheConsoleFloor`,
+`TestRollbackGroupMeetsTheConsoleFloor`, `TestHeldStageMeetsTheConsoleFloor`,
+`TestHeldRestoreThroughPublishMeetsTheConsoleFloor` (release), and
+`TestNamedRepairMeetsTheConsoleFloor`,
`TestNamedActiveRecoveryMeetsTheConsoleFloor`,
`TestRootRollbackResumeMeetsTheConsoleFloor`,
-`TestRootHistoryRollbackMeetsTheConsoleFloor` (host). All of them fail
-with the admission disabled.
+`TestRootHistoryRollbackMeetsTheConsoleFloor` (host), each with a no-floor
+control on the same console builds. All of them fail with the admission
+disabled. `TestNamedActiveRecoveryFloorFailureAtTheSwapIsRetryable` and
+`TestAdoptionFloorFailureAtTheSwapIsRetryable` fail the floor read at the
+swap only, run root's resume, and retry the same build; both fail without
+the cleanup above.
**The session policy** (§3): the core's `WriteScope`, rendered by AWS with
`NotAction` and by MinIO with action families.
diff --git a/internal/host/consolefloor_recovery_test.go b/internal/host/consolefloor_recovery_test.go
index a7a94f946..071d1f745 100644
--- a/internal/host/consolefloor_recovery_test.go
+++ b/internal/host/consolefloor_recovery_test.go
@@ -260,3 +260,127 @@ func TestRootHistoryRollbackMeetsTheConsoleFloor(t *testing.T) {
})
}
}
+
+// consoleFloorFailsAt fails the floor's listing on exactly its nth read
+// (1-based) and on no other, so a check before an attempt passes and the
+// one at the swap fails.
+type consoleFloorFailsAt struct {
+ release.Store
+ n, reads int
+}
+
+func (f *consoleFloorFailsAt) fail(prefix string) bool {
+ if prefix != release.ConsoleStoreWritersFloorKey {
+ return false
+ }
+ f.reads++
+ return f.reads == f.n
+}
+
+func (f *consoleFloorFailsAt) List(ctx context.Context, prefix string) ([]string, error) {
+ if f.fail(prefix) {
+ return nil, os.ErrDeadlineExceeded
+ }
+ return f.Store.List(ctx, prefix)
+}
+
+func (f *consoleFloorFailsAt) ListPage(ctx context.Context, prefix, after string, limit int) ([]string, error) {
+ if f.fail(prefix) {
+ return nil, os.ErrDeadlineExceeded
+ }
+ if pl, ok := f.Store.(release.PageLister); ok {
+ return pl.ListPage(ctx, prefix, after, limit)
+ }
+ return f.Store.List(ctx, prefix)
+}
+
+// Astra phase 2 round 1, finding 1: active recovery's floor check passes,
+// the attempt is captured, and the floor read at the swap fails. Nothing
+// was published, so nothing may count as tried: no attempt is left for
+// root's resume, the resume changes nothing, and the same promotion
+// recovers on the next pass.
+func TestNamedActiveRecoveryFloorFailureAtTheSwapIsRetryable(t *testing.T) {
+ // Not parallel: signedRecoveryFixture sets the release key with t.Setenv.
+ old, aware := floorConsoles(t)
+ e, u, c, source, pub := signedRecoveryFixtureWith(t, old, aware)
+ rt, err := e.root.reg.Get(observedHost)
+ if err != nil {
+ t.Fatal(err)
+ }
+ h := seedHostRootHistory(t, *rt)
+ c.history = func() (*release.RootHistoryPass, error) { return &release.RootHistoryPass{History: h}, nil }
+ source.store = &consoleFloorFailsAt{Store: e.store, n: 2}
+ n := namedUnitRecovery{source: source, pub: pub, readLive: os.Readlink}
+ handled, err := n.recover(t.Context(), observedHost, c, func(string) string { return "5s" }, e.root.reg)
+ if live, _ := release.LiveVersion(u.opt, observedHost); !handled || !errors.Is(err, release.ErrConsoleFloor) || live != "v1" || len(u.effects) != 0 {
+ t.Fatalf("refusal at the swap: handled %v, err %v, live %q, effects %v", handled, err, live, u.effects)
+ }
+ disk, err := c.attempts()
+ if err != nil {
+ t.Fatal(err)
+ }
+ if _, err := readRollbackAttempt(disk, observedHost); !errors.Is(err, os.ErrNotExist) {
+ t.Fatalf("an attempt that never published was left for root's resume: %v", err)
+ }
+ if names, _ := disk.Names(); len(names) != 0 {
+ t.Fatalf("rollback state left behind: %v", names)
+ }
+ c.started = &sync.Map{}
+ if err := recoverRootRestarts(t.Context(), u, u.opt, func(string) string { return "5s" }, c, hostwrite.Config{}); err != nil || len(u.effects) != 0 {
+ t.Fatalf("root's resume after the refusal: %v, effects %v", err, u.effects)
+ }
+ b := release.HistoryBinding{Host: observedHost, Account: "bab", App: "console"}
+ if refs, err := h.Refusals(b); err != nil || len(refs) != 0 {
+ t.Fatalf("the untried promotion was refused: %+v, %v", refs, err)
+ }
+ // The floor reads again: the same signed head recovers.
+ source.store = e.store
+ handled, err = n.recover(t.Context(), observedHost, c, func(string) string { return "5s" }, e.root.reg)
+ if live, _ := release.LiveVersion(u.opt, observedHost); !handled || err != nil || live != "v2" || len(u.effects) != 1 {
+ t.Fatalf("retry: handled %v, err %v, live %q, effects %v", handled, err, live, u.effects)
+ }
+}
+
+// The same for adoption under root history: the early floor check passes,
+// the history attempt is begun (and root's rollback attempt captured by its
+// Prepare), and the floor read at the swap fails. The history attempt is
+// settled with no refusal, root's resume changes nothing, and the next pass
+// adopts the same build.
+func TestAdoptionFloorFailureAtTheSwapIsRetryable(t *testing.T) {
+ t.Parallel()
+ old, aware := floorConsoles(t)
+ e, rt, u, c, pub := plan14AdoptionFixtureWith(t, old, aware)
+ h := seedHostRootHistory(t, rt)
+ b := release.HistoryBinding{Host: rt.Host, Account: rt.Account, App: rt.App}
+ // This route has run the console (D2's program history).
+ if err := h.RecordInstalledProgram(b, release.ConsoleProgram); err != nil {
+ t.Fatal(err)
+ }
+ deps := boundRootHistory(h, c.resolve, e.root.obs)
+ pass := func(s release.Store) error {
+ forward := rootRestartRouteWith(e.root.reg, u, u.opt, func(string) string { return "5s" }, e.root.obs.recordSettled(e.bake), c)
+ return release.Pass(context.Background(), e.root.reg, s, pub, u.opt, forward,
+ release.BakeDir(e.bake), release.WithRootHistory(deps), release.WithRestartFailurePropagation(),
+ release.WithRollbackRestart(rollbackUnitRestart(e.root.reg, u, u.opt, func(string) string { return "5s" }, c)))
+ }
+ _ = pass(&consoleFloorFailsAt{Store: e.store, n: 2})
+ if live, _ := release.LiveVersion(u.opt, rt.Host); live != "v1" || len(u.effects) != 0 {
+ t.Fatalf("refusal at the swap: live %q, effects %v", live, u.effects)
+ }
+ if p, err := h.Pending(b); err != nil || p != nil {
+ t.Fatalf("the history attempt was left pending: %+v, %v", p, err)
+ }
+ c.started = &sync.Map{}
+ if err := recoverRootRestarts(context.Background(), u, u.opt, func(string) string { return "5s" }, c, hostwrite.Config{}); err != nil || len(u.effects) != 0 {
+ t.Fatalf("root's resume after the refusal: %v, effects %v", err, u.effects)
+ }
+ if refs, err := h.Refusals(b); err != nil || len(refs) != 0 {
+ t.Fatalf("the untried build was refused: %+v, %v", refs, err)
+ }
+ if err := pass(e.store); err != nil {
+ t.Fatalf("retry: %v", err)
+ }
+ if live, _ := release.LiveVersion(u.opt, rt.Host); live != "v2" || len(u.effects) != 1 {
+ t.Fatalf("retry: live %q, effects %v", live, u.effects)
+ }
+}
diff --git a/internal/host/namedrecovery_active.go b/internal/host/namedrecovery_active.go
index 2bba0c32b..68a8d5bca 100644
--- a/internal/host/namedrecovery_active.go
+++ b/internal/host/namedrecovery_active.go
@@ -186,7 +186,12 @@ func (n namedUnitRecovery) recover(ctx context.Context, host string, c rootResta
_ = c.settleHistory(ctx, *superseded, superseded.Recovering)
}
}
- var err error
+ journal, err := s.Read(rollbackJournalKey(host))
+ if errors.Is(err, os.ErrNotExist) {
+ journal = nil
+ } else if err != nil {
+ return err
+ }
attempt, err = captureRollback(s, old, c.now(), unitSettleTimeout(getenv), target, id, historyRollbackLink{
Binding: release.HistoryBinding{Host: host, Account: rec.Account, App: rec.App},
Attempt: release.HistoryAttempt{ID: "signed-recovery", Source: old.Source, Version: pointer.Version, SHA256: digest, Platform: release.AdoptPlatform(), Started: c.now().UTC(), PromotedAt: pointer.PromotedAt}, Independent: true,
@@ -195,6 +200,14 @@ func (n namedUnitRecovery) recover(ctx context.Context, host string, c rootResta
return err
}
if err := release.PointLive(ctx, n.source.store, n.source.optDir, host, rec.Account, pointer.Version, rec.App); err != nil {
+ if errors.Is(err, release.ErrConsoleFloor) {
+ // The floor refused at the swap (a read that failed since
+ // the check above): nothing was published, so the attempt
+ // never ran. Undo the capture, or root's resume would settle
+ // it as a recovery onto the build still running and block
+ // this promotion for good (Astra phase 2 round 1).
+ return errors.Join(err, abandonRollbackCapture(s, attempt, journal))
+ }
return err
}
dir, err := os.Open(filepath.Dir(live))
diff --git a/internal/host/rootrollback.go b/internal/host/rootrollback.go
index 1aab3ac18..f4cf99543 100644
--- a/internal/host/rootrollback.go
+++ b/internal/host/rootrollback.go
@@ -177,6 +177,26 @@ func captureRollback(s rootstate.Store, b proofBinding, now time.Time, timeout t
return a, nil
}
+// abandonRollbackCapture undoes captureRollback for an attempt that never
+// published anything: the journal goes back to journal, what it held just
+// before the capture (nil: it held nothing), and the attempt's capability
+// is removed. Only for a refusal known to precede every effect.
+func abandonRollbackCapture(s rootstate.Store, a rollbackAttempt, journal []byte) error {
+ var err error
+ if journal == nil {
+ err = s.Remove(rollbackJournalKey(a.Host))
+ } else {
+ err = s.Write(rollbackJournalKey(a.Host), journal)
+ }
+ if err != nil && !errors.Is(err, os.ErrNotExist) {
+ return err
+ }
+ if err := s.Remove(rollbackCapabilityKey(a.Host, a.ID)); err != nil && !errors.Is(err, os.ErrNotExist) {
+ return err
+ }
+ return nil
+}
+
func loadRollback(s rootstate.Store, host string, now time.Time) (rollbackAttempt, proofBinding, error) {
a, err := readRollbackAttempt(s, host)
if err != nil {
diff --git a/internal/release/adopt.go b/internal/release/adopt.go
index 14fc5551d..e2459bcdb 100644
--- a/internal/release/adopt.go
+++ b/internal/release/adopt.go
@@ -1867,6 +1867,17 @@ func adoptHost(ctx context.Context, work hostwrite.Work, reg *registry.Registry,
return nil
}); err != nil {
cfg.historyError(err)
+ // A console floor refusal at the swap (the floor read failed since
+ // the early check above) precedes every effect of this attempt:
+ // settle the history attempt begun for it with no refusal, so the
+ // build was never tried and the next pass asks again (Astra phase 2
+ // round 1).
+ if historyAttempt != "" && errors.Is(err, ErrConsoleFloor) {
+ if serr := cfg.rootHistory.abandon(ctx, rt, cfg.historySelected[rt.Host], historyAttempt); serr != nil {
+ cfg.historyError(serr)
+ fmt.Printf(" %s: settling the history attempt the console floor stopped: %v\n", rt.Host, serr)
+ }
+ }
// The symlink did not move, so the box is still serving cur — and the
// unit shape on disk is the new version's. Put the old one back, or a
// port the running binary never asked for stays publicly bound.
diff --git a/internal/release/consolefloor_guard_test.go b/internal/release/consolefloor_guard_test.go
index f62ca8a7b..c07389a06 100644
--- a/internal/release/consolefloor_guard_test.go
+++ b/internal/release/consolefloor_guard_test.go
@@ -6,6 +6,7 @@ import (
"go/token"
"io/fs"
"os"
+ "path"
"path/filepath"
"sort"
"strconv"
@@ -14,40 +15,45 @@ import (
)
// TestEveryRepointPassesTheConsoleFloor is the guard for the console floor's
-// one admission (store write credential design §12-§13, Paul's option A):
+// one admission (store write credential design §12-§14, Paul's option A):
// a live link moves only through PointLive, which asks admitConsoleFloor
// first. It reads every non-test Go file in the module and fails on
//
// - any use of pointLive, the bare swap, outside PointLive itself;
-// - any function that both names a live link (LiveLink, liveDir,
-// liveLink, or a "live" path segment) and makes, renames or replaces a
-// link or file (os.Symlink, os.Rename, os.Link, unix.Symlinkat,
-// unix.Renameat, unix.Renameat2, unix.Linkat, syscall's three,
-// instancefs.RenameBetween*), outside pointLive.
+// - any call that puts a live-link path where a link or file is made,
+// renamed or replaced: the destination of os.Symlink, os.Rename,
+// os.Link, their unix and syscall forms or instancefs.RenameBetween*,
+// or a parameter of any module function that carries its argument to
+// such a destination, directly or through further helpers.
+//
+// A live-link path is an expression that names one (LiveLink, liveDir,
+// liveLink, a "live" path segment), or a local assigned from one, or
+// anything derived from those (a temp name beside it, an open of its
+// directory). Imports are resolved through their local names, so an
+// aliased "os" is still os. Calls are resolved by name, without types: a
+// function by its package, a method by its name within the caller's
+// package. release.PointLive is the sanctioned path and never counts as a
+// writer.
//
// The compiler holds the first half for other packages (pointLive is
// unexported); this holds it for this package, and the second half is the
-// second door: a path that writes the link itself. A function the second
-// rule flags that does not move a route's live link goes in linkWritersNotRepoints
-// with the reason.
+// second door: a path that writes the link itself or hands it to a helper
+// that does. A call the second rule flags that does not move a route's
+// live link goes in linkWritersNotRepoints with the reason.
func TestEveryRepointPassesTheConsoleFloor(t *testing.T) {
root, err := filepath.Abs("../..")
if err != nil {
t.Fatal(err)
}
- if _, err := os.Stat(filepath.Join(root, "go.mod")); err != nil {
- t.Fatalf("module root not found at %s: %v", root, err)
- }
- var offences []string
- seen := map[string]bool{}
- files := 0
- err = filepath.WalkDir(root, func(path string, d fs.DirEntry, err error) error {
+ mod := modulePath(t, root)
+ var files []guardFile
+ err = filepath.WalkDir(root, func(p string, d fs.DirEntry, err error) error {
if err != nil {
return err
}
name := d.Name()
if d.IsDir() {
- if path != root && (strings.HasPrefix(name, ".") || name == "testdata" || name == "vendor" || name == "node_modules") {
+ if p != root && (strings.HasPrefix(name, ".") || name == "testdata" || name == "vendor" || name == "node_modules") {
return filepath.SkipDir
}
return nil
@@ -55,27 +61,33 @@ func TestEveryRepointPassesTheConsoleFloor(t *testing.T) {
if !strings.HasSuffix(name, ".go") || strings.HasSuffix(name, "_test.go") {
return nil
}
- rel, _ := filepath.Rel(root, path)
+ rel, _ := filepath.Rel(root, p)
rel = filepath.ToSlash(rel)
- f, err := parser.ParseFile(token.NewFileSet(), path, nil, parser.SkipObjectResolution)
+ f, err := parser.ParseFile(token.NewFileSet(), p, nil, parser.SkipObjectResolution)
if err != nil {
return err
}
- files++
- for _, o := range repointOffences(rel, f) {
- if reason, ok := linkWritersNotRepoints[o.key]; ok && reason != "" {
- seen[o.key] = true
- continue
- }
- offences = append(offences, o.String())
+ pkg := mod
+ if dir := path.Dir(rel); dir != "." {
+ pkg = mod + "/" + dir
}
+ files = append(files, guardFile{rel: rel, pkg: pkg, file: f})
return nil
})
if err != nil {
t.Fatal(err)
}
- if files < 1000 {
- t.Fatalf("scanned only %d Go files under %s; the walk is not seeing the module", files, root)
+ if len(files) < 1000 {
+ t.Fatalf("scanned only %d Go files under %s; the walk is not seeing the module", len(files), root)
+ }
+ seen := map[string]bool{}
+ var offences []string
+ for _, o := range repointOffences(mod, files) {
+ if reason, ok := linkWritersNotRepoints[o.key]; ok && reason != "" {
+ seen[o.key] = true
+ continue
+ }
+ offences = append(offences, o.String())
}
sort.Strings(offences)
for _, o := range offences {
@@ -83,14 +95,37 @@ func TestEveryRepointPassesTheConsoleFloor(t *testing.T) {
}
for key := range linkWritersNotRepoints {
if !seen[key] {
- t.Errorf("linkWritersNotRepoints names %s, which no longer writes links beside a live-link name; remove it", key)
+ t.Errorf("linkWritersNotRepoints names %s, which no longer reaches a link writer beside a live-link name; remove it", key)
}
}
}
// linkWritersNotRepoints are functions the second rule flags that do not
-// move a route's live link, each with why. Empty today.
-var linkWritersNotRepoints = map[string]string{}
+// move a route's live link, each with why.
+var linkWritersNotRepoints = map[string]string{
+ "internal/instancectl/hardening.go:ensureExe": "an isolated instance's own live/<name> -> ../app, and app -> the host's " +
+ "live link (target), never a build: inside the namespace it follows whatever PointLive set",
+}
+
+func modulePath(t *testing.T, root string) string {
+ t.Helper()
+ b, err := os.ReadFile(filepath.Join(root, "go.mod"))
+ if err != nil {
+ t.Fatalf("module root not found at %s: %v", root, err)
+ }
+ for _, line := range strings.Split(string(b), "\n") {
+ if m, ok := strings.CutPrefix(strings.TrimSpace(line), "module "); ok {
+ return strings.TrimSpace(m)
+ }
+ }
+ t.Fatal("go.mod names no module")
+ return ""
+}
+
+type guardFile struct {
+ rel, pkg string
+ file *ast.File
+}
type repointOffence struct {
key, why string
@@ -98,59 +133,285 @@ type repointOffence struct {
func (o repointOffence) String() string { return o.key + ": " + o.why }
-// linkWriters are the calls that make, rename or replace a link or file.
-var linkWriters = map[string]bool{
- "os.Symlink": true, "os.Rename": true, "os.Link": true,
- "unix.Symlinkat": true, "unix.Renameat": true, "unix.Renameat2": true, "unix.Linkat": true,
- "syscall.Symlink": true, "syscall.Rename": true, "syscall.Link": true,
- "instancefs.RenameBetween": true, "instancefs.RenameBetweenNoReplace": true,
+// linkWriters are the primitive calls that make, rename or replace a link
+// or file, by import path and name.
+func linkWriters(mod string) map[string]bool {
+ return map[string]bool{
+ "os.Symlink": true, "os.Rename": true, "os.Link": true,
+ "golang.org/x/sys/unix.Symlinkat": true, "golang.org/x/sys/unix.Renameat": true,
+ "golang.org/x/sys/unix.Renameat2": true, "golang.org/x/sys/unix.Linkat": true,
+ "syscall.Symlink": true, "syscall.Rename": true, "syscall.Link": true,
+ mod + "/internal/instancefs.RenameBetween": true, mod + "/internal/instancefs.RenameBetweenNoReplace": true,
+ }
}
// liveNames are the identifiers that name a route's live link or its
// directory.
var liveNames = map[string]bool{"LiveLink": true, "liveDir": true, "liveLink": true}
-func repointOffences(rel string, f *ast.File) []repointOffence {
- var out []repointOffence
- for _, decl := range f.Decls {
- fn, ok := decl.(*ast.FuncDecl)
- if !ok || fn.Body == nil {
- continue
+// writeDests are the primitive writers and which of their arguments is a
+// destination: the path a link or file appears at.
+func writeDests(mod string) map[string][]int {
+ return map[string][]int{
+ "os.Symlink": {1}, "os.Rename": {1}, "os.Link": {1},
+ "golang.org/x/sys/unix.Symlinkat": {1, 2}, "golang.org/x/sys/unix.Renameat": {2, 3},
+ "golang.org/x/sys/unix.Renameat2": {2, 3}, "golang.org/x/sys/unix.Linkat": {2, 3},
+ "syscall.Symlink": {1}, "syscall.Rename": {1}, "syscall.Link": {1},
+ mod + "/internal/instancefs.RenameBetween": {2, 3}, mod + "/internal/instancefs.RenameBetweenNoReplace": {2, 3},
+ }
+}
+
+type guardFunc struct {
+ where string // rel:Name, the offence key
+ key string // pkg.Name, or pkg.*.Name for a method
+ pkg string
+ imports map[string]string
+ params []string
+ body *ast.BlockStmt
+ paths map[string]bool
+}
+
+// callee resolves a call's function to the keys it may name.
+func (g *guardFunc) callee(call *ast.CallExpr) string {
+ switch f := call.Fun.(type) {
+ case *ast.Ident:
+ return g.pkg + "." + f.Name
+ case *ast.SelectorExpr:
+ if id, ok := f.X.(*ast.Ident); ok {
+ if p, ok := g.imports[id.Name]; ok {
+ return p + "." + f.Sel.Name
+ }
+ }
+ return g.pkg + ".*." + f.Sel.Name
+ }
+ return ""
+}
+
+// pathCalls carry a path through: what they return is a path (or an open
+// file or descriptor) at or beside their arguments'.
+func pathCalls(mod string) map[string]bool {
+ return map[string]bool{
+ "path/filepath.Join": true, "path/filepath.Dir": true, "path/filepath.Clean": true, "path/filepath.Abs": true,
+ "path/filepath.FromSlash": true, "path/filepath.ToSlash": true, "path.Join": true, "path.Dir": true, "path.Clean": true,
+ "fmt.Sprintf": true, "strings.TrimSuffix": true, "strings.TrimPrefix": true, "strings.Join": true, "strings.ReplaceAll": true,
+ "os.Open": true, "os.OpenFile": true, "golang.org/x/sys/unix.Open": true, "golang.org/x/sys/unix.Openat": true,
+ mod + "/internal/safefile.OpenDir": true, mod + "/internal/safefile.OpenFile": true,
+ }
+}
+
+var conversions = map[string]bool{"string": true, "int": true, "uintptr": true, "uint32": true}
+
+// tainted reports whether e is a path tainted by taint, or, with live, a
+// live link's own path: a tainted or live name, a "live" path segment, or
+// one of those carried through concatenation, a path call, a conversion,
+// a field or index of one, or an open file's Fd. Data does not carry taint:
+// a composite literal, or any other call (a hash of the file, its resolved
+// target), is not a path at the live link.
+func (g *guardFunc) tainted(e ast.Expr, taint map[string]bool, live bool) bool {
+ switch x := e.(type) {
+ case *ast.Ident:
+ return taint[x.Name] || live && liveNames[x.Name]
+ case *ast.BasicLit:
+ if live && x.Kind == token.STRING {
+ if s, err := strconv.Unquote(x.Value); err == nil {
+ return s == "live" || strings.Contains(s, "/live/") || strings.HasSuffix(s, "/live")
+ }
+ }
+ case *ast.ParenExpr:
+ return g.tainted(x.X, taint, live)
+ case *ast.StarExpr:
+ return g.tainted(x.X, taint, live)
+ case *ast.UnaryExpr:
+ return g.tainted(x.X, taint, live)
+ case *ast.BinaryExpr:
+ return g.tainted(x.X, taint, live) || g.tainted(x.Y, taint, live)
+ case *ast.IndexExpr:
+ return g.tainted(x.X, taint, live)
+ case *ast.SelectorExpr:
+ return g.tainted(x.X, taint, live) || live && liveNames[x.Sel.Name]
+ case *ast.CallExpr:
+ if sel, ok := x.Fun.(*ast.SelectorExpr); ok && sel.Sel.Name == "Fd" && g.tainted(sel.X, taint, live) {
+ return true
}
- name := fn.Name.Name
- if fn.Recv != nil && len(fn.Recv.List) == 1 {
- name = recvName(fn.Recv.List[0].Type) + "." + name
+ c := g.callee(x)
+ name := c[strings.LastIndex(c, ".")+1:]
+ if live && liveNames[name] {
+ return true
}
- key := rel + ":" + name
- inRelease := f.Name.Name == "release" && rel == "internal/release/versions.go"
- var writes []string
- namesLive := false
- ast.Inspect(fn.Body, func(n ast.Node) bool {
- switch x := n.(type) {
- case *ast.Ident:
- if x.Name == "pointLive" && !(inRelease && name == "PointLive") {
- out = append(out, repointOffence{key, "uses pointLive, the swap without the console floor; call PointLive"})
- }
- if liveNames[x.Name] {
- namesLive = true
+ id, conv := x.Fun.(*ast.Ident)
+ if g.paths[c] || conv && conversions[id.Name] {
+ for _, a := range x.Args {
+ if g.tainted(a, taint, live) {
+ return true
}
- case *ast.BasicLit:
- if x.Kind == token.STRING {
- if s, err := strconv.Unquote(x.Value); err == nil && (s == "live" || strings.Contains(s, "/live/") || strings.HasSuffix(s, "/live")) {
- namesLive = true
+ }
+ }
+ }
+ return false
+}
+
+// spread grows taint through g's assignments until it stops growing: a
+// local assigned from a tainted expression is tainted.
+func (g *guardFunc) spread(taint map[string]bool, live bool) {
+ mark := func(lhs []ast.Expr) bool {
+ grew := false
+ for _, l := range lhs {
+ if id, ok := l.(*ast.Ident); ok && id.Name != "_" && !taint[id.Name] {
+ taint[id.Name], grew = true, true
+ }
+ }
+ return grew
+ }
+ for grew := true; grew; {
+ grew = false
+ ast.Inspect(g.body, func(n ast.Node) bool {
+ switch x := n.(type) {
+ case *ast.AssignStmt:
+ for _, r := range x.Rhs {
+ if g.tainted(r, taint, live) && mark(x.Lhs) {
+ grew = true
}
}
- case *ast.CallExpr:
- if sel, ok := x.Fun.(*ast.SelectorExpr); ok {
- if pkg, ok := sel.X.(*ast.Ident); ok && linkWriters[pkg.Name+"."+sel.Sel.Name] {
- writes = append(writes, pkg.Name+"."+sel.Sel.Name)
+ case *ast.ValueSpec:
+ for _, v := range x.Values {
+ if g.tainted(v, taint, live) {
+ var lhs []ast.Expr
+ for _, n := range x.Names {
+ lhs = append(lhs, n)
+ }
+ if mark(lhs) {
+ grew = true
+ }
}
}
+ case *ast.RangeStmt:
+ if g.tainted(x.X, taint, live) && mark([]ast.Expr{x.Key, x.Value}) {
+ grew = true
+ }
}
return true
})
- if namesLive && len(writes) > 0 && !(inRelease && name == "pointLive") {
- out = append(out, repointOffence{key, "names a live link and calls " + strings.Join(writes, ", ") + "; a live link moves only through release.PointLive"})
+ }
+}
+
+// sinks calls hit for every argument of a call in g, tainted by taint (and
+// live), that lands at a write destination: a primitive's, or a writer
+// parameter of a module function in writers.
+func (g *guardFunc) sinks(taint map[string]bool, live bool, prims map[string][]int, writers map[string]map[int]bool, sanctioned string, hit func(call string)) {
+ ast.Inspect(g.body, func(n ast.Node) bool {
+ call, ok := n.(*ast.CallExpr)
+ if !ok {
+ return true
+ }
+ c := g.callee(call)
+ if c == sanctioned {
+ return true
+ }
+ var dests []int
+ if d, ok := prims[c]; ok {
+ dests = d
+ }
+ for i := range writers[c] {
+ dests = append(dests, i)
+ }
+ for _, i := range dests {
+ if i < len(call.Args) && g.tainted(call.Args[i], taint, live) {
+ hit(c)
+ return true
+ }
+ }
+ return true
+ })
+}
+
+func repointOffences(mod string, files []guardFile) []repointOffence {
+ prims := writeDests(mod)
+ paths := pathCalls(mod)
+ sanctioned := mod + "/internal/release.PointLive"
+ var funcs []*guardFunc
+ for _, gf := range files {
+ imports := map[string]string{}
+ for _, im := range gf.file.Imports {
+ p, _ := strconv.Unquote(im.Path.Value)
+ name := path.Base(p)
+ if im.Name != nil {
+ name = im.Name.Name
+ }
+ imports[name] = p
+ }
+ for _, decl := range gf.file.Decls {
+ fn, ok := decl.(*ast.FuncDecl)
+ if !ok || fn.Body == nil {
+ continue
+ }
+ g := &guardFunc{pkg: gf.pkg, imports: imports, body: fn.Body, paths: paths}
+ name := fn.Name.Name
+ g.key = gf.pkg + "." + name
+ if fn.Recv != nil && len(fn.Recv.List) == 1 {
+ name = recvName(fn.Recv.List[0].Type) + "." + fn.Name.Name
+ g.key = gf.pkg + ".*." + fn.Name.Name
+ }
+ g.where = gf.rel + ":" + name
+ for _, f := range fn.Type.Params.List {
+ if len(f.Names) == 0 {
+ g.params = append(g.params, "_")
+ }
+ for _, n := range f.Names {
+ g.params = append(g.params, n.Name)
+ }
+ }
+ funcs = append(funcs, g)
+ }
+ }
+ // writers[key]: the parameters of the functions under key that reach a
+ // write destination, to a fixpoint across the module.
+ writers := map[string]map[int]bool{}
+ for grew := true; grew; {
+ grew = false
+ for _, g := range funcs {
+ if g.key == sanctioned {
+ continue
+ }
+ for i, p := range g.params {
+ if p == "_" || writers[g.key][i] {
+ continue
+ }
+ taint := map[string]bool{p: true}
+ g.spread(taint, false)
+ reached := false
+ g.sinks(taint, false, prims, writers, sanctioned, func(string) { reached = true })
+ if reached {
+ if writers[g.key] == nil {
+ writers[g.key] = map[int]bool{}
+ }
+ writers[g.key][i], grew = true, true
+ }
+ }
+ }
+ }
+ var out []repointOffence
+ for _, g := range funcs {
+ isSwap := strings.HasSuffix(g.where, "internal/release/versions.go:pointLive")
+ isGate := strings.HasSuffix(g.where, "internal/release/versions.go:PointLive")
+ bare := false
+ ast.Inspect(g.body, func(n ast.Node) bool {
+ if id, ok := n.(*ast.Ident); ok && id.Name == "pointLive" {
+ bare = true
+ }
+ return !bare
+ })
+ if bare && !isGate && !isSwap {
+ out = append(out, repointOffence{g.where, "uses pointLive, the swap without the console floor; call PointLive"})
+ }
+ if isSwap {
+ continue
+ }
+ taint := map[string]bool{}
+ g.spread(taint, true)
+ var via []string
+ g.sinks(taint, true, prims, writers, sanctioned, func(c string) { via = append(via, c) })
+ if len(via) > 0 {
+ out = append(out, repointOffence{g.where, "puts a live-link path where " + strings.Join(via, ", ") + " writes; a live link moves only through release.PointLive"})
}
}
return out
@@ -170,44 +431,134 @@ func recvName(e ast.Expr) string {
return "?"
}
-// The guard sees what it is meant to: a second writer of the live link, and
-// a use of the bare swap, in a file it has never seen.
+// The guard sees what it is meant to, in files it has never seen: a second
+// writer of the live link written inline, through a local, through an
+// aliased "os", through its directory's descriptor, through a helper in the
+// same package, through a method, and through a helper in another package;
+// and a use of the bare swap. It leaves alone PointLive's own callers,
+// writers that name no live link, and data derived from one (Astra phase 2
+// round 1, finding 2).
func TestRepointGuardCatchesASecondDoor(t *testing.T) {
- src := `package host
+ const mod = "example.com/m"
+ parse := func(rel, src string) guardFile {
+ t.Helper()
+ f, err := parser.ParseFile(token.NewFileSet(), rel, src, parser.SkipObjectResolution)
+ if err != nil {
+ t.Fatal(err)
+ }
+ return guardFile{rel: rel, pkg: mod + "/" + path.Dir(rel), file: f}
+ }
+ files := []guardFile{
+ parse("internal/host/x.go", `package host
-import "os"
+import (
+ fs "os"
+ "os"
+ "path/filepath"
+
+ "example.com/m/internal/linkutil"
+ "example.com/m/internal/release"
+ "golang.org/x/sys/unix"
+)
-func sneaky(opt, host, target string) error {
+func viaVariable(opt, host, target string) error {
link := release.LiveLink(opt, host)
- return os.Symlink(target, link)
+ tmp := link + ".tmp"
+ if err := os.Symlink(target, tmp); err != nil {
+ return err
+ }
+ return os.Rename(tmp, link)
+}
+
+func viaDirFD(opt, host, target string) error {
+ parent, err := os.Open(filepath.Dir(release.LiveLink(opt, host)))
+ if err != nil {
+ return err
+ }
+ return unix.Symlinkat(target, int(parent.Fd()), host)
+}
+
+func dataOnly(opt, host string) error {
+ row := map[string]any{"live": true}
+ _ = row
+ sum := hash(release.LiveLink(opt, host))
+ return os.Rename("/tmp/a", "/tmp/"+sum)
+}
+
+func hash(string) string { return "" }
+
+func inline(opt, host, target string) error {
+ return os.Symlink(target, release.LiveLink(opt, host))
}
func literal(opt, host, target string) error {
return os.Rename(target, opt+"/live/"+host)
}
+func aliased(opt, host, target string) error {
+ return fs.Symlink(target, release.LiveLink(opt, host))
+}
+
+func viaHelper(opt, host, target string) error {
+ return swap(target, release.LiveLink(opt, host))
+}
+
+func swap(target, link string) error {
+ tmp := link + ".tmp"
+ if err := os.Symlink(target, tmp); err != nil {
+ return err
+ }
+ return os.Rename(tmp, link)
+}
+
+type swapper struct{}
+
+func (swapper) put(target, link string) error { return swap(target, link) }
+
+func viaMethod(opt, host, target string) error {
+ return swapper{}.put(target, release.LiveLink(opt, host))
+}
+
+func viaOtherPackage(opt, host, target string) error {
+ return linkutil.Replace(target, release.LiveLink(opt, host))
+}
+
+func sanctioned(opt, host string) error {
+ link := release.LiveLink(opt, host)
+ _ = link
+ return release.PointLive(nil, nil, opt, host, "a", "v", "app")
+}
+
func harmless(a, b string) error { return os.Rename(a, b) }
-`
- f, err := parser.ParseFile(token.NewFileSet(), "x.go", src, parser.SkipObjectResolution)
- if err != nil {
- t.Fatal(err)
+`),
+ parse("internal/linkutil/l.go", `package linkutil
+
+import "golang.org/x/sys/unix"
+
+func Replace(target, link string) error { return unix.Renameat(0, target, 0, link) }
+`),
+ parse("internal/release/versions.go", `package release
+
+import "os"
+
+func LiveLink(opt, host string) string { return opt + "/live/" + host }
+func PointLive(_, _ any, opt, host, acct, ver, app string) error { return pointLive(opt, host) }
+func pointLive(opt, host string) error { return os.Symlink("x", LiveLink(opt, host)) }
+func other(opt, host string) error { return pointLive(opt, host) }
+`),
}
- got := repointOffences("internal/host/x.go", f)
- if len(got) != 2 || got[0].key != "internal/host/x.go:sneaky" || got[1].key != "internal/host/x.go:literal" {
- t.Fatalf("offences = %v, want sneaky and literal", got)
+ var got []string
+ for _, o := range repointOffences(mod, files) {
+ got = append(got, o.key)
}
- bare := `package release
-
-func PointLive() error { return pointLive() }
-func other() error { return pointLive() }
-func pointLive() error { return nil }
-`
- f, err = parser.ParseFile(token.NewFileSet(), "versions.go", bare, parser.SkipObjectResolution)
- if err != nil {
- t.Fatal(err)
+ sort.Strings(got)
+ want := []string{
+ "internal/host/x.go:aliased", "internal/host/x.go:inline", "internal/host/x.go:literal",
+ "internal/host/x.go:viaDirFD", "internal/host/x.go:viaHelper", "internal/host/x.go:viaMethod",
+ "internal/host/x.go:viaOtherPackage", "internal/host/x.go:viaVariable",
+ "internal/release/versions.go:other",
}
- got = repointOffences("internal/release/versions.go", f)
- if len(got) != 1 || got[0].key != "internal/release/versions.go:other" {
- t.Fatalf("offences = %v, want only other's use of pointLive", got)
+ if strings.Join(got, ",") != strings.Join(want, ",") {
+ t.Fatalf("offences =\n %s\nwant\n %s", strings.Join(got, "\n "), strings.Join(want, "\n "))
}
}
diff --git a/internal/release/consolefloor_paths_test.go b/internal/release/consolefloor_paths_test.go
index 927f1c640..1b4c72808 100644
--- a/internal/release/consolefloor_paths_test.go
+++ b/internal/release/consolefloor_paths_test.go
@@ -178,7 +178,7 @@ func TestAdoptionForwardFloorReadFailureRefuses(t *testing.T) {
// stays on the writer-aware build, nothing is started on the old one, and
// the process group is not moved either.
func TestD1RollbackMeetsTheConsoleFloor(t *testing.T) {
- for _, mode := range []string{"floor", "floor read fails"} {
+ for _, mode := range []string{"no floor", "floor", "floor read fails"} {
t.Run(mode, func(t *testing.T) {
ctx := context.Background()
s := &floorReadFails{Store: NewDirStore(t.TempDir())}
@@ -222,6 +222,19 @@ func TestD1RollbackMeetsTheConsoleFloor(t *testing.T) {
withCapturedStdout(t, &out, func() {
_ = Pass(ctx, reg, s, pub, opt, restart, BakeDir(t.TempDir()), WithStartUnit(start), WithRollbackRestart(start))
})
+ if mode == "no floor" {
+ // The control: the same consoles roll back, and the bound
+ // unit is started on old.
+ for _, h := range []string{"platform.example.com", "console.example.com"} {
+ if v, _ := LiveVersion(opt, h); v != "old" {
+ t.Errorf("control: %s live = %q, want old", h, v)
+ }
+ }
+ if started != 1 || !strings.Contains(out.String(), "rolled the symlink back") {
+ t.Errorf("control: started %d, printed %q", started, out.String())
+ }
+ return
+ }
for _, h := range []string{"platform.example.com", "console.example.com"} {
if v, _ := LiveVersion(opt, h); v != "new" {
t.Errorf("%s live = %q, want new: the rollback onto old is below the floor", h, v)
@@ -291,7 +304,7 @@ func TestRollbackGroupMeetsTheConsoleFloor(t *testing.T) {
// way back after a failed second bind, meets the floor too.
func TestHeldStageMeetsTheConsoleFloor(t *testing.T) {
old, aware := floorConsoles(t)
- for _, mode := range []string{"floor", "floor read fails"} {
+ for _, mode := range []string{"no floor", "floor", "floor read fails"} {
t.Run(mode, func(t *testing.T) {
ctx := context.Background()
s := &floorReadFails{Store: NewDirStore(t.TempDir())}
@@ -300,9 +313,10 @@ func TestHeldStageMeetsTheConsoleFloor(t *testing.T) {
t.Fatal(err)
}
opt := t.TempDir()
- if mode == "floor" {
+ switch mode {
+ case "floor":
putFloor(t, s)
- } else {
+ case "floor read fails":
s.fail.Store(true)
}
published := false
@@ -310,6 +324,26 @@ func TestHeldStageMeetsTheConsoleFloor(t *testing.T) {
published = true
return publish()
})
+ if mode == "no floor" {
+ // The control: the same pinned console is published, and
+ // put back after another build.
+ if err != nil || !published {
+ t.Fatalf("control: MaterializeHeld: %v (published %v)", err, published)
+ }
+ if v, _ := LiveVersion(opt, heldTestHost); v != "v1" {
+ t.Fatalf("control: live = %q, want v1", v)
+ }
+ if err := StageArtifact(opt, "bab", "aware", "console", aware); err != nil {
+ t.Fatal(err)
+ }
+ if err := pointLive(opt, heldTestHost, "bab", "aware", "console"); err != nil {
+ t.Fatal(err)
+ }
+ if err := restoreLive(ctx, s, opt, heldRoute(), "v1"); err != nil {
+ t.Fatalf("control: restoreLive: %v", err)
+ }
+ return
+ }
if !errors.Is(err, ErrConsoleFloor) || !published {
t.Fatalf("MaterializeHeld: %v (published %v), want the floor's refusal at the swap", err, published)
}
@@ -333,3 +367,63 @@ func TestHeldStageMeetsTheConsoleFloor(t *testing.T) {
})
}
}
+
+// The held stage's way back, reached as production reaches it: the pinned
+// writer-aware build is published, its bytes change before the second
+// bind, and publishHeld puts the link back on what it named before, here
+// a console from before writers. With the floor (or a floor read that
+// fails) that restore is refused and the link stays where it is; with no
+// floor, the control, it goes back.
+func TestHeldRestoreThroughPublishMeetsTheConsoleFloor(t *testing.T) {
+ old, aware := floorConsoles(t)
+ for _, mode := range []string{"no floor", "floor", "floor read fails"} {
+ t.Run(mode, func(t *testing.T) {
+ ctx := context.Background()
+ s := &floorReadFails{Store: NewDirStore(t.TempDir())}
+ shipRelease(t, s, "bab", "console", "v1", adoptPlatform, aware)
+ if err := Promote(ctx, s, heldPriv, "bab", "console", "canary/x", "v1"); err != nil {
+ t.Fatal(err)
+ }
+ opt := t.TempDir()
+ if err := StageArtifact(opt, "bab", "v0", "console", old); err != nil {
+ t.Fatal(err)
+ }
+ if err := pointLive(opt, heldTestHost, "bab", "v0", "console"); err != nil {
+ t.Fatal(err)
+ }
+ prover, _, pubB64 := proverKey(t)
+ e := &heldProofEnv{ctx: ctx, store: s, opt: opt, bake: t.TempDir(),
+ policy: filepath.Join(t.TempDir(), "proof-policy.json"), proverPub: pubB64, prover: prover,
+ pinnedSHA: etagOf(aware)}
+ e.gate = NewProofGate(e.policy, e.bake)
+ e.require(t, "console")
+ e.prove(t, e.pinnedSHA)
+ if mode == "floor" {
+ putFloor(t, s)
+ }
+ prev := heldAfterSwap
+ t.Cleanup(func() { heldAfterSwap = prev })
+ swapped := false
+ heldAfterSwap = func() {
+ swapped = true
+ s.fail.Store(mode == "floor read fails")
+ if err := StageArtifact(opt, "bab", "v1", "console", append(aware[:len(aware):len(aware)], 1)); err != nil {
+ t.Fatal(err)
+ }
+ }
+ err, guarded, _ := e.materialize(t, s)
+ if !swapped || !guarded || !errors.Is(err, ErrHeldNotProven) {
+ t.Fatalf("MaterializeHeld: %v (swapped %v, guarded %v), want the second bind's refusal", err, swapped, guarded)
+ }
+ if mode == "no floor" {
+ if errors.Is(err, ErrConsoleFloor) || e.live() != "v0" {
+ t.Fatalf("control: %v, live %q; want the link back on v0", err, e.live())
+ }
+ return
+ }
+ if !errors.Is(err, ErrConsoleFloor) || e.live() != "v1" {
+ t.Fatalf("restore below the floor: %v, live %q; want the floor's refusal and the link left on v1", err, e.live())
+ }
+ })
+ }
+}
diff --git a/internal/release/roothistory_pass.go b/internal/release/roothistory_pass.go
index 2fb592030..d39ce16aa 100644
--- a/internal/release/roothistory_pass.go
+++ b/internal/release/roothistory_pass.go
@@ -147,6 +147,16 @@ func (h *RootHistoryPass) CompleteAttempt(ctx context.Context, rt registry.Route
return h.complete(ctx, rt, sel, a.ID, a.Version)
}
+// abandon settles attempt id, begun for rt, with no refusal: for a refusal
+// known to precede every effect of the attempt (nothing repointed or
+// restarted), so the build counts as never tried.
+func (h *RootHistoryPass) abandon(ctx context.Context, rt registry.Route, sel historySelection, id string) error {
+ if err := h.recheck(ctx, rt, sel); err != nil {
+ return err
+ }
+ return h.History.Settle(sel.binding, id, nil)
+}
+
func (h *RootHistoryPass) complete(ctx context.Context, rt registry.Route, sel historySelection, id, version string) error {
if h.Installed == nil {
return os.ErrPermission