github-issue-tower-defence-management 1.122.1 → 1.122.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>TDPM Console</title>
7
- <script type="module" crossorigin src="/assets/index-syKbd_lW.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-CC-RYye2.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="/assets/index-D0RwhyOM.css">
9
9
  </head>
10
10
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "github-issue-tower-defence-management",
3
- "version": "1.122.1",
3
+ "version": "1.122.2",
4
4
  "description": "",
5
5
  "main": "bin/index.js",
6
6
  "scripts": {
@@ -129,6 +129,28 @@ describe('buildConsoleDataResponse', () => {
129
129
  });
130
130
  });
131
131
 
132
+ it('applies the done exclusion to the workflow-blocker list', () => {
133
+ writeJson('umino/workflow-blocker/list.json', {
134
+ pjcode: 'umino',
135
+ items: [
136
+ { projectItemId: 'PVTI_1', title: 'keep' },
137
+ { projectItemId: 'PVTI_2', title: 'processed blocker' },
138
+ ],
139
+ });
140
+ recordDoneProjectItemId(baseDir, 'umino', 'workflow-blocker', 'PVTI_2');
141
+ const response = buildConsoleDataResponse(baseDir, {
142
+ kind: 'list',
143
+ pjcode: 'umino',
144
+ tab: 'workflow-blocker',
145
+ });
146
+ expect(response.statusCode).toBe(200);
147
+ const parsed: unknown = JSON.parse(response.body);
148
+ expect(parsed).toEqual({
149
+ pjcode: 'umino',
150
+ items: [{ projectItemId: 'PVTI_1', title: 'keep' }],
151
+ });
152
+ });
153
+
132
154
  it('serves a list file without an items array unchanged', () => {
133
155
  writeJson('umino/prs/list.json', { pjcode: 'umino' });
134
156
  const response = buildConsoleDataResponse(baseDir, {
@@ -94,5 +94,13 @@ describe('consoleDoneStore', () => {
94
94
  ]);
95
95
  }
96
96
  });
97
+
98
+ it('includes the workflow-blocker tab so processed blockers are excluded', () => {
99
+ expect(CONSOLE_DONE_TAB_NAMES).toContain('workflow-blocker');
100
+ recordDoneProjectItemIdAcrossTabs(baseDir, 'umino', 'PVTI_7');
101
+ expect(
102
+ readDoneProjectItemIds(baseDir, 'umino', 'workflow-blocker'),
103
+ ).toEqual(['PVTI_7']);
104
+ });
97
105
  });
98
106
  });
@@ -72,6 +72,7 @@ export const recordDoneProjectItemId = (
72
72
  };
73
73
 
74
74
  export const CONSOLE_DONE_TAB_NAMES: string[] = [
75
+ 'workflow-blocker',
75
76
  'prs',
76
77
  'triage',
77
78
  'unread',
@@ -1,12 +1,9 @@
1
1
  import {
2
2
  countPendingItems,
3
- countTabPendingItems,
4
3
  filterPendingItems,
5
- filterTabPendingItems,
6
4
  isOverlayEntryActed,
7
5
  overlayKeyForItem,
8
6
  overlayStorageKey,
9
- tabIgnoresDoneOverlay,
10
7
  writeOverlayEntry,
11
8
  } from './overlay';
12
9
  import type { ConsoleListItem, ConsoleOverlay } from './types';
@@ -126,59 +123,29 @@ describe('filterPendingItems', () => {
126
123
  });
127
124
  });
128
125
 
129
- describe('tabIgnoresDoneOverlay', () => {
130
- it('ignores the done overlay on the workflow-blocker tab', () => {
131
- expect(tabIgnoresDoneOverlay('workflow-blocker')).toBe(true);
132
- });
133
-
134
- it('applies the done overlay on every other tab', () => {
135
- expect(tabIgnoresDoneOverlay('prs')).toBe(false);
136
- expect(tabIgnoresDoneOverlay('triage')).toBe(false);
137
- expect(tabIgnoresDoneOverlay('unread')).toBe(false);
138
- expect(tabIgnoresDoneOverlay('failed-preparation')).toBe(false);
139
- expect(tabIgnoresDoneOverlay('todo-by-human')).toBe(false);
140
- });
141
- });
142
-
143
- describe('countTabPendingItems', () => {
144
- it('counts every workflow-blocker item even when all are marked done', () => {
126
+ describe('workflow-blocker items are filtered by the done overlay like every other tab', () => {
127
+ it('subtracts a processed workflow-blocker item from the count', () => {
145
128
  const overlay: ConsoleOverlay = {
146
129
  PVTI_1: { ts: 100, mode: 'workflow-blocker', done: true },
147
- PVTI_2: { ts: 100, mode: 'workflow-blocker', done: true },
148
130
  };
149
- expect(
150
- countTabPendingItems([item(1), item(2)], overlay, 'workflow-blocker'),
151
- ).toBe(2);
131
+ expect(countPendingItems([item(1), item(2)], overlay)).toBe(1);
152
132
  });
153
133
 
154
- it('subtracts done items on tabs other than workflow-blocker', () => {
134
+ it('removes a processed workflow-blocker item from the list', () => {
155
135
  const overlay: ConsoleOverlay = {
156
- PVTI_1: { ts: 100, mode: 'prs', done: true },
136
+ PVTI_1: { ts: 100, mode: 'workflow-blocker', done: true },
157
137
  };
158
- expect(countTabPendingItems([item(1), item(2)], overlay, 'prs')).toBe(1);
138
+ const result = filterPendingItems([item(1), item(2)], overlay);
139
+ expect(result.map((entry) => entry.number)).toEqual([2]);
159
140
  });
160
- });
161
141
 
162
- describe('filterTabPendingItems', () => {
163
- it('keeps every workflow-blocker item even when all are marked done', () => {
142
+ it('drives the count to zero when every workflow-blocker item is processed', () => {
164
143
  const overlay: ConsoleOverlay = {
165
144
  PVTI_1: { ts: 100, mode: 'workflow-blocker', done: true },
166
145
  PVTI_2: { ts: 100, mode: 'workflow-blocker', done: true },
167
146
  };
168
- const result = filterTabPendingItems(
169
- [item(1), item(2)],
170
- overlay,
171
- 'workflow-blocker',
172
- );
173
- expect(result.map((entry) => entry.number)).toEqual([1, 2]);
174
- });
175
-
176
- it('drops done items on tabs other than workflow-blocker', () => {
177
- const overlay: ConsoleOverlay = {
178
- PVTI_1: { ts: 100, mode: 'prs', done: true },
179
- };
180
- const result = filterTabPendingItems([item(1), item(2)], overlay, 'prs');
181
- expect(result.map((entry) => entry.number)).toEqual([2]);
147
+ expect(countPendingItems([item(1), item(2)], overlay)).toBe(0);
148
+ expect(filterPendingItems([item(1), item(2)], overlay)).toEqual([]);
182
149
  });
183
150
  });
184
151
 
@@ -30,23 +30,6 @@ export const filterPendingItems = (
30
30
  (item) => !isOverlayEntryActed(overlay[overlayKeyForItem(item)]),
31
31
  );
32
32
 
33
- export const tabIgnoresDoneOverlay = (tab: ConsoleTabName): boolean =>
34
- tab === 'workflow-blocker';
35
-
36
- export const countTabPendingItems = (
37
- items: ConsoleListItem[],
38
- overlay: ConsoleOverlay,
39
- tab: ConsoleTabName,
40
- ): number =>
41
- tabIgnoresDoneOverlay(tab) ? items.length : countPendingItems(items, overlay);
42
-
43
- export const filterTabPendingItems = (
44
- items: ConsoleListItem[],
45
- overlay: ConsoleOverlay,
46
- tab: ConsoleTabName,
47
- ): ConsoleListItem[] =>
48
- tabIgnoresDoneOverlay(tab) ? items : filterPendingItems(items, overlay);
49
-
50
33
  export const writeOverlayEntry = (
51
34
  overlay: ConsoleOverlay,
52
35
  key: string,
@@ -255,7 +255,7 @@ describe('ConsolePage', () => {
255
255
  expect(queryByText('project: umino')).toBeNull();
256
256
  });
257
257
 
258
- it('keeps the workflow-blocker tab visible and lists its items even when every item is marked done in the overlay', async () => {
258
+ it('removes a processed workflow-blocker item from the list and decrements its tab badge, like every other tab', async () => {
259
259
  const blockerItems = [
260
260
  {
261
261
  number: 701,
@@ -311,7 +311,6 @@ describe('ConsolePage', () => {
311
311
  'pv_overlay_umino',
312
312
  JSON.stringify({
313
313
  PVTI_B1: { ts: 1, mode: 'workflow-blocker', done: true },
314
- PVTI_B2: { ts: 1, mode: 'workflow-blocker', done: true },
315
314
  }),
316
315
  );
317
316
  window.history.replaceState(
@@ -320,17 +319,17 @@ describe('ConsolePage', () => {
320
319
  '/projects/umino/workflow-blocker?k=token',
321
320
  );
322
321
 
323
- const { getByText } = render(<ConsolePage />);
322
+ const { getByText, queryByText } = render(<ConsolePage />);
324
323
  await waitFor(() => {
325
- expect(getByText('Blocked deployment task')).toBeInTheDocument();
324
+ expect(getByText('Blocked rollout task')).toBeInTheDocument();
326
325
  });
327
- expect(getByText('Blocked rollout task')).toBeInTheDocument();
326
+ expect(queryByText('Blocked deployment task')).toBeNull();
328
327
  const blockerTab = within(tabBar())
329
328
  .getByText('Workflow Blocker')
330
329
  .closest('a');
331
330
  expect(blockerTab).not.toBeNull();
332
331
  expect(blockerTab?.querySelector('.console-tab-badge')?.textContent).toBe(
333
- '2',
332
+ '1',
334
333
  );
335
334
  });
336
335
 
@@ -26,8 +26,8 @@ import {
26
26
  previousPendingKeyBefore,
27
27
  } from '../logic/navigation';
28
28
  import {
29
- countTabPendingItems,
30
- filterTabPendingItems,
29
+ countPendingItems,
30
+ filterPendingItems,
31
31
  overlayKeyForItem,
32
32
  } from '../logic/overlay';
33
33
  import type { ConsoleSwipeDirection } from '../logic/swipe';
@@ -65,10 +65,9 @@ export const ConsolePage = () => {
65
65
  if (snapshot === null) {
66
66
  continue;
67
67
  }
68
- result[tab.name] = countTabPendingItems(
68
+ result[tab.name] = countPendingItems(
69
69
  snapshot.items,
70
70
  overlayState.overlay,
71
- tab.name,
72
71
  );
73
72
  }
74
73
  return result;
@@ -93,12 +92,8 @@ export const ConsolePage = () => {
93
92
  if (activeSnapshot === null) {
94
93
  return [];
95
94
  }
96
- return filterTabPendingItems(
97
- activeSnapshot.items,
98
- overlayState.overlay,
99
- activeTab,
100
- );
101
- }, [activeSnapshot, overlayState.overlay, activeTab]);
95
+ return filterPendingItems(activeSnapshot.items, overlayState.overlay);
96
+ }, [activeSnapshot, overlayState.overlay]);
102
97
 
103
98
  const orderedPendingKeys = useMemo(
104
99
  () => pendingItems.map((item) => overlayKeyForItem(item)),