- Baseline HEAD: 146842e4e32f5a8cbe211fe02375374beece769b
- Final HEAD: 146842e4e32f5a8cbe211fe02375374beece769b (unchanged)
- Parent: 07613f34c9999a5a5ccf5074720b731716e7929a
M app/src/main/java/com/projectnuke/keplernightlab/MediaStoreExportRecovery.kt
No other production changes. Instrumentation added for measurement was removed before finalization.
| Run | Total Recovery (ms) | Atomic Write Delta | inspectMs Median | exportRecoveryMs Median | metaReconcileMs Median | initialJobReadMs Median |
|---|---|---|---|---|---|---|
| 1 | 16,786 | 84 | 330 | 333 | 1 | 3 |
| 2 | 16,426 | 92 | 324 | 330.5 | 1 | 2 |
| 3 | 16,193 | 92 | 322 | 329 | 1 | 2 |
16,426 ms (median of 16,786 / 16,426 / 16,193)
330 ms (median of 333 / 330.5 / 329)
330 ms (inspection dominates exportRecovery; 46 individual inspectMs values per run)
- Run 1: 84
- Run 2: 92
- Run 3: 92
0 — Same-state idempotency is working. No journal was rewritten when already in VERIFIED state.
0 — Not applicable for YUV_NIGHT_FUSION cohort. RAW-sidecar structural gate correctly skips YUV jobs.
0 — Fast-path skip is working. Jobs already in STABLE state with no recoveryMessage are not rewritten.
- 46 job.json writes:
PUBLIC_EXPORT_COMMITTED_PENDING_VERIFICATIONpath inrecoverOne(line 332). These are semantically required: the seed cohort was created withrecoveryState=STABLEbut the recovery code re-classifies them based on current MediaStore inspection results (exists=true, verified=false, pending=false → PUBLIC_COMMITTED_UNVERIFIED → PUBLIC_EXPORT_COMMITTED_PENDING_VERIFICATION). - 46 export journal writes:
markTerminalPersistedduring terminal settlement. Even though journals were seeded withterminalMetadataPersisted=true, the recovery path processes them through the normal terminal settlement flow.
Total: 92 atomic writes (46 job.json + 46 export journal files)
No baseline timing data exists from before U2.2. The timing instrumentation was added during this measurement phase. Comparison is not available.
N/A — No pre-U2.2 baseline measurement exists.
N/A — No pre-U2.2 baseline measurement exists.
YES — All 46 MAIN_IMAGE journals triggered ContextMediaStoreExportRecoveryAccess.inspect() with the same production verification path:
- Exact URI query
- Row existence check
- IS_PENDING read
verifyGalleryExportResult(stream/signature integrity probe, bounds decode, sampled decode)- Result: all 46 returned
exists=true, verified=false, pending=false
PASS — ExternalPublicRemovalRecoveryTest (9 tests) all passed:
verifiedTerminalRowMissing_classifiesRemoved_settlesStable_truthfulMetadataexternalRemoval_recoveryIsIdempotent_staysStableverifiedWithoutTerminalAck_rowMissing_keepsPublicCommitMissingBlockedcommittedUnverifiedRowMissing_keepsExistingDebtPolicyoldVerifiedExportRemoved_newReprocessExportVerified_oldMissingDoesNotOverrideNewtwoHistoricalMissingExports_currentVerifiedExportRemainsStableexternalDeletion_doesNotBlockDeleteCleanupOrReprocessdestructiveLocalIntents_stillBlockedByLiveOwnershipsidecarHistoricalMissing_doesNotEraseCurrentMainAuthority
No fallback to PUBLIC_COMMIT_MISSING for terminal-acknowledged evidence. Journal evidence is preserved (not deleted).
PASS — GalleryExportIdempotencyTest.multipleVerifiedMainJournals_omitSameStateRewrite_doesNotReorderEvidence passed. updatedAt values are byte/value unchanged after recovery. Selected current authority remains the same.
| Check | Result |
|---|---|
git diff --check |
PASS |
:app:compileDebugKotlin |
PASS |
:app:compileDebugUnitTestKotlin |
PASS |
| Focused unit tests (GalleryExportIdempotencyTest, MediaStoreExportRecoveryTest, KeplerStableFastPathTest, ExternalPublicRemovalRecoveryTest, RawSidecarJournalRecoveryTest) | PASS |
:app:testDebugUnitTest |
1,618 tests completed, 1 pre-existing failure (KeplerRecoveryCoordinatorTest.ordinaryTerminalFinalizationFailureRemainsRecoveryFailedAndPreservesOwner — exists on baseline HEAD) |
:app:lintDebug |
PASS |
:app:assembleDebug |
PASS |
MediaStore export inspection (exportRecovery / inspectMs) dominates at ~330 ms per job × 46 jobs = ~15.2 s (92% of total recovery time). All other stages are negligible (metadata temp reconcile ~1 ms, initial job read ~2 ms).
U2.3 MediaStore Terminal-Verified Reverification DESIGN REVIEW
MediaStore full verification (URI query, row existence, IS_PENDING, verifyGalleryExportResult with stream/signature integrity probe, bounds decode, sampled decode) is the dominant ~15 s class cost for the 46-job cohort. The same-state idempotency and fast-path optimizations have eliminated redundant writes, but the per-job MediaStore verification latency remains the bottleneck. A design review should explore whether terminal-verified MAIN_IMAGE rows can skip re-verification or use a cheaper existence-only check when durable journal evidence already proves terminal-stable verification — without weakening the verification contract for non-terminal or ambiguous jobs.