فهرست منبع

fix(tests): fire session.status busy before chat.message in #1183 hydration tests

The three #1183 hydration tests never ran green anywhere: they were
written against the pre-#1185 contract where chat.message directly
marks TUI activity, and the merged truncation bug (missing brace,
repaired in the stacked base branch) hid the mismatch ever since.

After #1185, markTuiAgentActive — and therefore
hydrateTuiSessionParent (the client.session.get ancestry walk these
tests assert on) — only fires when a session.status busy event has
arrived (pendingTuiBusySessions) or the session is already owned. The
tests fired chat.message alone, so hydration never started: attempts
stayed 0 and sessionParents stayed empty.

Fix is test-side only: each test now fires session.status busy on its
own plugin instance before the first chat.message, matching the
pattern of the passing sibling tests (busy() helper). The second
chat.message in the retry/malformed tests deliberately gets no busy —
refreshing via ownedTuiActivitySessions is exactly the 'later
activation must retry' behavior under test.

Scoped: plugin TUI agent activity 10 pass / 0 fail. Full suite:
2930 pass / 0 fail — first fully green run since d11ccb50.
GoldJohnKing 2 روز پیش
والد
کامیت
ad9e8111b4
1فایلهای تغییر یافته به همراه18 افزوده شده و 0 حذف شده
  1. 18 0
      src/index.test.ts

+ 18 - 0
src/index.test.ts

@@ -490,6 +490,12 @@ describe('plugin TUI agent activity', () => {
     } as never);
 
     try {
+      await chainHooks?.event?.({
+        event: {
+          type: 'session.status',
+          properties: { sessionID: 'grandchild', status: { type: 'busy' } },
+        },
+      } as never);
       await chainHooks?.['chat.message']?.(
         { sessionID: 'grandchild', agent: 'fixer' } as never,
         {} as never,
@@ -535,6 +541,12 @@ describe('plugin TUI agent activity', () => {
     } as never);
 
     try {
+      await retryHooks?.event?.({
+        event: {
+          type: 'session.status',
+          properties: { sessionID: 'orphan-a', status: { type: 'busy' } },
+        },
+      } as never);
       await retryHooks?.['chat.message']?.(
         { sessionID: 'orphan-a', agent: 'fixer' } as never,
         {} as never,
@@ -579,6 +591,12 @@ describe('plugin TUI agent activity', () => {
     } as never);
 
     try {
+      await malformedHooks?.event?.({
+        event: {
+          type: 'session.status',
+          properties: { sessionID: 'broken-a', status: { type: 'busy' } },
+        },
+      } as never);
       await malformedHooks?.['chat.message']?.(
         { sessionID: 'broken-a', agent: 'fixer' } as never,
         {} as never,