[PR #2762] [MERGED] fix(browser): treat an unusable cache list as incomplete storage coverage #5372

Closed
opened 2026-10-31 01:06:08 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/2762
Author: @kaoru0822-kitauji
Created: 10/13/2026
Status: ✅ Merged
Merged: 10/13/2026
Merged by: @morluto

Base: main ← Head: fix/issue-2660


📝 Commits (3)

  • 399ca21 fix(browser): treat an unusable cache list as incomplete storage coverage
  • 042f92b Merge remote-tracking branch 'origin/main' into fix/issue-2660
  • 0aed89c test(browser): retain valid cache names beside unusable entries

📊 Changes

2 files changed (+90 additions, -4 deletions)

View changed files

➕ src/browser/CdpCaptureStorage.test.ts (+84 -0)
📝 src/browser/CdpCaptureStorage.ts (+6 -4)

📄 Description

Fixes #2660.

Problem

captureStorage (src/browser/CdpCaptureStorage.ts) derives fingerprints_complete partly from structuredStorageComplete. For CacheStorage, that check was:

cacheRaw !== undefined && caches.length === cacheValues.length

cacheValues is recordsValue(raw.caches). That returns [] for a missing or non-array field and drops entries that aren't records. Any admitted CacheStorage.requestCacheNames response therefore counted as complete:

response cache_names fingerprints_complete (before)
{ caches: [] } [] true ✅
{} [] true
{ caches: "nope" } [] true
{ caches: [5] } [] true
method unsupported [] false ✅

An enumeration that never produced an inventory was reported as an observed empty inventory with complete fingerprints. The IndexedDB check right next to it already requires Array.isArray(indexedValues) and compares against the raw length.

Fix

Check the raw caches field the same way: it must be an array, and every entry must yield a cache name and ID (caches.length === cacheField.length). An observed empty array is still complete, and an unsupported command is still incomplete. Missing, non-array or partly unusable lists now report fingerprints_complete: false.

Validation

  • New src/browser/CdpCaptureStorage.test.ts drives captureStorage with a scripted CDP connection, using the issue's harness and no browser, for the five responses above. The three malformed cases fail on main and pass here. The two controls pass both before and after.
  • src/browser: 29 files, 325 tests pass. Storage-fingerprint boundary suites: 4 files, 36 tests pass. npm run check:fast and format:check pass.
  • Not run: a real Chromium session. The issue notes that no real browser was observed producing these responses.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/2762 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/13/2026 **Status:** ✅ Merged **Merged:** 10/13/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `fix/issue-2660` --- ### 📝 Commits (3) - [`399ca21`](https://github.com/morluto/rea/commit/399ca21d7f9f6e8ddc8a2f90a13ef5da735107ab) fix(browser): treat an unusable cache list as incomplete storage coverage - [`042f92b`](https://github.com/morluto/rea/commit/042f92b8980f4adcd6459528e5a26a979796ad56) Merge remote-tracking branch 'origin/main' into fix/issue-2660 - [`0aed89c`](https://github.com/morluto/rea/commit/0aed89c3c79ec4abca7e41da9d1c28298910da06) test(browser): retain valid cache names beside unusable entries ### 📊 Changes **2 files changed** (+90 additions, -4 deletions) <details> <summary>View changed files</summary> ➕ `src/browser/CdpCaptureStorage.test.ts` (+84 -0) 📝 `src/browser/CdpCaptureStorage.ts` (+6 -4) </details> ### 📄 Description Fixes #2660. ## Problem `captureStorage` (`src/browser/CdpCaptureStorage.ts`) derives `fingerprints_complete` partly from `structuredStorageComplete`. For CacheStorage, that check was: ```ts cacheRaw !== undefined && caches.length === cacheValues.length ``` `cacheValues` is `recordsValue(raw.caches)`. That returns `[]` for a missing or non-array field and drops entries that aren't records. Any admitted `CacheStorage.requestCacheNames` response therefore counted as complete: | response | cache_names | fingerprints_complete (before) | | --- | --- | --- | | `{ caches: [] }` | `[]` | true ✅ | | `{}` | `[]` | **true** | | `{ caches: "nope" }` | `[]` | **true** | | `{ caches: [5] }` | `[]` | **true** | | method unsupported | `[]` | false ✅ | An enumeration that never produced an inventory was reported as an observed empty inventory with complete fingerprints. The IndexedDB check right next to it already requires `Array.isArray(indexedValues)` and compares against the raw length. ## Fix Check the raw `caches` field the same way: it must be an array, and every entry must yield a cache name and ID (`caches.length === cacheField.length`). An observed empty array is still complete, and an unsupported command is still incomplete. Missing, non-array or partly unusable lists now report `fingerprints_complete: false`. ## Validation - New `src/browser/CdpCaptureStorage.test.ts` drives `captureStorage` with a scripted CDP connection, using the issue's harness and no browser, for the five responses above. The three malformed cases fail on main and pass here. The two controls pass both before and after. - `src/browser`: 29 files, 325 tests pass. Storage-fingerprint boundary suites: 4 files, 36 tests pass. `npm run check:fast` and `format:check` pass. - Not run: a real Chromium session. The issue notes that no real browser was observed producing these responses. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:06:08 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#5372
No description provided.