feat: add sparse checkout support for workspaces - #93
Open
Ziinc wants to merge 10 commits into
Open
Conversation
Collaborator
Author
|
test |
Workspaces can now be created with jj sparse working-copy patterns so only matching path prefixes are materialized on disk. Patterns are validated before any side effect and applied in a dedicated working-copy mutation between workspace init and checkout, mirroring 'jj workspace add --sparse-patterns'. None and an empty list both mean a full checkout. Adds TDD integration tests for materialization, jj sparse registration, full-checkout fallback, validation, and single-file patterns.
Adds a sparse_patterns TEXT column (JSON array, NULL for full checkouts) mirroring the moved_files precedent, decodes it in workspace records, and pins snapshot behavior: files outside the sparse cone are neither reported as changes nor swept into commits.
…ehavior Creating a workspace now fails fast when a moved file falls outside the sparse cone instead of committing a file that would be invisible on disk. Tests pin that included_copy_files are copied regardless of patterns and that stacked workspaces respect sparse patterns.
Extracts the duplicated metadata JSON parsing into a shared core::parse_workspace_metadata (with unit tests) used by both the Tauri command and the NAPI dispatch, and passes sparse_patterns through. Also fixes the NAPI create_workspace call that was missing the included_copy_files argument. Adds a TS integration test covering sparse and full creation via the NAPI path, and exposes sparse_patterns on the frontend Workspace type.
treq add gains a repeatable --sparse/-p flag. The creation dialog gets an optional sparse-paths textarea (plain creation only); metadata JSON is now built by a shared tested helper that includes sparse_patterns when set.
Drives the real Stack dialog to create a workspace with sparse paths and captures the dialog and resulting workspace, asserting only matching paths materialize on disk.
Ziinc
force-pushed
the
claude/sparse-checkouts-workspace-ark3sj
branch
from
July 27, 2026 19:57
d43f8dc to
f06f969
Compare
Contributor
📸 App QA screenshotsRe-ran the flow whose spec this PR adds or modifies — 4 captures. Other specs in the library were not run. workspace-sparse-checkout
Each bullet under a capture is what the spec claims that image should show — open the PNG and check it. commit |
hasSourceWorkspace is true even for the home repo (sourceWorkspace is null, not undefined), which hid the field in the exact flow it targets. Gate on the actual sourceWorkspace object instead. Caught by the workspace-sparse-checkout screenshot spec.
The Stack dialog's sparse paths input is an advanced option; hide it in a collapsible section that defaults to collapsed, following the existing chevron-toggle pattern. Screenshot spec drives the expand interaction.
Adds a before capture of the home repo's full root file list so the sparse workspace's reduced file list (only src/) is directly comparable.
The test arrived with the rebase onto main and still called core::create_workspace with the pre-sparse 6-argument signature, breaking the rust build on both runners.
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.
Summary
This PR adds sparse checkout functionality to workspaces, allowing users to create workspaces that materialize only a subset of files matching specified patterns. This is useful for large monorepos where developers only need to work with specific directories.
Key Changes
Core Functionality
parse_sparse_patterns()injj.rsto validate user-supplied patterns and convert them to jj'sRepoPathBufformat. Patterns are validated before any side effects occur.create_workspace()to accept an optionalsparse_patternsparameter that gets registered in jj's working-copy state viaset_sparse_patterns().None(full checkout).Database and Metadata
sparse_patternscolumn to the workspaces table to persist patterns across sessions.parse_workspace_metadata()function incore/workspaces.rsto centralize metadata JSON parsing, handlingsparse_patternsalongside existingtitle,description, andmoved_filesfields.local_db::Workspaceto includesparse_patternsfield.Frontend Integration
WorkspaceLeftPanelandUnifiedWorkspaceDialog.workspaceMetadata.tswithparseSparsePathsInput()andbuildCreateMetadata()utilities to handle newline-separated sparse path input from users.Workspaceinterface to include optionalsparse_patternsfield.CLI and Commands
--sparseflag to the CLI workspace add command.Testing
core_workspaces_sparse_checkout_test.rswith 11 tests covering:Implementation Details
parse_sparse_patterns()before workspace creation, ensuring no partial state is left behind on errors.srcmatches both thesrcfile and everything undersrc/../prefix and trailing slashes, with duplicates removed.Noneand empty lists both result in full checkouts.https://claude.ai/code/session_01ARzJzBaQCPUpHgYJqdi1zF