Skip to content

[Bug] Session GC deletes parseable records with malformed compression or companion data #6141

Closed

Description

@Afloat16

Reproduction

At e1e33a9, opt into session GC and create an old record whose state.blocks is an object containing a summary instead of an array. viewFromParsed treats it as empty and deletes it. An old session with a companion byHash entry containing an object is counted as zero companion tokens and both files are deleted.

Expected behavior

Retain data whose compression/content representation is unrecognized, as required by the existing corrupt-file policy. Supported legacy records with absent optional fields should retain their existing defaults.

Verified patch

Validate explicit state, block-content and stats shapes plus finite non-negative token counts; reject non-string companion content entries. Three regressions fail on unchanged source, including a real-files run that deletes two sessions. The patch retains both sessions and their companion, and passes all 26 session-GC tests, typecheck and build. #1084 introduced GC and #1189 added companion retention; these malformed-valid-JSON cases are separate.

Activity

  1. ranxianglei commented on Nov 12, 2026

    @ranxianglei
    Owner

    Fixed in batch PR #6439 (merged).

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions