github-issue-tower-defence-management 1.187.0 → 1.187.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-wj6o8qvo.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-DfKDTGzS.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="/assets/index-yZy1TUOo.css">
9
9
  </head>
10
10
  <body>
@@ -976,6 +976,90 @@ describe('IssueRejectionEvaluator', () => {
976
976
  'ANY_CI_JOB_FAILED_OR_IN_PROGRESS',
977
977
  );
978
978
  });
979
+
980
+ it('should resolve the pull request item itself and not call findRelatedOpenPRs when the item is a pull request', async () => {
981
+ mockIssueRepository.findRelatedOpenPRs.mockRejectedValue(
982
+ new Error(
983
+ 'findRelatedOpenPRs only supports issue URLs, not pull request URLs',
984
+ ),
985
+ );
986
+ mockIssueRepository.getOpenPullRequest.mockResolvedValue(
987
+ createReadyPr('https://github.com/user/repo/pull/7', {
988
+ isConflicted: true,
989
+ }),
990
+ );
991
+
992
+ const result = await evaluator.evaluate(
993
+ {
994
+ url: 'https://github.com/user/repo/pull/7',
995
+ labels: [],
996
+ isPr: true,
997
+ agent: 'chore',
998
+ },
999
+ [],
1000
+ {
1001
+ detectConflictEvenIfEvaluationSkipped: true,
1002
+ relatedOpenPrUrls: null,
1003
+ },
1004
+ );
1005
+
1006
+ expect(mockIssueRepository.findRelatedOpenPRs).not.toHaveBeenCalled();
1007
+ expect(mockIssueRepository.getOpenPullRequest).toHaveBeenCalledWith(
1008
+ 'https://github.com/user/repo/pull/7',
1009
+ );
1010
+ expect(result.rejections).toHaveLength(1);
1011
+ expect(result.rejections[0].type).toBe('PULL_REQUEST_CONFLICTED');
1012
+ });
1013
+
1014
+ it('should return no rejections when the pull request item itself is not conflicted', async () => {
1015
+ mockIssueRepository.findRelatedOpenPRs.mockRejectedValue(
1016
+ new Error(
1017
+ 'findRelatedOpenPRs only supports issue URLs, not pull request URLs',
1018
+ ),
1019
+ );
1020
+ mockIssueRepository.getOpenPullRequest.mockResolvedValue(
1021
+ createReadyPr('https://github.com/user/repo/pull/7'),
1022
+ );
1023
+
1024
+ const result = await evaluator.evaluate(
1025
+ {
1026
+ url: 'https://github.com/user/repo/pull/7',
1027
+ labels: [],
1028
+ isPr: true,
1029
+ agent: 'chore',
1030
+ },
1031
+ [],
1032
+ {
1033
+ detectConflictEvenIfEvaluationSkipped: true,
1034
+ relatedOpenPrUrls: null,
1035
+ },
1036
+ );
1037
+
1038
+ expect(mockIssueRepository.findRelatedOpenPRs).not.toHaveBeenCalled();
1039
+ expect(result.rejections).toHaveLength(0);
1040
+ });
1041
+
1042
+ it('should return no rejections when resolving the pull request item fails transiently', async () => {
1043
+ mockIssueRepository.getOpenPullRequest.mockRejectedValue(
1044
+ new Error('Something went wrong while executing your query.'),
1045
+ );
1046
+
1047
+ const result = await evaluator.evaluate(
1048
+ {
1049
+ url: 'https://github.com/user/repo/pull/7',
1050
+ labels: [],
1051
+ isPr: true,
1052
+ agent: 'chore',
1053
+ },
1054
+ [],
1055
+ {
1056
+ detectConflictEvenIfEvaluationSkipped: true,
1057
+ relatedOpenPrUrls: null,
1058
+ },
1059
+ );
1060
+
1061
+ expect(result.rejections).toHaveLength(0);
1062
+ });
979
1063
  });
980
1064
 
981
1065
  describe('change-target-must: label behavior', () => {
@@ -189,7 +189,16 @@ export class IssueRejectionEvaluator {
189
189
  }
190
190
  } else if (options.detectConflictEvenIfEvaluationSkipped) {
191
191
  let prsToCheck: RelatedPullRequest[];
192
- if (options.relatedOpenPrUrls != null) {
192
+ if (issue.isPr) {
193
+ const resolved = await this.resolveOpenPrsForPrItem(
194
+ issue.url,
195
+ options.resolvedOpenPrByUrl ?? null,
196
+ );
197
+ if (resolved === null) {
198
+ return { rejections, approvedPrUrl };
199
+ }
200
+ prsToCheck = resolved;
201
+ } else if (options.relatedOpenPrUrls != null) {
193
202
  const resolved = await this.resolveOpenPrsFromUrls(
194
203
  options.relatedOpenPrUrls,
195
204
  options.resolvedOpenPrByUrl ?? null,
@@ -293,6 +293,41 @@ describe('RevertNotReadyReviewQueueIssueUseCase', () => {
293
293
  expect(mockIssueCommentRepository.createComment).not.toHaveBeenCalled();
294
294
  });
295
295
 
296
+ it('should keep sweeping without calling findRelatedOpenPRs when an Awaiting Quality Check item is itself a pull request', async () => {
297
+ const pullRequestItem = createMockPullRequest({
298
+ status: 'Awaiting Quality Check',
299
+ url: 'https://github.com/user/repo/pull/9',
300
+ agent: 'chore',
301
+ });
302
+ mockIssueRepository.getAllIssues.mockResolvedValue({
303
+ project: mockProject,
304
+ issues: [pullRequestItem],
305
+ cacheUsed: false,
306
+ });
307
+ mockIssueRepository.findRelatedOpenPRs.mockRejectedValue(
308
+ new Error(
309
+ 'findRelatedOpenPRs only supports issue URLs, not pull request URLs',
310
+ ),
311
+ );
312
+ mockIssueRepository.getOpenPullRequest.mockResolvedValue({
313
+ ...createReadyPr('https://github.com/user/repo/pull/9'),
314
+ isConflicted: true,
315
+ });
316
+
317
+ await useCase.run({
318
+ manager: 'manager-user',
319
+ projectUrl: 'https://github.com/users/user/projects/1',
320
+ allowedIssueAuthors: ['owner'],
321
+ });
322
+
323
+ expect(mockIssueRepository.findRelatedOpenPRs).not.toHaveBeenCalled();
324
+ expect(mockIssueRepository.updateStatus).toHaveBeenCalledWith(
325
+ mockProject,
326
+ pullRequestItem,
327
+ 'awaiting-workspace-id',
328
+ );
329
+ });
330
+
296
331
  it('should revert Awaiting Quality Check issue with developer agent field and no linked PR', async () => {
297
332
  const issue = createMockIssue({
298
333
  status: 'Awaiting Quality Check',
@@ -1 +1 @@
1
- {"version":3,"file":"IssueRejectionEvaluator.d.ts","sourceRoot":"","sources":["../../../src/domain/usecases/IssueRejectionEvaluator.ts"],"names":[],"mappings":"AAAA,O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