Skip to content

fix(installer): run the network-FS guard before the log dir is created - #441

Merged
LukasWodka merged 3 commits into
developfrom
fix/432-nfs-guard-order
Jul 27, 2026
Merged

fix(installer): run the network-FS guard before the log dir is created#441
LukasWodka merged 3 commits into
developfrom
fix/432-nfs-guard-order

Conversation

@LukasWodka

@LukasWodka LukasWodka commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

The NFS/root-squash guard is good — but it fires after setup_log_file has already mkdir'd HOST_DATA_DIR and redirected the session's output onto it. On the exact machine the guard exists for (NFS home, sudo, root_squash), the install dies on a bare mkdir error — or leaves a squashed/nobody-owned log dir — before the guard's friendly, named failure can print.

Change

  • _pf_is_network_fstype — the filesystem classification extracted from _pf_storage_type (shared, single list; the full check's user-visible strings are byte-identical).
  • early_data_dir_guard — runs right after validate_config, before setup_log_file: silent on local/undetermined filesystems, refuses network filesystems with the named fix (HOST_DATA_DIR=/local/path), and defers to the full preflight warning when TRACEBLOC_ALLOW_NETWORK_FS=1.
  • Call is declare -F-guarded (same stale-bootstrap pattern as the assess/host_audit gates).
  • 6 new bats tests incl. an ordering gate (guard line must precede setup_log_file in main()); manifest.sha256 regenerated.

Independent of the #437#440 stack (different manifest lines) — mergeable in any order relative to it.

Type

Bug fix

Test plan

Full bats suite green locally (incl. copy catalog — no golden drift); bash -n + shellcheck --severity=error clean; gen-manifest.sh --check clean.

🤖 Generated with Claude Code


Note

Low Risk
Installer-only ordering and messaging change with regression tests; no runtime cluster or auth behavior changes.

Overview
Moves the NFS/network-home failure earlier so users see a clear refusal instead of a bare mkdir error or a root-squashed log dir when setup_log_file creates HOST_DATA_DIR before preflight runs.

Adds early_data_dir_guard in preflight.sh, invoked from install-k8s.sh right after validate_config and before setup_log_file (with the same declare -F stale-bootstrap pattern as other gates). Network filesystem types are centralized in _pf_is_network_fstype, reused by the existing _pf_storage_type check (behavior unchanged there). The early guard skips when the data directory already exists so healthy re-runs still reach assess (#441), honors TRACEBLOC_ALLOW_NETWORK_FS, and uses remediation text that fits HOST_DATA_DIR under $HOME (no bogus /local/path advice).

Six new bats cases cover classification, pass/fail paths, and install ordering; manifest.sha256 is updated.

Reviewed by Cursor Bugbot for commit e4642d6. Bugbot is set up for automated code reviews on this repo. Configure here.

#432)

setup_log_file mkdirs HOST_DATA_DIR and tees the whole session's output
onto it BEFORE run_preflight fires — so on the exact machine the
network-FS guard was built for (NFS home + sudo + root_squash), the
unguarded mkdir failed with a bare error, or the log dir landed
squashed/nobody-owned, before the friendly named failure could print.

New early_data_dir_guard runs right after validate_config and before
setup_log_file: same filesystem classification (extracted as the shared
_pf_is_network_fstype), console-only, silent on local/undetermined
filesystems, defers to the full check's warning under
TRACEBLOC_ALLOW_NETWORK_FS. The call is declare -F-guarded so a stale
bootstrap without the new helper proceeds as before.

Closes #432

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@LukasWodka
LukasWodka requested a review from saadqbal as a code owner July 27, 2026 14:04
@LukasWodka LukasWodka self-assigned this Jul 27, 2026
@LukasWodka

Copy link
Copy Markdown
Contributor Author

bugbot run

Comment thread scripts/lib/preflight.sh Outdated
…#441)

The guard advised HOST_DATA_DIR=/local/path, but validate_config
requires the data dir under $HOME (Bugbot #384 hardening) — so the
exact audience this guard exists for (network home) was pointed at a
fix that fails validation on re-run. The copy now states the real
constraint and the two workable paths (local-home user, or the explicit
TRACEBLOC_ALLOW_NETWORK_FS=1 override with its risk), and notes that
datasets may stay on network storage via HOST_DATASET_DIR. Test asserts
the impossible advice stays gone.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@LukasWodka

Copy link
Copy Markdown
Contributor Author

bugbot run

Comment thread scripts/install-k8s.sh
… r2)

The early guard's job is protecting the pre-log mkdir; an existing data
dir has no at-risk mkdir, and a healthy machine's re-run must keep
reaching the assess hand-off exactly as it did when the network-FS check
lived only in run_preflight. Existing dir -> silent pass; the full
preflight guard still classifies network storage for real (re)installs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@LukasWodka

Copy link
Copy Markdown
Contributor Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit e4642d6. Configure here.

@LukasWodka
LukasWodka merged commit dacba26 into develop Jul 27, 2026
32 checks passed
@LukasWodka
LukasWodka deleted the fix/432-nfs-guard-order branch July 27, 2026 15:43
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.

2 participants