immune-brain 2.8.2 → 2.8.3
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.
package/package.json
CHANGED
|
@@ -8,9 +8,10 @@ const PROTOCOL_MARKER = "<!-- immune-brain-tracker:v1 -->";
|
|
|
8
8
|
const KIND_INITIATIVE_MARKER = "<!-- immune-brain:kind=initiative -->";
|
|
9
9
|
const KIND_TASK_MARKER = "<!-- immune-brain:kind=task -->";
|
|
10
10
|
const ID_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
|
|
11
|
-
const MAX_GH_OUTPUT = 1024 * 1024;
|
|
11
|
+
const MAX_GH_OUTPUT = 8 * 1024 * 1024;
|
|
12
12
|
const MAX_DIAGNOSTIC = 512;
|
|
13
13
|
const GH_TIMEOUT_MS = 20_000;
|
|
14
|
+
const MAX_SNAPSHOT_PAGES = 100;
|
|
14
15
|
const GITHUB_ISSUE_BODY_LIMIT = 65_536;
|
|
15
16
|
const MAX_TERMINAL_EVENT_ID = 500;
|
|
16
17
|
|
|
@@ -348,19 +349,33 @@ async function snapshot(root: string, gh: GhTransport, operation: TrackerOperati
|
|
|
348
349
|
} catch (error) {
|
|
349
350
|
return result(operation, "permanent_failure", error instanceof Error ? error.message : String(error));
|
|
350
351
|
}
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
352
|
+
// ponytail: paginated fetch avoids single 1MiB slurp blob; 100 issues/page * 8MiB handles 65KB bodies without hitting limit
|
|
353
|
+
const issues: GithubIssue[] = [];
|
|
354
|
+
for (let page = 1; page <= MAX_SNAPSHOT_PAGES; page += 1) {
|
|
355
|
+
const issuesExecution = await gh.run(
|
|
356
|
+
["api", `repos/${repository.name_with_owner}/issues?state=all&per_page=100&page=${page}`],
|
|
357
|
+
{ cwd: root },
|
|
358
|
+
);
|
|
359
|
+
if (issuesExecution.exit_code !== 0 || issuesExecution.output_exceeded)
|
|
360
|
+
return ghFailure(operation, issuesExecution, "cannot query GitHub Issues");
|
|
361
|
+
let raw: unknown;
|
|
362
|
+
try {
|
|
363
|
+
raw = JSON.parse(issuesExecution.stdout);
|
|
364
|
+
} catch (error) {
|
|
365
|
+
return result(operation, "permanent_failure", error instanceof Error ? error.message : String(error));
|
|
366
|
+
}
|
|
367
|
+
if (!Array.isArray(raw)) return result(operation, "permanent_failure", "gh returned malformed Issue list");
|
|
368
|
+
const pageCount = raw.length;
|
|
369
|
+
try {
|
|
370
|
+
issues.push(...parseIssues(issuesExecution.stdout));
|
|
371
|
+
} catch (error) {
|
|
372
|
+
return result(operation, "permanent_failure", error instanceof Error ? error.message : String(error));
|
|
373
|
+
}
|
|
374
|
+
if (pageCount < 100) break;
|
|
375
|
+
if (page === MAX_SNAPSHOT_PAGES)
|
|
376
|
+
return result(operation, "permanent_failure", "too many GitHub Issues to snapshot");
|
|
363
377
|
}
|
|
378
|
+
return { repository, issues };
|
|
364
379
|
}
|
|
365
380
|
|
|
366
381
|
function findIssue(issues: GithubIssue[], primary: string[], required: string[]): IssueLookup {
|