test: upstream merge - combined-commit regression covering the acceptance checklist (4.5.0-beta.2, #30)
CI / verify (push) Successful in 58s
Release / release (push) Successful in 35s

Files changed:
- CHANGES.md
- VERSION
- tools/chemenu/tests/test_upstream_cmd.py
This commit is contained in:
2026-09-04 07:11:20 +02:00
parent 686c08bb14
commit d2b1719a4b
3 changed files with 40 additions and 3 deletions
+30
View File
@@ -62,6 +62,7 @@ def two_repos(tmp_path, monkeypatch):
_write(seed, "kb/entities/COLLECTION.md", "instance collection contract v1\n")
_write(seed, "kb/Both.md", "page both sides delete\n")
_write(seed, "kb/ToDelete.md", "page the instance will delete\n")
_write(seed, "kb/RegularPage.md", "an ordinary page neither side has touched yet\n")
_write(seed, "raw/CONTRACT.md", "raw contract v1\n")
_write(seed, "work/CONTRACT.md", "work contract v1\n")
_write(seed, "reports/CONTRACT.md", "reports contract v1\n")
@@ -207,6 +208,35 @@ def test_open_workshop_run_files_do_not_land(two_repos):
assert not (repo / "work/some-run").exists()
def test_one_upstream_commit_mixing_every_case_at_once(two_repos):
"""The acceptance test from the issue: a single upstream commit that edits
a page the instance deleted, adds a new page, deletes an untouched page,
changes a stack contract, changes a template, and deletes a different
stack contract - all at once, all restored or discarded correctly by one
`upstream merge` call."""
upstream, repo = two_repos
_git(repo, "rm", "-q", "kb/ToDelete.md")
_commit(repo, "instance deletes ToDelete")
_write(upstream, "kb/ToDelete.md", "upstream edited it after the instance deleted it\n")
_write(upstream, "kb/BrandNewPage.md", "a demo page the upstream added\n")
_git(upstream, "rm", "-q", "kb/RegularPage.md")
_write(upstream, "kb/CONTRACT.md", "stack kb contract v2\n")
_write(upstream, "kb/CONVENTIONS.md.template", "template v2\n")
_git(upstream, "rm", "-q", "raw/CONTRACT.md")
_commit(upstream, "one upstream commit: edit + add + delete + contract + template + contract-delete")
_merge()
assert not (repo / "kb/ToDelete.md").exists()
assert not (repo / "kb/BrandNewPage.md").exists()
assert (repo / "kb/RegularPage.md").exists()
assert (repo / "kb/CONTRACT.md").read_text(encoding="utf-8") == "stack kb contract v2\n"
assert (repo / "kb/CONVENTIONS.md.template").read_text(encoding="utf-8") == "template v2\n"
assert (repo / "kb/CONVENTIONS.md").read_text(encoding="utf-8") == "instance conventions v1\n"
assert not (repo / "raw/CONTRACT.md").exists()
def test_real_conflict_in_tools_leaves_the_merge_open(two_repos):
upstream, repo = two_repos