Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR standardizes how SQLite path identity is stored and compared (especially on Windows) by introducing a canonical “storage path” format and a migration to rewrite existing rows, while ensuring APIs return native absolute paths at row boundaries. It also updates session filtering logic to use the new canonical path comparisons and adds targeted Windows-focused tests, plus a few small app-side UI/state tweaks.
Changes:
- Add
PathIdentityutilities and apply them across project/session/workspace persistence, session list filtering, and worktree canonicalization. - Add a data migration (
normalize_paths_to_forward_slashes) to rewrite existing DB rows (including embedded event JSON fields) into the canonical storage format. - Add/adjust tests for Windows path matching + migration behavior, and refine app global-sync loading status plus a helper for v2 new-session layout gating.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/opencode/test/storage/path-normalization-migration.test.ts | New test validating Windows path normalization migration rewrites persisted rows correctly. |
| packages/opencode/test/server/session-list.test.ts | Adds Windows-specific session.list filtering tests for canonical directory/path matching. |
| packages/opencode/src/worktree/index.ts | Switches worktree path canonicalization/comparison to PathIdentity keys. |
| packages/opencode/src/v2/session.ts | Normalizes path output and uses PathIdentity SQL helpers for directory/path filters. |
| packages/opencode/src/util/path-identity.ts | Introduces canonical path normalization + SQL comparison helpers. |
| packages/opencode/src/session/session.ts | Uses PathIdentity at row boundaries and for list filters (directory/path). |
| packages/opencode/src/session/projectors.ts | Ensures projector writes persist normalized storage paths. |
| packages/opencode/src/server/routes/instance/httpapi/handlers/v2/session.ts | Makes cursor mismatch detection use canonical path identity keys. |
| packages/opencode/src/project/project.ts | Normalizes persisted worktree/sandboxes and compares sandboxes via canonical keys. |
| packages/opencode/src/data-migration.ts | Adds and wires a migration to normalize stored paths across tables and event JSON. |
| packages/opencode/src/control-plane/workspace.ts | Normalizes workspace directory persisted/returned paths via PathIdentity. |
| packages/app/src/pages/session/new-session-layout.ts | New helper to decide whether to use v2 new-session layout. |
| packages/app/src/pages/session/new-session-layout.test.ts | Tests for the new v2 new-session layout gating helper. |
| packages/app/src/pages/session.tsx | Uses the new layout gating helper instead of inline env/id logic. |
| packages/app/src/pages/home.tsx | Refactors legacy home UI layout and removes unused state. |
| packages/app/src/context/global-sync/child-store.ts | Initializes new child stores as loading instead of complete. |
| packages/app/src/context/global-sync/child-store.test.ts | Updates tests to accommodate loading-first child store behavior and adds coverage. |
| packages/app/src/context/global-sync/bootstrap.ts | Sets status to partial while bootstrapping and complete on successful bootstrap. |
| packages/app/src/context/global-sync/bootstrap.test.ts | New test verifying loading -> partial -> complete bootstrap status transitions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+100
to
+102
| Effect.gen(function* () { | ||
| const created = yield* withSession({ title: "windows-directory" }) | ||
| yield* Effect.sync(() => |
Comment on lines
+161
to
+164
| Effect.gen(function* () { | ||
| const created = yield* withSession({ title: "windows-path" }) | ||
| yield* Effect.sync(() => | ||
| Database.use((db) => |
Comment on lines
+26
to
+39
| function realWindowsPath(value: string) { | ||
| const native = value.replaceAll("/", "\\") | ||
| try { | ||
| return normalize(realpathSync.native(native)) | ||
| } catch { | ||
| const parent = path.win32.dirname(native) | ||
| if (!parent || parent === native) return value | ||
| try { | ||
| return normalize(path.win32.join(realpathSync.native(parent), path.win32.basename(native))) | ||
| } catch { | ||
| return value | ||
| } | ||
| } | ||
| } |
Hona
force-pushed
the
fix/path-normalization-db
branch
from
May 28, 2026 01:10
c6557e7 to
a783985
Compare
Hona
force-pushed
the
fix/path-normalization-db
branch
from
May 28, 2026 01:23
a783985 to
b6af39d
Compare
Hona
marked this pull request as draft
May 28, 2026 02:01
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
C:/x/y, notC:\x\y.storage: writes/migrationquery: SQL filtersnative: row-to-app output