Repository navigation
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Reviewer's GuideImplementationMake
ConfigurationGive the source-gates checkout full history so diff-base resolution can find the actual merge base.
TestsAdd regression tests for inert heredoc generation, supported list commands, shell syntax, and using the correct Bash executable.
Assert that the source-gates checkout is configured to fetch full history.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Use a quoted heredoc in smoke-linux common_asserts() so the CI host cannot expand backticks or command substitution inside assertion comments. Splice only allowlisted dpkg/rpm list commands. Set source-gates checkout fetch-depth to 0 so fork merge-base resolution does not fall back to base TIP. Regression tests pin both behaviors. Signed-off-by: Albert Hsieh <knowlet@users.noreply.github.com>
84537f9 to
ed690d3
Compare
The smoke assert tests invoked PATH bash, which on a Windows runner is the WSL launcher: it prints a UTF-16 "no distributions" line and exits 1, so the new suite failed every Windows shard and the subprocess encoding ratchet. Run them with the shared POSIX shell (Git Bash there) and pin the child's encoding. source-gates still fetches origin for the diff base, so the checkout keeps its credential. The opt-out contradicted the retention comment and failed the checkout ratchet, which failed Coverage Gate closed. Signed-off-by: Albert Hsieh <knowlet@pm.me>
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-packagesjobs occasionally fail even when the built.deb/.rpmartifacts 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
--network hostfor smoke containers (a one-off DNS flake is not treated as bridge-root-caused).What changed (motivation → approach → change)
common_asserts()inscripts/smoke-linux-packages.shnow 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-gatesjob in.github/workflows/fast-gate.ymlchecks out withfetch-depth: 0soresolve_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 runsgit fetch originfor 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
bashonPATH. 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.python3 scripts/local-gate.pypassed on this tree (602 backend tests, 15736 frontend tests). Headc200748332.Manual verification
build-linux-x64from nightly run43032889810and ransudo scripts/smoke-linux-packages.sh— exit 0 for deb and rpm install/assert/uninstall paths.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
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)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:
CI:
Tests:
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-gatesource-gatescheckout tofetch-depth: 0, retaining credentials since it still fetches origin, so diff-scoped gates on forks compute an exactmerge-baseinstead of falling back to the base TIP. Smoke behavior and assertions are unchanged.Written for commit c200748. Summary will update on new commits.