{"record":{"id":"ad97df5595b8e0c7","repo":"affaan-m/ECC","slug":"outcome-must-be-one-of-success-failure-or-partia","errorCode":null,"errorMessage":"outcome must be one of success, failure, or partial","messagePattern":"outcome must be one of success, failure, or partial","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/lib/skill-evolution/tracker.js","lineNumber":70,"sourceCode":"  const taskDescription = input.task_description || input.task_attempted || input.taskAttempted;\n  const outcome = input.outcome;\n  const recordedAt = input.recorded_at || options.now || new Date().toISOString();\n  const userFeedback = input.user_feedback || input.userFeedback || null;\n\n  if (typeof skillId !== 'string' || skillId.trim().length === 0) {\n    throw new Error('skill_id is required');\n  }\n\n  if (typeof skillVersion !== 'string' || skillVersion.trim().length === 0) {\n    throw new Error('skill_version is required');\n  }\n\n  if (typeof taskDescription !== 'string' || taskDescription.trim().length === 0) {\n    throw new Error('task_description is required');\n  }\n\n  if (!VALID_OUTCOMES.has(outcome)) {\n    throw new Error('outcome must be one of success, failure, or partial');\n  }\n\n  if (userFeedback !== null && !VALID_FEEDBACK.has(userFeedback)) {\n    throw new Error('user_feedback must be accepted, corrected, rejected, or null');\n  }\n\n  if (Number.isNaN(Date.parse(recordedAt))) {\n    throw new Error('recorded_at must be an ISO timestamp');\n  }\n\n  return {\n    skill_id: skillId,\n    skill_version: skillVersion,\n    task_description: taskDescription,\n    outcome,\n    failure_reason: input.failure_reason || input.failureReason || null,\n    tokens_used: toNullableNumber(input.tokens_used ?? input.tokensUsed, 'tokens_used'),\n    duration_ms: toNullableNumber(input.duration_ms ?? input.durationMs, 'duration_ms'),","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/lib/skill-evolution/tracker.js#L52-L88","documentation":"normalizeExecutionRecord validates the outcome field against VALID_OUTCOMES and throws 'outcome must be one of success, failure, or partial' when the value is outside that set. The tracker only supports three canonical outcomes so downstream analysis can group execution records reliably.","triggerScenarios":"Calling record() with outcome values like 'ok', 'SUCCESS', 'passed', 'error', true/false, or omitting outcome entirely (undefined).","commonSituations":"Mapping another tool's status vocabulary onto the tracker without translating (e.g. 'passed'/'failed' from a test runner); case-sensitivity mistakes ('Success'); shell scripts quoting or casing the flag incorrectly; newer callers assuming more outcome categories exist.","solutions":["Use exactly one of 'success', 'failure', or 'partial' (lowercase) as the outcome value.","Normalize upstream statuses before calling: map runner results onto the three allowed values.","If you need additional outcome categories, extend VALID_OUTCOMES in tracker.js and its consumers deliberately, not ad hoc."],"exampleFix":"// before\ntracker.record({ skillId, skillVersion, taskDescription, outcome: 'passed' });\n\n// after\nconst outcome = testsFailed ? 'failure' : fixesApplied ? 'partial' : 'success';\ntracker.record({ skillId, skillVersion, taskDescription, outcome });","handlingStrategy":"validation","validationCode":"const VALID_OUTCOMES = new Set(['success', 'failure', 'partial']);\nfunction assertOutcome(outcome) {\n  if (!VALID_OUTCOMES.has(outcome)) {\n    throw new Error(`outcome must be one of success, failure, or partial (got ${JSON.stringify(outcome)})`);\n  }\n}","typeGuard":"function isValidOutcome(v) {\n  return v === 'success' || v === 'failure' || v === 'partial';\n}","tryCatchPattern":"try {\n  tracker.record(record);\n} catch (err) {\n  if (err.message.startsWith('outcome must be one of')) {\n    console.error(`Invalid outcome \"${record.outcome}\"; use success | failure | partial.`);\n    process.exitCode = 1;\n    return;\n  }\n  throw err;\n}","preventionTips":["Map external status vocabularies (passed/failed, ok/error) onto the three tracker outcomes at the boundary.","Lowercase and trim the outcome before recording to avoid case mismatches.","Keep a single shared constant/list of allowed outcomes in caller code, mirroring the library's VALID_OUTCOMES."],"tags":["validation","enum","skill-evolution"],"backgroundTag":"invalid-enum-value","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}