test(preflight): cover nfs4 mount type in preflight-fs-networked BATS#1126
test(preflight): cover nfs4 mount type in preflight-fs-networked BATS#1126yasinBursali wants to merge 2 commits intoLight-Heart-Labs:mainfrom
Conversation
NFS / SMB / CIFS / AFP / WebDAV mounts have a quirk: POSIX permissions are *advisory* — the local kernel accepts chmod 600 and reports back the new mode, but actual access control is governed by the server's ACL system. For users mounting a NAS share at INSTALL_DIR, chmod 600 .env LOOKS enforced from the local machine but is world-readable from another client of the same share. Same trap on Windows networked drives — local NTFS ACLs do not bind across the share. Adds warn-only detection on all three platforms. Existing FATAL behavior for non-POSIX filesystems (exfat/msdos/etc.) is preserved. macOS: stat -f %T returns nfs/smbfs/afpfs/webdav personality strings. Linux: stat -fc %T returns nfs/nfs4/cifs/fuse.smbnetfs/fuse.glusterfs/ ocfs2. Windows: PowerShell DriveInfo.DriveType reports 'Network' for SMB- mapped drives; UNC paths (^\\\\) are flagged regardless. Reuses the existing FS-FATAL block's DriveInfo, short-circuit-guarded for null safety against the catch path. Each platform branch sets a separate state variable so the fatal-vs- warn logic stays cleanly separated. New tests/bats-tests/preflight-fs- networked.bats covers macOS+Linux (Windows lacks Pester infra in this repo today; manual verification documented).
Linux production preflight (installers/phases/01-preflight.sh) matches nfs|nfs4|cifs|fuse.smbnetfs|fuse.glusterfs|ocfs2 in its networked-FS case statement, but the BATS fixture added in Light-Heart-Labs#1083 only exercised nfs and cifs. Add a single mirrored test case for nfs4 so the legitimate production code path is covered. Mirrors the existing nfs case structure: GNU stat stub, _extract_linux_fs_fn extraction, warn() shim, asserts on "networked filesystem" + "nfs4" partial match + non-fatal exit. Must merge after upstream PR Light-Heart-Labs#1083 (creates the file).
Lightheartdevs
left a comment
There was a problem hiding this comment.
Blocking this because the branch makes the Windows preflight script unparsable.
The new Windows advisory string in installers/windows/phases/01-preflight.ps1 contains mojibake for an em dash (—). PowerShell treats the embedded smart-quote character in that sequence as a string delimiter, so parsing the file fails before the installer can run. Reproduction:
$src = Get-Content -Raw dream-server/installers/windows/phases/01-preflight.ps1
[scriptblock]::Create($src)That reports The string is missing the terminator: ' and points at the later causing 'model not found' line because the earlier advisory string was prematurely closed. Please replace the advisory dash with plain ASCII (-) or otherwise ensure the file parses cleanly, and update the PR title/body because this is not test-only: it changes Linux, macOS, and Windows preflight behavior in addition to adding BATS coverage.
The Linux/macOS BATS target itself passed locally (8/8) and the shell syntax checks passed; the blocker is the Windows script parse failure.
What
Add one new BATS test case to
dream-server/tests/bats-tests/preflight-fs-networked.bats(the file added by #1083) covering thenfs4filesystem type.Why
#1083's Linux production case statement at
01-preflight.sh:121matchesnfs|nfs4|cifs|fuse.smbnetfs|fuse.glusterfs|ocfs2, but the BATS fixture only exercisesnfs/cifs/ext/exfat— leavingnfs4untested. A future change that broke thenfs4arm of the regex-OR would slip past CI.How
21-line test case mirroring the existing
linux preflight: nfs warns and does not exit fatallytest, with the stat stub returningnfs4instead ofnfs. Asserts:networked filesystem)nfs4)EXIT_OK)Testing
bash dream-server/tests/run-bats.sh dream-server/tests/bats-tests/preflight-fs-networked.bats: 8/8 PASSReview
Critique Guardian: APPROVED. Production warn line at
01-preflight.sh:122includes($fs_type), so thenfs4partial-match is reliable. Test scope honors the plan (nfs4only);fuse.glusterfsandocfs2are also untested but out of scope here.Known Considerations
preflight-fs.shdoes not includenfs4in its case statement — that's a separate production gap in feat(preflight): warn when INSTALL_DIR is on networked filesystem #1083 itself, not a test-only gap, and is out of scope for this PR.fuse.smbnetfs,fuse.glusterfs,ocfs2Linux types are similarly untested by the fixture but match the same case statement; follow-up worth filing.Platform Impact
This branch contains two commits: the first is a rebased copy of #1083's commit on current upstream/main (so this PR's diff is self-contained); the second is the new BATS case. Must merge after #1083 — when #1083 lands, rebase this branch onto upstream/main and the #1083 commit drops out cleanly.