Skip to content

[P1] Make the precompact compaction-boundary stamp idempotent #7

Description

@jsirish

From docs/AUDIT-v0.4.0.md (P1, item 6).

session-flush.sh guards its end-stamp with an anchored grep so a double SessionEnd writes one stamp. session-precompact.sh has no such guard: a double PreCompact fire for one seam writes two boundary markers. Low impact (informational marker), but asymmetric with flush for no documented reason.

Fix: mirror flush's grep guard, but keyed to "a boundary already exists as the LAST marker" rather than "any boundary exists in the file" - multiple genuine compactions in one long session must still each get their own stamp. Simplest correct form: skip the write only if the file already ends with a compaction-boundary marker (tail -n2 check), since two stamps with no captured actions between them mark the same seam.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions