fix(sessions): pinned-skip note counts pinned rows, not spared ancestors
_note_pinned_skipped diffed count_prune_matches(include_pinned=True/False) with whole_lineages on for prune. Excluding a pinned tip turns it into an unmatched continuation, so its unpinned compression ancestors drop out of the "without" count too and the note reported them as pinned (chain a -> a-2 -> a-3 with only a-3 pinned said "3 pinned sessions"). Count plain filter matches for the note; the delete itself is unchanged. count_prune_matches has no other caller that needs whole_lineages, so the keyword goes back to base's signature.
This commit is contained in:
@@ -250,10 +250,10 @@ class SessionMaintenanceMixin:
|
||||
FROM sessions s WHERE {where}
|
||||
ORDER BY last_active ASC, s.started_at ASC""", params)]
|
||||
|
||||
def count_prune_matches(self, older_than_days: Optional[float] = None, source: str = None, *,
|
||||
whole_lineages: bool = False, **filters) -> int:
|
||||
def count_prune_matches(self, older_than_days: Optional[float] = None, source: str = None,
|
||||
**filters) -> int:
|
||||
"""Count-only :meth:`list_prune_candidates` (CLI reports spared pinned sessions)."""
|
||||
where, params = self._prune_where(older_than_days, source, filters, whole_lineages=whole_lineages)
|
||||
where, params = self._prune_where(older_than_days, source, filters)
|
||||
return int(self._read_one(f"SELECT COUNT(*) FROM sessions s WHERE {where}", params)[0])
|
||||
|
||||
def count_open_prune_matches(self, older_than_days: Optional[float] = None, source: str = None, *,
|
||||
|
||||
Reference in New Issue
Block a user