Commit Graph
2 Commits
Author SHA1 Message Date
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 d940fc7c61 fix(projects): sidecars stay the truth when they cannot be read, are missing or newer
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>
2026-11-03 10:13:40 +01:00