Skip to content

fix(sidebar): persist project and Space disclosure state - #411

Merged
DeadWaveWave merged 4 commits into
mainfrom
codex/issue-404
Sep 10, 2026
Merged

fix(sidebar): persist project and Space disclosure state#411
DeadWaveWave merged 4 commits into
mainfrom
codex/issue-404

Conversation

@DeadWaveWave

@DeadWaveWave DeadWaveWave commented Sep 9, 2026

Copy link
Copy Markdown
Owner

💡 Change Scope

  • Small Change: Fast feedback, localized UI/logic, low-risk.
  • Large Change: Persistent settings and restart recovery.

📝 What Does This PR Do?

Fixes #404.

Collapsed projects and Space groups previously expanded when the Sidebar remounted or the app restarted. Store these choices in the existing persisted settings and restore them using stable project IDs and workspace-scoped group IDs. Expanding a node removes its collapsed entry; older settings default to expanded.

🏗️ Large Change Spec (Required if "Large Change" is checked)

1. Context & Business Logic

Preserve explicit tree disclosure choices across remounts and cold restarts. Follow the stable-node-ID tree view state pattern used by VS Code Explorer. Project and Space preferences remain independent, so expanding a restored project preserves its collapsed Space groups.

2. State Ownership & Invariants

The existing settings/app-state persistence chain owns these preferences and writes them to SQLite. Sidebar reads and updates that owner. No new IPC channel or database schema is introduced.

  • Project keys are workspace IDs; Space-group keys are workspaceId:groupId.
  • Only nonempty keys with true values survive normalization. Missing or malformed legacy values default to expanded.
  • Remounting or temporary tree absence does not clear saved choices; explicit expansion removes the corresponding key.

3. Verification Plan & Regression Layer

  • Target Vitest: 4 files / 37 tests passed, including settings normalization and Sidebar remount coverage.
  • pnpm check: passed after correcting the new test fixture and DOM attribute assertions.
  • Prettier, staged line-check, and diff-check: passed.
  • Target Electron E2E: 1 passed (24.6s), with retries and crash fallback disabled. It reads durable settings before each shutdown, confirms process exit, and verifies both collapsed and later expanded states after two cold restarts using the same userData directory.
  • The E2E uses the existing bounded close helper, which may force process termination. It proves durable cold-restart recovery, not graceful shutdown completion.
  • Complete staged OPENCOVE_REQUIRE_STAGED=1 pnpm pre-commit passed: static checks, 809 related tests, 8 native recovery tests, and 323 Electron E2E passed / 79 skipped (23.1 minutes). The new two-cold-restart test also passed within this complete run. Platform skips are not claimed as verified.
  • CI for the final commit passed on macOS, Ubuntu, and the Windows platform suite.

Target E2E command (run after a successful build):

OPENCOVE_E2E_RETRIES=0 OPENCOVE_E2E_DISABLE_CRASH_FALLBACK=1 pnpm exec playwright test tests/e2e/sidebar-tree.persistence.spec.ts --project electron --reporter=line

✅ Delivery & Compliance Checklist

  • My code passes the ultimate gatekeeper: pnpm pre-commit is completely green.
  • CLA signed if required (repository check passed).
  • Regression tests included.
  • Existing architectural boundaries preserved.
  • Screenshot attached to PR (available in the Playwright test artifacts).
  • Persistence ownership documentation updated.

📸 Screenshots / Visual Evidence

The passing Electron test attaches restored-project-and-space-disclosure after the first cold restart. This is a persistence behavior change without layout changes; screenshots remain in Playwright artifacts and are not committed.

@DeadWaveWave
DeadWaveWave merged commit e7a7cb5 into main Sep 10, 2026
26 of 29 checks passed
@DeadWaveWave
DeadWaveWave deleted the codex/issue-404 branch September 10, 2026 17:42
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.

[FEAT] 优化侧边栏折叠展示方式

1 participant