Publish only the work: leave build artifacts out and report them (#80)
CI / checks (push) Skipped
CI / checks (pull_request) Failing after 56s

The clone gets the standard build artifacts in its own exclude file, so
they never show as changes, even to a model's `git add -A`. The
harness's commits leave the same patterns out even when the project
tracks them, as the sandbox's main did. What was left out is reported in
the publish note and the PR description. Found again in bring-up run 3
(sandbox PR #208).

Fixes #80.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PPQ14L3LikyefCMFBqEbKE
This commit is contained in:
dongarandClaude Opus 5.5 committed 2026-10-02 22:38:13 +00:00
1 parent 4f152af170
commit e02bac110d
5 files changed
+164 -8

No files matched your search

+49
View File
@@ -195,3 +195,52 @@ def test_an_https_token_answers_git_through_the_helper(
assert asked.stdout == "username=[redacted]\npassword=[redacted]\n"
stored = ssh_host.execute(f"{body} store", secrets={"NISSE_PUSH_TOKEN": "x"})
assert stored.stdout == ""
# --- build artifacts are never the work (#80, D4) ----------------------------
def test_artifacts_are_left_out_even_when_the_project_tracks_them(
repo: GitRepo,
) -> None:
# The sandbox's main tracks .pyc files (an earlier run published them).
cache = repo.root / "pkg" / "__pycache__"
cache.mkdir(parents=True)
(repo.root / "pkg" / "m.py").write_text("x = 1\n")
(cache / "m.cpython-312.pyc").write_bytes(b"old")
repo._git("add", "-A")
repo._git("commit", "-qm", "a project that tracks its caches")
# A test run: the tracked .pyc changes, new caches appear, and the work.
(cache / "m.cpython-312.pyc").write_bytes(b"new")
(cache / "m.cpython-310.pyc").write_bytes(b"x")
(repo.root / ".pytest_cache").mkdir()
(repo.root / ".pytest_cache" / "v").write_text("x")
(repo.root / "pkg" / "m.py").write_text("x = 2\n")
assert repo.commit_all("the work") is not None
committed = repo._git("show", "--name-only", "--format=", "HEAD").split()
assert committed == ["pkg/m.py"]
assert repo.left_out() == [
".pytest_cache/v",
"pkg/__pycache__/m.cpython-310.pyc",
"pkg/__pycache__/m.cpython-312.pyc",
]
def test_only_artifacts_changed_means_nothing_to_commit(repo: GitRepo) -> None:
(repo.root / "__pycache__").mkdir()
(repo.root / "__pycache__" / "a.pyc").write_bytes(b"x")
assert repo.commit_all("nothing real") is None
def test_excludes_hide_new_artifacts_and_install_once(repo: GitRepo) -> None:
repo.install_excludes()
repo.install_excludes()
exclude = (repo.root / ".git" / "info" / "exclude").read_text()
assert exclude.count("__pycache__/") == 1
(repo.root / "node_modules").mkdir()
(repo.root / "node_modules" / "x.js").write_text("x")
(repo.root / "real.py").write_text("x")
# Even the model's own `git add -A` now skips them.
assert repo._git("status", "--porcelain", "--untracked-files=all") == "?? real.py"
+20
View File
@@ -90,6 +90,9 @@ class FakeGit:
def commit_all(self, message: str) -> str | None:
return self.repo.commit_all(message)
def left_out(self) -> list[str]:
return self.repo.left_out()
def push(self, remote_url: str, branch: str, *, credential: object = None) -> None:
self.pushed.append(branch)
self.remote[branch] = self.repo.head_sha()
@@ -147,6 +150,23 @@ def test_a_branch_named_after_the_task_does_not_block_publishing(
assert git.pushed == ["demo-abc-milestone-1"]
def test_left_out_artifacts_are_reported_not_published(
store: StateStore, tmp_path: Path
) -> None:
git = FakeGit(tmp_path / "work")
(tmp_path / "work" / "__pycache__").mkdir()
(tmp_path / "work" / "__pycache__" / "work.cpython-310.pyc").write_bytes(b"x")
client = FakeGitea()
result = build(store, git, client).publish(
task_id="t", milestone=1, project="demo", plan="p"
)
assert "left out 1 build artifact(s): __pycache__/work.cpython-310.pyc" in (
result.note
)
assert "## Left out" in client.opened[0]["body"]
assert "`__pycache__/work.cpython-310.pyc`" in client.opened[0]["body"]
def test_intent_is_recorded_then_committed(store: StateStore, tmp_path: Path) -> None:
build(store, FakeGit(tmp_path / "work"), FakeGitea()).publish(
task_id="t", milestone=1, project="demo", plan="p"