Skip to content

feat: add session archive state and scoped stats - #77

Merged
teedole merged 4 commits into
mainfrom
teedole/stats-session-state
Jul 30, 2026
Merged

feat: add session archive state and scoped stats#77
teedole merged 4 commits into
mainfrom
teedole/stats-session-state

Conversation

@teedole

@teedole teedole commented Jul 29, 2026

Copy link
Copy Markdown
Member

Summary

Add archive/delete session state with subtree-aware visibility, deterministic re-ingest tombstones, and archive-aware session UI controls. Extend stats APIs and cards so project, tool, text, and archived filters describe the same visible session set.

This is stacked on #73 because it advances that schema baseline from v19 to v20. Retarget to main after #73 lands.

Why

This completes WS-A and WS-E from the UX/API hardening plan: users can trust filtered summaries, hide work without losing exact replay, and permanently delete a full session subtree without a later sync resurrecting it.

Validation

  • just check passes: 683 tests, TypeScript, Biome, and darwin-arm64 distribution staging smoke.
  • New behavior has focused tests. No existing test was weakened or deleted to make this pass.
  • Two adversarial review passes completed with all findings fixed and a clean second read.
  • Rendered at 1440px light and 680px dark; verified archive, inherited archive, unarchive, delete dialog keyboard/focus behavior, URL preservation, and matching cards/rows.
  • Restarted against a synthetic fixture source and verified manual sync skips a deleted session instead of resurrecting it.

Archive schema

The baseline is LATEST_SCHEMA_VERSION in src/db.ts. Check one:

  • This change does not touch the archive schema.
  • This change bumps the schema. It adds schema v20 and the session_user_state migration. Supported TypeScript-cutover archives migrate in place; pre-v8 archives remain rebuild-only.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a durable session archiving and deletion feature to prevent deleted sessions from being resurrected during synchronization. It adds a new session_user_state table (schema version 20), updates database queries, statistics, and recommendations to respect these states, and provides UI controls for archiving, unarchiving, and deleting sessions. Feedback on the changes highlights a redundant check for deleted session identities in src/ingest.ts that duplicates logic already handled by writeSession.

Comment thread src/ingest.ts Outdated
@teedole
teedole force-pushed the teedole/stats-session-state branch from 0b2bee3 to 3dcc795 Compare July 29, 2026 23:16
@teedole
teedole marked this pull request as ready for review July 29, 2026 23:34
@teedole
teedole force-pushed the teedole/stats-session-state branch from 3dcc795 to 6684ac9 Compare July 30, 2026 00:50
@teedole

teedole commented Jul 30, 2026

Copy link
Copy Markdown
Member Author

Validator follow-up complete and rebased at signed tip 6684ac9.

  • Late Codex and Claude descendants inherit deleted lineage transitively and order-independently, including deleted intermediate Claude boundaries.
  • Empty session_user_state archives bypass recursive visibility work across every archive-wide rollup.
  • Scoped Sessions stat cards include reload state, while the sidebar summary remains unscoped.

Evidence: focused state/ingest/stats suite 131/131; adversarial re-review clean; combined gate 781/781. A headed browser canary changed a scratch session state under include_archived=true and observed a second scoped summary request after archive_updated before restoring the row to visible.

@teedole
teedole changed the base branch from teedole/schema-v19-repair to main July 30, 2026 02:52
@teedole
teedole force-pushed the teedole/stats-session-state branch from 6684ac9 to 8de6816 Compare July 30, 2026 03:16
@teedole
teedole merged commit 18e243f into main Jul 30, 2026
6 checks passed
@teedole
teedole deleted the teedole/stats-session-state branch July 30, 2026 03:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant