fix(prd-7): M1 architecture review — consolidate duplication, fix bugs, memoize detection

- F1: Consolidated updateForgejoCommentBody into unified updateCommentBody (~150 lines removed)
- F2: Fixed wrong run identifier in update-with-branch.ts (context.runId → getForgejoRunIndex())
- F3: Memoized detectPlatform() with _resetPlatformCache() for tests
- F4: Added getServerUrl() runtime helper to resolve constant-vs-function inconsistency
- F5: Fixed sticky comment bot matching on Forgejo via context.inputs.botName
- F6: Documented GHES heuristic misidentification in docs/forgejo.md
- Updated PRD M1 checkbox to complete

Progress: 17% complete — M1 done, M2 (error handling review) next

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Vlad MocanuandClaude Opus 4.6 committed 2026-02-26 12:09:02 +02:00
1 parent ae326659b1
commit ac58fb6c14
15 files changed
+151 -266

No files matched your search

+3 -7
View File
@@ -8,7 +8,6 @@ import {
type CommentUpdateInput,
} from "../github/operations/comment-logic";
import {
updateForgejoCommentBody,
createForgejoPrCompareUrl,
getForgejoRunIndex,
} from "../forgejo/comment-logic";
@@ -19,7 +18,7 @@ import {
isEntityContext,
} from "../github/context";
import type { ParsedGitHubContext } from "../github/context";
import { GITHUB_SERVER_URL } from "../github/api/config";
import { getServerUrl } from "../github/api/config";
import { checkAndCommitOrDeleteBranch } from "../github/operations/branch-cleanup";
import { updateClaudeComment } from "../github/operations/comments/update-claude-comment";
@@ -54,7 +53,7 @@ export async function updateCommentLink(
const { owner, repo } = context.repository;
const platform = detectPlatform();
const serverUrl = GITHUB_SERVER_URL;
const serverUrl = getServerUrl();
const runIdentifier =
platform === "forgejo" ? getForgejoRunIndex() : process.env.GITHUB_RUN_ID;
const jobUrl = `${serverUrl}/${owner}/${repo}/actions/runs/${runIdentifier}`;
@@ -250,10 +249,7 @@ export async function updateCommentLink(
errorDetails,
};
const updatedBody =
platform === "forgejo"
? updateForgejoCommentBody(commentInput)
: updateCommentBody(commentInput);
const updatedBody = updateCommentBody(commentInput);
try {
await updateClaudeComment(octokit.rest, {