From 1a92a1cdaebb52b48e71bbe6ec1d88b433990fd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sondre=20Engebr=C3=A5ten?= Date: Fri, 13 Feb 2026 14:03:41 +0100 Subject: [PATCH] fix(issues): align types across layers and deduplicate constants - INT-1: Add verification_failed and redundancy to frontend PRReviewFinding.category to match backend ReviewCategory enum - INT-2: Extend enrichment TriageCategory to superset of all backend values; remove local type redefinition in triage-handlers - INT-4: Remove duplicate WORKFLOW_LABEL_MAP from enrichment.ts; single source of truth is now label-sync.ts - BE-4: Add _add_repo_flag to all issue_* methods in GHClient (prevents wrong repo targeting in multi-remote setups) Phase 4 of alpha stability audit. Co-Authored-By: Claude Opus 4.6 --- apps/backend/runners/github/gh_client.py | 5 +++++ .../main/ipc-handlers/github/triage-handlers.ts | 6 +----- .../frontend/src/preload/api/modules/github-api.ts | 2 +- .../shared/__tests__/enrichment-constants.test.ts | 2 +- apps/frontend/src/shared/constants/enrichment.ts | 14 -------------- apps/frontend/src/shared/types/enrichment.ts | 5 ++++- 6 files changed, 12 insertions(+), 22 deletions(-) diff --git a/apps/backend/runners/github/gh_client.py b/apps/backend/runners/github/gh_client.py index d527a1be..2866afa6 100644 --- a/apps/backend/runners/github/gh_client.py +++ b/apps/backend/runners/github/gh_client.py @@ -484,6 +484,7 @@ class GHClient: "--json", ",".join(json_fields), ] + args = self._add_repo_flag(args) result = await self.run(args) try: @@ -525,6 +526,7 @@ class GHClient: "--json", ",".join(json_fields), ] + args = self._add_repo_flag(args) result = await self.run(args) try: @@ -542,6 +544,7 @@ class GHClient: body: Comment body """ args = ["issue", "comment", str(issue_number), "--body", body] + args = self._add_repo_flag(args) await self.run(args) async def issue_add_labels(self, issue_number: int, labels: list[str]) -> None: @@ -562,6 +565,7 @@ class GHClient: "--add-label", ",".join(labels), ] + args = self._add_repo_flag(args) await self.run(args) async def issue_remove_labels(self, issue_number: int, labels: list[str]) -> None: @@ -582,6 +586,7 @@ class GHClient: "--remove-label", ",".join(labels), ] + args = self._add_repo_flag(args) # Don't raise on error - labels might not exist await self.run(args, raise_on_error=False) diff --git a/apps/frontend/src/main/ipc-handlers/github/triage-handlers.ts b/apps/frontend/src/main/ipc-handlers/github/triage-handlers.ts index 89aaaccf..e388cc63 100644 --- a/apps/frontend/src/main/ipc-handlers/github/triage-handlers.ts +++ b/apps/frontend/src/main/ipc-handlers/github/triage-handlers.ts @@ -29,6 +29,7 @@ import { validateGitHubModule, buildRunnerArgs, } from './utils/subprocess-runner'; +import type { TriageCategory } from '../../../shared/types/enrichment'; import type { ChildProcess } from 'child_process'; @@ -38,11 +39,6 @@ const { debug: debugLog } = createContextLogger('GitHub Triage'); // Track active triage runs per project to prevent concurrent subprocess spawns const activeTriageRuns = new Map(); -/** - * Triage categories - */ -export type TriageCategory = 'bug' | 'feature' | 'documentation' | 'question' | 'duplicate' | 'spam' | 'feature_creep'; - /** * Triage result for a single issue */ diff --git a/apps/frontend/src/preload/api/modules/github-api.ts b/apps/frontend/src/preload/api/modules/github-api.ts index 5ef07d1a..ec1e075a 100644 --- a/apps/frontend/src/preload/api/modules/github-api.ts +++ b/apps/frontend/src/preload/api/modules/github-api.ts @@ -455,7 +455,7 @@ export interface PRListResult { export interface PRReviewFinding { id: string; severity: 'critical' | 'high' | 'medium' | 'low'; - category: 'security' | 'quality' | 'style' | 'test' | 'docs' | 'pattern' | 'performance'; + category: 'security' | 'quality' | 'style' | 'test' | 'docs' | 'pattern' | 'performance' | 'verification_failed' | 'redundancy'; title: string; description: string; file: string; diff --git a/apps/frontend/src/shared/__tests__/enrichment-constants.test.ts b/apps/frontend/src/shared/__tests__/enrichment-constants.test.ts index 52991ed1..135b8644 100644 --- a/apps/frontend/src/shared/__tests__/enrichment-constants.test.ts +++ b/apps/frontend/src/shared/__tests__/enrichment-constants.test.ts @@ -2,11 +2,11 @@ import { describe, it, expect } from 'vitest'; import { VALID_TRANSITIONS, COMPLETENESS_WEIGHTS, - WORKFLOW_LABEL_MAP, WORKFLOW_STATE_COLORS, isValidTransition, getValidTargets, } from '../constants/enrichment'; +import { WORKFLOW_LABEL_MAP } from '../constants/label-sync'; import type { WorkflowState } from '../types/enrichment'; const ALL_STATES: WorkflowState[] = [ diff --git a/apps/frontend/src/shared/constants/enrichment.ts b/apps/frontend/src/shared/constants/enrichment.ts index 3e0158f1..05fc830e 100644 --- a/apps/frontend/src/shared/constants/enrichment.ts +++ b/apps/frontend/src/shared/constants/enrichment.ts @@ -32,20 +32,6 @@ export const WORKFLOW_STATE_LABELS: Record = { blocked: 'Blocked', }; -// ============================================ -// GitHub Label ↔ Workflow State Mapping -// ============================================ - -export const WORKFLOW_LABEL_MAP: Record = { - new: 'ac:new', - triage: 'ac:triage', - ready: 'ac:ready', - in_progress: 'ac:in-progress', - review: 'ac:review', - done: 'ac:done', - blocked: 'ac:blocked', -}; - // ============================================ // Valid Transitions (State Machine) // ============================================ diff --git a/apps/frontend/src/shared/types/enrichment.ts b/apps/frontend/src/shared/types/enrichment.ts index ed79b333..b3cf142d 100644 --- a/apps/frontend/src/shared/types/enrichment.ts +++ b/apps/frontend/src/shared/types/enrichment.ts @@ -32,7 +32,10 @@ export type TriageCategory = | 'documentation' | 'chore' | 'security' - | 'performance'; + | 'performance' + | 'duplicate' + | 'spam' + | 'feature_creep'; export type TransitionActor = | 'user'