feat(builder): auto-mount + promote schelk datadirs on state-actor build#257
Merged
Conversation
When a builder.state_actor target's output_dir lives under a schelk mount,
`benchmarkoor build` now:
1. ensures the schelk scratch is mounted before it inspects or writes the
datadir (so the skip/diff checks read the mounted content, not an empty
mount point), and
2. runs `schelk promote` after a build that actually ran, persisting the new
datadir as the virgin baseline. A skipped, unchanged target is not
promoted; a failed promote is fatal (a stale baseline would let a later
`schelk recover` silently revert).
Detection is automatic from the output_dir path — no config needed, and
non-schelk builds are untouched.
New datadir helpers: SchelkDir, EnsureSchelkMounted, SchelkPromote. The
runner's schelk mount-preflight is refactored to share EnsureSchelkMounted
(removing the duplicated logic while preserving its errors and `mount -y`).
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.
When a
builder.state_actortarget'soutput_dirlives under a schelk mount,benchmarkoor buildnow integrates with schelk so the built datadir becomes the runner's baseline automatically.What
schelk mount -yif/proc/mountsshows it unmounted; hard error on the mounted-but-not-in-/proc/mountscrash case, pointing atschelk full-recover). This matters because the datadir is materialised onto the mount and the skip/diff checks must read the mounted content, not an empty mount point.schelk promote -ypersists the new datadir as the virgin baseline. A skipped (unchanged) target is not promoted; with the diff-detection work, "a build ran" is exactly "the datadir changed". A failed promote is fatal — leaving the mount ahead of the baseline would let a laterschelk recoversilently revert to the stale datadir.Detection is automatic from the
output_dirpath (via/var/lib/schelk/state.json); when schelk isn't set up, non-schelk builds are completely untouched.Changes
pkg/datadir/schelk.go:SchelkDir(is output_dir under the schelk mount? absent state → not schelk),EnsureSchelkMounted(the mount/crash-inconsistent logic),SchelkPromote.pkg/config/config.go: refactored the runner's schelk mount-preflight to reuseEnsureSchelkMounted— removes the duplicated switch while preserving itsfull-recovererror and theschelk mount -ycall.pkg/builder/state_actor.go: ensure-mount hook before the skip checks; promote hook after the sidecar write.Validation
go build ./...clean; golangci-lint--new-from-rev0 issues; new datadir tests pass (incl. a fake-schelk shim assertingpromote -yis invoked and failure output is surfaced)./proc/mountslimitation —EnsureSchelkMountedreads/proc/mountsexactly as the old inline code did).Not covered
The live mount+promote path was not e2e'd — it needs a schelk-initialized Linux host (block devices, dm-era, root), which wasn't available. It's covered by unit tests + the Linux config test + code review, but a manual smoke test on a schelk-enabled box is worthwhile. Note schelk ops require root, so
benchmarkoor buildmust run as root for schelk output_dirs (consistent with the runner; it fails loudly otherwise).