Skip to content

feat(builder): auto-mount + promote schelk datadirs on state-actor build#257

Merged
skylenet merged 1 commit into
masterfrom
schlek-auto-promote
Jul 2, 2026
Merged

feat(builder): auto-mount + promote schelk datadirs on state-actor build#257
skylenet merged 1 commit into
masterfrom
schlek-auto-promote

Conversation

@skylenet

@skylenet skylenet commented Jul 2, 2026

Copy link
Copy Markdown
Member

When a builder.state_actor target's output_dir lives under a schelk mount, benchmarkoor build now integrates with schelk so the built datadir becomes the runner's baseline automatically.

What

  1. Ensure mounted — before inspecting or writing the datadir, mount the schelk scratch (schelk mount -y if /proc/mounts shows it unmounted; hard error on the mounted-but-not-in-/proc/mounts crash case, pointing at schelk 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.
  2. Promote — after a build that actually ran, schelk promote -y persists 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 later schelk recover silently revert to the stale datadir.

Detection is automatic from the output_dir path (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 reuse EnsureSchelkMounted — removes the duplicated switch while preserving its full-recover error and the schelk mount -y call.
  • pkg/builder/state_actor.go: ensure-mount hook before the skip checks; promote hook after the sidecar write.
  • Tests + a docs note under the schelk section.

Validation

  • go build ./... clean; golangci-lint --new-from-rev 0 issues; new datadir tests pass (incl. a fake-schelk shim asserting promote -y is invoked and failure output is surfaced).
  • The config schelk mount-preflight test passes on Linux (VM), confirming the shared-helper refactor is behavior-equivalent (the macOS failure is the pre-existing /proc/mounts limitation — EnsureSchelkMounted reads /proc/mounts exactly 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 build must run as root for schelk output_dirs (consistent with the runner; it fails loudly otherwise).

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`).
@skylenet skylenet merged commit 76aba41 into master Jul 2, 2026
7 checks passed
@skylenet skylenet deleted the schlek-auto-promote branch July 2, 2026 08:58
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