From adfcb59978b497eac38331a68e864e4863714d10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Thu, 16 Apr 2026 23:07:08 -0400 Subject: [PATCH] refactor(task-rubrics): share DEFAULT_RUBRIC between general and code types --- src/main/task-rubrics.ts | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/main/task-rubrics.ts b/src/main/task-rubrics.ts index fc0e627c..6c94a55a 100644 --- a/src/main/task-rubrics.ts +++ b/src/main/task-rubrics.ts @@ -18,6 +18,17 @@ export interface TaskRubric { briefTemplate: string; } +/** + * Default rubric used by task types that carry no type-specific quality + * expectations. Single source of truth so "general" and "code" cannot drift. + */ +const DEFAULT_RUBRIC: TaskRubric = { + requiredSections: [], + qualityKeywords: [], + minDescriptionLength: 50, + briefTemplate: "", +}; + const RUBRICS: Record = { research: { requiredSections: ["research question", "methodology", "sources", "expected findings"], @@ -40,24 +51,14 @@ const RUBRICS: Record = { briefTemplate: "A management task brief should cover: Objective, Stakeholders, Timeline, and Success Metrics.", }, - general: { - requiredSections: [], - qualityKeywords: [], - minDescriptionLength: 50, - briefTemplate: "", - }, - code: { - requiredSections: [], - qualityKeywords: [], - minDescriptionLength: 50, - briefTemplate: "", - }, + general: DEFAULT_RUBRIC, + code: DEFAULT_RUBRIC, }; /** Returns the rubric for the given task type, defaulting to "general" for unknown values. */ function getTaskTypeRubric(taskType: string): TaskRubric { const key = taskType as TaskType; - return RUBRICS[key] ?? RUBRICS.general; + return RUBRICS[key] ?? DEFAULT_RUBRIC; } /**