← Back to Pull requests

Verify local custody of excluded photos #1503

Closed
unknown closed this pull request without merging on Nov 28, 2026 01:14 UTC
View on GitHub
unknown unknown commented on Nov 27, 2026 23:02 UTC
Author

Motivation

Closes #1135. Excluded photos may have their only original locally, but integrityItems() correctly limits the existing scrub to remote backup claims. External loss or corruption therefore went unverified and the Inspector continued to present a healthy local-only choice.

Description

Add a separate provider-independent local-custody pass when ordinary library maintenance opens and every 60 seconds after completion. It visits up to 50 rows with a durable local cursor and a soft 64 MiB full-read budget; one oversized original may finish a pass. Stat/header observations trigger a full chunk-authenticated plaintext SHA-256 check on first observation, file changes, prior failure, or a verification at least 24 hours old when the rolling walk reaches the row. Streams are bounded to observed size, check live eligibility and abort/drain on lock or library switch.

Migration 50 stores device-local missing/corrupt evidence and verification stamps. Detection cannot upload, delete, change coverage/origin/since, or dirty the ledger. Known failed originals also refuse Back up again until a verified repair clears the finding, retaining local rather than borrowing remote custody. Matching-file recovery remains available for missing originals.

Inspector, status glyphs, status bar and storage statistics disclose local-missing/local-corrupt independently of cloud sync. Logical exclusion totals remain intact, while missing asset bytes leave the on-disk figure once per shared original. Verified rechecks clear findings and Unavailable membership. Device-local findings never enter manifests.

Missing keys, protected migration rows and known restored-exclusion placeholders are skipped. Shared variants retain import-owner AAD after root purge. #1127 protected-domain coverage and #1126 provider capability classification are separate decision work; neither blocks this ordinary-photo slice.

Documentation

Updated docs/acceptance/Acceptance-Test-Backup-Coverage.md with strategy/cadence, bounds, offline operation, loss/corruption/recheck, recovery, shared assets and lock/custody boundaries. Accepted ADR-0033 §2/§6 already requires this behavior; no architectural amendment is needed.

Changeset

  • Patch changeset included.
  • Acceptance coverage

  • Coverage map updated with backend/DOM tests, Inspector interaction stories and packaged manual steps.
  • Regression coverage includes healthy/missing/malformed/truncated/authentication/content-hash/AAD damage, file-change and daily rechecks, cursor/byte bounds, streaming growth, key revocation, close/drain, protected visibility, restored placeholders, shared-owner purge, manifest omission, exact-file recovery, and refusal to re-include known failed originals.

    Testing

    Targeted Electron-hosted backend suites passed (59 tests, then a 44-test transition/recovery rerun after the final guard). Six targeted DOM tests passed. The acceptance-map validator passed. Initial lint found the repository file-size ceiling and a test-generator await issue; statistics were extracted into their own reader and the asynchronous revocation test was corrected. Focused lint rerun passed.

    The full cheap gates passed sequentially on Node 24.18.0:

  • npm run lint

  • INTEROP_IMAGE_TRAIL_ROOT=/workspace/image-trail npm test

  • DOCS_GOV_TOOLING_ROOT=/workspace/docs-gov npm run docs:gov
  • The full run passed all unit, DOM and database lanes; docs governance reported zero findings. The final shared-verification cache guard was then covered by a 60-test Electron-hosted backend rerun, test compilation and focused lint, all passing. It prevents reuse across different size/key bindings. Acceptance-map and formatting checks also passed.

    All 15 current-head CI checks passed on signed head 356277ccc97810c390a629e3e7325527831ae19c, including full coverage, build, Storybook interactions, Electron E2E, Windows x64 tests/import, CodeQL, docs governance and workflow policy. Four inapplicable lanes were skipped. Complete CI run. Exact required context/App bindings and effective strict freshness were independently verified before requesting native auto-merge.

    Manual Testing

    Follow the excluded local-custody section in docs/acceptance/Acceptance-Test-Backup-Coverage.md. Exclude an ordinary photo, disconnect its provider, remove/damage a saved encrypted original externally, and wait for the rolling visit. Expect explicit local loss/corruption with unchanged backup policy and provider contents. Restore the verified envelope and recheck; expect the finding to clear without re-inclusion. Repeat across shared variants, missing keys, lock/library switch and known restored placeholders.

    <!-- agent-bot-write: ghw_1346e5764f70a812 session=f601b21bf418 bot=trueline-codex-agent[bot] -->

    Diff: 604 lines (+453 / -151) across 7 files Reviewer: qwts Review duration: 131m
    All Vouch review confidence checks passed
    Residual risk 0.24 = Change Risk (0.55) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.55 · 604 lines diff across 7 files
    0.55
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.383
    Shallow Review Depth shallow_review_depth
    0.289
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #1503"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 55.1% (MEDIUM) · Higher = larger blast radius
    55.1%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 23.8% · Safe to merge
    23.8%