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 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
750d330ef3
commit
1a92a1cdae
@@ -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)
|
||||
|
||||
|
||||
@@ -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<string, ChildProcess>();
|
||||
|
||||
/**
|
||||
* Triage categories
|
||||
*/
|
||||
export type TriageCategory = 'bug' | 'feature' | 'documentation' | 'question' | 'duplicate' | 'spam' | 'feature_creep';
|
||||
|
||||
/**
|
||||
* Triage result for a single issue
|
||||
*/
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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[] = [
|
||||
|
||||
@@ -32,20 +32,6 @@ export const WORKFLOW_STATE_LABELS: Record<WorkflowState, string> = {
|
||||
blocked: 'Blocked',
|
||||
};
|
||||
|
||||
// ============================================
|
||||
// GitHub Label ↔ Workflow State Mapping
|
||||
// ============================================
|
||||
|
||||
export const WORKFLOW_LABEL_MAP: Record<WorkflowState, string> = {
|
||||
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)
|
||||
// ============================================
|
||||
|
||||
@@ -32,7 +32,10 @@ export type TriageCategory =
|
||||
| 'documentation'
|
||||
| 'chore'
|
||||
| 'security'
|
||||
| 'performance';
|
||||
| 'performance'
|
||||
| 'duplicate'
|
||||
| 'spam'
|
||||
| 'feature_creep';
|
||||
|
||||
export type TransitionActor =
|
||||
| 'user'
|
||||
|
||||
Reference in New Issue
Block a user