fix(issue-50): review findings of PR #56 on macOS

- admission: a `submit --dry-run` record is marked dry_run and is not an
  open job of its session (review 1e25cf2f F1)
- create: the monitor-row adoption requires the row's server to be the one
  this create spawned on (review 1e25cf2f F2)
- pane lock: retry only on contention (BlockingIOError); the docs say the
  flock lasts while any fd-9 holder (the claim shell and the shim) lives
  (review 66680d9d)
- tests on macOS: real-herdr box HOMEs under /tmp (sun_path is 104 bytes),
  resolved paths, the fake claude reads non-canonical input (MAX_CANON 1024)
  and the pane is read unwrapped; lock holders exec their sleep so killing
  them frees the lock; the adoption tests name the server

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VCgu9Fa9iT7TbJUSzdq4Ff
This commit is contained in:
GodopuandClaude Opus 5.5 committed 2026-10-12 09:03:08 +09:00
1 parent 320aa9f7a0
commit a9ffedac36
10 files changed
+75 -19

No files matched your search

+20
View File
@@ -159,6 +159,26 @@ def test_u1c_the_job_itself_and_unreadable_records_are_skipped(tmp_path):
assert decide.open_jobs(str(tmp_path), "herdr:s", me) == ([], [])
def test_u1e_a_dry_run_record_is_not_an_open_job(tmp_path):
"""review 1e25cf2f F1: `submit --dry-run` registers a record it never
dispatches; it stays pending (Issue #34 shows it as an open job), but the
admission must not wait for it."""
reg = tmp_path / "jobs"
env = dict(os.environ, HOME=str(tmp_path), MAM_ENV_FILE=str(tmp_path / ".mam.env.absent"))
res = subprocess.run(["bash", str(WRAPPER), "submit", "--agent", "human", "--agent-session", "herdr:s",
"--dry-run", "--registry-dir", str(reg), "--prompt", "preview only"],
capture_output=True, text=True, env=env, cwd=str(tmp_path), timeout=120)
assert res.returncode == 0, res.stdout + res.stderr
(dry,) = [p.stem for p in reg.glob("*.json")]
assert _rec(reg, dry)["status"] == "pending" and _rec(reg, dry)["dry_run"] is True
me = _register(reg)
assert decide.open_jobs(str(reg), "herdr:s", me) == ([], [])
assert decide.wait_open_jobs(_ns(reg, me)) == "clear"
# control: the same record without the mark is an `injected` job that holds the session
_edit(reg, dry, dry_run=None)
assert decide.wait_open_jobs(_ns(reg, me)) == f"busy {dry}"
# ---------------------------------------------------------------------------
# U2 - FIFO release and the bound (wait_s=0: an immediate decision)
# ---------------------------------------------------------------------------