{"record":{"id":"e7a878799d4426f7","repo":"ruvnet/ruflo","slug":"pod-template-at-path-auditreadview-retentionda","errorCode":null,"errorMessage":"pod-template at ${path}: auditReadView.retentionDays must be ≥1","messagePattern":"pod-template at (.+?): auditReadView\\.retentionDays must be ≥1","errorType":"validation","errorClass":"PodTemplateValidationError","httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/cli/src/business-pods/pod-schema.ts","lineNumber":168,"sourceCode":"  if (scheduleHours < 1) {\n    throw new PodTemplateValidationError('bench.scheduleHours must be ≥1', path);\n  }\n  return { name, description, successCriteria, scheduleHours };\n}\n\nfunction validateAuditReadView(item: unknown, path: string): PodAuditReadView {\n  if (!isObject(item)) {\n    throw new PodTemplateValidationError('auditReadView must be an object', path);\n  }\n  const includedEventTypes = requireArray(item, 'includedEventTypes', path, (s, sp) => {\n    if (typeof s !== 'string' || s.length === 0) {\n      throw new PodTemplateValidationError('includedEventTypes entries must be non-empty strings', sp);\n    }\n    return s;\n  });\n  const retentionDays = requireNumber(item, 'retentionDays', path);\n  if (retentionDays < 1) {\n    throw new PodTemplateValidationError('auditReadView.retentionDays must be ≥1', path);\n  }\n  return { includedEventTypes, retentionDays };\n}\n\n// POSIX cron — five or six space-separated fields. Permissive on field\n// contents (digits, *, -, /, ,) — actual cron evaluation happens at schedule\n// time. We only catch obviously malformed values here.\nconst CRON_RE = /^([\\d*/,\\-]+\\s+){4,5}[\\d*/,\\-]+$/;\n\n/**\n * Validate `json` and return a typed `PodTemplate`. Throws\n * `PodTemplateValidationError` with a JSON-pointer-style path on failure.\n *\n * Used by:\n *   - `business_pod_validate` MCP tool — returns the error verbatim\n *   - `pod-tick.mjs` — pre-flight check before any pod execution\n *   - any external schema-loader that wants typed templates\n */","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/ruvnet/ruflo/blob/6b01dc5a687b26b3e218f796de45ec51f8fa9e8c/v3/@claude-flow/cli/src/business-pods/pod-schema.ts#L150-L186","documentation":"Thrown inside validateAuditReadView() after requireNumber() confirms retentionDays is a finite number. Fires when that number is less than 1 (zero, negative, or fractional). retentionDays defines how long audit events are kept in the business-owner read view; a sub-day retention is rejected as it would drop events before they can be reviewed.","triggerScenarios":"validateAuditReadView() reads auditReadView.retentionDays, requireNumber() passes (finite number), but the value is < 1.","commonSituations":"retentionDays set to 0 (disable audit retention); a fractional value; a negative number from a misconfigured default; confusion between days and hours.","solutions":["Set auditReadView.retentionDays to an integer >= 1 (e.g., 90 for a standard compliance window)","Align the value with the piiPolicy in effect — HIPAA/gdpr may mandate specific minimum retention periods"],"exampleFix":"// before:\n\"retentionDays\": 0 // throws\n\n// after:\n\"retentionDays\": 90 // 90-day compliance window","handlingStrategy":"validation","validationCode":"import { validatePodTemplate, PodTemplateValidationError } from '@claude-flow/cli/business-pods/pod-schema';\n\ntry {\n  const pod = validatePodTemplate(parsedJson);\n} catch (e) {\n  if (e instanceof PodTemplateValidationError) {\n    console.error(`retentionDays error at ${e.path}: ${e.message}`);\n  }\n}","typeGuard":null,"tryCatchPattern":"import { validatePodTemplate, PodTemplateValidationError } from '@claude-flow/cli/business-pods/pod-schema';\n\ntry {\n  const pod = validatePodTemplate(raw);\n} catch (e) {\n  if (e instanceof PodTemplateValidationError) {\n    console.error(e.message);\n    process.exit(1);\n  }\n  throw e;\n}","preventionTips":["Set auditReadView.retentionDays to an integer >= 1 (e.g., 90 for a standard compliance window)","Align retention with the piiPolicy — HIPAA/gdpr may mandate longer minimums","Validate templates with validatePodTemplate() in CI"],"tags":["validation","pod-template","schema","audit","numbers"],"backgroundTag":null,"analyzedSha":"6b01dc5a687b26b3e218f796de45ec51f8fa9e8c","analyzedAt":"2026-08-12T13:20:50.148Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}