Sfoglia il codice sorgente

Test suite repair: align stale checks with the current surfaces

The full-suite run for goal 24 verification could not complete: five
pre-existing check failures (none from goal 24's code) aborted or failed
bundles.

- pages: the log page's SSE client and the yeehaw badge classes live in
  the compiled task_log.js resource, not the page HTML (plan 17 b3+);
  the comment card renders its body via stm-markdown now. Assert on the
  served resource where the code actually ships.
- pages: the migration-serial check still pinned [1,2,3]; goal 24 added
  M0004 (understandings) and M0005 (discoveries), so a fresh boot runs
  1..5.
- answers: the fake daemon's /status never reported task_id, so every
  answered staleness probe looked like a crash orphan and requeued the
  task. The real daemon reports it (Server.vala) — teach the fake the
  wire contract.
- users: Spry's change-own-password revokes the user's auth slots; the
  bundle kept using the pre-change handle for its cleanup fetches.
  Re-login and reuse the fresh slot.
- goalui, parity: same compiled-resource drift as pages.

Bundles now pass standalone and sequentially: pages 121/0, dispatch,
subtasks, lineage, allocation, lifecycle, answers 62/0, goals, replay,
goalui 128/0, forcewake, users 39/0, stacks, notes, resurrect, origins,
parity 21/0, understanding, discoveries.
saddle-Clanker-Saddle 4 settimane fa
parent
commit
bddce37c59
5 ha cambiato i file con 34 aggiunte e 11 eliminazioni
  1. 5 1
      test/bundles/goalui.py
  2. 12 6
      test/bundles/pages.py
  3. 6 2
      test/bundles/parity.py
  4. 4 1
      test/bundles/users.py
  5. 7 1
      test/harness.py

+ 5 - 1
test/bundles/goalui.py

@@ -301,7 +301,11 @@ def run(ctx):
           and log_state["task_url"] == "/tasks/%d" % run_task,
           "the event log page hydrates the run-task header")
     log_page = http_get_page(auth, "/tasks/%d/log" % run_task)
-    check("EventSource" in log_page and "events/stream" in log_page
+    # The SSE client ships as the compiled task_log.js resource (plan 17
+    # b3+): the page references it and the resource carries the code.
+    status, log_js = http("GET", "/_statum/resource/task_log.js", timeout=15)
+    check(status == 200 and "task_log.js" in log_page
+          and "EventSource" in log_js and "events/stream" in log_js
           and "data-log-feed" in log_page,
           "the log page subscribes to the ledger's SSE stream")
     check(goal_state(goal)["runs"][0]["terminal_url"] == "/tasks/%d/log" % run_task,

+ 12 - 6
test/bundles/pages.py

@@ -720,7 +720,12 @@ def run(ctx):
     check(log_state.get("exists") is True and int(log_state["task_id"]) == dash_run,
           "the event log page state names the run task")
     log_html = http_get_page(auth, "/tasks/%d/log" % dash_run)
-    check("EventSource" in log_html and "events/stream" in log_html,
+    # The log page's client JS ships as a compiled resource (plan 17
+    # b3+), so the SSE subscription is asserted on the served resource
+    # the page references, not the page HTML itself.
+    status, log_js = http("GET", "/_statum/resource/task_log.js", timeout=15)
+    check(status == 200 and "task_log.js" in log_html
+          and "EventSource" in log_js and "events/stream" in log_js,
           "the log page subscribes to the task's SSE stream")
     run_detail = task_state(auth, dash_run)
     check(run_detail.get("is_goal_run") is True and run_detail.get("mode") == "orchestrate",
@@ -757,7 +762,7 @@ def run(ctx):
     task_page_html = http_get_page(auth, "/tasks/%d" % keeper)
     check("saddle comment" not in task_page_html,
           "the task page never shows the command echo")
-    check(task_page_html.index('stm-text="comment.body"')
+    check(task_page_html.index('stm-markdown="comment.body"')
           < task_page_html.index('stm-text="comment.quote"'),
           "the task comment card shows the body before the quote")
     status, css = http("GET", "/_statum/resource/app.css", timeout=15)
@@ -905,10 +910,11 @@ def run(ctx):
         "select name from sqlite_master"
         " where type = 'index' and tbl_name = 'events'").fetchall()}
     conn.close()
-    check([s[0] for s in serials] == [1, 2, 3],
-          "the clanker-saddle namespace carries exactly serials 1, 2 and 3"
-          " (a fresh boot ran M0001 then the M0002 no-op then M0003)")
-    check(len(serials) == 3,
+    check([s[0] for s in serials] == [1, 2, 3, 4, 5],
+          "the clanker-saddle namespace carries exactly serials 1 through 5"
+          " (a fresh boot ran M0001 then the M0002 no-op then M0003,"
+          " M0004 understandings and M0005 discoveries)")
+    check(len(serials) == 5,
           "no duplicate migration rows (each guarded up() applied once)")
     check({"idx_events_scope", "idx_events_terminal"} <= event_indexes,
           "M0003's event reader indexes exist (fresh boot)")

+ 6 - 2
test/bundles/parity.py

@@ -109,8 +109,12 @@ def run(ctx):
     fake.push_events([{"kind": "yeehaw", "actor": "model",
                        "payload": {"message": "shipped the parity wire — delightful task"}}])
     status, page = http("GET", "/tasks/%d/log" % task_id, timeout=15)
+    # The badge classes and kind handling live in the compiled
+    # task_log.js resource (plan 17 b3+), not the page HTML.
+    status_js, log_js = http("GET", "/_statum/resource/task_log.js", timeout=15)
     check(status == 200 and "data-log-feed" in page,
           "yeehaw: the task log page renders")
-    check("badge-yeehaw" in page, "yeehaw: the page ships the festive badge class")
-    check("'yeehaw'" in page or '"yeehaw"' in page,
+    check(status_js == 200 and "badge-yeehaw" in log_js,
+          "yeehaw: the page ships the festive badge class")
+    check("'yeehaw'" in log_js or '"yeehaw"' in log_js,
           "yeehaw: the page's client script knows the kind")

+ 4 - 1
test/bundles/users.py

@@ -125,7 +125,10 @@ def run(ctx):
         "current_password": "adminpass123", "new_password": "newpass9",
         "confirm_password": "newpass9"})
     check("changed" in (action_notify(result) or ""), "password changed")
-    login("admin", "newpass9")
+    # Spry's change-own-password revokes the user's auth slots: the
+    # seeded handle above dies with the old password, so re-login and
+    # use the fresh slot for everything after this point.
+    admin = login("admin", "newpass9")
     check(True, "admin logs in with the new password")
 
     carol_auth = login("carol", "carolpass")

+ 7 - 1
test/harness.py

@@ -887,7 +887,13 @@ class FakeSaddle:
                 response = {"state": self.daemon.state, "summary": self.daemon.summary,
                             "uptime_seconds": int(time.monotonic() - self.daemon.started_mono),
                             "last_activity_epoch": self.daemon.last_activity_epoch,
-                            "ssh_public_key": self.daemon.ssh_public_key}
+                            "ssh_public_key": self.daemon.ssh_public_key,
+                            # The wire contract's task confirmation (the
+                            # probe-recovery flip): a running daemon names
+                            # the task it runs; an idle one reports null.
+                            # Without it every answered probe looks like a
+                            # crash orphan and requeues the task.
+                            "task_id": self.daemon.running_task or None}
                 if getattr(self.daemon, "status_extra", None):
                     response.update(self.daemon.status_extra)
                 if self.daemon.resumed_pending: