fix: reduce noise for gh issue view comments

This commit is contained in:
Codex
2026-07-04 12:21:29 +00:00
parent e7749113d8
commit efb205aa39
4 changed files with 65 additions and 8 deletions
+20
View File
@@ -292,6 +292,8 @@ function summarizeEnvelope(envelope: JsonEnvelope<unknown>): Record<string, unkn
const issueRecord = issue as Record<string, unknown>;
summary.issue = pickSummary(issueRecord, ["number", "title", "state", "url", "bodyChars", "commentCount"]);
}
const issueCommentsMigration = summarizeIssueCommentsMigration(source);
if (issueCommentsMigration !== null) summary.issueCommentsMigration = issueCommentsMigration;
const pullRequest = source.pullRequest;
if (typeof pullRequest === "object" && pullRequest !== null) {
const prRecord = pullRequest as Record<string, unknown>;
@@ -319,6 +321,24 @@ function summarizeArrayCounts(source: Record<string, unknown>): Record<string, n
return result;
}
function summarizeIssueCommentsMigration(source: Record<string, unknown>): Record<string, unknown> | null {
const command = typeof source.command === "string" ? source.command : null;
if (command !== "issue view" && command !== "issue read") return null;
const jsonFields = Array.isArray(source.jsonFields) ? source.jsonFields.filter((value): value is string => typeof value === "string") : [];
if (!jsonFields.includes("comments")) return null;
const compatibility = recordOrNull(source.compatibility);
const readCommands = recordOrNull(compatibility?.readCommands);
const disclosure = recordOrNull(source.disclosure);
const preferredCommand = stringOrNull(compatibility?.preferredCommand)
?? stringOrNull(readCommands?.preferred)
?? stringOrNull(disclosure?.preferredCommand);
return {
legacyCommentsPath: stringOrNull(compatibility?.commentsPath) ?? ".data.json.comments",
preferredCommand,
migrationHint: stringOrNull(compatibility?.migrationHint) ?? stringOrNull(disclosure?.migrationHint),
};
}
function summarizeDebugDispatch(source: Record<string, unknown>): Record<string, unknown> | null {
const dispatch = recordOrNull(source.dispatch);
const wait = recordOrNull(source.wait);