fix(goal): quiet waits and unify fleet NG ownership (#56, #57, #58)

This commit is contained in:
Dewey
2026-09-06 04:07:09 -05:00
parent 7345f330fc
commit 9a5fbdbda7
14 changed files with 892 additions and 26 deletions
+9 -3
View File
@@ -62,7 +62,7 @@ with tempfile.TemporaryDirectory(prefix="ng-native-pi-") as home:
rpc.terminate()
rpc.communicate(timeout=10)
for status, label, width, no_color in [("paused", "Paused", 120, False), ("blocked", "Blocked", 45, False), ("none", "Complete", 120, True), ("active", "Waiting", 45, False)]:
for status, label, width, no_color, timed in [("paused", "Paused", 120, False, False), ("blocked", "Blocked", 45, False, False), ("none", "Complete", 120, True, False), ("active", "Waiting", 45, False, True), ("active", "Waiting", 120, False, False)]:
incarnation = "ng-native-test-" + uuid.uuid4().hex
statefile = ROOT / ".pi/state/goal" / f"goal-state.{incarnation}.json"
statefile.parent.mkdir(parents=True, exist_ok=True)
@@ -70,7 +70,10 @@ with tempfile.TemporaryDirectory(prefix="ng-native-pi-") as home:
if status == "none":
state.update(text="", lastOutcome=dict(text=TEXT, status="complete", evidence="native fixture", at="2026-09-06T00:00:00.000Z"))
if status == "active":
state.update(waitTimeoutSeconds=3600, waitWakeUsed=False, activeWait=dict(owner="native fixture", nextCheck="manual acceptance", deadlineAt=int(time.time() * 1000) + 3600000, wakeSent=False))
state.update(activeWait=dict(owner="native fixture", nextCheck="manual acceptance"))
if timed:
state.update(waitTimeoutSeconds=3600, waitWakeUsed=False)
state["activeWait"].update(deadlineAt=int(time.time() * 1000) + 3600000, wakeSent=False)
statefile.write_text(json.dumps(state))
tty_env = {**env, "MOSAIC_LAUNCH_INCARNATION": incarnation}
tty_env.pop("NO_COLOR", None)
@@ -98,7 +101,10 @@ with tempfile.TemporaryDirectory(prefix="ng-native-pi-") as home:
Path("/tmp/ng-goal-native-entered.log").write_bytes(entered)
os.write(master, b"\x1b[13u")
receive(master, "END-OF-GOAL")
print(f"PASS native {label}, width={width}, NO_COLOR={no_color}: footer + /goal + Alt+G", flush=True)
if status == "active":
current = json.loads(statefile.read_text())
assert current == state, "waiting startup/recall must not inject checks or mutate the fixture"
print(f"PASS native {label}, width={width}, NO_COLOR={no_color}, timed={timed}: footer + /goal + Alt+G; zero wait checks", flush=True)
finally:
os.killpg(child.pid, signal.SIGTERM)
child.wait(timeout=10)