Repository navigation
fix: tree-walk test flake (#1334); discard per-instance state inherited from an image (#1241) - #1339
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
…rates vanished entries (#1334) TestReleaseBuildLeavesTheTreeClean created and removed dist/ and the before-hook outputs inside the checkout while tests in other packages walked it, so a walk could list an entry and fail to lstat it (reproduced 11/50, 0/50 after). The gate now runs git status against the checkout's index with a temporary work tree holding its .gitignores and the probes, and TestReleaseTreeProbesStayOutOfTheCheckout holds it there. internal/treewalk adds Vanished, used by every test walk callback; TestTreeWalksTolerate- VanishedEntries discovers every Walk/WalkDir in the repo's tests and fails on a callback that returns its error without consulting it.
… instance (#1241) pkg/instancestate records the instance owning the per-instance state in /var/lib/spawn/instance-owner; when it names another instance, files under instancestate.Paths last modified before the current boot are removed and the owner rewritten. Files written during this boot are kept, so the order of the discard against the bootstrap's writes and the MPI peers push does not matter. The bootstrap body runs 'spored discard-inherited-state' after installing spored and before starting it; the daemon runs it in NewEC2Provider before loading plugins.json. ImageStateCleanupScript records the source as owner before the snapshot. Paths are held to every state path named in the source by a discovery gate.
scttfrdmn
force-pushed
the
fix/1334-1241-flake-ami
branch
from
October 26, 2026 23:31
2ba8aea to
5214b8d
Compare
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.
Fixes #1334
Fixes #1241
#1334: tree-walk flake
TestReleaseBuildLeavesTheTreeCleancreated and removeddist/and the before-hook outputs (lambda/ttl-reaper/build/bootstrap, the reaper zip) inside the checkout. Meanwhile tests in other packages walked the tree, so a walk could list an entry and then fail to lstat it.Reproduced. I ran the taskiam test 50 times while the root test looped concurrently. Before: 11/50 and 5/50 failures, on
lstat ../../dist,lstat ../../lambda/ttl-reaper/ttl-reaper_lambda_linux_arm64.zipandopen ../../lambda/ttl-reaper/build, so skippingdistalone would not have fixed it. After: 0/50. Each half alone also gives 0/50.git --git-dir=<checkout> --work-tree=<tempdir> status. The temp tree holds the tracked.gitignorefiles and the probes, andGIT_OPTIONAL_LOCKS=0is set. It still fails when/dist/is dropped from.gitignore, which I checked.TestReleaseTreeProbesStayOutOfTheCheckout: new gate that the probes stay out of the checkout.internal/treewalk.Vanished: used by all 33 test tree-walks. The nestedscriptsmodule does the same check inline.TestTreeWalksTolerateVanishedEntriesparses every Walk/WalkDir callback in the repo's tests and fails on one that returns its error without the check.#1241: inherited per-instance state
pkg/instancestaterecords which instance owns the state in/var/lib/spawn/instance-owner. When that names another instance, it removes the files underinstancestate.Pathsmodified before the current boot and records the new owner. Files written during this boot are kept: the launch's own plugins.json and command, and a peers file pushed over SSM. So it doesn't matter which runs first, and no lock is needed. The source keeps its state, because the owner is itself.spored discard-inherited-state || trueafter installing spored and beforesystemctl start spored,--command, profile scripts, MPI and user data. Bare bootstrap gzip size: 8001 → 8023 (budget 8192).NewEC2ProviderbeforeloadConfigFromEC2Tags(Linux, root only). This covers instances launched from such an image by something other than spawn.ImageStateCleanupScript(spawn ami create) records the source as owner before the snapshot, so images of instances launched by older releases are covered. It does not delete these files: the source keeps running and still needs them.TestEveryWrittenStatePathIsCovereddiscovers every path under the state roots named in a non-test Go string literal. Each must be covered or have a reason for being left out (signing key, local.yaml, mpi.sh, efa.sh).Not covered: an image of an older instance made outside
spawn ami create, then booted without spawn's bootstrap and with that older spored (there is no owner record to compare). Windows. Root's MPI cluster SSH key, filed as #1338.Gates, each watched failing against a revert that compiles
.→ the probes-stay-out gate fails.make checkpasses exceptcheck-build-tags, which fails on unmodified main at f887212 too (it's the /private/tmp path issue).make lintreports 0 issues.semgrep --config=auto --error .is clean.make check-docsis clean.