Skip to content

Preserve changed cache rows during failed-decryption cleanup - #70

Merged
Jason-Doyle merged 6 commits into
mainfrom
experiment/conditional-corrupt-cache-cleanup
Dec 3, 2026
Merged

Jason-Doyle merged 6 commits into
mainfrom
experiment/conditional-corrupt-cache-cleanup

Conversation

@Jason-Doyle

@Jason-Doyle Jason-Doyle commented Dec 3, 2026 •

Copy link
Copy Markdown
Owner

Summary

Guard failed-decryption cleanup against removing a changed committed encrypted
cache row. For eligible concrete built-in snapshots, compare known metadata
and IV/ciphertext bytes in the same readwrite transaction as any delete.
Unchanged corrupt rows are still removed.

Production scope is one file: 57 insertions and one deletion in
src/browser/cache.ts. Public options, formats, budgets, device-key lifecycle,
tiered invalidation and mutation ordering are unchanged. Subclasses, delete
overrides and non-binary original snapshots retain delegated unconditional
cleanup and its replacement races.

Evidence

Protocol, report, exact tables, graph and raw captures.

Corrected controlled comparison Baseline Candidate
Qualified outcomes 192/384 384/384
Correct declared cold results 264/384 384/384
Work-phase readonly/readwrite transactions 456 / 648 456 / 648
Work-phase object lookups 408 720
Work-phase object deletes 528 240
Work-phase successful memory-tier clones 336 336

All 192 protected retention failures reproduce in the historical module.
The candidate recovers 120 usable cold outcomes; 72 additional retained rows
remain corrupt and correctly miss on their own later read. Passing legacy
controls does not mean their replacement races are fixed.

All three comparative captures remain published. Independent replay rejected the
first capture's omitted initial-miss work despite its collector completion
flag. An explicit regression check reproduced both budget modes; the corrected
harness and strengthened existing work gate were pushed before a new detached
capture. Runtime code did not change for that ledger correction.

Further compatibility qualification found reuse of the original connection
could disable persistence after close/reopen during decryption. Cleanup now
resolves the adapter's current connection before its transaction. The new
focused regression and all 12 policy/budget/browser close-reopen controls pass.
The second capture remains retained as superseded source; the third detached
capture qualifies the final production revision. Protocol and matrix dimensions
remain unchanged.

Qualification

The final candidate passes 42 focused cases and all 312 existing controls.
The exact historical module has 23 expected focused failures. Final native
qualification passes 66 cases: 22 each in Chromium, Firefox and WebKit,
including six queued-writer atomicity cases and 12 close/reopen controls
overall. Earlier attempts, including an intermediate declaration error,
remain recorded in the report. Root/collector/native types,
package isolation/exports, canonical documentation and website links pass.
Raw rows, transaction plans, binary identities, memory/copy work, all pair
gates, CSV rows, graph bars and report tables were independently reconciled.
Normal exact-head CI remains required before merge.

Costs and decision

Eligible failures add one stored-row lookup and result copy inside the
existing cleanup transaction, plus comparisons and potential additional
object-store lock occupancy. Ordinary successful reads and misses retain
their exact request/copy work. No latency, heap or corruption-frequency
benefit is established.

This is one-row stale-cleanup protection, not arbitrary-record repair,
read linearizability, cross-instance mutation ordering or durable logout.
No provider campaign, infrastructure change, runtime upgrade or release ran.

Assessment: 92/100 against the prospective 85/100 threshold
(38/40 correctness, 24/25 compatibility, 18/20 reproduction, 12/15 simplicity).
Recommend merge after all required checks and human review.

Compare known metadata and encrypted bytes before removing a failed-read snapshot, using one readwrite transaction for lookup and deletion. Retain delegated cleanup for overridden delete methods and non-binary snapshots. Add focused and native-browser qualification plus the paired comparison collector.
Keep the initial missing read in the measured phase. Enforce the existing absolute ordinary-read transaction and request gate, and label unreadable-retention expectations explicitly. Runtime implementation, prospective rules and matrix dimensions are unchanged.
Record corrected paired encrypted-state evidence, native transaction atomicity and ordinary-read work. Retain the rejected initial ledger capture, exact report digests and the prospective92/100 assessment with explicit compatibility and failure-path cost limits. Keep canonical cache documentation consistent.
Resolve the current database connection before the conditional cleanup transaction. Cover close/reopen during decryption in focused tests and both policy/budget combinations across browser engines.
Retain the superseded matrix and add a detached capture of the current-connection source. Record 354 focused/control passes, 66 native passes and the negative close/reopen and declaration attempts.
@Jason-Doyle
Jason-Doyle merged commit e615fda into main Dec 3, 2026
4 checks passed
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