Fix pre-existing issues and update README for v2.0
CI / build (push) Has been cancelled

- Fix _infer_state_from_artifacts: SPEC-only maps to research (was bug_find)
- Fix cmd_validate_folder: corrupted .state files now error instead of silent fallback
- Fix upgrade.sh: remove || true, add python3 check, use git rev-parse --git-dir
- Update README.md with --project flag, --can-edit modes, --upgrade, enforcement layers
- Add 6 new tests for inference and validation fixes
- Complete hook-install-process and readme-upgrade-docs tasks
This commit is contained in:
2026-06-15 14:56:33 -04:00
parent 06e47c5503
commit af66f5081d
26 changed files with 511 additions and 27 deletions
+60 -1
View File
@@ -362,4 +362,63 @@ class TestAudit:
task_dir = _create_task(tmp_project, "clean-audit", "research")
(task_dir / "SPEC.md").write_text("# Spec")
out, code = _run_status(["--audit"], tmp_project)
assert "PASS" in out
assert "PASS" in out
class TestInferStateFromArtifacts:
def test_spec_only_infers_research(self, tmp_project):
task_dir = tmp_project / ".automaton" / "tasks" / "spec-only"
task_dir.mkdir()
(task_dir / "SPEC.md").write_text("# Spec")
out, code = _run_status(["--upgrade", "--task", "spec-only"], tmp_project)
assert code == 0
state = (task_dir / ".state").read_text().strip()
assert state == "research"
def test_implementation_only_infers_bug_find(self, tmp_project):
task_dir = tmp_project / ".automaton" / "tasks" / "impl-only"
task_dir.mkdir()
(task_dir / "IMPLEMENTATION.md").write_text("# Impl")
out, code = _run_status(["--upgrade", "--task", "impl-only"], tmp_project)
assert code == 0
state = (task_dir / ".state").read_text().strip()
assert state == "bug_find"
def test_bug_report_only_infers_adversarial_bug_find(self, tmp_project):
task_dir = tmp_project / ".automaton" / "tasks" / "bug-only"
task_dir.mkdir()
(task_dir / "BUG_REPORT.md").write_text("# Bugs")
out, code = _run_status(["--upgrade", "--task", "bug-only"], tmp_project)
assert code == 0
state = (task_dir / ".state").read_text().strip()
assert state == "adversarial_bug_find"
def test_spec_and_decomposition_infers_decomposition(self, tmp_project):
task_dir = tmp_project / ".automaton" / "tasks" / "decomp-test"
task_dir.mkdir()
(task_dir / "SPEC.md").write_text("# Spec")
(task_dir / "DECOMPOSITION.md").write_text("# Decomp")
out, code = _run_status(["--upgrade", "--task", "decomp-test"], tmp_project)
assert code == 0
state = (task_dir / ".state").read_text().strip()
assert state == "decomposition"
class TestValidateFolderCorruptedState:
def test_corrupted_empty_state_file_errors(self, tmp_project):
task_dir = tmp_project / ".automaton" / "tasks" / "corrupt-test"
task_dir.mkdir()
(task_dir / ".state").write_text("")
(task_dir / "SPEC.md").write_text("# Spec")
out, code = _run_status(["--validate-folder", "--task", "corrupt-test"], tmp_project)
assert code == 1
assert "corrupted" in out.lower()
def test_whitespace_state_file_errors(self, tmp_project):
task_dir = tmp_project / ".automaton" / "tasks" / "ws-test"
task_dir.mkdir()
(task_dir / ".state").write_text(" \n")
(task_dir / "SPEC.md").write_text("# Spec")
out, code = _run_status(["--validate-folder", "--task", "ws-test"], tmp_project)
assert code == 1
assert "corrupted" in out.lower()