Skip to content

An audit interrupted while building its report leaves a crawl retention never counts or retires #288

Closed

Description

@nc9

Automatic retention (#285) records what an audit's report said on its crawl, in crawls.report_status. Between the point where the crawl is stamped analyzed and the point where its report has been reconstructed, that column holds the sentinel building, which is what stops a second audit of the same project retiring a crawl its own process is still reading.

A process killed in that window leaves building behind permanently. listRetentionCandidates excludes those crawls from both halves of retention: they never count towards [storage] keep_audits and they are never retired. So a crashed audit's rows, which on a 1,000-page site are about 95 MB, stay in project.db until somebody runs squirrel self disk --prune, and nothing tells them to.

The same is true today for a crawl left at running or failed, so this is not a new class of leak. It is a new instance of it, and unlike the others it is caused by a normal interruption: Ctrl-C during the report phase of a large audit is not an unusual thing for a user to do.

Reproduce by killing squirrel audit after the crawl finishes and while the report is being built, then re-auditing that project until the window would otherwise have retired that crawl. It stays, and squirrel self disk counts it.

Worth deciding rather than patching: whether the recovery belongs to the next audit of the same project, which knows no other process can still be building a report older than the one it just replaced, or to a timestamp on the sentinel, or to self disk reporting it so the user can act.

Acceptance Criteria

  • A crawl left stamped building by an interrupted audit does not hold a place in the [storage] keep_audits window indefinitely
  • Whatever recovers it cannot retire a crawl whose process is genuinely still building its report, proven by a test that models a live audit alongside the recovery
  • squirrel self disk makes the space held by interrupted audits visible, or the recovery removes it without the user having to know it existed
  • The recovery is bounded in cost per audit, with a query-plan assertion rather than a timing

Follow-up from #285. Part of squirrelscan/repo#1912.

Activity

  1. added
    bug
    P3
    size: M
    on Sep 8, 2026
  2. added theissue type on Oct 28, 2026
  3. nc9 commented on Oct 30, 2026

    @nc9
    ContributorAuthor

    Shipped in v0.0.145 (d24f4d27 e4d6c671), verified against main: every acceptance criterion is met. Release: https://github.com/squirrelscan/squirrelscan/releases/tag/v0.0.145

    nik

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

    P3bugsize: M

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions