Skip to content

R4: Make read-only backup verification resilient to sync and network races - #7027

Open
antuz123 wants to merge 9 commits into
release/2.6.3from
codex/r3-backup-verification
Open

antuz123 wants to merge 9 commits into
release/2.6.3from
codex/r3-backup-verification

Conversation

@antuz123

@antuz123 antuz123 commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Current delivery scope — R4 / 2.6.4 (8 October owner decision)

All unfinished R3 work is now part of R4. This PR is reused in the complete coordinated 2.6.4 app set, with separately tracked backend/Desktop delivery where applicable. Keep existing source and review evidence; this scope transfer publishes no build or backend. One independent developer approval remains required, feasible agent checks precede submission, and owner phone/Desktop/hardware testing remains retrospective. The original branch and older QA version labels below are provenance, not the next release scope.

Current iPhone and source checkpoint — 8 October 2026

  • A wired physical iPhone's in-app Version History confirmed 2.6.3 (619). Repeated Check Again attempts briefly showed “Checking your backup” (owner estimate: about one second) and returned to “Backup not verified.” The failure stage and backup state remain unknown; no phone data or backup was changed.
  • Current PR head is ac868253f3460dd875035e1a4f73fc99ca658c1b, still based on frozen release/2.6.3 (84476d7b). R4 / 2.6.4 is the target, not a built or delivered version. Keep this base until R4: bring the shipped 2.6.3 baseline into sprint #7031 (fee03fab6) receives current independent approval and merges into sprint; then reconcile the test-file overlap, retarget, and rerun sprint CI.
  • Two focused commits classify malformed snapshot structures as validation failures and bind inspected wallet map keys to decrypted wallet IDs. They preserve the Relay's legacy empty-array recovery path and recovery's ability to salvage aliased map keys. Check Again remains read-only.
  • Disposable A/B evidence: one transient network read error makes frozen 2.6.3 source return unverified; this PR verifies the same nonempty encrypted backup after one read-only retry, with no upload. This confirms a source defect class, not the cause of the affected phone failure.
  • Current-head local validation: 225/225 recovery tests pass; a disposable integration rehearsal with R4: bring the shipped 2.6.3 baseline into sprint #7031 passed 237/237 after retaining six baseline tests in the sole fixture conflict. Production Babel retained the fixed stage/category warning. A native simulator build was unavailable because clean dependencies need more disk space and the existing Pods do not match this head. No signed app build or physical-phone fix validation is claimed. Current-head GitHub test job passed. The release-branch SonarCloud job fails while fetching PR metadata; its scanner did not reach code analysis. Independent developer approval is still required; the Copilot quota response was not a completed source review.

Read-only Assisted Server Backup checks can report Backup not verified while a healthy snapshot is briefly unavailable or an incremental write is queued. This change waits for login wallet sync to finish, retries one transient snapshot failure or queued-write revision change, and preserves privacy-safe failure-stage diagnostics.

  • Both read attempts share the same overall deadline. Retry is limited to network, HTTP 5xx or timeout failures and concurrent queued writes.
  • HTTP 4xx, malformed/decryption-failed snapshots, account switches, and explicit repair/upload are not retried. Check Again performs no backup mutation.
  • Raw errors, request/response bodies, headers and account identifiers are never logged by these diagnostics.

Validation: 212/212 disposable recovery fixtures pass at 8fa6bf744, including iOS/Android RestClient wiring, transient failures, shared deadline, account switches and repair boundaries. Against the previous source, the new fixtures reproduce false unverified results for transient failures. Production Babel transformation retains the stage/category warning. Formatting and diff checks pass; current-head CI is pending.

The affected live iPhone's failure stage and cause remain unknown. Earlier Android emulator failure was explained by the retired development Relay returning 404; production Android behavior has not been established. Human phone validation is after release. These changes correct reproducible shared-client causes but do not claim that the live defect is proven fixed. The public Relay contributor snapshot-API gap is being handled separately; this PR deploys no backend changes.

Keep this change focused on the existing release baseline until the approved baseline backmerge is in sprint, then retarget to sprint and run its required CI. Ben, Utkarsh or Parsh can provide the one required developer approval; product signoff is separate.

Earlier engineering/review checkpoint at 8fa6bf7 (historical)

Ready for developer review at 8fa6bf7446bd828b8c446503312eec0566d8b400: 212 focused recovery tests and current-head GitHub CI's 306 tests/24 suites pass. The older release branch's SonarCloud check failed while querying PR metadata with a service error; sprint has replaced that integration with CodeQL/Lint. No check or approval gate was bypassed.

An actual Copilot review was requested (event32695145509), but response5443291469 reports the requester's quota limit. Copilot source review did not complete. This PR is ready for the already required human developer review; no merge is authorized here. Ben, Utkarsh and Parsh remain requested.

The base stays release/2.6.3 until baseline PR #7031 is actually approved and merged into sprint. Then retarget/update to sprint with feature-only diffs and run current sprint checks before any delivery merge. Affected-phone acceptance remains retrospective after release, as the owner requested. No production backend deployment is included.

@antuz123 antuz123 changed the title R3: Diagnose backup verification and retry concurrent snapshot reads R3: Make read-only backup verification resilient to sync and network races Oct 7, 2026
@antuz123
antuz123 requested a balanced review from Copilot October 7, 2026 13:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@antuz123
antuz123 marked this pull request as ready for review October 7, 2026 13:52
@antuz123 antuz123 changed the title R3: Make read-only backup verification resilient to sync and network races R4: Make read-only backup verification resilient to sync and network races Oct 8, 2026

antuz123 commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator Author

Codex Cloud continuation handoff

State: NEEDS_CLOUD (source is on GitHub; review and final integration remain open). Baseline checked: 12 October 2026.

Workstream and exact source

  • Objective: Diagnose the affected physical iPhone's Assisted Server Backup Check Again failure and carry the smallest confirmed, read-only mobile correction through R4 / 2.6.4. The observed phone failure stage is still unknown; do not infer missing backup or data loss from the UI.
  • Repository: KeeperCommunity/bitcoin-keeper.
  • Primary PR / branch / remote head: #7027, codex/r3-backup-verification, ac868253f3460dd875035e1a4f73fc99ca658c1b. It is open and targets frozen release/2.6.3 at 84476d7b17cbd34b0859023052b0d49407e05984. This historical base is intentional until the baseline reaches sprint.
  • Latest sprint checked: 53f0ddd01e594c63e3c8d38824a6c2fc2e05c101. Since the R4 candidate's recorded sprint base, Define ChatGPT → Codex Cloud → Mac validation handoff #7047 added AGENTS.md and Add native Mac validation status gate for Keeper PRs #7048 added the keeper/local-validation workflow/status gate; neither changed backup app source. Read the newest sprint/AGENTS.md before further Cloud work.
  • Local preservation: the dedicated backup checkout was clean and matched R4: Make read-only backup verification resilient to sync and network races #7027's remote head exactly. Its local alias branch codex/r4-backup-diagnostic-stage-fix adds no distinct commit. No staged, unstaged, untracked, or unpushed implementation change from this backup stream remains. A disposable one-off A/B script outside Git is preserved verbatim below; generated Pods/Xcode logs and derived build output were excluded from GitHub.

Completed and observed

Partial work, dependencies, and blockers

Exact next Cloud tasks, in priority order

  1. Fetch the latest sprint, R4: Make read-only backup verification resilient to sync and network races #7027, R4: bring the shipped 2.6.3 baseline into sprint #7031, Repair Assisted Server Backup vault registration metadata #7038, [R4] Bind Assisted Server Backup to account consent and origin #7040, R4: 2.6.4 mobile integration and release-readiness candidate #7045 and relevant review comments. Reconfirm heads before editing. Keep this workstream separate from the other R4 and Assisted Multisig branches.
  2. Review R4: Make read-only backup verification resilient to sync and network races #7027's existing recovery/transport/diagnostic changes and the disposable fixture evidence. Address concrete reviewer findings or reproduced defects only; add focused regressions for any correction. Preserve read-only Check Again, the shared retry deadline, account-switch cancellation, and sanitized diagnostics. Do not make a speculative fix for the owner's one-second UI result.
  3. Prepare an isolated R4: bring the shipped 2.6.3 baseline into sprint #7031→R4: Make read-only backup verification resilient to sync and network races #7027 integration rehearsal without touching shared dirty worktrees. After an owner-authorized maintainer merge of R4: bring the shipped 2.6.3 baseline into sprint #7031 to sprint, retarget/update R4: Make read-only backup verification resilient to sync and network races #7027 to sprint, resolve the known recovery-fixture overlap, and rerun recovery, release, full applicable CI/CodeQL on the final head. Re-request human review if the head changes.
  4. Reconcile R4: Make read-only backup verification resilient to sync and network races #7027 with the separate Repair Assisted Server Backup vault registration metadata #7038/[R4] Bind Assisted Server Backup to account consent and origin #7040 stack and the complete R4: 2.6.4 mobile integration and release-readiness candidate #7045 source manifest; check Add isolated Assisted Multisig preview and verification foundations #7041's bhr.ts overlap. Do not merge streams together merely to make this PR pass. Record the exact resulting source SHA and any remaining conflict.
  5. When the PR is stable, add the Codex local handoff specified by current sprint/AGENTS.md with Required local checks: IOS, ANDROID because R4: Make read-only backup verification resilient to sync and network races #7027 changes shared client behavior. Request a signed/entitled disposable iOS simulator backup flow and an applicable Android native/emulator flow; report fixture, compile, installed-app, and physical-phone evidence separately. Add native Mac validation status gate for Keeper PRs #7048's keeper/local-validation status requires a repository collaborator's LOCAL_PASSED comment for the exact final SHA and both named platforms; administrators still need to require that status in branch protection for enforcement. The owner plans affected-phone acceptance after the live release; no 2.6.4 phone result exists today.

Restrictions

  • No uninstall/replacement of Keeper on the owner's phone, restore/reset, account/key change, consent change, replacement backup upload, or transaction. Never request or record passcodes, Recovery Key words, private keys, credentials, raw request bodies, or unsanitized logs. Use disposable/testnet fixtures for state-changing recovery, switching, and repair tests.
  • No merge into sprint, backend deployment, secret rotation, signing, store upload/submission, direct APK publication, or release without the owner's explicit approval. Reviewer approval alone is not release authorization. Backend parity, Desktop, Android reproducibility, and other R4 delivery retain their separate owners and gates.

Preserved one-off A/B fixture source

Run as node backup-read-ab.cjs <source-checkout> against disposable source/fixtures. It is evidence for a transient read only and is not production code.

const assert = require('node:assert/strict');
const path = require('node:path');

const root = process.argv[2];
if (!root) throw Error('Pass source checkout');
const { harness, wallet } = require(path.join(root, 'tests/recovery/helpers.cjs'));

(async () => {
  let reads = 0;
  let failFirstRead = false;
  const fixture = harness({
    post: async ({ path: requestPath }) => {
      if (failFirstRead && requestPath.endsWith('getBackupSnapshot') && ++reads === 1)
        throw { code: 'ERR_NETWORK' };
    },
  });
  fixture.local.Wallet.push(wallet('existing-disposable-wallet'));
  assert.equal(await fixture.run(true), 'verified');
  const backupBeforeCheck = JSON.stringify(fixture.remote);
  fixture.calls.length = 0;
  fixture.phases.length = 0;
  failFirstRead = true;
  const phase = await fixture.run();
  assert.deepEqual(fixture.calls, Array(reads).fill('getBackupSnapshot'));
  assert.equal(fixture.calls.some((call) => call !== 'getBackupSnapshot'), false);
  assert.equal(JSON.stringify(fixture.remote), backupBeforeCheck);
  console.log(JSON.stringify({
    source: root,
    phase,
    reads,
    calls: fixture.calls,
    phases: fixture.phases,
  }));
})().catch((error) => { console.error(error); process.exitCode = 1; });

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.

2 participants