Commit Graph
16 Commits
Author SHA1 Message Date
Alby96andClaude Opus 5.5 7692ab402e fix(workspace): a cancelled copy clears only media no other copy writes; a deletion keeps late versions
Owner review 2, phase 5a, fix round 5.

- A cancelled workspace copy clears its partial media only under the project's
  lease, after checking again that the job is still cancelled, that no other
  copy of the same root and project is queued, running or paused, and that no
  copy in this process is writing. The engine now waits for a paused job's run
  to end before calling the cancel handler, so the clean-up is never skipped.
- The clean-up never recreates a project folder that was removed meanwhile
  (the lease no longer creates the folder). The next list removes a project
  folder that holds only lease files nobody holds, older than the lease.
- A Main this Chronos cannot read (newer or damaged) refuses the open at once
  only when nothing else can be offered. Otherwise Open in workspace lists it
  disabled, with the reason as its tooltip. The refusal's action tooltip is
  now Remove copy.
- The removal plan counts a conflict the same way the sync status does: a
  conflict that a settling replay took past its commit point is not work
  left.
- A healed record is stamped after both the record's time and the index's, so
  the next rename made elsewhere is taken.
- A trash folder holds back the rebuild of a lost record only when it is this
  sequence's deletion: its record names this sequence or cannot be read, or it
  has no record, is within a one-day grace and holds no version of another
  project. What was seen of folders that are gone or have a record again is
  forgotten.
- When a deletion wins, version files pushed into the live folder before the
  deletion arrived are moved beside the deleted record in the trash, never
  deleted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 15:10:44 +01:00
Alby96andClaude Opus 5.5 279ebf437f fix(workspace): a deleted project asks nothing, prunes and copies clean up only after what ended well
Owner review 2, phase 5a (R8), fix round 4.

A project the library no longer has now reads as Gone with no conflict to
answer. The conflict stays recorded in sync.json, so Save both on a deleted
project says Gone once and offers its copy. It no longer reopens the conflict
dialog. Keep mine and Take the library's first check that the home still has
the project. Neither is merged onto the last version a deleted project had,
so the working state and the unsent versions stay as they were.

Old files in versions/.replaced are pruned only after a push that ended well,
never after one that stopped at a conflict. A file an earlier build set aside
kept the time its version was written. It now counts as set aside no earlier
than when this build first knew the folder (versions/.replaced.since), so an
upgrade does not prune it by an old mtime. The Merge mark goes on the replayed
version whose own change met a setting the conflict listed. A version that
only rides along with a working-state conflict stays a commit.

A first copy cancelled while paused or failed, which no handler runs, now has
its partial media removed under the project's lease, as a running one does
(ICancelledJobHandler). The space estimate counts a proxy held under its
<id>-<sha16>.jpg name. The frames stamp carries a weighted SQL checksum of
the hashes, so a hash replaced in place (a Verify) makes the workspace read
the frames again.

Desktop: a removal that cannot move a file puts back what it moved, so the
copy stays whole and listed, and the failure is said. The Removed toast names
a damaged copy as it is known, never by its folder id. One copy that cannot
be listed no longer hides the others. A Main this Chronos cannot read (newer
or damaged) is refused at once with the reason, and a damaged one offers
Remove local copy. Save version is off on a Gone project, and Send/Delete
there say the project was deleted in the library.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 14:07:35 +01:00
Alby96andClaude Opus 5.5 c5ed31bced Merge branch 'review2-p5a-fix3-desktop' into review2-p5a-int3
Conflict in WorkspaceFallbackTests: keeps desktop's new newer-copy test
and drops ACancelledFirstCopyLeavesNoHalfMedia, which the sync branch
removed along with WorkspaceHost.RemovePartialMediaAsync (the cancelled
first copy's clean-up now runs in the copy job, tested in Data).
ReplayAsync auto-merged with both intents: desktop's working-state
conflicts and silent paths, and sync's skip of no-change versions,
Settles journal flag and PruneReplaced.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 13:33:34 +01:00
Alby96andClaude Opus 5.5 5eeb64b680 fix(workspace): finish or keep every choice, copy and sync a cut or a deleted project leaves
- A take of the library's values cut past its commit point settles its conflict
  (replay journal marks Settles); a later stale choice finds nothing to settle,
  and one cut before it keeps the conflict so the next choice is applied.
- A local version that changes nothing once replayed on the head is not sent
  nor written as a Merge; its file stays in versions/.replaced.
- Save both journals its intent (name, base, time) before the home is asked,
  so a cut after the copy was made reuses that copy on retry.
- A project deleted at the home reads as Gone from pull, push, resolve and
  save both, logged once, without retry loops; versions and working state stay.
- Save both keeps the restore recorded in sync.json.
- The copy job writes a photo's new bytes under a name of its own while the
  editor's media still name the old file, switching at the commit; a cancelled
  first copy removes its own half media under the lease (VM hook removed).
- Status reads the version files once, re-reads the home's frames only when
  its stamp moved, reports damage only when confirmed under the lease, and
  waits once for a busy lease before calling the media outdated.
- versions/.replaced is pruned after a sync that ended well (30 days, newest
  20 kept, never a file a journal names).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 13:06:19 +01:00
Alby96andClaude Opus 5.5 e8ea858021 fix: phase 5a fix round 3, desktop: newer copies, readable discard, working-state conflicts, edits kept aside
Owner review 2, R8. Round 2's checkers left five desktop problems:

- A workspace copy whose project.chronos a newer Chronos wrote (a format
  this one does not know) was listed as damaged and offered for Discard.
  It is now listed as "Newer Chronos" with its own tooltip, named from
  what of its file still reads. It never opens, is never checked out
  over, and Remove local copy refuses it with a sentence that says why.
- Discard of any copy moved only the files Chronos knows. It now moves
  every file and folder of the copy aside (only the media are deleted)
  and removes the folder only when nothing else came into it.
- Discarding a damaged copy asked to type its folder's GUID. It now asks
  for the name the copy is still known by (its file, else the library's
  index; the project's name, else the sequence's title), else for the
  number of its files. The heading never shows the id.
- A conflict at a path where the working state had gone back to the base
  value listed the local version's value. The conflict now lists the
  working state's value in every case. Where the working state already
  holds the library's value there is nothing to ask: that path takes the
  library's value in the replayed versions too, so they agree.
- EditorSession.ReloadAsync, ResolveConflict and TakeOverAsync threw
  NewerSettingsException on every reload when an edit was not stored
  yet and the stored project became a newer Chronos's. The edit is now
  kept in versions/.replaced (outside the chain, never sent), a toast
  says so, the pending save is dropped and the newer settings are shown
  read-only. When the edit cannot be kept aside, the editor stays as it
  is and nothing is dropped.

The SequenceViewModel wiring now has a view-model test: the copy's facts
in Open in workspace, the refused-folder toast and its Choose folder
action, and the picker for a newer copy and a damaged one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 12:55:13 +01:00
Alby96 47c660735f Merge branch 'review2-p5a-fix2-desktop' into review2-p5a-int2
# Conflicts:
#	i18n/en/Editor.resx
#	i18n/en/Tooltips.resx
#	i18n/it/Tooltips.it.resx
#	src/Chronos.Data/Workspaces/WorkspaceSync.cs
#	tests/Chronos.Data.Tests/Workspaces/WorkspaceRecoveryTests.cs
2026-11-03 12:15:27 +01:00
Alby96 775deda0f4 Merge branch 'review2-p5a-fix2-workspace' into review2-p5a-int2
# Conflicts:
#	src/Chronos.Data/Workspaces/WorkspaceSync.cs
2026-11-03 12:12:19 +01:00
Alby96 fd35e83dfc Merge branch 'review2-p5a-fix2-merge' into review2-p5a-int2 2026-11-03 12:10:16 +01:00
Alby96andClaude Opus 5.5 64fc5521c0 fix(workspace): settle conflicts in one answer and give refused folders a way on
Phase 5a fix round 2 of owner review 2 (desktop):

- Take library's no longer commits the working state first, so a take that
  leaves only the library's values sends no empty version; the working state
  it replaces is kept aside in versions/.replaced, outside the chain.
- Conflicts list this side's value as the working state holds it, so one
  answer settles them instead of asking again for the newer value.
- A conflict of format (library saved by a newer Chronos) offers only Save
  both and Later, says why in its tooltip and shows no raw format numbers.
- Conflict lines count the photos a setting differs on ("Excluded frames
  (3)") instead of dropping the duplicates.
- A read-only library is named as such, not as offline; checkouts from it
  stay editable and their versions wait in the workspace.
- A workspace folder refused inside a library offers Choose folder, and
  Settings > Workspace gets Change...: a plan (projects left, projects found)
  is confirmed before the folder changes; nothing is moved.
- Open in workspace shows the copy's size and the drive's free space, and
  warns when the copy would not fit with its 0.5 GB reserve.
- A cancelled first copy removes the half media it wrote.
- A copy whose project.chronos cannot be read is listed as damaged instead of
  hidden, and goes only through Remove local copy > Discard, after a plan.
- Pruning keeps a version whose archive file is damaged (test added).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 11:52:49 +01:00
Alby96andClaude Opus 5.5 e23cba3ee1 fix(workspace): phase 5a fix round 2, workspace sync and copy
A Save both, a recorded conflict and a damaged version file could each leave
a local version out of the chain or a copy half-made at the home. This round
makes every one of these end with nothing lost and nothing half done.

- Save both retry: a journaled copy somebody else sent a version to (or one
  deleted since) is left as it is, and a new copy takes every local version.
  A divergence met at the copy while sending also makes a new copy, once.
- Keep mine, Take server, or a pull that settles a conflict after a Save both
  was cut short first send the rest of the journaled versions to that copy,
  if it is still this workspace's. The journal is cleared at the commit point.
- A conflict of format met past local versions the home already stored
  (their answer lost) now moves the base onto them, like any other conflict.
  The conflict, the base and the chain then name one version. A save-both
  journal follows the base when it moves.
- A conflict recorded before stays while the home holds no version after
  the base. A base that has reached the conflict's head clears it.
- Take server no longer replays or sends the version it saves first when,
  replayed, that version holds only the server's values. It stays in
  versions/.replaced for the undo. The test checks the exact history again.
- Version files after the base that cannot be read, or that do not follow
  from it, are listed (WorkspaceProject.UnreadableVersions). The new state
  WorkspaceState.Damaged shows them. Commit, push, pull and resolve refuse to
  go past them. A damaged file whose version the home holds takes the home's
  copy at the next sync, and the damaged file is kept aside. Remove local
  copy counts these files as unsent.
- PushOutcome.TooLarge raises its own WorkspaceSyncException message. The
  desktop says Errors.Workspace.VersionTooLarge for it and for
  ProjectVersionTooLargeException when a local commit is too large.
- The editor maps LeaseUnavailableException from opening a busy project to
  Errors.Workspace.Busy.
- The copy job no longer deletes, during the pass, a proxy that the editor's
  current media name. RemoveStale removes it after the commit. A resumed run
  does not keep such a file as a frame whose photo changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 11:31:18 +01:00
Alby96andClaude Opus 5.5 a368dc8bf0 fix(projects): phase 5a fix round 2 of the projects engine
The sidecars stay the truth of a sequence's projects in the cases round 1's
checkers found still open, and no version or setting is lost on the way:

- An index-only Main meeting a Main another index made is written back as
  another project, and Main passes to theirs in one transaction through a
  free temporary name, so ux_projects_name and ux_projects_main never fail
  (the SqliteException used to escape ListAsync and leave the index and the
  sidecars disagreeing). A refusal is logged; the next reconcile settles it.
- The reconcile takes Main from the records, in step with the index, when
  another index passed it on: exactly one Main per sequence, names from the
  records where free.
- A project folder with versions and no record, of a project no index row
  names (a creation cut before its record), no longer holds the sequence
  back forever: it is left as it is and indexed once its record arrives.
- A record behind the index (a projects folder put back from an older
  backup) is made whole from the index: its missing versions and the record
  are written again, at every catch-up and before any append, rename or
  delete. Only a record ahead of the index or naming another version is
  refused, with a message that says so.
- An index meeting Main walks the chain down to the version the record names
  as mirrored (a bound, since that record write may lag project.json), so a
  lagging record never makes an External that reverts a newer push. When the
  record names a mirrored ancestor, settings written since merge with the
  unmirrored versions, as for an index that knows its mirror.
- The catch-up merge's External + Merge pair is resumable: an External head
  whose parent is a push no mirror wrote is finished into its Merge version
  next time, by this index or one rebuilt from the sidecars.
- A project deleted at the home has no head there, so a workspace copy of it
  reads Gone, never In sync; Remove local copy without discard says the
  project was deleted in the library.
- DatabaseExceptions are contained per sequence in the archive scan's project
  reconcile and in ProjectService reads.

Tests: SQLite (PostgreSQL-ready) for each scenario, including a cut between
the two catch-up versions, a 40,000-exclusion version through save, push and
rebuild, and the App's Remove local copy of a project deleted at home.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 11:24:15 +01:00
Alby96andClaude Opus 5.5 43b092bd5d fix(workspace): newer-format editor stays usable; media learn the home's photo names
A pull onto a newer Chronos's settings made the editor throw: ProjectHistory.Replace
rebased every undo and redo snapshot through ProjectMerge, which refuses to merge a
newer format when both sides changed, so any non-empty undo stack broke the reload
after a sync that had succeeded. Replace now drops the steps instead when either side
(or a step) is of a newer format: the project is shown read-only and undo never brings
back values from before the newer settings.

The media learnt the home's hashes and conversion aliases only inside a replay, so a
status or Save version before that compared a SHA-named base with photo-named media
and read a false Modified or saved a version that only re-keyed photos. Now:
- ProjectContent.SameChoices also compares the texts as placed on the frames, hashed
  or not (Bound), so status and commit without a home agree with the base;
- a status asked of the home teaches the media its names (written under the lease, or
  when the lease is free), and so does a checkout of a project already here;
- WorkspaceStatus.MediaOutdated reports frames moved at the home, or names the media
  could not learn yet, and the project menu offers Update media for it (tooltip text
  updated in en and it).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 11:19:21 +01:00
Alby96 1a35fcdb27 merge: review2-p5a-fix-desktop into phase 5a fix round 1 integration
# Conflicts:
#	src/Chronos.Data/Workspaces/WorkspaceSync.cs
2026-11-03 10:40:02 +01:00
Alby96andClaude Opus 5.5 8027d84f7e fix(workspace): settle only the conflict shown, keep what a choice replaces, desktop gaps of phase 5a
Review 2, phase 5a, fix round 1 (desktop and the engine side of Resolve and Restore).

- Resolve applies Keep mine / Take the library's only to the conflict the dialog listed:
  when the head or what differs moved since, the new conflict is recorded and asked again;
  Sync re-works a pending conflict instead of re-showing a stale list. Take the library's
  first saves uncommitted changes as a version, and the editor takes it as one undo step
  (toast Undo, Ctrl+Z) that brings back only the settings both changed.
- Restore saves unsaved changes as a version also while a conflict waits; a restore that
  changed nothing, or was undone, no longer marks the next version as a Restore.
- The editor's saves and merges of a workspace project merge positions photo by photo
  (portable form) and ask where both sides changed a setting, never deciding for ours.
- Read-only after a pull is signalled, and no save that can never be stored is left behind.
- The chip is read again after edits; a background conflict waits for the open dialog;
  Send first and Delete show the conflict they met; Discard changes needs the typed name.
- Open project... reaches the library's other projects (Save both's sibling, also from
  its toast); copies whose project or sequence is gone read Not in library and can be
  removed from the picker's Workspace rows; a delete whose local copy stays says so.
- A workspace folder inside a library is refused before anything is written.
- Conflict and Compare lines name heroes, exclusions and keyframes; History shows the PC
  name alone, never the program's prefixes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 10:22:17 +01:00
Alby96andClaude Opus 5.5 833d7cf8e9 fix(workspace): every cut of a sync is recoverable, renders name only versions the home holds
A push now moves the base before its local file reads as sent; a replay
journals itself in sync.json, writes the replayed versions, then the base
(the commit point), and only then sets the old ones aside and adopts the
local commits the home already held; a conflict met past such commits moves
the base onto them first. A save-both journals its copy and the ids it sends
under, so a retry completes the same copy instead of making another. The
next push, pull or resolve finishes or undoes whatever a cut left, so no
version is orphaned and no false conflict appears.

The editor reads the working state and the media index under the project
lease; workspace.json is written whole and moved into place (an empty one is
made again); project files may hold 64 MiB and one that would be larger is
refused before it is written, so large projects check out. The workspace copy
checks the drive's free space before and during the copy, keeps the folder in
its checkpoint and stores a reset when a pass starts again, and runs at High
level in the priority queue. Renders record a version only when the index
holds it with the settings rendered; an unsent version renders as the project.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 10:19:56 +01:00
Alby96 b9d1c396a1 feat(app): Edit opens workspace projects, with versions, sync and the project menu
Owner review 2, phase 5a (R8), desktop package: editing moves out of the library. A sequence of this PC's archive
now opens in Edit as a project of the workspace (%LOCALAPPDATA%\Chronos\workspace, .\data\workspace when portable),
with this PC's archive as its home; the editor writes the workspace's working state, never the library.

- WorkspaceHost composes WorkspaceStore and WorkspaceSync over Settings > Workspace's folder: checkout and the
  WorkspaceCopy job, status, Save version with the sync after it (Sync automatically, on by default), sync (pull,
  then push), conflicts, restore, history, new / rename / delete project, and Remove local copy, which refuses
  while work is unsent unless the user sends it first or discards it, reads back the home's head and base and
  checks their hashes, and keeps discarded work in <workspace>/.trash; versions past Kept versions are pruned only
  once the home returns them with the same content.
- WorkspaceSequenceSource: frames and pixels of the media (proxies), the working state saved atomically under the
  project's lease and merged against the basis, the home's deep report while its frames are the media's, renders
  at the home with the portable settings recording the project and the version.
- Edit: the project opened last for the sequence, else "Open in workspace" (Main made from the sequence's settings,
  another project or a new one; proxies) checks out, copies and opens once the copy is done. The picker lists the
  workspace's projects with their state above the library. The title's project menu: Save version (Ctrl+S, note),
  Sync, History (compare, restore as one undo step), New project, Rename, Delete project, Remove local copy; a
  conflict dialog only on real conflicts (keep mine, take the library's, save both, later); Update media when the
  library's frames moved. .chronos files: format 2 opens its project, format 1 gives its settings to Main.
- Settings > Workspace: folder (shown, Open), Sync automatically, Kept versions. Strings in English and Italian.
- A capture (sample data without an engine) keeps editing the library.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit da47a580ba9db3ce2a1db2f11c30cf7344c8b394)
2026-10-27 22:53:05 +01:00