Skip to content
This repository was archived by the owner on Sep 2, 2026. It is now read-only.

[Spec #21] Board state storage & two-board model - #56

Merged
64ix merged 12 commits into
mainfrom
spec/21-board-state
Aug 23, 2026
Merged

64ix merged 12 commits into
mainfrom
spec/21-board-state

Conversation

@64ix

@64ix 64ix commented Aug 22, 2026 •

Copy link
Copy Markdown
Owner
Files Added Deleted Net
Test 7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​603 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​603
Prod 22 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​171 $\color{#cf222e}{\Huge{\mathbf{−}}}$​28 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​143

Summary

Adds a workflowStage pipeline field (fixed set: idea, exploring, spec, implementing, review, shipped, triage; null = unstaged) to worktrees and folder workspaces, persisted as a plain per-key value that survives restarts and folder renames, with validation at every write boundary (IPC, RPC, store) and safe degradation to unstaged on corrupt persisted data. The classic kanban drawer now hides staged workspaces — exclusivity is purely a display rule, so manual workspaceStatus stays intact in data and unstaging restores the previous organization. No data migration: fields begin empty and clean.

Spec

Tickets Included

Closing References

Closes #21
Closes #32
Closes #40

Acceptance / Success Criteria

Scope Criterion Verdict Evidence
#32 Setting a stage persists it across app restarts ✅ workflow-stage-persistence.test.ts round-trips worktreeMeta + folderWorkspaces through flush + fresh Store from disk
#32 Renaming a folder workspace keeps its stage (rekey survival) ✅ migrateWorktreeIdentity test moves workflowStage old→new id; wholesale record move in persistence
#32 An unknown/invalid persisted stage reads back as unstaged without breaking anything ✅ corrupt data ('not-a-real-stage', {rank:1.5}) loads without throwing; hydration + mergeWorktree + ps-summary tests assert degradation
#32 RPC can read and write the stage of local, SSH, and remote workspaces ✅ worktree.set / folderWorkspace.update dispatcher tests (forward, null clear, invalid→invalid_argument) + updateMeta boundary test; RuntimeWorktreePsSummary read asserted in orca-runtime.test.ts; methods host-agnostic by construction (no connection gating)
#32 Manual workspaceStatus remains intact while staged ✅ store-level tests keep workspaceStatus through stage set+clear for both record types; write paths never touch it
#32 Stored values are plain per-key values (sync-friendly, no fractional ranks) ✅ raw orca-data.json asserted to hold 'triage' as a bare string; schema is optional enum|null union
#40 Staging a workspace makes it disappear from the classic drawer ✅ computeClassicDrawerWorktreeIds post-filter; tests assert exact id sets for every fixed stage
#40 Its manual status is preserved in data while staged ✅ no write path couples workspaceStatus to staging (persistence deletes/sets workflowStage only); projection code is pure
#40 Unstaging returns it to the drawer with its previous status ✅ round-trip test: hidden → stage cleared → visible again with prior workspaceStatus
#40 The filter is tested at the projection level (what each surface shows) ✅ classic-drawer-stage-exclusivity.test.ts drives computeClassicDrawerWorktreeIds/computeVisibleWorktrees directly incl. corrupt-value and sidebar-stays-visible cases

Modifications Par Intention

Zone Files Why / What to review
Shared stage domain src/shared/workflow-stages.ts
src/shared/workflow-stages.test.ts
src/shared/workflow-stage-schema.ts
Fixed 7-stage set, WorkflowStage type, isWorkflowStage guard, normalizeWorkflowStage (invalid → null), and one zod boundary schema shared by IPC/RPC.

Review: Single source of truth for stage vocabulary; check the normalizer is total (never throws).
Persisted data model src/shared/worktree/meta-types.ts
src/shared/worktree/types.ts
src/shared/folder-workspace-types.ts
src/shared/runtime-types.ts
Optional workflowStage?: WorkflowStage | null on WorktreeMeta, Worktree, FolderWorkspace, and RuntimeWorktreePsSummary — plain per-key values, wire-safe optional additions.

Review: Field independence from workspaceStatus; no migration code.
Store write/read normalization src/main/persistence/loading-store/store.ts
src/main/persistence/restoring-sessions/folder-workspace-operations.ts
src/shared/folder-workspaces.ts
setWorktreeMeta merge-then-normalize (invalid dropped), updateFolderWorkspace workflowStage pick+normalization (null clears), hydration degrades corrupt persisted stages.

Review: workspaceStatus untouched in every path; invalid values never persist.
Projection carry-through src/main/ipc/worktree-metadata-merge.ts
src/shared/folder-workspace-worktree.ts
src/main/runtime/runtime-folder-workspace.ts
src/main/runtime/orca-runtime.ts
All five meta→projection sites surface workflowStage with read-time degradation; folder adapter keeps main's new diffComments alongside.

Review: Corrupt values degrade to absent/unstaged at every site.
Boundaries (IPC + RPC) src/main/ipc/repos.ts
src/main/ipc/worktrees.ts
src/main/runtime/rpc/methods/worktree.ts
src/main/runtime/rpc/methods/folder-workspace.ts
src/main/runtime/rpc/methods/worktree-schemas.ts
src/preload/api/worktree-api.ts
Zod validation at updateMeta, folderWorkspace create/update args, worktree.set and folderWorkspace.update RPC; invalid writes rejected at the boundary and defensively dropped at the store.

Review: Optional-field-only wire changes; mixed client/host versions safe; methods execute on the owning runtime regardless of host.
Two-board display rule src/renderer/src/components/sidebar/workspace-stage-exclusivity.ts
src/renderer/src/components/sidebar/use-visible-workspace-kanban-worktree-ids.ts
isStagedWorkspace predicate (self-normalizing) + computeClassicDrawerWorktreeIds wrapping the shared sidebar visibility pipeline, dropping staged rows after computation; hook delegates so every drawer consumer inherits the rule.

Review: Display rule only — no field mutation; sidebar keeps staged rows visible.
Tests src/main/workflow-stage-persistence.test.ts
src/main/runtime/rpc/methods/worktree-stage-rpc.test.ts
src/main/runtime/rpc/methods/folder-workspace.test.ts
src/main/ipc/worktrees-create-metadata-persistence.test.ts
src/main/runtime/orca-runtime.test.ts
src/renderer/src/components/sidebar/classic-drawer-stage-exclusivity.test.ts
Persistence/restart, rekey survival, corrupt-data degradation, RPC forward/clear/reject, ps read-side projection, updateMeta boundary, and projection-level exclusivity coverage.

Review: Each acceptance criterion has an asserting test at the external-behavior level.

Review Guardrails

Per-unit reviews

  • Stage storage & RPC read/write #32: passed. Reviewer re-derived all six criteria, verified asserting tests exist, confirmed wire safety and host-agnosticism of both RPC methods, and added the missing read-side test (worktree.ps surfaces workflowStage, corrupt {rank:2.5} degrades, workspaceStatus preserved).
  • Two-board exclusivity filter #40: passed. Reviewer verified the staged→hidden→unstaged→visible round trip, display-rule purity, and drawer-consumer coverage via the hook; hardened isStagedWorkspace against raw corrupt values with a test that fails without the hardening; fixed three typecheck errors the implementer had committed.

Final integration review

  • passed: Integration review found no cross-unit defects: single stage module + one zod boundary, uniform vocabulary, all five projection sites consistent, seams closed (schema→runtime→store normalize; renderer re-normalizes defensively), upstream-reconcile merge ported completely into the split type modules and persistence layout preserving diffComments, zero scope creep. Ran affected suites twice for flake check; oxlint clean on changed files.

Fixed after review

  • Missing RPC read-side assertion (criterion Stage storage & RPC read/write #32-4): added worktree.ps projection test (c16dec6)
  • isStagedWorkspace accepted raw corrupt stage values and could hide workspaces: now normalizes itself, with regression test (0e3ec76)
  • Three pre-existing typecheck errors in Two-board exclusivity filter #40's files (unused param, Partial-spread widening, null assignment) fixed before merge

Points to double-check

  • E2E gate was not run live end-to-end on this machine — environmental failures reproduce on pristine origin/main (verified during unit reviews); run once on a clean machine
  • Manual smoke: stage a worktree via CLI/RPC and watch it leave the classic drawer while keeping its lane status in data

QA Plan

Automated

  • pnpm run typecheck — expected: node + cli + web tsconfigs clean (Type gate across all targets)

    pnpm run typecheck
  • pnpm test — expected: Only known-unrelated failures (codex-fetcher-pty-settle reproduces on pristine main; wsl-exec-mode-separator fails only under full-suite artifact interference and passes standalone; transcript-watch load flake passes standalone) (Full regression suite incl. new stage/exclusivity tests)

    pnpm test
  • Targeted suites twice — expected: 38/38 stable across repeat runs (Flake check on the new suites)

    pnpm exec vitest run --config config/vitest.config.ts src/shared/workflow-stages.test.ts src/main/workflow-stage-persistence.test.ts src/renderer/src/components/sidebar/classic-drawer-stage-exclusivity.test.ts src/main/ipc/worktrees-create-metadata-persistence.test.ts src/shared/folder-workspace-worktree.test.ts

Manual scenarios

  • Set a stage on a worktree (orca worktree set path or RPC worktree.set), restart Orca — expected: Stage still present; classic drawer hides the workspace (Restart persistence + display exclusivity)
  • Rename a folder workspace's folder on disk — expected: Stage survives the identity rekey (Rekey survival criterion)
  • Clear the stage (worktree.set workflowStage=null) — expected: Workspace returns to the classic drawer with its previous lane/status unchanged (Two-board restoration guarantee)
  • Hand-edit orca-data.json to workflowStage: "garbage" and start Orca — expected: App starts fine; workspace treated as unstaged (Corrupt-data degradation)
  • Same flows over an SSH remote workspace — expected: RPC read/write works identically (Remote parity)

Regression checks

  • Classic drawer with zero staged workspaces — expected: Behavior identical to before this PR (Null-stage default must not change existing boards)
  • Sidebar listing with a staged workspace — expected: Staged workspace still listed/navigable outside the board (Exclusivity is board-scoped, not global hiding)

Arbitrations / Decisions

  • Problem: the fork-triggered Track Community PRs check failed because BUFO_BOT_PRIVATE_KEY only exists upstream -> Resolution: workflow now skips cleanly when the secret is absent (bae2734, also on 64ix/orca main so pull_request_target picks it up); re-triggered green via reopen.

  • Problem: origin/main advanced 505 commits mid-run, splitting src/shared/types.ts into per-domain modules and persistence.ts into src/main/persistence/** -> Resolution: merged origin/main into the integration branch and ported workflowStage into the new layout (type modules, loading-store/store.ts, restoring-sessions/folder-workspace-operations.ts); took main's barrel/deletions wholesale rather than resurrecting old files

  • Problem: computeVisibleWorktreeIds sat at its max-lines lint budget so the exclusivity rule could not live inside it -> Resolution: pure computeClassicDrawerWorktreeIds wraps the renamed computeVisibleWorktrees pipeline at the drawer's visibility seam; every drawer consumer inherits the rule with zero sidebar churn

  • Problem: implementer committed Two-board exclusivity filter #40 with failing typecheck and an unhardened staged predicate -> Resolution: independent reviewer fixed all three errors and normalized corrupt values inside isStagedWorkspace with a regression test

  • Problem: full E2E gate exits non-zero on this machine (~30 failures) -> Resolution: reviewers cross-ran failing specs on a pristine origin/main worktree; all reproduce there (caffeinate, tab-rename, settings-agent-awake, smart-sort flake, worker-crash cascades) — environmental/pre-existing, recorded as not-run rather than passed

Risks / Follow-ups

  • E2E gate not executed live end-to-end on this machine; needs one clean-machine run before release
  • Read-side degradation depends on future meta→projection sites calling normalizeWorkflowStage; write-side store normalization mitigates but a forgetful new projection would surface raw values — consider a shared projection helper if more sites appear
  • Until the feature board UI lands (spec [Spec] Feature board view #24), staged workspaces have no surface displaying their stage; exclusion is observable only as absence from the classic drawer
  • Minor inconsistency: renderer folderWorkspace.update rejects invalid stages via zod while worktrees:updateMeta silently drops them — both safe, error surfacing differs

@64ix 64ix closed this Aug 22, 2026
@64ix 64ix reopened this Aug 22, 2026
@64ix
64ix merged commit 94bc715 into main Aug 23, 2026
95 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Two-board exclusivity filter Stage storage & RPC read/write [Spec] Board state storage & two-board model

1 participant