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:
1 parent
ae326659b1
commit
ac58fb6c14
15 files changed
+151
-266
No files matched your search
@@ -9,7 +9,7 @@
|
||||
*/
|
||||
|
||||
import { describe, it, expect, beforeEach, afterEach } from "bun:test";
|
||||
import { detectPlatform } from "../src/platform/detector";
|
||||
import { detectPlatform, _resetPlatformCache } from "../src/platform/detector";
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Helpers
|
||||
@@ -40,11 +40,13 @@ function restoreEnv() {
|
||||
|
||||
describe("M7: Platform routing for mode handlers", () => {
|
||||
beforeEach(() => {
|
||||
_resetPlatformCache();
|
||||
saveEnv("PLATFORM", "FORGEJO", "GITHUB_SERVER_URL");
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
restoreEnv();
|
||||
_resetPlatformCache();
|
||||
});
|
||||
|
||||
describe("detectPlatform() — used by tag mode and update-comment-link", () => {
|
||||
@@ -156,13 +158,13 @@ describe("M7: Forgejo PR compare URL format", () => {
|
||||
// update-comment-link: platform-aware final comment body
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
describe("M7: updateForgejoCommentBody vs updateCommentBody", () => {
|
||||
it("Forgejo version strips Unicode spinner", async () => {
|
||||
const { updateForgejoCommentBody } = await import(
|
||||
"../src/forgejo/comment-logic"
|
||||
describe("M7: unified updateCommentBody handles both platforms", () => {
|
||||
it("strips Unicode spinner (Forgejo format)", async () => {
|
||||
const { updateCommentBody } = await import(
|
||||
"../src/github/operations/comment-logic"
|
||||
);
|
||||
|
||||
const result = updateForgejoCommentBody({
|
||||
const result = updateCommentBody({
|
||||
currentBody:
|
||||
"Claude Code is working… ⏳\n\nI'll analyze this and get back to you.\n\n[View job run](https://git.wxs.ro/owner/repo/actions/runs/123)",
|
||||
actionFailed: false,
|
||||
|
||||
Reference in new issue
Block a user