Skip to content

feat(projects): copy a workspace to another worker - #503

Merged
nixuuu merged 1 commit into
devfrom
feat/workspace-copy
Nov 10, 2026
Merged

nixuuu merged 1 commit into
devfrom
feat/workspace-copy

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Change

Add workspace now offers Copy from for a project on local and linked workers. Web/desktop uses the add dialog; mobile uses a sheet with a touch tree picker. Both show directory sizes, file counts, ignored groups, secret confirmation, progress, cancellation and completion summaries. Project presets store path hashes in the gateway database.

The default copies the complete Git metadata, including unpushed commits, the index, branch and remotes. A remote clone would lose unpublished objects and index state, and can require credentials unavailable on the target. Linked worktrees become independent checkouts. The target verifies Git connectivity before publication. Selecting .git/config and other potential credentials requires explicit confirmation.

Transfers use existing worker and linked-computer links, with one acknowledged 128 KiB chunk in flight and an 8 MiB/s cap. SHA-256 verifies each file and the aggregate. Staging plus rename prevents publishing partial checkouts; receipts recover interrupted finalization and cleanup checks directory identities. Retries start from a fresh preview rather than resuming partial file offsets. Limits are 20 GiB selected, 8 GiB per file, 100,000 entries and an 8 MiB manifest. Nested checkouts/submodules, external Git alternates and unsafe paths need cloning instead.

Additive contracts negotiate workspace_copy_v1; protocol 1 and frozen update/v1 stay unchanged. Migration 0112 stores presets and owner-scoped transfer summaries. File contents bypass journals, outboxes, models, logs and diagnostics. Audit records contain actor, source, target, counts and bytes. Polish protocol, worktree, linked-computer, durability and governor docs describe the flow.

Verification

  • bun install, bun run gen, bun run gen:check, root typecheck, lint, format check and web build passed. Generated contracts are included.
  • Real-worker gRPC coverage exercises local and linked copies in both directions, worktree Git state, ignored defaults/presets, explicit secrets, symlink escapes, executable bits, cancellation/failure cleanup, chunk and aggregate integrity, size limits, foreign ownership, older workers, log confidentiality, restart recovery and starting a thread in the new workspace: 11 tests and 66 assertions passed.
  • Full check:tmp covered all 394 test files, one process/file at a time. Every file passed, with opt-in live tests skipped. Four existing test files needed a retry: channel identity, promotion and skills initially hit the default 5-second timeout; gateway UI initially observed a duplicate interaction answer. All four passed individually with a 30-second timeout. Worker shutdown now waits for copy-receipt recovery, avoiding filesystem work after shutdown.
  • Manual browser checks covered light/dark, 1280 px desktop, 760 px narrow and 390 px phone layouts, long paths, ignored directories, secrets, progress, cancel, error and success. Expanding 3,501 files took 17 ms and mounted 21 rows. A selected 64 MiB copy completed and appeared immediately; cancellation removed both staging and destination. Screenshots remain outside the repository.
  • Mobile: typecheck and changed-file ESLint passed, Expo Doctor 20/20, CNG prebuild and iOS/Android exports passed. Production fingerprints using [email protected] are unchanged: iOS 6ddec9ef559ee0095ac33e94ff9418a942053b17, Android 5f6eae3ab278f1cd543e9ed763f923a319b65ec9. Full mobile ESLint reports 39 errors and 3 warnings in unchanged files; changed files are clean. Native device inspection was unavailable: device support failed twice. Windows/macOS worker runtime behavior was not exercised.

Copy audit (docs/copy.md §8)

  1. Checked new text for short active sentences, sentence case, punctuation and glossary terms. 1 files → 1 file fixes singular counts in both clients. No new glossary term or humour.
  2. Actions use verbs: Choose files, Review secrets, Copy these files, Cancel copy, Refresh file list. Confirmation repeats the copy action and names the target.
  3. Errors name the failure and recovery: generic failure → Workspace copy failed. Refresh the file list and retry. Older capability → Update this worker to copy files. Technical transport details stay off the surface.
  4. Empty filtering has No matching files. Limits, remembered selection and ignored defaults appear once at the selection step. Secret warnings use plain language and an explicit file list; no meaning depends on colour.
  5. Checked short/typical/long worker names and long paths at desktop, narrow and phone widths. Counts use tabular digits, paths truncate or wrap, and partial selections have a visible mark.

Related: #500

@nixuuu
nixuuu force-pushed the feat/workspace-copy branch from 052ec3e to 528fbb8 Compare November 10, 2026 14:57
@nixuuu
nixuuu force-pushed the feat/workspace-copy branch from 528fbb8 to 07f7154 Compare November 10, 2026 15:11
@nixuuu
nixuuu merged commit f2f3ec3 into dev Nov 10, 2026
10 checks passed
@nixuuu
nixuuu deleted the feat/workspace-copy branch November 10, 2026 15:20
nixuuu added a commit that referenced this pull request Nov 10, 2026
nixuuu added a commit that referenced this pull request Nov 10, 2026
nixuuu added a commit that referenced this pull request Nov 10, 2026
nixuuu added a commit that referenced this pull request Nov 10, 2026
PR #503 allowed selecting individual repository files, which could
produce a partial checkout. Copy the whole repository state instead: Git
metadata, tracked files and nonignored untracked work are mandatory,
enforced by the source worker before any reads. Web and mobile show a
fixed repository summary and offer only ignored local files.

Ignored dependency, build and cache directories are pruned before
walking their contents and listed in a disclosure. Secret-like and local
configuration files retain explicit confirmation; large ignored groups
start collapsed. Old presets apply only to available ignored files and
are narrowed on their next save. Limits, chunk transfer, integrity
checks and cleanup remain in place.

The copy dialog has its own persistent footer alongside the shared
palette header action, including Enter handling and disabled/busy
states. Its full-width primary action stays visible while the preview
scrolls, explains disabled states and shows progress with a cancel
action. Scroll containers, including the file tree, use `scroll-stable`.
Both clients use a three-line repository summary, a truncated monospace
branch with access to its full name, animated kit disclosures, file lock
icons with contextual help and muted folder counts. The root keeps its
indeterminate checkbox without repeating a secrets warning.

Contracts are additive, generated code is included, and legacy
full-selection fields are deprecated. The new `workspace_copy_scope_v2`
capability requires updated workers and linked gateways. Polish
documentation is updated.

Fixes: #503

## Validation

Rebased onto `dev` at `26f61cce`, retaining the shared palette actions
from #511, scrollbar gutters from #512 and linked-bot fixes from #509.
Re-ran generation, typecheck, lint, format check, both focused
workspace-copy test files separately (14 tests, 98 assertions, no
temporary files left), and the web build; all passed. Browser
screenshots and mobile fingerprint evidence below were collected before
this rebase.

- Passed: `bun install`, `bun run gen:check`, `bun run typecheck`, `bun
run lint`, `bun run format:check`, and the web build. The final layout
adjustment also passed web typecheck and build.
- Focused gRPC tests ran one file at a time through `check:tmp`:
workspace-copy (12 tests, 90 assertions) and workspace-copy-durability
(2 tests, 8 assertions). Coverage includes mandatory tracked and
nonignored untracked files, direct worker rejection of partial
selections, dependency requests, ignored choices, old presets, linked
transfers, integrity and recovery. Both left no temporary files. The
full repository test suite was not run.
- Real browser: light/dark at 1280, 760 and 390 px, with long names,
`.env` files, local configuration, over 100,000 dependency entries,
`target`, and a 205-file unusual ignored data directory. Replaced all
six screenshots after checking the visible, clickable footer before and
after scrolling, animated disclosure, branch/file tooltips, fixed row
heights and disabled confirmation with a reason. A real 64 MB browser
transfer exercised the busy state and completed successfully; the copied
tracked file matched byte-for-byte and Git retained the tracked
modification and nonignored untracked file. Screenshot artifacts stay
outside the repository; the before image is the maintainer-supplied
screenshot.
- Mobile: changed-file ESLint, Expo Doctor (20/20) and iOS/Android JS
exports passed. Production fingerprints generated before/after with
`[email protected]` are unchanged: iOS
`6ddec9ef559ee0095ac33e94ff9418a942053b17`, Android
`5f6eae3ab278f1cd543e9ed763f923a319b65ec9`. No native device runtime
validation.

## Copy audit

1. Selectable “Repository files” / “Git metadata” → compact fixed
summary: “Repository · …”, a separate monospace branch and a line of
unpushed commits/changes. Describes what is copied without implying a
choice or producing a paragraph on phones.
2. “Ignored build files start excluded” → “Skipped: node_modules, target
and … (dependencies and build output)” with disclosure. Explains that
these directories are omitted; a separate hint asks users to check
unusually large ignored groups.
3. “Secrets?” / repeated row warnings → a small lock icon with “May
contain secrets: …” contextual help for files and “N may contain
secrets” for folders. The synthetic root omits the repeated warning.
Desktop tooltips and native help preserve the meaning without adding a
second line; explicit confirmation and verb-led actions remain.
4. “Your selection is remembered” → “Ignored file choices are remembered
for this project”. Accurately scopes the preset. Empty state: “No
ignored local files to choose”. Repository errors state the problem and
recovery action.
5. Added “Confirm the files above to continue.” to explain a disabled
action; loading/copying actions show busy states. Checked sentence case,
glossary, punctuation, one idea per sentence, empty/error states,
confirmation wording and absence of decorative humour. Checked short,
typical and long names at desktop, narrow and phone widths in light/dark
themes; warnings have accessible text and contextual help.
nixuuu added a commit that referenced this pull request Nov 11, 2026
## Change

**Rebase update (2026-11-11):** the complete stack was rebased bottom-up
onto `origin/dev` `48cd5e9c3ce07b7a46873ac40d92819ca847f85a`, preserving
#522, #526 and #527. This layer's current CI is green; implementation
layers passed typecheck, lint and formatting after conflict resolution.
The migration maximum at this layer is **0116**; this supersedes
historical numbering below. Proto generation was repeated in each
affected layer (worker git-context fields use 227, preserving dev's file
API fields). Final cross-stack security, parity, performance and
verification evidence is in #534. Earlier results below describe the
pre-rebase implementation. All layers remain draft; native device UI
remains unverified.

Stage 4 enables Summary, Timeline and Code on web/desktop and mobile.
PRs now have paginated timeline/review threads and replies, checks/jobs
with lazy in-app redacted logs, and a paginated file list with commit
filtering and lazy unified/split diffs. Binary, renamed, truncated and
stale-SHA files have explicit fallback states. Viewed remains hidden
until stage 5; this stage makes no GitHub mutations.

Visible PRs share a watch producer and durable fetch leases; hidden
clients stop their streams, reconnect gaps invalidate pages, and active
background threads fetch bounded header batches. Linked homes retain
verified offline snapshots without mirroring logs. Cache retention,
owner quotas and fixed-label metrics cover the new resources. Composer
actions prepare bounded, quoted, untrusted attachments through the
existing attachment/harness path and never send a message automatically.

The release catalog stays CDN-first and can use an administrator's own
connected GitHub account for its authenticated API fallback. The visible
setting defaults on; missing, expired, disconnected or disabled accounts
retain the public update path. Credentials stay in the gateway and are
stripped from storage/CDN redirects.

Individual check/review states use Tabler outline glyphs with tooltips
and accessible labels, including mobile accessibility labels. The PR's
primary state stays readable as a compact icon-and-text badge. Aggregate
check counts remain text. Thread PR links use quiet source captions and
panel rows. Summary/Timeline/Code, checks, logs and the file-list
scrollport follow #512's `scroll-stable` helper and balanced padding.

The design pass gives Code one compact toolbar for commit filtering,
file count, layout, wrap, whitespace and tree view. File rows expand
their diff directly below a sticky file header; paths truncate in the
middle, renames retain both paths, and binary/large patches have inline
recovery actions. Timeline uses a compact event menu and sort toggle, an
avatar rail, grouped commits with short SHAs, relative timestamps with
absolute-time tooltips, markdown cards and inline review threads with
indented replies. Checks and review replies use progressive loading.
Shared activity/file presentation and focused components keep
web/desktop and mobile aligned; existing thread diff controls retain
their defaults.

## Stack and migrations

Rebased #485 → #487 → #501 → #508 with `gh stack` onto `origin/dev` at
`26f61cce`, including #486's static release index and #512's scrollbar
helper. Resolved conflicts, regenerated contracts where needed, checked
typecheck/lint/format at each layer, and force-pushed the rewritten
layers with explicit leases. All PRs remain drafts and their bases still
chain. Dev subsequently advanced with #510, #513 and #515; those changes
are outside this completed prerequisite rebase.

Renumbered the stack migrations above dev's 0112 in layer order: 0113
accounts, 0114 manual links, 0115 detection, then 0116 full read.
Updated the expected schema list and migration registration. Frozen
`update/v1` is unchanged; generated additive contracts are committed. No
material design deviations.

## Verification

- Passed `bun install`, `bun run gen:check`, root `bun run typecheck`,
`bun run lint`, `bun run format:check`, and the web build, including
final typecheck/build after the sticky-padding correction and mobile
typecheck/lint/format after the final mobile reset correction. The build
reports the existing chunk-size advisory. Final head
`429c46af353546c433e87293dd128910e524c04e`: CI is green. All five layers
#485/#487/#501/#508/#518 have SUCCESS check rollups, remain draft, and
retain the correct chained bases. No GitHub reviews have been submitted
for this stage.
- Sequential local fixture files passed: full-read pagination (5 tests),
security/composer (5), lifecycle/retention (4), release fallback (4),
linked-home offline/cache scope (3), and paired mobile transport (1).
Coverage includes >100 timeline/check/thread/reply/job items,
304/429/403, GraphQL partial errors, independent-client single-flight,
stream gaps/restart, 300 files/SHA races, log
SSRF/redaction/download/page limits, concurrent owner log quota,
retention, and authenticated/public release paths. Composer attachments
reached the scripted worker blob path. No live tests or anonymous
production API calls were used.
- Fresh-process full `bun run check:tmp` after the design pass: **2242
passed, 165 skipped, 0 failed**, **25397 assertions**, 2407 tests across
413 files, **1120.32 seconds**; exit 0 and **no Canopy temp entries
remained**. Harness-owned runtime entries were listed separately by the
runner and removed with its private directory. This rerun includes the
earlier cache-eviction correction and linked-home regression coverage.
The historical run was 2236 passed / 165 skipped / 6 failed; it is
superseded by this clean full run, not relabelled as passing. The final
two-file mobile state-reset correction additionally passed focused
ESLint, mobile typecheck, root lint/format and native JS exports.
- Browser fixture QA: light/dark, desktop 1440×1000, narrow 768×1000,
phone 390×844, with 18 new screenshots. Verified grouped commits, inline
review threads/replies (3→50→100), event filter/sort, relative-time
accessible labels containing absolute dates, folder collapse, long
paths, binary notices, long inline diffs and global
layout/wrap/whitespace controls. Checks progress 5→50→100→137 using one
control. Sticky toolbar/file-header bounds remain flush while scrolling;
phone panel has no horizontal overflow. Prior stage-4 fixture QA also
covered failing-job logs, huge/truncated/renamed patches, commit
filtering and all three composer attachments, including preserving an
existing draft when adding a second context.
- Mobile JS only: `bunx [email protected] fingerprint:generate --platform
ios --build-profile production --json --non-interactive` and the Android
equivalent passed. Fingerprints unchanged from stage 3: iOS
`6ddec9ef559ee0095ac33e94ff9418a942053b17`, Android
`5f6eae3ab278f1cd543e9ed763f923a319b65ec9`. Expo Doctor passed 20/20;
prebuild passed in a scratch checkout with no package changes; iOS and
Android Hermes exports passed, both limited to one bundler worker.
Additional mobile ESLint found existing app-wide findings; two findings
in the new reset effects were corrected and focused ESLint on those
files now passes. Mobile typecheck, canonical repository lint and format
checks passed again after that correction. App-wide mobile ESLint still
reports 40 errors / 5 warnings in unchanged code and is not claimed
green.

Native simulator visual QA is unverified: device tools returned “Device
list failed: Could not communicate with device support. Try refreshing
devices.” Refreshing once produced the same error; no alternate device
control was used. Mobile RPC parity is covered over the real pinned,
paired and revocable mobile transport. Live GitHub tests remain
optional.

### Performance

Real gRPC/Postgres fixture benchmark, same scripted GitHub 503 load,
stage-3 baseline versus stage 4. 10 warmups and 80 samples per read/ACK
operation, 40 dispatch samples. ACK measures committed ACK enqueue, not
network round trip.

| Existing operation | Baseline p95 ms | Stage 4 p95 ms |
| --- | ---: | ---: |
| GetOverview | 3.705 | 3.453 |
| GetThread | 1.094 | 0.893 |
| Send → worker input | 13.466 | 8.095 |
| Ingest → ACK enqueue | 2.294 | 2.309 |

No material regression observed; ACK's +0.015 ms (+0.6%) is within
shared-machine noise. This is a local sample comparison, not a
confidence-interval study. Candidate measurements precede the final
cache-write byte-accounting and access-error eviction corrections; those
change cache misses and GitHub access-error paths, not the measured
existing operations or warm-read paths. Warm-read p95: PR 3.091,
Timeline 5.392, Checks 4.412, Files 15.145, Diff 14.059, Log 6.460 ms,
all below the 50 ms target. Browser/native rendering p95, cold upstream
latency and an unavailable-partner performance comparison were not
measured; the offline partner behavior has integration coverage.

### Copy audit (§8)

Reviewed new/changed labels, settings, errors and empty states against
`docs/copy.md`: sentence case, active verbs, glossary, actionable
recovery, no decorative prose or duplicate facts. Long check names,
branches and paths were inspected at desktop and phone widths.

| Before → after | Reason |
| --- | --- |
| Author login input and separate review section → compact activity
menu, inline threads and relative times | Reduce filter weight and
preserve chronological context |
| Per-file display controls → one shared icon toolbar | Keep file rows
focused on paths and changes |
| “Show 45 more checks” plus “Next page” → progressive “Show more
checks” | One paging pattern transparently loads further pages |
| Bare SHA → “on aaaaaaa”; primary state glyph → icon plus
“Open”/“Merged”/“Draft”/“Closed” | Clarify the revision and keep the
PR's primary fact readable |
| Individual “Failed”/“Requested” status text → labelled glyphs and
tooltips | More room for names; state remains available to assistive
technology |
| “Auto”/“Manual” chips → quiet source captions | Reduce visual weight
without hiding provenance |
| Bordered “Link pull request”/“Show less” → “+ Link pull request” and
quiet “Show N more”/“Show less” rows | Match panel row actions |
| Generic missing patch → “Binary file”, “File renamed with no text
changes”, or explicit size-limit guidance | Explain the actual
limitation and recovery |

No new glossary term or “soul” sentence. Empty/error text keeps the
necessary status words; aggregate counts remain readable text. Icons
have distinct shapes and labels rather than relying on colour.

### Screenshot evidence (uncommitted)

New design matrix under `/var/tmp/canopy-github-4/`:
`{desktop,narrow,phone}-{summary,timeline,code}-{light,dark}.png` (18
files), plus `desktop-code-sticky-dark.png`. Desktop is 1440×1000,
narrow 768×1000 and phone 390×844. Phone Code light shows stacked and
dark shows split. Existing logs/composer screenshots remain in the same
uncommitted directory.

Related: #485, #486, #487, #501, #503, #508, #512.
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.

1 participant