Skip to content

check-links: crashes on a bad --stale-days, and GitHub API failures are reported as catalog problems #82

Closed

Description

@TMHSDigital

Why it matters
Two robustness gaps in the weekly workflow. (1) --stale-days given as the last argument or as a non-number becomes NaN, and new Date(NaN).toISOString() throws after every fetch has already run, wasting the whole run. (2) When the GitHub repository check hits a 5xx, a timeout or a rate limit, the failure is written as a row under "repository state differs from maintenance" and counted in problems, so links.yml opens or updates the correction issue over a transient API error; after a 403/429 the loop breaks and the remaining repositories are silently unchecked, with no line in the report saying so.

Evidence

  • site/check-links.mjs:39-42, 123, 127 (argument parsing and the date call).
  • site/check-links.mjs:105-108, 116-118, 136 (API failure handling and the break).

Suggested approach
Validate --stale-days up front and print usage on error. Keep API failures in a separate "Could not check (N skipped)" section that is excluded from problems, and when the loop breaks, append how many repositories were skipped and why. Add tests for the argument parser and for the failure classification (the report renderer is pure).

Done when
A bad flag exits immediately with usage, an API outage produces no catalog "problem", and the report says how many checks were skipped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpriority: medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions