fix(ci): keep smoke-linux host heredoc inert and use host DNS
Problem / Motivation
Goal: Stop Linux package smoke tests from failing on nightly builds because the CI host expands assertion-script heredocs before they run inside containers.
Nightly smoke-linux-packages jobs occasionally fail even when the built .deb/.rpm artifacts are good. The runner builds install/assert shell by expanding an unquoted heredoc on the host, so backticks and $(…) inside assertion comments execute on the host and corrupt the script sent to Docker.
Why it matters
Without this fix, Linux nightly publication can fail structurally (smoke assertions never reach the container faithfully), blocking release signal for every distro target the job covers.
Not a goal
- Changing which files the smoke job asserts inside the container.
- Reintroducing
--network hostfor smoke containers (a one-off DNS flake is not treated as bridge-root-caused). - Fixing unrelated macOS nightly runner acquisition timeouts.
What changed (motivation → approach → change)
common_asserts() in scripts/smoke-linux-packages.sh now emits assertions from a quoted heredoc (<<'ASSERTS') and splices only allowlisted package-list commands (dpkg -L \"$pkg\" / rpm -ql \"$pkg\") through a __LIST_CMD__ placeholder. Host expansion cannot interpret backticks or command substitution in comments (including paths like /opt/KiroCrew Nightly/...).
The Fast Gate source-gates job in .github/workflows/fast-gate.yml checks out with fetch-depth: 0 so resolve_base() on fork PRs can compute a real merge-base instead of falling back to the base branch tip (which widens diff-scoped gates incorrectly). That checkout still retains credentials: the job runs git fetch origin for the diff base, and the retention comment above the step is the reason the credential stays.
The regression tests call the shared POSIX shell (Git Bash on Windows) instead of bash on PATH. On a GitHub Windows runner that name is the WSL launcher, which writes a UTF-16 "no installed distributions" line and exits 1. The child's text mode is pinned to UTF-8.
Backwards compatibility
Compatible: smoke behavior and assertions are unchanged; only how the host emits the in-container script and how CI checks out history for diff-base resolution differ. The source-gates checkout credential matches the retention comment that was already on the step.
Removes nothing: no weakening of network isolation on operator machines; checkout depth change is CI-only for source-gates.
Tests
test/test_smoke_linux_packages_common_asserts.py— quoted heredoc, allowlist,bash -n, host-substitution sentinel on the old pattern, and a pin that a Git Bash path is not replaced by a PATH lookup.test/test_workflow_checkout_credentials.py::test_no_checkout_both_opts_out_and_claims_retention— source-gates keeps the retention comment and does not also opt out.test/test_check_comment_history.py::TestCiWiring::test_source_gates_checkout_fetches_full_history_for_merge_base— pins full-history checkout forsource-gates.- Proof:
python3 scripts/local-gate.pypassed on this tree (602 backend tests, 15736 frontend tests). Headc200748332.
Manual verification
- Downloaded public
build-linux-x64from nightly run43032889810and ransudo scripts/smoke-linux-packages.sh— exit 0 for deb and rpm install/assert/uninstall paths. - Targeted pytest modules above pass locally after rebasing onto current
main.
Pattern harvest
Rule candidate: semgrep
Pattern: unquoted bash heredoc delimiter when downstream content is passed to a container/subprocess and may contain shell metacharacters in comments.
Sibling sweep
Swept: git grep -nE "common_asserts|<<ASSERTS" -- scripts/
Siblings: none — common_asserts() is the only host-side heredoc emitter for Linux package smoke.
Checklist
- At most two commits (one is the norm), with a Conventional Commits title (
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...) - Existing tests pass and new tests added for new functionality
- Self-review completed; code follows project style guidelines
- Documentation updated (if applicable)
- No secrets, credentials, or internal references in the diff
Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license; see CONTRIBUTING.md.


Summary by Sourcery
Keep Linux smoke-test scripts inert during host generation and make source-gate diff detection use accurate repository history.
Bug Fixes:
- Prevent Linux package smoke-test assertion scripts from being corrupted by host-side shell expansion.
- Ensure fork pull requests use the true merge base for diff-scoped source gates.
CI:
- Configure the source-gates checkout to fetch full history for accurate merge-base resolution.
Tests:
- Add regression coverage for quoted smoke-test heredocs, command allowlisting, shell syntax, and full-history source-gates checkout.
Summary by cubic
Fixes recurring Nightly Build failures in the Linux package smoke-install job caused by host-side heredoc expansion.
The common_asserts() function expanded an unquoted heredoc on the CI runner, so backticks in comments ran as command substitution on the host and corrupted the emitted container script. It now uses a quoted heredoc and splices only two allowlisted list commands (dpkg -L "$pkg" / rpm -ql "$pkg") via __LIST_CMD__. New regression tests run on the shared POSIX shell (Git Bash on Windows runners) so the WSL launcher cannot run them. Also deepens the fast-gate source-gates checkout to fetch-depth: 0, retaining credentials since it still fetches origin, so diff-scoped gates on forks compute an exact merge-base instead of falling back to the base TIP. Smoke behavior and assertions are unchanged.