{"record":{"id":"e126e45be7b9db7a","repo":"ruvnet/ruflo","slug":"auditreadview-retentiondays-must-be-1","errorCode":null,"errorMessage":"auditReadView.retentionDays must be ≥1","messagePattern":"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/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/cli/src/business-pods/pod-schema.ts#L150-L186","documentation":"Thrown by validateAuditReadView() after requireNumber() parses auditReadView.retentionDays: the value must be >= 1. Zero-day retention is treated as invalid configuration (it would mean the auditor sees nothing), so the schema forces an explicit positive retention window.","triggerScenarios":"A pod template with auditReadView.retentionDays set to 0 or a negative number. Non-numeric values fail earlier in requireNumber with a different message.","commonSituations":"Configs where 0 meant 'keep forever' or 'disabled' in a previous system; sign errors from spreadsheets (e.g. -90); expressing 'no audit retention' which this schema does not permit.","solutions":["Set retentionDays to the smallest acceptable positive integer (e.g. 1) if you want minimal retention","If long retention was intended, use the explicit number of days (365, 2555, ...)","Re-run business_pod_validate to confirm the template is now fully valid"],"exampleFix":"// before\n\"auditReadView\": { \"includedEventTypes\": [\"pod.started\"], \"retentionDays\": 0 }\n// after\n\"auditReadView\": { \"includedEventTypes\": [\"pod.started\"], \"retentionDays\": 90 }","handlingStrategy":"try-catch","validationCode":"if (typeof av?.retentionDays !== 'number' || av.retentionDays < 1) {\n  throw new Error('set auditReadView.retentionDays to a positive day count');\n}","typeGuard":"function isValidRetentionDays(v: unknown): boolean {\n  return typeof v === 'number' && Number.isFinite(v) && v >= 1;\n}","tryCatchPattern":"try { validatePodTemplate(json); } catch (err) {\n  if (err instanceof PodTemplateValidationError && /retentionDays/.test(err.message)) {\n    // clamp or prompt for a positive retention, then re-validate\n  }\n}","preventionTips":["Translate 'keep forever' conventions to an explicit large day count (e.g. 3650)","Validate retention policy fields in the same pass as other audit config before shipping"],"tags":["schema-validation","business-pods","audit","retention","configuration"],"backgroundTag":"schema-validation-failed","analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}