Commit Graph
13 Commits
Author SHA1 Message Date
Claude 9ca10d96f4 fix(sync): compare stand-ins again after a proxy download that did not finish
The agent recorded the server's update time for a cache of stand-in
thumbnails before the proxy download it queued, so a download that failed
(server restart, network drop) was never queued again once its backoff
ended: the server's sequence may never change again. A comparison that
offers proxies is now recorded only once their download is queued, and
dropped when that download ends other than done.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
2026-10-12 19:59:53 +00:00
Claude 99a0f37973 fix(sync): replace cached thumbnails once the server offers their proxies
With Keep proxies offline, the agent refreshed a proxy cache only when the
server's sequence had ProxiesBuilt. That flag waits for every frame, and a
missing or damaged frame never gets a proxy, so a HEIF sequence with one
such frame kept the 320-px thumbnails cached in place of proxies forever,
although the server offered the other frames' proxies sent by clients.

For such a cache the agent now reads the manifest once per change of the
server's update time and queues the background download when a frame is
offered as a proxy that the cache holds only a stand-in for (or nothing).
The test server's fake serves proxies sent to it, as the real one does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
2026-10-12 19:14:13 +00:00
Claude a56aaf8d65 fix(sync): translate positions only against the frames they name
Positions crossing copies could still land on other photos in three
windows:

- A push translated a row snapshot's settings against local frames
  listed later, after a manifest round trip: an import of earlier photos
  meanwhile moved the row's positions, and the server stored shifted
  exclusions, hero and keyframes. SyncPositions now reads this copy's
  row with its frames as one state (frames listed between two reads of
  the row at the same frames version) and translates that row's
  settings, at the settings version being pushed. The conflict
  comparison and ApplyLocallyAsync compare against that same row. When
  the copy was edited since, or its frames keep changing, nothing is
  sent or applied and the next comparison translates again (Keep mine
  reports a changed conflict; PushAll sends an edit saved meanwhile).
- The manifest read the sequence row, then paged its frames: an upload
  committed in between paired settings of one frames version with
  frames of the next. The server now lists them again while the frames
  version moved during the listing, then inside a transaction holding
  the row (on SQLite, on that transaction's connection, so no second
  pooled connection waits behind the write lock). The client also
  refuses to translate against a manifest whose frames are not each
  listed once at 0..n-1.
- Server capture times were fetched only when something was unhashed,
  so the same parked photo was written with or without capturedAt. They
  are now fetched whenever the two frame lists differ; an equal project
  then compares equal, and an entry can be placed on a photo that
  arrives unhashed.

CompareOriginals counted unhashed server frames one-to-one against this
PC's photos, so two copies of one photo in a folder the server adopted
left Download on offer forever while the download fetched nothing. A
photo on either side is now there when any photo of the other side
matches it, as downloads and uploads find them. Paged frame listings
keep each frame once (an insertion between pages lists one again).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
2026-10-12 17:09:30 +00:00
Claude b0c364539d fix(sync): replace cached thumbnails once the server has the proxies
A proxy download caches a frame's thumbnail under its proxy name while
the server has no proxy of it (HEIF until a client or render node sends
one). The cache did not record which it was, so the thumbnail stayed
there for good after the server's proxies arrived (V-29).

- remote.json records each cached file's kind (proxy or thumbnail); a
  later proxy download replaces thumbnails, and files of caches written
  before kinds were kept, once the server offers the frame's proxy.
- A cache filled with thumbnails while the server had no proxies counts
  as stale, so offline caches are fetched again when the proxies arrive.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
2026-10-12 16:22:50 +00:00
Claude f4103d42a1 fix(sync): download and match originals the server has not hashed
A folder the server adopted and never verified lists no SHA-256. A
download of such a sequence failed ("did not arrive intact") because
every unhashed frame collapsed into one wanted entry and the empty hash
was refused, and desktops never sent the proxies the server asked for
those frames (V-9).

- Each unhashed server original is fetched by frame id into staging,
  accepted on its size (two attempts, resumed with Range) and hashed
  here; the archive ingest files it by that hash like any other.
- Server frames without a hash are matched to this PC's originals by
  size and capture time: they are not downloaded twice, not uploaded
  again, counted right in the comparison (each frame on its own), and
  their wanted proxies are counted and sent from the matching original.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
2026-10-12 16:21:35 +00:00
Claude ea6e1a69e0 fix(sync): keep project positions on their photos when settings cross copies
Settings synced between a PC and its server sequence were stored as they
came, in the other copy's frame order. When the inserted photos arrived
later (a download, an upload), the index moved those already-correct
positions a second time, so exclusions, the hero and camera keyframes
landed on other photos (V-21, CD-2).

- Settings are translated by photo (SHA-256, else size and capture time)
  to the frames of the copy they go to: the server's before they are
  compared or applied here, this PC's to the server's frames as its
  manifest lists them before a push (SyncPositions).
- A position on a photo the receiving copy lacks waits in project.json as
  a pending frame and takes its place when the photo arrives, on an
  insertion or an append in step with the index; the Library's hero
  frame follows. A hero chosen meanwhile wins, and advice does not fill
  a hero while one waits. Old projects without the member are unchanged.
- Pushes send expectedFramesVersion; PATCH /api/v1/sequences/{id} answers
  409 frames_conflict when the frames changed since, and the next
  comparison translates again.
- A pulled payload equal to the local copy is settled without the
  archive: an offline or read-only archive no longer fails the
  comparison (V-10).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
2026-10-12 16:20:11 +00:00
Claude 17311cc459 fix(sync): send wanted proxies of unverified originals and recount them
Wanted proxies were matched to this PC's originals by SHA-256 only, and
frames adopted from a folder stay unhashed until verified. A desktop that
uploaded an adopted HEIC folder counted none of the proxies the server asked
for, showed the link in sync and sent none of them. The upload now keeps the
hash it computes for each original the index has none for and makes the
proxies from those too; the comparison counts a wanted frame no hash matched
against an unhashed original this PC reads by size (the server names its copy
by its own template, so not by name).

The wanted count was recomputed only when frame or render counters moved, so
proxies a render node sent left the row "Local ahead" with an upload that
sent nothing, and proxies the server started asking for later were never
counted. A link whose copy may make proxies for the server now keeps the
server's update time of the last comparison (sync_links.diff_remote_updated_at,
migration 0006) and is compared again when it moved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
2026-10-12 11:06:53 +00:00
Claude 9588ed7f4b fix(proxies): get proxies of undecodable originals from clients and nodes
The server decodes with managed decoders only, so HEIF originals had no
proxies, thumbnails from their small previews and no pixels for analysis or
managed renders, and nothing could send it proxies (ENG-05). Manifests now
carry the archive's proxy spec and, per frame, its flags and whether the
server wants its proxy. PUT /api/v1/frames/{id}/proxy (Edit or RenderNode)
stores a JPEG of at most 64 MiB that decodes and whose Exif capture time is
the frame's, then queues thumbnails and the proxy pass. An upload from the
desktop makes and sends the wanted proxies after the originals and counts
them as local changes; a render node sends those it can make from the
originals it fetched once the job is done. The server never makes such a
proxy from a preview, drops one left by a renumbered frame, takes thumbnails
from a proxy, and analyses and renders those frames from their proxies.

Render nodes fetched every frame of the manifest: frames missing, corrupt or
excluded on the server failed the download, and originals not hashed yet
failed the SHA-256 check (ENG-07). Nodes now skip those frames, fetch unhashed
originals into the job folder with a size check, judge decodability with their
own decoders, and use the proxy of a frame they cannot decode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
2026-10-12 09:58:58 +00:00
Claude c87357b02c fix(sync): finish stuck downloads and keep edits saved during a comparison
A download whose .part already held the whole original (the job stopped while
hashing it) or more asked the server to resume past the end, got 416 and
failed on every retry; such a part is now hashed again, and one the server
cannot resume starts over (CD-1).

Auto-sync pulled the server's settings with the copy of the sequence read when
the comparison began, so an edit saved on this PC meanwhile was overwritten
unseen. The payload is now applied in one step under the sequence lease and
only while the local settings version is the one read; otherwise nothing is
written and the change is settled as a conflict (CD-3).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
2026-10-12 09:58:36 +00:00
Claude f4c529c853 test(sync): wait for the comparison an event starts, not for its first write
ATimedOutComparisonIsRecordedAndLiveUpdatesGoOn polled until the server's
settings reached the local copy and then asserted that the link's error was
cleared. The engine writes the local copy first and stores the link (error
cleared, versions agreed) afterwards, so a poll landing between the two writes
saw the old error: 1 failure in 60 runs idle, 11 in 60 under CPU load.

The agent tests now wait for SyncService.Changed, which the engine raises once
a comparison stored every link and state (the moment the Server screen reloads),
and assert on that settled state. The same fix applies to the proxy refresh
test (the cache is complete before the link and the job: it waits for the job,
whose row showed Transferring until then) and the retry test (the agent stores
the snapshot before it clears the last error and raises Changed).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
2026-10-06 21:04:55 +00:00
Claude 2d40a613b9 fix(sync): resolve conflicts against the versions shown, isolate failures, renders on request
- Conflicts are settled against the versions the user was shown; a later change on
  either side refuses the choice and compares again. Title, tags, rating and notes
  changed differently on both sides are a conflict too (no silent tag union).
- Links are written under the engine's gate and forgotten only after a 404; linked
  local copies are read by id; unlinked copies with the same originals are linked
  by content.
- A failure on one sequence is recorded on its link; the others are still compared.
- Downloads hash unverified local copies first and restore originals missing here.
- Background proxy downloads give way to the user's requests; "Keep proxies offline"
  refreshes the caches of sequences opened with proxies, checks free space and backs
  off after a failure.
- Renders travel on request: Send exports (chunked, hash-verified upload keeping the
  render id; new POST /sequences/{id}/renders endpoints) and Get exports.
- Server screen: stable row buttons, mockup column grid, Tab through rows, conflict
  rows first on the card colour, localised conflict detail, Save both confirmation,
  Pause metered uploads, culture switch, Library one-word sync glyphs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
2026-10-03 10:26:56 +00:00
Claude c02d1867d0 test(sync): upload, download, resume, proxies and live events against the real server
The first original of an upload now creates the server sequence through its
session key (the archive ingest files API-created empty sequences nowhere), and
settings sent after an upload are retried when the server's own analysis edits
the new sequence meanwhile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
2026-10-02 22:44:20 +00:00
Claude 7f542646b4 test(sync): state, settings conflicts, transfers and agent against an in-memory server
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
2026-10-02 22:29:49 +00:00