8000 fix: 4 high-priority correctness bugs by nixpt · Pull Request #5 · nixpt/buckets · GitHub
[go: up one dir, main page]

Skip to content

fix: 4 high-priority correctness bugs - #5

Merged
nixpt merged 5 commits into
masterfrom
agent/foreman/BUCKETS-HIGH-PRIORITY
Nov 17, 2026
Merged

nixpt merged 5 commits into
masterfrom
agent/foreman/BUCKETS-HIGH-PRIORITY

Conversation

@nixpt
@nixpt nixpt commented Aug 26, 2026
Copy link
Copy Markdown
Owner

Summary

Fixes the 4 highest-impact gaps identified in docs/GAPS_AND_OPPORTUNITIES.md.

Fix Files Change
session bwrap bind sandbox.rs, session.rs, bucketfile.rs, main.rs Added SandboxProfile.binds_at_path: Vec<(PathBuf, String)> for path-redirect binds. session_start/session_exec now pass the overlay mount through the profile — bwrap actually receives it. +1 regression test.
gui --web no-op main.rs Removed the flag. cmd_gui no longer takes _web: bool. VNC still works via --vnc-port.
session --zram no-op main.rs, session.rs Removed the flag. session_start no longer takes use_zram. --tmpfs still works.
herd stop/scale IPC herd.rs, main.rs herd deploy writes deploy.pid. herd stop reads it, signals SIGTERM to the deploy process. herd scale writes desired_replicas; run_reconciler polls it each tick.

Test results

  • 96/96 tests pass (was 95, +1 for binds_at_path_emits_bind_with_distinct_dest)
  • cargo doc: 9 pre-existing warnings (unclosed HTML tags), 0 new

Files changed

  • src/sandbox.rs — SandboxProfile.binds_at_path field + build_bwrap_args/build_proot_args support + test
  • src/session.rs — session_start/session_exec use binds_at_path instead of post-arg-append
  • src/main.rs — removed gui --web flag, removed session --zram flag, wired herd stop/scale IPC
  • src/herd.rs — deploy.pid write in create(), poll_desired_replicas in run_reconciler, pid cleanup in stop()
  • src/bucketfile.rs — added binds_at_path: Vec::new() to SandboxProfile construction

nixpt and others added 5 commits August 26, 2026 03:24
Module maturity map, correctness bugs (session bwrap bind, gui --web,
session --zram, herd stop/scale IPC), containment gaps (no caps/seccomp/
cgroup
8000
s, unconditional /usr RO bind, proot RW downgrade), distribution
gap (crush can't self-provision through pkgx), and hygiene items.
session.rs bwrap bind: added SandboxProfile.binds_at_path for path-redirect
binds (src != dest). session_start/session_exec now pass the overlay mount
through the profile instead of appending --bind AFTER sandboxed_command()'s
-- separator, where bwrap never saw it.

gui --web: removed the no-op flag (cmd_gui had _web: bool, silently
discarded). VNC server still works via --vnc-port.

session --zram: removed the no-op flag (use_zram was recorded in
SessionConfig but no zram device was ever provisioned). --tmpfs still works.

herd stop/scale IPC (BUCKETS-12): herd deploy writes deploy.pid; herd stop
reads it and signals SIGTERM to the deploy process (whose existing handler
triggers clean shutdown + replica kill + state cleanup). herd scale writes
desired_replicas; run_reconciler polls it each tick and calls scale().

96/96 tests pass (was 95, +1 for binds_at_path regression test).
cargo doc: 9 pre-existing warnings (unclosed HTML tags), 0 new.
(1) HIGH - regression test now asserts binds_at_path --bind precedes the
    -- separator (the ordering IS the original defect; the old test only
    checked flag presence + src/dest, so it would pass if the loop regressed
    below --).
(2) HIGH - herd stop now validates deploy.pid via /proc/<pid>/cmdline
    (is_herd_deploy_pid) before signalling, so a stale pidfile with a
    recycled PID can't kill an unrelated process. Stale/absent pidfile falls
    through to the direct replica-kill path. Refactored the force-remove into
    force_remove_herd() + read_deploy_pid() helpers.
(3) LOW - upper_is_zram documented as back-compat (always false; the --zram
    flag it came from was a no-op). Kept, not removed, per the back-compat
    rationale.

96/96 tests pass, no new compile warnings.
Merge master's BUCKETS-17 (fail-closed bwrap + zandbox sandbox hardening)
and BUCKETS-14 (herd Unix-socket IPC) into PR #5's 4 high-priority fixes.
Rule applied: master's sandbox behaviour wins; no fix is kept where master
already covers it; no two mechanisms for the same job.

Per fix:
- F1 session bwrap bind ordering: DROPPED — already on master. BUCKETS-17
  introduced SandboxProfile.binds (BindMount{source,dest,writable}),
  emitted by build_bwrap_args before the `--` separator, used by both
  session_start and session_exec via session_exec_profile. Covered by
  custom_binds_come_before_separator, session_exec_binds_precede_separator
  and proot_custom_binds_use_dest. The PR's binds_at_path field, its
  emitters and its test were superseded and removed.
- F2 gui --web no-op flag: KEPT — removed the flag from the Gui command,
  the match arm and cmd_gui's discarded _web parameter.
- F3 session --zram no-op flag: KEPT — removed the flag from
  session start (session_start drops its use_zram param; backing_desc
  no longer claims zram; help text + README synopsis updated).
  SessionConfig.upper_is_zram kept as documented back-compat: always
  written false, only read for `session list` display. Master's BUCKETS-16
  --flare zram build-cache flag is untouched.
- F4 herd stop/scale deploy reachability: DROPPED — already on master.
  BUCKETS-14's control-socket IPC (send_control Stop/Scale, with a
  state.json SIGTERM fallback for orphaned herds) reaches the deploy
  process for both stop and scale. The PR's deploy.pid + desired_replicas
  file-polling mechanism and its helpers (is_herd_deploy_pid,
  read_deploy_pid, force_remove_herd, poll_desired_replicas) removed.

Verified: cargo build clean (no warnings); 137-test set identical to
master's (133 passed, 1 pre-existing environmental failure —
sandbox::live::timeout_kills_whole_tree false-positives on an unrelated
session's `sleep 60` poll loop and fails identically on pristine
origin/master); cargo fmt --check deviations identical to master's.
- session.rs module doc (Backing stores): remove the zram bullet —
  it advertised the --zram flag removed by this PR. upper_is_zram
  field comment untouched (documented back-compat).
- docs/GAPS_AND_OPPORTUNITIES.md: add dated status note (2026-11-17)
  and mark each resolved item in place, one line each — items 1-4
  (session bwrap bind ordering fixed on master by BUCKETS-17; gui
  --web and session --zram removed in this PR; herd stop/scale IPC
  fixed on master by BUCKETS-14), plus the three maturity-map rows
  restating them. Audit body unchanged; all other items untouched.

Docs-only; cargo build stays at 0 warnings.
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

0