fix(demo): print the monitor summary once per incident
Some checks failed
Tests / Declarative: Post Actions testing.tests.test_repo_structure.test_knowledge_service_mirror_matches_source failed

The resolving tick remains the newest one until another incident opens, so the
completed checklist reprinted on every poll.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
jenkins 2026-08-06 16:07:03 -03:00
parent 93ff096fa1
commit e9c2d84dbc

View File

@ -96,6 +96,7 @@ class Monitor:
self.done: dict[str, str] = {}
self.incident = ""
self.last_line = ""
self.summarised = False
def mark(self, key: str, evidence: str) -> None:
"""Record a stage as reached and print it once, with its evidence."""
@ -123,6 +124,7 @@ class Monitor:
if incident and incident != self.incident:
self.incident = incident
self.done.clear()
self.summarised = False
print(f"\n{BOLD}{YELLOW}{stamp()} ── incident {incident} ──{RESET}")
sys.stdout.flush()
@ -167,10 +169,13 @@ def main() -> None:
f"Ariadne refused: {state.get('reason', 'human_required')} — no action taken",
)
monitor.mark("response", "escalated to a human; issue filed in the service repository")
if status == "healthy" and state.get("resolved"):
if status == "healthy" and state.get("resolved") and not monitor.summarised:
monitor.mark("verify", "rebuild finished green")
monitor.mark("outputs", f"resolved: {', '.join(state['resolved'])}")
monitor.checklist()
# The resolving tick stays newest until another incident opens, so
# the completed checklist is printed once rather than every poll.
monitor.summarised = True
line = f"{status}|{incident}|{fixture_state()}"
if line != monitor.last_line: