Skip to content

Recover local database access and retain incomplete file reflection - #1364

Draft
vrtmrz wants to merge 3 commits into
mainfrom
case/issue-1360
Draft

vrtmrz wants to merge 3 commits into
mainfrom
case/issue-1360

Conversation

@vrtmrz

@vrtmrz vrtmrz commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

This fix restores unavailable local database access before synchronisation resumes and retains incomplete ordinary-file reflection for a bounded retry after its required resources recover.

Related to #1360 and #1224.

Dependency and draft status

Depends on Commonlib #225, revision 696e31bac449e5531242855bffa45080090df16e. This PR remains draft until a published package containing that change is pinned exactly in the dependency manifest and lockfile and consumer validation passes with that package.

The manifest and lockfile still select registry Commonlib 0.5.0, which lacks the required APIs. Local validation used a combined unpublished package with tarball SHA-256 4b2e0122514c925ba54bf2a85c3277e31b4d74fc30cc5f58029c3de31879e542. Its package contents were checked byte-for-byte in the locked dependency tree, preserving transitive versions. A plain npm ci does not reproduce this candidate. Existing PR test workflows skip drafts.

Behaviour

  • On foreground return or a managed local-operation failure, probe the current initialised Pouch. A failed probe holds file dispatch, drains started work, retires replication, and requests one same-database reopen. Preserve user/settings suspension; failed recovery or local completion requests an Obsidian restart.
  • Carry target identity and execution policy in an operation context. Propagate terminal read/reflection exceptions to the receiver owner, which awaits pending-target retention and snapshot persistence. Keep resource cleanup separate so its failure cannot retry an already-completed reflection; shutdown waits for started work and cleanup. Use the shared reflection result contract at the receiver and CLI boundaries.
  • Retain ordinary-file failures from start-up scanning and received Metadata in the existing snapshot. Explicitly known local-database and remote dependencies must all recover before consuming and saving one automatic allowance per revision. Unknown failures and unsuccessful retries remain available for review. Same-database reopening preserves pending records and consumed allowances.
  • Recheck current Metadata, conflicts, local content, and provenance through existing protection paths. Target scopes reject obsolete work; scanner retries retain scanner policy. Expose remaining targets through 'Review files which could not be reflected' and the Hatch action.
  • Wrap native request failures at the request boundary, preserving the original cause and explicit cancellation signal. Recovery does not depend on error-name, message, or nested-cause matching, and does not replace public Pouch methods.
  • Keep Review Harness fixture outcomes separate from active-database samples, with timestamps, stages, event registrations, zero counts, and received events. A pre-existing active-database failure cannot pass the controlled fixture test. Explicit fixture reopen remains a manual diagnostic action.

Validation

  • npm run check passed: main/application types, lint, Svelte, production build, and iOS 15 syntax compatibility. The full unit suite passed with 220 files / 2,383 tests passed and 2 skipped. Existing warnings remain.
  • With the final packed dependency, real Linux Obsidian passed injected native close during received Metadata access: retention before reopening, same-database recovery, exact content/revision/provenance, settled pending work, and subsequent local writes.
  • The database-recovery fixture now registers its safety-scan observer before releasing plug-in start-up, avoiding a late-subscription race. Readiness, scan completion, and all recovery assertions remain required; the revised script passed twice consecutively. Final host type checks passed.
  • The same final build passed offline start-up and an online transport interruption. Both automatically reflected the exact content before a manual scan after finite replication succeeded, without changing the Metadata revision. The delayed-Chunk control also passed.
  • CLI local-database E2E (11 tests) and WebApp/WebPeer builds passed with the final packed dependency. Chromium diagnostics and real Obsidian diagnostic UI/mobile-width/copied-report checks passed before this structural cleanup; their diagnostic implementation is unchanged.

Tested plug-in bundle SHA-256: 0b5d08b170e54047c762a7d6142405bd771bbcb970c7cb3b380e1d392518ff7c.

For controlled receiver verification with the matching package installed, run npm run test:e2e:obsidian:focused -- database-recovery with a discoverable Obsidian executable. Build the Commonlib package with npm run build:package and pack the generated .package directory, rather than the repository root.

Remaining verification

Earlier iPhone diagnostics reproduced repeated fixture InvalidStateError after explicit native closure. A same-name Pouch reused the stale connection; explicit close/reopen preserved the fixture content and revision. Natural iOS/WebKit connection termination was not reproduced in the successful baseline runs, and this integrated recovery candidate still needs physical iPhone verification. Linux WebKit diagnostics could not start because shared libraries were missing.

The implemented contracts and verification boundaries are recorded in local database recovery, file reflection recovery, and Review Harness diagnostics.

@vrtmrz vrtmrz changed the title Recover local database access and retry interrupted file reflection Recover local database access and retain incomplete file reflection Nov 16, 2026
Use the shared Commonlib reflection result contract at the receiver and CLI boundaries.

Register the recovery probe observer before releasing layout-ready callbacks so late subscription cannot leave the test waiting for a completed safety scan.

This branch has not been deployed

No deployments
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