test: behavioral host-agent install poll + bats resolver/preflight + pre-commit shellcheck#1102
Draft
yasinBursali wants to merge 1 commit intoLight-Heart-Labs:mainfrom
Draft
Conversation
…pre-commit shellcheck - TestInstallStatePollBehavior (test_host_agent.py): four wire-tests for the install state-poll loop — error progress on never-running, startup_check=false skipping inspect, started on starting->running transition, and TimeoutExpired tolerance. Uses types.SimpleNamespace to stub _mod.time so the test helper's own time.sleep stays real (helper imports `import time as _real_time` to bypass the stub). - preflight-docker-desktop.bats: six cases stubbing docker via $BATS_TEST_TMPDIR/bin/docker for Mounts-denied, not-shared, success, missing-CLI, warning-allowed, and unrelated-error preservation paths. - resolver-user-ext.bats: eleven cases for the user-ext loop scenarios and gpu_backends edge cases. Four cases are fail-as-expected pending the resolver-python-hygiene branch (gpu_backends filter + apple guard on compose.local.yaml). Test 8 inline note explains the vacuous-pass mechanic. - .pre-commit-config.yaml: shellcheck error-only (matches CI), SC2006 catch (--include=SC2006 since SC2006 is style-level, not warning), and a local heredoc-backtick guard backed by check-heredoc-backticks.awk. - check-heredoc-backticks.awk: POSIX-awk state machine for the guard. Skips tests/bats-tests/preflight-fs-detection.bats because another in-flight branch ships an equivalent preflight-fs-networked.bats with the same scope. PR is DRAFT until the resolver-python-hygiene branch merges; the four fail-as-expected resolver cases are the mechanical safeguard.
This was referenced May 2, 2026
Collaborator
|
Merge-pass recheck: holding this as draft/red. The test coverage is useful, but the PR body explicitly says 4 resolver tests fail until the resolver prerequisite lands, and the live |
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.
What
Adds BATS + pytest test coverage and pre-commit shellcheck guards across four areas:
Why
TestInstallRunningStateVerificationis 100% source-inspection (asserts substrings appear in the function body). A refactor preserving substrings while breaking runtime semantics — wrong terminal status, missing error-progress, swallowed timeouts — would have shipped silently..pre-commit-config.yamlhad no shellcheck hook; CI's lint-shell.yml only fails on--severity=error, so SC2006 (legacy backtick command-substitution) was silently allowed. SC2006 inside an unquoted heredoc body is doubly dangerous because shellcheck doesn't lint heredoc bodies at all — needed both a top-level SC2006 catch and a heredoc-specific guard.test_docker_desktop_sharing()ininstallers/macos/lib/preflight-fs.shhad no test; a regression that flippedDOCKER_SHARE_OK=trueon a bind-mount denial would silently pass preflight.resolve-compose-stack.sh's user-extension loop had no fixture-based tests; the apple-deadlock guard, GPU-backend filter, and overlay-discovery edge cases would all have been hand-verified at most.How
Added files:
dream-server/tests/bats-tests/preflight-docker-desktop.bats— 6 cases. StubsdockerviaBATS_TEST_TMPDIR/bin/docker(chmod +x) and prepends to PATH. Covers Mounts-denied, not-shared-from-host, success, missing-docker-CLI, mount succeeds despite warning, and unrelated-error must-not-flip-OK.dream-server/tests/bats-tests/resolver-user-ext.bats— 11 cases combining the GPU-filter edge cases and the 5 user-ext loop scenarios (AMD-only excluded on NVIDIA, legacy-no-manifest included, local-mode overlay handling, apple-deadlock guard, multigpu overlay at gpu-count > 1, plusgpu_backends=[all]/[none]and overlay discovery).dream-server/scripts/check-heredoc-backticks.awk— POSIX-awk state machine that flags backticks inside unquoted heredoc bodies. Wired through pre-commit as alanguage: systemlocal hook.Modified:
.pre-commit-config.yaml— adds 3 hooks: shellcheck--severity=error(matches CI's failing pass), shellcheck--include=SC2006(catches legacy backticks regardless of base severity), and the local heredoc-backtick guard.dream-server/extensions/services/dashboard-api/tests/test_host_agent.py— appendedTestInstallStatePollBehaviorclass with 4 wire-tests. Usestypes.SimpleNamespacetime stub on_mod.timeso the no-op'dtime.sleepdoesn't break the test helper's owntime.sleep(helper importsimport time as _real_timeto bypass).Deferred (collision with another in-flight branch):
tests/bats-tests/preflight-fs-detection.bats(FS personality detection — nfs/cifs/exfat) is already shipping in another in-flight PR with substantially the same scope. Dropping rather than duplicating.Testing
pytest tests/test_host_agent.py::TestInstallStatePollBehavior -v— 4/4 pass.bash tests/run-bats.sh tests/bats-tests/preflight-docker-desktop.bats— 6/6 pass.bash tests/run-bats.sh tests/bats-tests/resolver-user-ext.bats— 7 pass / 4 fail-as-expected (the four cases that depend on the resolver-python-hygiene branch'sgpu_backendsfilter and apple-guard expansion).pre-commit run --all-files— 3 new hooks pass cleanly on the existing tree (zero SC2006 violations, zero heredoc-backtick violations).Review
Critique Guardian: APPROVED WITH WARNINGS (DRAFT note + deferred deliverable note required in description — both included here, no code blockers).
Known Considerations
upstream/mainbecause they reference resolver behavior that's added by that branch (thegpu_backendsfilter and the apple-guard oncompose.local.yaml). Mechanical safeguard.preflight-fs-detection.batsis intentionally deferred — another in-flight branch ships exactly that file with 7 cases for nfs/cifs/exfat/ext2-3/apfs/smbfs on both BSD and GNUstat. Adding our own would duplicate work.--severity=warningwould NOT catch it. The hook uses--include=SC2006to catch the symbol regardless of base severity.compose.local.yamlon the user-ext loop at all; once that discovery lands (alongside the apple guard) in the prerequisite branch, the test becomes a real regression shield._make_docker_stubuses an unquoted heredoc —$messageis shell-expanded into the stub at write time. Inline note in the file flags the constraint; current test inputs are all literal strings.Platform Impact
preflight-docker-desktop.batsandresolver-user-ext.batsrun identically; PATH-stub mocks (docker,stat) are POSIX-shell.check-heredoc-backticks.awkuses POSIX awk only — no GNU-isms (gensub,\b).