{"record":{"id":"354243d5a2e8c9f5","repo":"pbakaus/impeccable","slug":"close-days-must-be-at-least-warning-days","errorCode":null,"errorMessage":"--close-days must be at least --warning-days.","messagePattern":"--close-days must be at least --warning-days\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/github/sheriff.mjs","lineNumber":453,"sourceCode":"    else if (arg === '--warning-days') options.warningDays = Number(requireValue(argv, ++i, arg));\n    else if (arg === '--close-days') options.closeDays = Number(requireValue(argv, ++i, arg));\n    else if (arg === '--maintainers') options.maintainers = splitList(requireValue(argv, ++i, arg));\n    else if (arg === '--regular-contributors') options.regularContributors = splitList(requireValue(argv, ++i, arg));\n    else if (arg === '--exempt-labels') options.exemptLabels = splitList(requireValue(argv, ++i, arg));\n    else if (arg === '--now') options.now = new Date(requireValue(argv, ++i, arg));\n    else if (arg === '--help' || arg === '-h') {\n      printHelp();\n      process.exit(0);\n    } else {\n      throw new Error(`Unknown argument: ${arg}`);\n    }\n  }\n\n  if (!Number.isFinite(options.warningDays) || options.warningDays < 0) {\n    throw new Error('--warning-days must be a non-negative number.');\n  }\n  if (!Number.isFinite(options.closeDays) || options.closeDays < options.warningDays) {\n    throw new Error('--close-days must be at least --warning-days.');\n  }\n  if (Number.isNaN(options.now.getTime())) throw new Error('--now must be a valid date.');\n\n  return options;\n}\n\nfunction latestMaintainerWaitCommand(pr, maintainers) {\n  return latestDate([\n    ...(pr.comments || [])\n      .filter((comment) => maintainers.has(normalizeLogin(comment.authorLogin)))\n      .filter((comment) => hasSheriffWaitCommand(comment.body))\n      .map((comment) => comment.createdAt),\n    ...(pr.reviews || [])\n      .filter((review) => maintainers.has(normalizeLogin(review.authorLogin)))\n      .filter((review) => hasSheriffWaitCommand(review.body))\n      .map((review) => review.submittedAt),\n  ]);\n}","sourceCodeStart":435,"sourceCodeEnd":471,"githubUrl":"https://github.com/pbakaus/impeccable/blob/d14711ae3d1a1dd62dee61a358d27f107c51ccd0/scripts/github/sheriff.mjs#L435-L471","documentation":"Thrown by sheriff.mjs parseArgs when --close-days is not a finite number or is less than --warning-days. The close threshold must come at or after the warning threshold or the warning phase could be skipped entirely.","triggerScenarios":"Passing `--warning-days 10 --close-days 5`, a non-numeric close-days, or a close-days smaller than the warning window.","commonSituations":"Swapping the two flags by mistake, or lowering close-days without adjusting warning-days.","solutions":["Ensure close-days >= warning-days, e.g. `--warning-days 7 --close-days 14`.","If you want a shorter close window, lower warning-days to match.","Double-check the order of the two flags in your wrapper."],"exampleFix":"# before\nnode sheriff.mjs --warning-days 10 --close-days 5\n\n# after\nnode sheriff.mjs --warning-days 5 --close-days 10","handlingStrategy":"validation","validationCode":"function isValidDayPair(warningDays, closeDays) {\n  const w = Number(warningDays), c = Number(closeDays);\n  return Number.isFinite(w) && Number.isFinite(c) && w >= 0 && c >= w;\n}","typeGuard":"function isOrderedDayPair(warningDays, closeDays) {\n  const w = Number(warningDays), c = Number(closeDays);\n  return Number.isFinite(w) && Number.isFinite(c) && w >= 0 && c >= w;\n}","tryCatchPattern":"if (!isOrderedDayPair(warningDays, closeDays)) {\n  console.error('--close-days must be at least --warning-days.');\n  process.exit(2);\n}","preventionTips":["Set close-days and warning-days together, never one in isolation.","Document the ordering invariant next to the flags in --help.","Add a CI test asserting the relationship holds for default values."],"tags":["cli","sheriff","validation","argv"],"backgroundTag":null,"analyzedSha":"d14711ae3d1a1dd62dee61a358d27f107c51ccd0","analyzedAt":"2026-08-13T00:52:25.771Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}