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>
Phase 5a fix round 4, projects engine.
- The reconcile reads the projects' trash before the live folders, so a
deletion wins over what a sync tool has left of the live folder. A lost
record is never written again while the trash holds a folder of that
project; a trashed record that cannot be read holds the project back.
- A lost record is written again from the index only once the folder has
looked the same, file by file, on two reconciles two minutes apart, so a
record a sync tool is still bringing (a rename, a newer head) wins.
- IndexAsync's "behind" is the rule the heal uses: the record's head must
be a version the index holds below its head. A record on another chain
keeps its name.
- A record written before what the index knows (its Updated time is
older, e.g. a backup made before a rename) never gives its name, and the
heal writes the index's name back. A record's Updated time never goes
back, so a newer rename from a PC whose clock is behind is still taken.
- A mirror never writes project.json over settings written there since
this index last knew what it held (another PC, an older client): they
are merged first (theirs win where both changed) or kept as an external
version, then the result is mirrored.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The catch-up merge of a push whose mirror a crash cut short with settings
written meanwhile was two appends (External, then Merge), resumed by a purely
structural test that also fired on ordinary histories (two outside edits in
a row, a second index with an older mirror) and reverted the latest edit.
It is now one Merge version on the head in which the settings written
meanwhile (the settings in force, which older clients wrote) win where both
changed; the head's values stay in its version. A merge that adds nothing to
the head makes no version, so a cut before its mirror is finished next time
by the same index or a rebuilt one without any marker. The structural resume
is gone. An index meeting Main with a lagging record merges project.json the
same way, so a newer outside edit is no longer reverted by an older push.
Versions the catch-up records as mirrored are named in Main's record too
when project.json holds them, so records no longer lag behind externals.
Duplicate Main claimants (an index that met the sequence before Main's
record arrived) are settled from the records: the oldest claimant with a
version is Main in every index, the others are ordinary projects, and their
records say so when the archive takes writes.
A live project folder whose record is missing while the index holds the
project gets its record (and missing version files) written again from the
index instead of being held back forever. A record behind the index no
longer gives the index its old name. MirrorAsync reads the version leniently
and skips a newer one, as the other branches do.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
A project record that could not be read once, or a missing .chronos/projects, marked
projects deleted for good and made a second Main; an index meeting Main with no mirror
state took its own stale settings column as an outside change and reverted the pushed
head; a newer-format or unreadable head made every project call fail or rewrote the
record's head over the real history. Now:
- Deletion is never inferred from absence or a read failure: an unreadable record holds
its project back (listed as indexed, nothing written for it, no second Main), a row
marked deleted is revived when its live record says so, and projects the archive has
no folder for are written back from the index.
- Appends re-read the record under the lease and refuse when its head is not the
index's; Main is only made when the sequence has none anywhere.
- An index with no mirror state decides from project.json and the record's new
mirrored member (older records: the head's ancestry), never from its own column.
- A newer-format Main head is listed and pulled but never mirrored, merged or built on;
pushes must parse strictly and fit the one 64 MB version limit (TooLarge otherwise).
- Duplicate version numbers and name/Main clashes are contained per project, so a scan
or rebuild never stops.
- Delete moves the folder first, then writes the deleted record in the trash.
- The home's read-back for workspace pruning and Remove local copy reads the version
files (IProjectHome.HoldsAsync), not the index.
- A read-only archive is read without writing: its projects open from the sidecars and
a sequence with no Main gets one in the index only, written back once writable.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>