mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-01-31 20:03:37 +00:00
feat: Implement stale validation cleanup and improve GitHub issue handling
- Added a scheduled task to clean up stale validation entries every hour, preventing memory leaks. - Enhanced the `getAllValidations` function to read validation files in parallel for improved performance. - Updated the `fetchLinkedPRs` function to use `spawn` for safer execution of GitHub CLI commands, mitigating shell injection risks. - Modified event handling in the GitHub issues view to utilize the model for validation, ensuring consistency and reducing stale closure issues. - Introduced a new property in the issue validation event to track the model used for validation.
This commit is contained in:
@@ -162,14 +162,14 @@ export function GitHubIssuesView() {
|
||||
return next;
|
||||
});
|
||||
|
||||
// Update cached validations (use event.issueTitle to avoid stale closure)
|
||||
// Update cached validations (use event.model to avoid stale closure race condition)
|
||||
setCachedValidations((prev) => {
|
||||
const next = new Map(prev);
|
||||
next.set(event.issueNumber, {
|
||||
issueNumber: event.issueNumber,
|
||||
issueTitle: event.issueTitle,
|
||||
validatedAt: new Date().toISOString(),
|
||||
model: validationModel,
|
||||
model: event.model,
|
||||
result: event.result,
|
||||
});
|
||||
return next;
|
||||
|
||||
@@ -2730,6 +2730,7 @@ function createMockGitHubAPI(): GitHubAPI {
|
||||
cb({
|
||||
type: 'issue_validation_complete',
|
||||
issueNumber: issue.issueNumber,
|
||||
issueTitle: issue.issueTitle,
|
||||
result: {
|
||||
verdict: 'valid' as const,
|
||||
confidence: 'medium' as const,
|
||||
@@ -2739,6 +2740,7 @@ function createMockGitHubAPI(): GitHubAPI {
|
||||
estimatedComplexity: 'moderate' as const,
|
||||
},
|
||||
projectPath,
|
||||
model: model || 'sonnet',
|
||||
})
|
||||
);
|
||||
}, 2000);
|
||||
@@ -2772,6 +2774,12 @@ function createMockGitHubAPI(): GitHubAPI {
|
||||
validations: [],
|
||||
};
|
||||
},
|
||||
markValidationViewed: async (projectPath: string, issueNumber: number) => {
|
||||
console.log('[Mock] Marking validation as viewed:', { projectPath, issueNumber });
|
||||
return {
|
||||
success: true,
|
||||
};
|
||||
},
|
||||
onValidationEvent: (callback: (event: IssueValidationEvent) => void) => {
|
||||
mockValidationCallbacks.push(callback);
|
||||
return () => {
|
||||
|
||||
Reference in New Issue
Block a user