github-issue-tower-defence-management 1.117.8 → 1.117.10

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.
Files changed (40) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +4 -2
  3. package/bin/adapter/entry-points/console/ui-dist/assets/{index-DID_sTas.js → index-DWiG7btO.js} +24 -24
  4. package/bin/adapter/entry-points/console/ui-dist/index.html +1 -1
  5. package/bin/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.js +14 -2
  6. package/bin/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.js.map +1 -1
  7. package/bin/adapter/entry-points/handlers/notifySilentTmuxSessions.js +7 -2
  8. package/bin/adapter/entry-points/handlers/notifySilentTmuxSessions.js.map +1 -1
  9. package/bin/adapter/repositories/FileSystemSilentSessionCandidateStateRepository.js +128 -0
  10. package/bin/adapter/repositories/FileSystemSilentSessionCandidateStateRepository.js.map +1 -0
  11. package/bin/domain/usecases/NotifySilentLiveSessionsUseCase.js +16 -4
  12. package/bin/domain/usecases/NotifySilentLiveSessionsUseCase.js.map +1 -1
  13. package/bin/domain/usecases/adapter-interfaces/SilentSessionCandidateStateRepository.js +3 -0
  14. package/bin/domain/usecases/adapter-interfaces/SilentSessionCandidateStateRepository.js.map +1 -0
  15. package/package.json +1 -1
  16. package/src/adapter/entry-points/console/ui/e2e/consoleScenario.spec.ts +39 -26
  17. package/src/adapter/entry-points/console/ui/e2e/consoleTestHarness.ts +28 -2
  18. package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsoleItemDetail.stories.tsx +2 -2
  19. package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsoleItemDetail.tsx +1 -7
  20. package/src/adapter/entry-points/console/ui/src/features/console/pages/ConsoleItemDetailContainer.test.tsx +55 -26
  21. package/src/adapter/entry-points/console/ui/src/features/console/pages/ConsoleItemDetailContainer.tsx +1 -8
  22. package/src/adapter/entry-points/console/ui-dist/assets/{index-DID_sTas.js → index-DWiG7btO.js} +24 -24
  23. package/src/adapter/entry-points/console/ui-dist/index.html +1 -1
  24. package/src/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.ts +11 -0
  25. package/src/adapter/entry-points/handlers/notifySilentTmuxSessions.test.ts +37 -3
  26. package/src/adapter/entry-points/handlers/notifySilentTmuxSessions.ts +14 -0
  27. package/src/adapter/repositories/FileSystemSilentSessionCandidateStateRepository.test.ts +201 -0
  28. package/src/adapter/repositories/FileSystemSilentSessionCandidateStateRepository.ts +115 -0
  29. package/src/domain/usecases/NotifySilentLiveSessionsUseCase.test.ts +117 -22
  30. package/src/domain/usecases/NotifySilentLiveSessionsUseCase.ts +22 -2
  31. package/src/domain/usecases/adapter-interfaces/SilentSessionCandidateStateRepository.ts +10 -0
  32. package/types/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.d.ts.map +1 -1
  33. package/types/adapter/entry-points/handlers/notifySilentTmuxSessions.d.ts +3 -0
  34. package/types/adapter/entry-points/handlers/notifySilentTmuxSessions.d.ts.map +1 -1
  35. package/types/adapter/repositories/FileSystemSilentSessionCandidateStateRepository.d.ts +18 -0
  36. package/types/adapter/repositories/FileSystemSilentSessionCandidateStateRepository.d.ts.map +1 -0
  37. package/types/domain/usecases/NotifySilentLiveSessionsUseCase.d.ts +5 -1
  38. package/types/domain/usecases/NotifySilentLiveSessionsUseCase.d.ts.map +1 -1
  39. package/types/domain/usecases/adapter-interfaces/SilentSessionCandidateStateRepository.d.ts +11 -0
  40. package/types/domain/usecases/adapter-interfaces/SilentSessionCandidateStateRepository.d.ts.map +1 -0
@@ -30,6 +30,13 @@ export type ConsoleE2eReviewCommentCall = {
30
30
  body: string;
31
31
  };
32
32
 
33
+ export type ConsoleE2eRequestChangesCall = {
34
+ url: string;
35
+ changedFilePath: string | null;
36
+ body: string;
37
+ inlineCommentLocation: { line: number; side: string } | null;
38
+ };
39
+
33
40
  type ConsoleFixtureListItem = {
34
41
  number: number;
35
42
  title: string;
@@ -370,6 +377,7 @@ const inlineCommentPullRequestDetail: PullRequestDetail = {
370
377
 
371
378
  const createStubIssueRepository = (
372
379
  reviewCommentCalls: ConsoleE2eReviewCommentCall[],
380
+ requestChangesCalls: ConsoleE2eRequestChangesCall[],
373
381
  ): IssueRepository => ({
374
382
  getAllIssues: () => notImplemented('getAllIssues'),
375
383
  getIssueByUrl: async (url: string): Promise<Issue | null> =>
@@ -402,7 +410,19 @@ const createStubIssueRepository = (
402
410
  : null,
403
411
  getPullRequestChangedFilePaths: async (): Promise<string[]> => [],
404
412
  approvePullRequest: async (): Promise<void> => undefined,
405
- requestChangesWithInlineComment: async (): Promise<void> => undefined,
413
+ requestChangesWithInlineComment: async (
414
+ prUrl: string,
415
+ changedFilePath: string | null,
416
+ commentBody: string,
417
+ inlineCommentLocation?: { line: number; side: string } | null,
418
+ ): Promise<void> => {
419
+ requestChangesCalls.push({
420
+ url: prUrl,
421
+ changedFilePath,
422
+ body: commentBody,
423
+ inlineCommentLocation: inlineCommentLocation ?? null,
424
+ });
425
+ },
406
426
  createPullRequestReviewComment: async (
407
427
  prUrl: string,
408
428
  filePath: string,
@@ -469,6 +489,7 @@ export type ConsoleE2eHarness = {
469
489
  appRootUrl: string;
470
490
  consoleDataOutputDir: string;
471
491
  reviewCommentCalls: ConsoleE2eReviewCommentCall[];
492
+ requestChangesCalls: ConsoleE2eRequestChangesCall[];
472
493
  stop: () => Promise<void>;
473
494
  };
474
495
 
@@ -486,12 +507,16 @@ export const startConsoleE2eHarness = async (): Promise<ConsoleE2eHarness> => {
486
507
  pjcode === CONSOLE_E2E_PJCODE ? { pjcode, project } : null;
487
508
 
488
509
  const reviewCommentCalls: ConsoleE2eReviewCommentCall[] = [];
510
+ const requestChangesCalls: ConsoleE2eRequestChangesCall[] = [];
489
511
 
490
512
  const server = await startWebServer({
491
513
  accessToken: CONSOLE_E2E_TOKEN,
492
514
  uiDistDir,
493
515
  consoleDataOutputDir,
494
- issueRepository: createStubIssueRepository(reviewCommentCalls),
516
+ issueRepository: createStubIssueRepository(
517
+ reviewCommentCalls,
518
+ requestChangesCalls,
519
+ ),
495
520
  resolveProject,
496
521
  issueTitleStateCache: new IssueTitleStateCache(),
497
522
  pullRequestStatusCache: new PullRequestStatusCache(),
@@ -518,6 +543,7 @@ export const startConsoleE2eHarness = async (): Promise<ConsoleE2eHarness> => {
518
543
  appRootUrl,
519
544
  consoleDataOutputDir,
520
545
  reviewCommentCalls,
546
+ requestChangesCalls,
521
547
  stop: async (): Promise<void> => {
522
548
  await closeServer(server);
523
549
  fs.rmSync(tmpRoot, { recursive: true, force: true });
@@ -212,8 +212,8 @@ export const IssueWithLinkedPullRequest: Story = {
212
212
  commitsError: null,
213
213
  },
214
214
  ],
215
- buildAddInlineComment: (prUrl) => async (path, line, side, body) => {
216
- window.alert(`comment on ${prUrl} ${path}:${line} (${side})\n${body}`);
215
+ onAddInlineComment: async (path, line, side, body) => {
216
+ window.alert(`comment on ${path}:${line} (${side})\n${body}`);
217
217
  },
218
218
  },
219
219
  };
@@ -64,7 +64,6 @@ export type ConsoleItemDetailProps = {
64
64
  buildImageProxyUrl?: ImageProxyUrlBuilder;
65
65
  renderReferenceLink?: ConsoleReferenceLinkRenderer;
66
66
  onAddInlineComment?: ConsoleAddInlineComment;
67
- buildAddInlineComment?: (prUrl: string) => ConsoleAddInlineComment;
68
67
  };
69
68
 
70
69
  export const ConsoleItemDetail = ({
@@ -93,7 +92,6 @@ export const ConsoleItemDetail = ({
93
92
  buildImageProxyUrl,
94
93
  renderReferenceLink,
95
94
  onAddInlineComment,
96
- buildAddInlineComment,
97
95
  }: ConsoleItemDetailProps) => {
98
96
  const resolvedState = state?.state ?? 'open';
99
97
  const merged = state?.merged ?? false;
@@ -283,11 +281,7 @@ export const ConsoleItemDetail = ({
283
281
  now={now}
284
282
  buildImageProxyUrl={buildImageProxyUrl}
285
283
  renderReferenceLink={renderReferenceLink}
286
- onAddInlineComment={
287
- buildAddInlineComment
288
- ? buildAddInlineComment(related.pullRequest.url)
289
- : undefined
290
- }
284
+ onAddInlineComment={onAddInlineComment}
291
285
  />
292
286
  ))}
293
287
 
@@ -187,28 +187,39 @@ describe('ConsoleItemDetailContainer', () => {
187
187
  ]);
188
188
  });
189
189
 
190
- it('routes an inline review comment on an issue related pull request to that pull request url', async () => {
190
+ it('collects an inline comment on an issue related pull request diff, enables Reject, and submits it as the request-changes review for that pull request url', async () => {
191
191
  const operations = buildOperations();
192
+ const onQueueAction = jest.fn();
192
193
  const relatedPullRequest = consoleRelatedPullRequestsFixture[0];
193
- const { container, findByRole, getAllByRole, getByPlaceholderText } =
194
- render(
195
- <ConsoleItemDetailContainer
196
- tab="unread"
197
- item={issueItem}
198
- caches={buildCaches({
199
- relatedPrs: [relatedPullRequest],
200
- prFiles: consoleChangedFilesFixture,
201
- })}
202
- operations={operations}
203
- statusOptions={consoleStatusOptionsFixture}
204
- storyOptions={consoleStoryOptionsFixture}
205
- storyColors={consoleStoryColorsFixture}
206
- storyName="TDPM Console port"
207
- overlayStatus={null}
208
- now={Date.parse('2026-06-19T12:00:00.000Z')}
209
- onQueueAction={jest.fn()}
210
- />,
211
- );
194
+ const {
195
+ container,
196
+ findByRole,
197
+ getAllByRole,
198
+ getByPlaceholderText,
199
+ getByText,
200
+ } = render(
201
+ <ConsoleItemDetailContainer
202
+ tab="unread"
203
+ item={issueItem}
204
+ caches={buildCaches({
205
+ relatedPrs: [relatedPullRequest],
206
+ prFiles: consoleChangedFilesFixture,
207
+ })}
208
+ operations={operations}
209
+ statusOptions={consoleStatusOptionsFixture}
210
+ storyOptions={consoleStoryOptionsFixture}
211
+ storyColors={consoleStoryColorsFixture}
212
+ storyName="TDPM Console port"
213
+ overlayStatus={null}
214
+ now={Date.parse('2026-06-19T12:00:00.000Z')}
215
+ onQueueAction={onQueueAction}
216
+ />,
217
+ );
218
+
219
+ await waitFor(() => {
220
+ expect(getByText('Reject')).toBeInTheDocument();
221
+ });
222
+ expect(getByText('Reject')).toBeDisabled();
212
223
 
213
224
  const fileRow = await findByRole('button', {
214
225
  name: new RegExp(consoleChangedFilesFixture[0].path),
@@ -230,13 +241,31 @@ describe('ConsoleItemDetailContainer', () => {
230
241
  expect(submitButton).not.toBeNull();
231
242
  fireEvent.click(submitButton as Element);
232
243
 
233
- const addInlineReviewComment =
234
- operations.addInlineReviewComment as jest.Mock;
235
244
  await waitFor(() => {
236
- expect(addInlineReviewComment).toHaveBeenCalledTimes(1);
245
+ expect(getByText('Reject')).not.toBeDisabled();
237
246
  });
238
- const call = addInlineReviewComment.mock.calls[0];
239
- expect(call[0]).toBe(relatedPullRequest.url);
240
- expect(call[4]).toBe('Please rename this variable.');
247
+ expect(operations.addInlineReviewComment).not.toHaveBeenCalled();
248
+
249
+ fireEvent.click(getByText('Reject'));
250
+ const rejectInput = onQueueAction.mock.calls.at(-1)?.[0];
251
+ expect(rejectInput.kind).toEqual({
252
+ type: 'review',
253
+ action: 'request_changes',
254
+ });
255
+ rejectInput.commit();
256
+ const reviewCall = (
257
+ operations.reviewPullRequest as jest.Mock
258
+ ).mock.calls.at(-1);
259
+ expect(reviewCall?.[1]).toBe(relatedPullRequest.url);
260
+ expect(reviewCall?.[2]).toBe('request_changes');
261
+ expect(reviewCall?.[3]).toEqual([
262
+ {
263
+ path: consoleChangedFilesFixture[0].path,
264
+ line: expect.any(Number),
265
+ side: expect.stringMatching(/LEFT|RIGHT/),
266
+ body: 'Please rename this variable.',
267
+ },
268
+ ]);
269
+ expect(reviewCall?.[3][0].body).not.toBe('');
241
270
  });
242
271
  });
@@ -77,12 +77,6 @@ export const ConsoleItemDetailContainer = ({
77
77
  const [pendingReviewComments, setPendingReviewComments] = useState<
78
78
  ConsolePendingReviewComment[]
79
79
  >([]);
80
- const buildAddInlineComment = useCallback(
81
- (prUrl: string): ConsoleAddInlineComment =>
82
- (path, line, side, body) =>
83
- operations.addInlineReviewComment(prUrl, path, line, side, body),
84
- [operations],
85
- );
86
80
  const addInlineComment = useCallback<ConsoleAddInlineComment>(
87
81
  async (path, line, side, body) => {
88
82
  setPendingReviewComments((previous) => [
@@ -175,8 +169,7 @@ export const ConsoleItemDetailContainer = ({
175
169
  now={now}
176
170
  buildImageProxyUrl={resolveImageProxyUrl}
177
171
  renderReferenceLink={renderReferenceLink}
178
- onAddInlineComment={item.isPr ? addInlineComment : undefined}
179
- buildAddInlineComment={buildAddInlineComment}
172
+ onAddInlineComment={addInlineComment}
180
173
  commentComposer={
181
174
  <ConsoleCommentComposer
182
175
  isPr={item.isPr}