← Back to Pull requests

Say how far each computer has got, and keep synced folders where they belong #147

Closed
unknown closed this pull request without merging on Nov 23, 2026 05:04 UTC
View on GitHub
unknown unknown commented on Nov 23, 2026 04:27 UTC
Author

Why

Two things went wrong after adding a Mac and switching from syncing everything to syncing just Desktop:

  • Computers said "Up to date · 2,332 files · 24.7 GB" while the Mac had 193 of those files and 23.8 GB still to download. The line only ever described this Uncloud's own copy: Syncthing's idle and the host's localFiles/localBytes.

  • Desktop landed at ~/Uncloud/uncloud-desktop-1bc24a84c811, and an empty-ish ~/Uncloud/Desktop sat beside it. Pairing had synced all of the files first, at ~/Uncloud, which created ~/Uncloud/Desktop. When that was stopped and Desktop synced instead, Syncthing's own auto-accept found the name taken and fell back to the folder ID. The stopped "Uncloud" folder also stayed configured on the Mac over all of ~/Uncloud, with 615 files it could never get.
  • What changed

    Host / web

  • ISyncthingApi.ProgressAsync reads /rest/db/completion for a folder and device. SyncService.StatusAsync adds Computers (state, completion, need bytes and items) to each folder for the account's own devices.

  • SyncPanel says "Up to date" only when every computer has all of the folder. Otherwise it says who is still getting it and how much is left, for example "Sending to Ethan's MacBook Pro: 10% there, 22.2 GB to go". A computer that hasn't accepted the folder gets "Waiting for … to accept it", and one that's away gets "… catches up when it's back online". Syncthing reports an offline device as unknown but keeps its numbers, so a laptop asleep with everything still reads "Up to date".

  • New POST /api/sync/computers/folders (anonymous, like release). A computer signs a challenge with its Syncthing key and is told the place of each folder shared with it. ComputerReleases.SignedByAsync is shared with release. The message is tagged uncloud-folders-v1, so a release signature can't be replayed for this, or the other way round.
  • Mac app (ComputerSync.KeepInStepAsync, run on every 5-second status check)

  • Turns autoAcceptFolders off for the host and accepts the host's offers itself, at the host's path. It asks the host only when something needs placing, caches the answer (a folder's ID is a hash of its path, so the answer never goes stale), and asks at most every 30 s. A host without the endpoint (401/404) falls back to the folder's name, as before.

  • Drops a folder once the host has reported notSharing for it for a whole minute while connected (StoppedFor), so a brief mismatch right after pairing doesn't restart a folder. The files stay.

  • Moves a folder Syncthing put at ~/Uncloud/<its id> to its proper place: it pauses the folder, renames the directory, sets the new path, then unpauses. It only moves into a place where nothing exists yet, and moves back if setting the path fails.

  • Never places a folder inside or around another one the Mac keeps. Such a folder waits until the other has been dropped.

  • Failures here are logged once per distinct message, and never replace the menu bar's status.

  • SetDefaultFolderPathAsync is gone: with auto-accept off, nothing uses it.
  • For reviewers


  • Folder drops and moves are tested against FakeSyncthing only, not a real Syncthing. The /rest/db/completion shape (remoteState, completion, needBytes, needItems) was checked against the Mac app's real Syncthing.

  • Mixed versions: a new app with an old host places folders by name, which is the old behaviour minus the ID fallback. An old app with a new host only gains the progress line.

  • On the Mac that hit this: once both are updated, the stale "Uncloud" folder is dropped after a minute, then uncloud-desktop-… is renamed to ~/Uncloud/Desktop (the leftover there was already removed by hand).
  • Tests


  • dotnet test Homebase.slnx: 506 passed. Web: npm run test, 181 passed; tsc -b clean; npm run build OK.

  • New .NET tests: folders shared later land at the host's path; a stopped folder is dropped only after StoppedFor while connected, and its files stay; "all of the files" waits for an overlapping folder to go, then lands at ~/Uncloud; a folder under its ID moves only into a free spot; an unreachable host is asked again after AskAtMostEvery, and an old host means placement by name; the signed folders endpoint, end to end, including refusing a release signature and a stranger; status carries per-computer progress.

  • New syncProgress.test.tsx covers each wording, including that a computer the server couldn't ask about is never shown as done.
  • 🤖 Generated with Claude Code

    Diff: 570 lines (+427 / -143) across 7 files Reviewer: ethanteng Review duration: 37m
    All Vouch review confidence checks passed
    Residual risk 0.22 = Change Risk (0.50) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.50 · 570 lines diff across 7 files
    0.50
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.380
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #147"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 49.8% (MEDIUM) · Higher = larger blast radius
    49.8%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 21.5% · Safe to merge
    21.5%