Repository navigation
Phase 35: add native desktop repository browser - #51
Conversation
These documents lay out strategic direction for the future productization of `sc`. They cover recommendations, product shape, MVP features, technical approaches, and security boundaries for both a desktop application and a native hosting platform. The desktop app is proposed as the stronger initial product surface, emphasizing `sc`'s unique semantics and keeping sensitive data local. The platform strategy focuses on a narrow native collaboration product for `sc`'s differentiated features, with continued GitHub interoperability.
There was a problem hiding this comment.
Pull request overview
Adds the Phase 35 native desktop “read-only repository browser” slice, introducing a new apps/desktop/ Tauri v2 + React/TypeScript application plus supporting ADR/design/threat-model documentation, while keeping protected/private content opaque via a narrow typed IPC boundary.
Changes:
- Adds a new Tauri v2 desktop app (
apps/desktop/) with a Rust read-model adapter and bundled React UI for browsing refs, snapshot DAG, trees, files, and first-parent diffs. - Extends architecture/roadmap/ADR/threat-model docs to cover the desktop/WebView trust boundary and Phase 35 scope.
- Integrates the desktop Rust crate into the workspace and adds frontend build/test tooling and ignores.
Reviewed changes
Copilot reviewed 36 out of 61 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| ROADMAP.md | Records Phase 34/35 descriptions and completion status. |
| docs/THREAT-MODEL.md | Adds explicit WebView/desktop trust-boundary section for Phase 35. |
| docs/research/platform-strategy.md | New research note on native hosting/platform direction. |
| docs/research/desktop-app-strategy.md | New research note on desktop strategy and scope. |
| docs/design/phase-35-desktop-app.md | New design doc defining the typed IPC boundary and DTO states. |
| docs/adr/README.md | Registers ADR-0044 and ADR-0045 in the ADR index. |
| docs/adr/0045-native-desktop-read-model.md | New ADR defining the desktop adapter, IPC boundary, and confidentiality behavior. |
| CLAUDE.md | Updates repo guide: adds desktop slice, commands, and Phase 35 capability notes. |
| Cargo.toml | Adds apps/desktop/src-tauri to the workspace members. |
| ARCHITECTURE.md | Updates workspace description and adds Phase 35 architecture notes. |
| apps/desktop/vite.config.ts | Adds Vite/Vitest config for the desktop renderer bundle. |
| apps/desktop/tsconfig.node.json | Adds TS config for node-side tooling (Vite config). |
| apps/desktop/tsconfig.json | Adds TS project references for app + node configs. |
| apps/desktop/tsconfig.app.json | Adds strict TS config for the React renderer. |
| apps/desktop/src/vite-env.d.ts | Adds Vite env type reference. |
| apps/desktop/src/test/setup.ts | Adds Vitest + DOM test setup/mocks. |
| apps/desktop/src/test/DemoApp.tsx | Adds dev-only demo fixtures used for screenshots. |
| apps/desktop/src/styles/app.css | Adds desktop UI styling for the three-panel browser. |
| apps/desktop/src/model.ts | Defines renderer-side DTO types mirroring the IPC boundary. |
| apps/desktop/src/main.tsx | Adds app entrypoint + dev-only demo loading. |
| apps/desktop/src/components/RepositoryTree.tsx | Adds Pierre Trees adapter for browsing snapshot paths. |
| apps/desktop/src/components/PresentationSpike.test.tsx | Adds smoke tests that Pierre components mount correctly. |
| apps/desktop/src/components/FileSurface.tsx | Adds Pierre Diffs/File rendering with locked/binary/unavailable states. |
| apps/desktop/src/App.tsx | Implements the main browser UI and typed async flow handling. |
| apps/desktop/src/App.test.tsx | Adds renderer tests for flows (open, errors, navigation, locked/private states). |
| apps/desktop/src/api.ts | Adds typed IPC wrapper over Tauri invoke. |
| apps/desktop/src-tauri/tauri.conf.json | Adds Tauri v2 config including CSP/dev CSP. |
| apps/desktop/src-tauri/src/read_model.rs | Implements Rust read-model adapter enforcing reachability/path constraints and confidentiality states. |
| apps/desktop/src-tauri/src/main.rs | Adds Tauri binary entry calling scl_desktop::run(). |
| apps/desktop/src-tauri/src/lib.rs | Exposes run() for launching the desktop shell. |
| apps/desktop/src-tauri/src/commands.rs | Implements the five-command typed IPC surface + repo selection dialog. |
| apps/desktop/src-tauri/icon.svg | Adds desktop app icon. |
| apps/desktop/src-tauri/Cargo.toml | Adds scl-desktop crate dependencies and build deps. |
| apps/desktop/src-tauri/capabilities/default.json | Adds minimal Tauri capability configuration. |
| apps/desktop/src-tauri/build.rs | Adds Tauri build script hook. |
| apps/desktop/README.md | Documents desktop dev workflow, security boundary, and screenshot fixtures. |
| apps/desktop/package.json | Adds renderer dependencies/scripts (Vite/Vitest/Tauri CLI). |
| apps/desktop/index.html | Adds renderer HTML entry. |
| .gitignore | Ignores desktop build artifacts and generated capability schemas. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (mode === "locked") { | ||
| const timer = window.setTimeout(() => { | ||
| Array.from(document.querySelectorAll<HTMLButtonElement>("[role=tab]")).find((button) => button.textContent === "changes")?.click(); | ||
| window.setTimeout(() => Array.from(document.querySelectorAll<HTMLButtonElement>(".change-pane button")).find((button) => button.textContent?.includes("release.env"))?.click(), 100); | ||
| }, 250); | ||
| return () => window.clearTimeout(timer); | ||
| } |
| const paths = useMemo(() => files.map((file) => file.path), [files]); | ||
| const filePaths = useMemo(() => new Set(paths), [paths]); | ||
| const { model } = useFileTree({ | ||
| paths, | ||
| initialExpansion: 1, | ||
| flattenEmptyDirectories: true, | ||
| search: paths.length > 8, | ||
| density: "compact", | ||
| onSelectionChange(selected) { | ||
| const path = selected.at(-1); | ||
| if (path && filePaths.has(path)) onSelect(path); | ||
| }, | ||
| renderRowDecoration({ item }) { | ||
| const file = files.find((candidate) => candidate.path === item.path); | ||
| if (file?.contentState === "protected_locked") { | ||
| return { text: "locked", title: "Protected content is locked" }; | ||
| } | ||
| if (file?.contentState === "binary") { | ||
| return { text: "binary" }; | ||
| } | ||
| return null; | ||
| }, | ||
| }); |
tonibergholm
left a comment
There was a problem hiding this comment.
Overall the design is sound — the WebView trust boundary is well-defined, protected and private-branch content is correctly redacted at the Rust layer, and the dependency rules are respected. A few issues need to be addressed before merge:
Must fix before merge
TreeFileView.contentStateincludes"binary"whichtree_view()never emits — dead branch inRepositoryTree.tsxthat will silently misbehave if the type union is ever narrowed (inline comment onmodel.ts)validate_relative_pathdoes not reject null bytes — security-relevant, easy fix (inline comment onread_model.rs)compare_first_parenthas no size cap before loading both blob sides — can spike memory on large local blobs (inline comment onread_model.rs)
Should fix
reachable_snapshotre-walks the full DAG on everyread_file/compare_first_parentcall — will be visibly slow on real repos (inline comment onread_model.rs)MutexvsRwLockchoice for the read-only command set needs either a fix or an explanatory comment (inline comment oncommands.rs)$schemaincapabilities/default.jsonpoints to a gitignored generated file, breaking fresh-checkout IDE experienceCLAUDE.mdandARCHITECTURE.mddisagree on whethertlsiodepends oncore
Nice to have
- O(n²)
files.findinRepositoryTree.tsxrenderRowDecoration— easyuseMemoMap fix load_trust_mapsilently returns empty on parse errors, making corrupt-trust-file and missing-key indistinguishable in the UIfrom_repoleaks raw Rust error strings to the UI error card@pierre/treespre-release pin semantics and missing registry note for contributors
Generated by Claude Code
| fn reachable_snapshot( | ||
| &self, | ||
| repo: &Repo, | ||
| snapshot_id: &str, |
There was a problem hiding this comment.
Performance: full DAG re-walk on every file access
reachable_snapshot is called by snapshot_details, read_file, and compare_first_parent. Each call opens a fresh Repo, collects all public refs, and walks the entire commit graph to verify the supplied snapshot id is reachable. On a repo with thousands of commits and the user clicking through files in the inspector, this means multiple full DAG walks per interaction.
The session flow already guarantees ordering: the frontend only calls read_file / compare_first_parent after select_reference has returned a HistoryView containing the snapshot id. Caching the reachable set (even just as a HashSet<ObjectId> in AppState alongside the repo path, invalidated on choose_repository) would reduce these to O(1) lookups.
Alternatively, add a bounded walk with a depth cap as a short-term guard against latency spikes on large repos.
Generated by Claude Code
tonibergholm
left a comment
There was a problem hiding this comment.
Re-review after f6da8dd + cf84d5e
Excellent response to the review — all 10 must/should items are addressed and most of the nice-to-haves landed too. Resolved threads accordingly.
Fixed ✅
| Finding | How addressed |
|---|---|
"binary" dead-code in tree panel |
TreeContentState = "public_available" | "protected_locked" — RepositoryTree no longer references ContentView's discriminants |
O(n²) renderRowDecoration |
useMemo + Map<string, TreeFileView> — O(1) lookup |
Mutex serialising reads |
Comment added explaining the guard is released immediately after clone, before any I/O — the design is intentional and correct |
reachable_snapshot full re-walk per call |
Arc<RwLock<HashSet<ObjectId>>> in DesktopRepository — cache checked first, populated on first walk, shared across clones |
Null byte in validate_relative_path |
!path.contains('\0') added |
| No size cap before diffing | MAX_RENDER_BYTES = 4 MiB cap, ContentView::TooLarge returned + rendered in the UI |
from_repo leaks raw error strings |
Matched variant-by-variant to human-readable messages; raw to_string() no longer crosses IPC |
load_trust_map silent on parse errors |
Only NotFound returns empty map; unreadable or malformed files now surface "repository_error" / "corrupt_repository" |
$schema pointing to gitignored file |
Now https://schema.tauri.app/config/2 |
@pierre/trees pre-release ^ range |
Exact-pinned to 1.0.0-beta.5; README note added explaining both packages resolve from the public registry |
CLAUDE.md/ARCHITECTURE.md tlsio disagreement |
ARCHITECTURE.md now shows repo → tlsio as a separate leaf edge, consistent with the "not even core" clause |
Copilot: tree_view marks missing partial-clone blobs as readable |
store.blob_size checked before marking public_available; missing blobs surface ContentView::Unavailable (resolved by author) |
Copilot: DemoApp setTimeout leak |
clearTimeout cleanup added in all timer paths |
One minor follow-on (inline comment on read_model.rs)
select_reference walks the full DAG but doesn't write the results into self.reachable, so the first read_file call after each reference switch still triggers a second walk before the cache warms. Easy fix, not a blocker.
This is ready to merge once the CI is green.
Generated by Claude Code
| let valid = !path.is_empty() | ||
| && !path.starts_with('/') | ||
| && !path.contains('\\') | ||
| && !path.contains('\0') |
There was a problem hiding this comment.
Follow-up on DAG re-walk: cache is correct but warms lazily
The Arc<RwLock<HashSet<ObjectId>>> reachable cache is a good fix — subsequent read_file / compare_first_parent calls within a session are O(1) after the first hit. One gap remains: select_reference performs a full DAG walk and populates a local seen set, but does not write those ids into self.reachable. This means the first read_file call after switching a reference still triggers a second full walk before the cache warms.
Cheapest fix — at the end of select_reference's walk loop, extend the shared cache with the local seen set:
// after the while loop in select_reference:
if let Ok(mut guard) = self.reachable.write() {
guard.extend(seen.iter().copied());
}This is a minor latency improvement (one extra walk per reference switch), not a correctness issue, so happy to leave it as a follow-on ticket rather than blocking merge.
Generated by Claude Code
Summary
apps/desktop/.scbranches, snapshot DAG history, provenance, trees, files, and first-parent changesWhy
Phase 35 proves that src-control's native object model can power a polished desktop experience without parsing CLI output or translating through Git. The slice is deliberately read-only and keyless so the new WebView boundary does not expand the repository's secret or mutation surfaces.
User and developer impact
Users can open an existing
.screpository and inspect local and remote-tracking branches, merge topology, signatures, transcript presence, public files, and first-parent comparisons. Protected files render as locked and unauthorized private branches remain opaque. Developers get exact setup and build commands, typed Rust/TypeScript DTOs, regression tests, and replaceable@pierre/treesand@pierre/diffspresentation adapters.Validation
cargo test --workspacecargo clippy -p scl-desktop --all-targets -- -D warningsnpm run typechecknpm test -- --runnpm run tauri build -- --bundles appThe production macOS
.appbundle completed successfully, and the PR includes screenshots for the main browser, protected comparison, and private-branch states.