Skip to content

csb list shows stale data -- auto-refresh or staleness warning #5

@djdarcy

Description

@djdarcy

csb list shows stale data -- should auto-refresh when index is outdated

Problem

csb list reads from the SQLite index, which is only updated when csb backup runs. If the user hasn't run backup recently, list shows outdated session data (old message counts, missing new sessions, wrong timestamps).

User observed: sessions from a week ago showing as most recent, despite having active sessions right now.

Current behavior

csb list     # shows data from last backup scan (could be days old)
csb backup   # updates the index
csb list     # now shows current data

Options

Option A: Auto-refresh on csb list

  • Check if index is older than N minutes (configurable, default 15?)
  • If stale, run a quick re-scan before displaying
  • Pros: Always current. No extra step.
  • Cons: Slower list when stale. Mixes read and write operations.

Option B: Show staleness warning

  • If last scan was > 1 hour ago, print a warning: Index last updated 7 days ago. Run 'csb backup' to refresh.
  • Pros: Fast list. User knows data is old.
  • Cons: Extra noise in output. User still has to run backup manually.

Option C: csb list --refresh

  • Explicit flag to re-scan before listing
  • Pros: Clear intent. Fast by default.
  • Cons: Extra flag to remember.

Option D: csb list always re-scans (no separate backup step for reads)

  • list does a quick metadata-only scan (skip git commits)
  • backup does the full scan + git commit
  • Pros: Always current. Clean separation.
  • Cons: Slower list (94 sessions takes ~10s to parse all JSONLs).

Recommendation

Option B + C combined: Show a staleness warning by default, offer --refresh to force update. This keeps list fast while making staleness visible.

Related

Depends on how often csb backup runs via cron. If cron runs every 15 minutes, staleness is rarely an issue. If no cron is configured, staleness is the default experience.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions