Skip to content

feat(sync): review first — decide and ask everything, then transfer unattended - #80

Merged
michvllni merged 1 commit into
mainfrom
feat/review-first
Nov 8, 2026
Merged

michvllni merged 1 commit into
mainfrom
feat/review-first

Conversation

@michvllni

Copy link
Copy Markdown
Collaborator

Why

A normal sync decides and transfers each file in turn, so a conflict prompt can come up between two long transfers. A ROM over FTP from a phone took 6 minutes, so you had to keep watching the console for the whole run.

What changes

B on the menu, "Review first":

  1. Plan: every remote of every chosen path is listed, and every file is decided. Every conflict is asked as it comes up, after the byte comparison from feat(sync): check a conflict against the bytes before asking #78. Nothing is transferred and the manifest is not written.
  2. Review: the log prints --- Review --- with every file to download or upload and where from or to. The bottom screen (SCREEN_REVIEW) says "Ready to transfer · N down, M up", with A Start and B/START Cancel.
  3. Transfer: the transfers run without another question.
    • START still stops them, also mid-file (fix(sync): START stops the file in flight; FTP skips MDTM for filtered files #77).
    • Lid: closing it keeps them going: frontend::setUnattended() refuses sleep (aptSetSleepAllowed(false)) for this pass only, and frame() turns the backlights off while the lid is closed (PTMU_GetShellState(), GSPLCD_PowerOffBacklight()).
    • Afterwards: sleep and the backlights are restored.

Engine: syncFile() is split in two.

  • decideFile(): everything up to and including the conflict prompt. It returns a FilePlan: the sides, the source, the new generation, and one SideAction per side (source, same, read-only, renumber, upload).
  • applyFile(): carries the plan out, transfers first, then the manifest.
  • A normal sync (syncEntry(), A) applies each plan at once, so it behaves exactly as before; the existing tests pass unchanged.
  • Review mode uses planEntry() and applyEntryPlan(), plus countPlan() and planLines() for the review list. transferPlanned() in main.cpp runs the second pass.

Edge cases:

  • A save changed on the 3DS between the review and its transfer is left alone and listed under problems in the summary.
  • Comparison copies from the plan pass stay with their plan and are moved into place, not downloaded again. Unused ones are removed with the plan.
  • Drive's own upload-only path (legacyUpload()) transfers as it goes, so SyncProvider::hasLegacyUpload() holds it back for the second pass.

The README (controls, a "Review first" section) and AGENTS.md describe it.

Tests

  • make -C tests: 290 pass. New in test_review.cpp:

    • planning transfers nothing and writes no manifest;
    • the result is identical to a normal sync's;
    • a skipped conflict is left alone;
    • cancelling at a conflict changes nothing;
    • a save changed after the review is left alone;
    • a compared copy is not downloaded again;
    • an unused compared copy goes with its plan;
    • every path's questions come before any transfer;
    • the review list.

    The UI tests cover the B button and the review screen. make -C tests preview renders the menu, the review screen and the transferring card.

  • node --test: 28 pass.

  • The 3DS build has no warnings.

  • Tested on a console: questions first, then the review, then unattended transfers.

🤖 Generated with Claude Code

…nattended

- B on the menu: every entry is listed and every file decided first,
  conflicts and the byte comparison before them included, with nothing
  transferred and the manifest untouched.  The log then lists each
  transfer and the bottom screen asks once whether to start; the
  transfers run without another question.
- The engine's syncFile() is split into decideFile(), which returns a
  FilePlan (source, generation, one action per side), and applyFile().
  A normal sync applies each plan at once and behaves as before.
- A save changed between the review and its transfer is left alone and
  reported.  Comparison copies live with their plan and are reused.
  Drive's own one-way upload is held back until the second pass
  (SyncProvider::hasLegacyUpload()).
- During the transfers the console refuses to sleep, so the lid can be
  closed without dropping Wi-Fi; the backlights go off meanwhile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@michvllni
michvllni merged commit 61d00e8 into main Nov 8, 2026
7 checks passed
@michvllni
michvllni deleted the feat/review-first branch November 8, 2026 21:31
michvllni added a commit that referenced this pull request Nov 9, 2026
* fix: open ptm:u and gsp::Lcd only while they are needed

- v0.9.0 opened both services in componentsInit() and held them until
  exit.  On a 2DS the whole console then froze after a while at the menu,
  HOME included, with no crash dump; the build before #80 did not.  The
  system needs those sessions itself (dimming the screens after a while
  without input, among other things).
- ptm:u is now opened by watchLid() for the unattended pass of a
  review-first sync only, and gsp::Lcd by setBacklights() for each call.
  The lid behaviour during that pass is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore: 0.9.1

- v0.9.0 freezes the console after a while at the menu; 0.9.1 carries
  the fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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