github-issue-tower-defence-management 2.184.7 → 2.184.8

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.
@@ -3,17 +3,40 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ConsoleErrorReportUseCase = void 0;
4
4
  const commentCreateWithDedupRetry_1 = require("../services/commentCreateWithDedupRetry");
5
5
  const secretRedaction_1 = require("../services/secretRedaction");
6
+ const ClearDependedIssueURLUseCase_1 = require("./ClearDependedIssueURLUseCase");
7
+ const ISSUE_MEMORY_DURATION_MILLISECONDS = 3 * 60 * 60 * 1000;
8
+ const RATE_LIMIT_GROUP = 'API rate limit';
9
+ const RATE_LIMIT_CANONICAL_TITLE = 'Console error: API rate limit exceeded';
10
+ const RATE_LIMIT_SEARCH_PHRASE = 'rate limit';
11
+ const RATE_LIMIT_MESSAGE_PATTERN = /rate limit/i;
12
+ const CONSOLE_ERROR_TITLE_PREFIX = 'Console error';
6
13
  class ConsoleErrorReportUseCase {
7
14
  constructor(issueRepository, sleep = commentCreateWithDedupRetry_1.realSleep) {
8
15
  this.issueRepository = issueRepository;
9
16
  this.sleep = sleep;
17
+ this.latestRunByGroupKey = new Map();
18
+ this.rememberedIssueByGroupKey = new Map();
10
19
  this.run = async (params) => {
11
20
  const { error, owner, repo, requestPath, requestBody } = params;
12
21
  const errorName = error instanceof Error ? (error.name ?? 'Error') : 'Error';
13
22
  const message = (0, secretRedaction_1.redactSecrets)(error instanceof Error ? error.message : String(error));
14
23
  const stack = (0, secretRedaction_1.redactSecrets)(error instanceof Error && error.stack ? error.stack : String(error));
15
- const title = `Console error: ${errorName}: ${message.slice(0, 80)}`;
24
+ const title = `${CONSOLE_ERROR_TITLE_PREFIX}: ${errorName}: ${message.slice(0, 80)}`;
16
25
  const occurredAt = new Date().toISOString();
26
+ const group = RATE_LIMIT_MESSAGE_PATTERN.test(message)
27
+ ? {
28
+ groupKey: `${owner}/${repo}|${RATE_LIMIT_GROUP}`,
29
+ createTitle: RATE_LIMIT_CANONICAL_TITLE,
30
+ searchTitle: RATE_LIMIT_SEARCH_PHRASE,
31
+ matchesSearchResultTitle: (resultTitle) => resultTitle.includes(CONSOLE_ERROR_TITLE_PREFIX) &&
32
+ RATE_LIMIT_MESSAGE_PATTERN.test(resultTitle),
33
+ }
34
+ : {
35
+ groupKey: `${owner}/${repo}|${title}`,
36
+ createTitle: title,
37
+ searchTitle: title,
38
+ matchesSearchResultTitle: (resultTitle) => resultTitle.endsWith(title),
39
+ };
17
40
  const buildBody = (prefix) => [
18
41
  `${prefix}`,
19
42
  ``,
@@ -36,26 +59,82 @@ class ConsoleErrorReportUseCase {
36
59
  stack,
37
60
  `\`\`\``,
38
61
  ].join('\n');
62
+ const previousRun = this.latestRunByGroupKey.get(group.groupKey) ?? Promise.resolve();
63
+ const currentRun = previousRun.then(() => this.reportWithinTurn({ owner, repo, group, buildBody }));
64
+ this.latestRunByGroupKey.set(group.groupKey, currentRun);
65
+ try {
66
+ await currentRun;
67
+ }
68
+ finally {
69
+ if (this.latestRunByGroupKey.get(group.groupKey) === currentRun) {
70
+ this.latestRunByGroupKey.delete(group.groupKey);
71
+ }
72
+ }
73
+ };
74
+ this.reportWithinTurn = async (params) => {
75
+ const { owner, repo, group, buildBody } = params;
39
76
  try {
77
+ this.removeExpiredRememberedIssues();
78
+ const rememberedIssueUrl = await this.findOpenRememberedIssueUrl(group.groupKey);
79
+ if (rememberedIssueUrl !== null) {
80
+ await this.createCommentByUrlWithDedup(rememberedIssueUrl, buildBody('Console error recurrence'));
81
+ return;
82
+ }
40
83
  const results = await this.issueRepository.searchIssue({
41
84
  owner,
42
85
  repositoryName: repo,
43
86
  type: 'issue',
44
87
  state: 'open',
45
- title,
88
+ title: group.searchTitle,
46
89
  });
47
- const existing = results.find((r) => r.title === title);
90
+ const existing = results.find((r) => group.matchesSearchResultTitle(r.title));
48
91
  if (existing) {
92
+ this.rememberIssue(group.groupKey, existing.url);
49
93
  await this.createCommentByUrlWithDedup(existing.url, buildBody('Console error recurrence'));
94
+ return;
50
95
  }
51
- else {
52
- await this.issueRepository.createNewIssue(owner, repo, title, buildBody('Console error'), [], []);
53
- }
96
+ const createdIssueNumber = await this.issueRepository.createNewIssue(owner, repo, group.createTitle, buildBody('Console error'), [], []);
97
+ this.rememberIssue(group.groupKey, `https://github.com/${owner}/${repo}/issues/${createdIssueNumber}`);
54
98
  }
55
99
  catch (reportError) {
56
100
  console.error('ConsoleErrorReportUseCase: failed to report error:', reportError);
57
101
  }
58
102
  };
103
+ this.removeExpiredRememberedIssues = () => {
104
+ const nowMilliseconds = Date.now();
105
+ for (const [groupKey, remembered] of this.rememberedIssueByGroupKey) {
106
+ if (!this.isRememberedIssueValid(remembered, nowMilliseconds)) {
107
+ this.rememberedIssueByGroupKey.delete(groupKey);
108
+ }
109
+ }
110
+ };
111
+ this.findOpenRememberedIssueUrl = async (groupKey) => {
112
+ const remembered = this.rememberedIssueByGroupKey.get(groupKey) ?? null;
113
+ if (remembered === null) {
114
+ return null;
115
+ }
116
+ try {
117
+ const issueState = await this.issueRepository.getIssueOrPullRequestState(remembered.issueUrl);
118
+ if (issueState.state.toLowerCase() === 'open') {
119
+ return remembered.issueUrl;
120
+ }
121
+ }
122
+ catch (stateError) {
123
+ if (!(stateError instanceof ClearDependedIssueURLUseCase_1.GitHubConfirmedNotFoundError)) {
124
+ throw stateError;
125
+ }
126
+ }
127
+ this.rememberedIssueByGroupKey.delete(groupKey);
128
+ return null;
129
+ };
130
+ this.isRememberedIssueValid = (remembered, nowMilliseconds) => nowMilliseconds - remembered.rememberedAtMilliseconds <
131
+ ISSUE_MEMORY_DURATION_MILLISECONDS;
132
+ this.rememberIssue = (groupKey, issueUrl) => {
133
+ this.rememberedIssueByGroupKey.set(groupKey, {
134
+ issueUrl,
135
+ rememberedAtMilliseconds: Date.now(),
136
+ });
137
+ };
59
138
  this.createCommentByUrlWithDedup = async (url, commentBody) => {
60
139
  await (0, commentCreateWithDedupRetry_1.commentCreateWithDedupRetry)(commentBody, async () => {
61
140
  const existing = await this.issueRepository.getIssueOrPullRequestComments(url);
@@ -1 +1 @@
1
- {"version":3,"file":"ConsoleErrorReportUseCase.js","sourceRoot":"","sources":["../../../src/domain/usecases/ConsoleErrorReportUseCase.ts"],"names":[],"mappings":";;;AACA,yFAIiD;AACjD,iEAA4D;AAU5D,MAAa,yBAAyB;IACpC,YACmB,eAA6C,EAC7C,QAAe,uCAAS;QADxB,oBAAe,GAAf,eAAe,CAA8B;QAC7C,UAAK,GAAL,KAAK,CAAmB;QAG3C,QAAG,GAAG,KAAK,EAAE,MAMZ,EAAiB,EAAE;YAClB,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC;YAChE,MAAM,SAAS,GACb,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;YAC7D,MAAM,OAAO,GAAG,IAAA,+BAAa,EAC3B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CACvD,CAAC;YACF,MAAM,KAAK,GAAG,IAAA,+BAAa,EACzB,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CACpE,CAAC;YACF,MAAM,KAAK,GAAG,kBAAkB,SAAS,KAAK,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;YACrE,MAAM,UAAU,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;YAE5C,MAAM,SAAS,GAAG,CAAC,MAAc,EAAU,EAAE,CAC3C;gBACE,GAAG,MAAM,EAAE;gBACX,EAAE;gBACF,eAAe,S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 @@
1
1
  {
2
2
  "name": "github-issue-tower-defence-management",
3
- "version": "2.184.7",
3
+ "version": "2.184.8",
4
4
  "description": "",
5
5
  "main": "bin/index.js",
6
6
  "scripts": {
@@ -1,9 +1,11 @@
1
1
  import type { IssueRepository } from './adapter-interfaces/IssueRepository';
2
2
  import { Sleep } from '../services/commentCreateWithDedupRetry';
3
- type ConsoleErrorReportRepository = Pick<IssueRepository, 'searchIssue' | 'createNewIssue' | 'createCommentByUrl' | 'getIssueOrPullRequestComments'>;
3
+ type ConsoleErrorReportRepository = Pick<IssueRepository, 'searchIssue' | 'createNewIssue' | 'createCommentByUrl' | 'getIssueOrPullRequestComments' | 'getIssueOrPullRequestState'>;
4
4
  export declare class ConsoleErrorReportUseCase {
5
5
  private readonly issueRepository;
6
6
  private readonly sleep;
7
+ private readonly latestRunByGroupKey;
8
+ private readonly rememberedIssueByGroupKey;
7
9
  constructor(issueRepository: ConsoleErrorReportRepository, sleep?: Sleep);
8
10
  run: (params: {
9
11
  error: unknown;
@@ -12,6 +14,11 @@ export declare class ConsoleErrorReportUseCase {
12
14
  requestPath: string;
13
15
  requestBody?: Record<string, unknown>;
14
16
  }) => Promise<void>;
17
+ private reportWithinTurn;
18
+ private removeExpiredRememberedIssues;
19
+ private findOpenRememberedIssueUrl;
20
+ private isRememberedIssueValid;
21
+ private rememberIssue;
15
22
  private createCommentByUrlWithDedup;
16
23
  }
17
24
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"ConsoleErrorReportUseCase.d.ts","sourceRoot":"","sources":["../../../src/domain/usecases/ConsoleErrorReportUseCase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAGL,KAAK,EACN,MAAM,yCAAyC,CAAC;AAGjD,KAAK,4BAA4B,GAAG,IAAI,CACtC,eAAe,EACb,aAAa,GACb,gBAAgB,GAChB,oBAAoB,GACpB,+BAA+B,CAClC,CAAC;AAEF,qBAAa,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