Skip to content

The agent that grows with you

fix(build): list dirty paths when source admission fails

ethernetd8f4653b5243
diff --git a/scripts/bundles/desktop_prepare.py b/scripts/bundles/desktop_prepare.py
index 159fb547dc4..c6492fd59cd 100644
--- a/scripts/bundles/desktop_prepare.py
+++ b/scripts/bundles/desktop_prepare.py
@@ -17,14 +17,15 @@ if str(ROOT) not in sys.path:
def git(source: Path, *args: str) -> str:
- return subprocess.check_output(["git", *args], cwd=source, text=True, encoding="utf-8").strip()
+ return subprocess.check_output(["git", *args], cwd=source, text=True, encoding="utf-8").rstrip("\r\n")
def require_source(source: Path, commit: str) -> None:
if git(source, "rev-parse", "HEAD") != commit:
raise ValueError("preparation source checkout changed revision; prepare again")
- if git(source, "status", "--porcelain", "--untracked-files=normal"):
- raise ValueError("desktop builds require a clean source checkout at the admitted revision")
+ status = git(source, "status", "--porcelain", "--untracked-files=all")
+ if status:
+ raise ValueError(f"desktop builds require a clean source checkout at the admitted revision:\n{status}")
def fingerprint(path: Path) -> str:
diff --git a/tests/scripts/test_desktop_preparation.py b/tests/scripts/test_desktop_preparation.py
index 89e6bd97823..c3573573c42 100644
--- a/tests/scripts/test_desktop_preparation.py
+++ b/tests/scripts/test_desktop_preparation.py
@@ -119,8 +119,18 @@ def test_source_admission_rejects_dirty_checkout_and_invalid_store_before_writes
with pytest.raises(ValueError, match="Store.*stable"):
BuildRequest.create(source, tag=tag, commit=selected, variant="store", work=work, cache=cache, bundle_env={})
(source / "package.json").write_text("{}", encoding="utf-8")
- with pytest.raises(ValueError, match="source|checkout"):
+ (source / "pyproject.toml").write_text('staged fixture contents', encoding="utf-8")
+ subprocess.run(["git", "add", "pyproject.toml"], cwd=source, check=True)
+ (source / "generated output").mkdir()
+ (source / "generated output" / "receipt.json").write_text('untracked fixture contents', encoding="utf-8")
+ with pytest.raises(ValueError, match="source|checkout") as rejected:
BuildRequest.create(source, tag=None, commit=commit, variant="light", work=work, cache=cache, bundle_env={})
+ status = subprocess.check_output(
+ ["git", "status", "--porcelain", "--untracked-files=all"], cwd=source, text=True,
+ ).rstrip("\r\n")
+ assert str(rejected.value).endswith("\n" + status)
+ assert 'generated output/receipt.json' in str(rejected.value)
+ assert 'fixture contents' not in str(rejected.value)
assert not work.exists()
assert not cache.exists()