Make Photos PhotoKit-first - #107
Conversation
Hermes-omt
left a comment
There was a problem hiding this comment.
The exact head passes swift test (117 tests), but this PR must be rebased onto current main before approval. Live main is d7f88dc01bd283b53c55fa59ed63f43f212a50a5; GitHub reports this PR unmergeable/dirty, and a local merge-tree reproduces conflicts in CommandLine.swift, CommandRunner.swift, ProviderManifest.swift, and provider-manifest tests. Resolve the rebase while preserving main's providers external-manifest support and combining this PR's PhotoKit/provider capability changes, then rerun CI on the rebased head.
48beb71 to
21274dd
Compare
Hermes-omt
left a comment
There was a problem hiding this comment.
Request changes: photos list --photos-library PATH parses and retains PATH, but CommandRunner only uses it inside if options.degradedFilesystem; without that flag it calls PhotoKit against the system library. This silently reads a different library than the caller explicitly selected. Reject --photos-library unless --degraded-filesystem is present (or make the option select the intended source), and add a CommandRunner-level regression test.
|
Implemented the outstanding review repair in
Verified locally:
Please re-review when convenient. |
Hermes-omt
left a comment
There was a problem hiding this comment.
Reviewed exact head 70f13f6. The prior Photo Library override repair is present, main is current and mergeable, and CI is green. Hermes validation passed: swift test, scripts/ci/run-fast-checks.sh, and git diff --check. Approve.
athena-omt
left a comment
There was a problem hiding this comment.
$P1: The new withSnapshot routine does not create a coherent SQLite snapshot of a live WAL-mode database. It copies the main database at lines 108-110 and then separately tests/copies -wal and -shm at 111-115, with no read transaction, SQLite backup API, or lock held on the source. A writer may checkpoint/truncate or append between those operations, so the copied main/WAL pair can represent different database states; SQLite can then return stale/inconsistent results or fail to open the purported snapshot. This affects the newly migrated Messages and Safari history reads. Please create the copy through SQLite while holding a read snapshot (for example using the backup API / VACUUM INTO in a read transaction), rather than copying live files independently, and add a race/regression test covering checkpoint or WAL mutation during snapshot creation.
|
Addressed the current-head review request. The snapshot engine now uses SQLite Local verification:
|
8d58485 to
b4c2dd4
Compare
Hermes-omt
left a comment
There was a problem hiding this comment.
Reviewed exact head b4c2dd4 on Hermes. The live-WAL coherence repair now uses SQLite VACUUM INTO, with a single-file live-WAL regression test. Branch is current, clean, and mergeable against main; no inline review threads are present. Local swift test and git diff --check passed; CI Gate and PR Checks succeeded. Approve.
b4c2dd4 to
d199b09
Compare
Hermes-omt
left a comment
There was a problem hiding this comment.
Reviewed exact head d199b09 on Hermes. The prior PhotoKit option and SQLite live-WAL concerns are repaired: caller-selected Photos libraries require the explicit degraded path, and snapshots use SQLite VACUUM INTO with live-WAL coverage. Local swift test and git diff --check passed. CI Gate and PR Checks are successful; the PR is clean and auto-merge is enabled. Approve.
d199b09 to
3a4bb22
Compare
Hermes-omt
left a comment
There was a problem hiding this comment.
Reviewed exact head 3a4bb221b72b22ef2e4a997e70009716e6673f59 on Hermes. The PhotoKit-first path, explicit filesystem fallback, and coherent SQLite VACUUM INTO snapshot path are correctly wired and covered by adjacent tests. swift test and git diff --check pass; live CI Gate and PR Checks are green. No actionable issues found.
3a4bb22 to
1f6e93c
Compare
Hermes-omt
left a comment
There was a problem hiding this comment.
Reviewed exact head 1f6e93c on Hermes. PhotoKit-first reads, explicit filesystem fallback, and coherent SQLite VACUUM INTO snapshots are correctly wired and covered. swift test and git diff --check passed; CI Gate and PR Checks are successful. No actionable issues found.
athena-omt
left a comment
There was a problem hiding this comment.
Exact-head re-review at 1f6e93cb9e2e4b15e6146550615c8bcf618665c6 — APPROVE.
photos list is now PhotoKit-first and fail-closed. Verified on exact head:
PhotoKitProvidernever requests authorization or media:authorization()reportsrequestsAccess=false;assets()throws unless state is.authorized/.limited— there is no silent filesystem fallback.- Metadata-only:
fetchAssetsreadsPHAssetfacts (id, filename, media type, dates, pixel dimensions, favorite/hidden, album names); availability is honestly reported as.unknown; no pixels/thumbnails are requested. - Filesystem path is opt-in via
--degraded-filesystem, and--photos-libraryrequires it (parser-enforced and error-tested). - Provenance: degraded rows tagged
photos-library-filesystem/degraded=true; PhotoKit rows taggedphotokit/degraded=false. PermissionsDoctornow probes PhotoKit authorization (photokit-<state>) instead of a filesystem path probe.- The SQLite snapshot engine on this head also uses SQLite-coordinated
VACUUM INTO(no independent file copy). - Regression tests cover: never-prompt, no-media, evidence/provenance, explicit-flag requirement,
--photos-libraryrejection without the flag, and the doctor probe. - Required checks green on exact head (
CI Gate,PR Checks).git diff --checkclean.
The earlier CHANGES_REQUESTED review was against stale head 70f13f6a; superseded by this approval.
Return evidence-backed logical asset facts through bounded PhotoKit reads without media requests or downloads. Keep the filesystem walk as an explicit degraded fallback and expose non-prompting authorization diagnostics.
Require explicit degraded filesystem mode when callers supply a Photo Library path, with CommandRunner coverage for the invalid combination. Signed-off-by: John McChesney TenEyck Jr <59268465+jmcte@users.noreply.github.com>
1f6e93c to
990bbb1
Compare
Merge origin/main (post-#110/#107) into the SQLite-snapshot branch. Conflicts in the snapshot surface resolved in favor of the PR's repairs: - SQLiteSnapshotQuery.swift: keep resolvedSource (symlink resolution) feeding VACUUM INTO so live/symlinked WAL stores snapshot coherently. - SQLiteSnapshotQueryTests.swift: keep both the PR symlink-coherent-WAL test and main's single-file-WAL test, plus the production timeout-floor test. - docs/sqlite-snapshots.md: keep production timeout minimums (500ms busy / 5s process). swift build clean; swift test --filter SQLiteSnapshot 10/10 passed on macOS (Hermes).
Summary
--degraded-filesystemGoverning Issue
Closes #94
Validation
Relevant local checks passed
Required PR checks are expected to satisfy
CI GateSkipped checks are explained below
swift test --disable-sandbox(117 tests passed)bash scripts/ci/run-fast-checks.sh(passed)./.build/debug/icloud-cli photos authorization --format json(exit 0, denied state, no access request)No checks skipped.
Bootstrap Governance
CONTRIBUTING.md,.github/PULL_REQUEST_TEMPLATE.md, anddocs/bootstrap/onboarding.mdwhen applicableNo contributor guidance changed. Auto-merge will be enabled after stacked dependencies merge.
Flow Contract
Flow Merge Readiness
Next actor: independent reviewer after #101 and #102 merge.
Merge Automation
gh pr merge --auto --squash, or the reason it is unavailable/unsafe is noted belowThis draft is stacked on the #89 provider manifest and #90 SQLite snapshot foundation. It can be rebased and enabled for auto-merge after those land.
Notes
unknown.