fix(story-mode): one verdict per call, failed saves, and loops that end at a check

From review round 2 (a question, failing tests first, and a push):

- A run that reported failed tests is now failed on the event itself, so
  its drawer and wire tags agree with the panel (the TDD red run was a red
  panel with a green "ok" tag; `; echo "exit=$?"` had hidden the exit code).
- A save whose command failed says so ("Claude tries to send the work up,
  and the command fails."), stamps ERROR instead of SAVED, and counts the
  error in the Director's cut. A save still running stamps nothing.
- A loop ends at its last check: README, .gitignore and the like written
  after the tests passed are their own fix panel instead of disappearing
  into the loop's diff.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Codeman maintainer committed 2026-10-18 10:43:04 +02:00
1 parent 848566828f
commit d7a6644c2f
4 files changed
+69 -13

No files matched your search

+28
View File
@@ -607,6 +607,34 @@ describe('buildStoryPage', () => {
expect(loop.tests).toEqual({ passed: 4, failed: 0 });
});
it('a failed save says so; the failing run is marked failed on the event itself', () => {
const page = pageOf([
prompt('ship'),
...bash('b1', 'pytest -q; echo "exit=$?"', 'Run tests', '1 error in 0.22s\nexit=2'),
...bash('b2', 'git push -u origin main && git -C remote.git log', 'Push', 'fatal: bad object', true),
end(1000),
]);
expect(page.events[1]).toMatchObject({ ok: false, tests: { passed: 0, failed: 1 } });
const save = page.panels.find((p) => p.kind === 'save')!;
expect(save.ok).toBe(false);
expect(save.caption.story).toBe('Claude tries to send the work up, and the command fails.');
expect(save.caption.director).toContain('1 error');
});
it('a loop ends at its last check; writes after it are a panel of their own', () => {
const page = pageOf([
prompt('tdd'),
...edit('e1', '/w/test_a.py', ['+def test_a(): ...']),
...bash('b1', 'pytest -q', 'Run tests', '1 failed in 0.1s'),
...edit('e2', '/w/a.py', ['+a = 1']),
...bash('b2', 'pytest -q', 'Run tests', '1 passed in 0.1s'),
...edit('e3', '/w/README.md', ['+# a']),
end(1000),
]);
expect(page.panels.map((p) => p.kind)).toEqual(['mission', 'loop', 'fix', 'complete']);
expect(page.panels[2].files).toEqual(['/w/README.md']);
});
it('what Claude says about a check that just ran stays on that check', () => {
const page = pageOf([
prompt('test then commit'),