Skip to content

Fix/precache cleanupresult compat#3483

Open
Ujjwaljain16 wants to merge 2 commits intoGoogleChrome:v7from
Ujjwaljain16:fix/precache-cleanupresult-compat
Open

Fix/precache cleanupresult compat#3483
Ujjwaljain16 wants to merge 2 commits intoGoogleChrome:v7from
Ujjwaljain16:fix/precache-cleanupresult-compat

Conversation

@Ujjwaljain16
Copy link
Copy Markdown

Fixes #3400

Summary

This PR resolves a mismatch between the declared CleanupResult type and the actual runtime behavior of PrecacheController.activate().

Currently:

  • The type defines deletedCacheRequests
  • The implementation returns deletedURLs
  • Tests and runtime behavior already rely on deletedURLs

This leads to an inconsistent public API where TypeScript users are guided to use a property that does not exist at runtime.


Changes

  • Align runtime and types

    • deletedURLs is now treated as the canonical field
  • Add backward compatibility

    • deletedCacheRequests is returned as an alias pointing to the same array
  • Update type definition

    • Include both fields in CleanupResult
    • Mark deletedCacheRequests as deprecated
  • Update JSDoc

    • Reflect deletedURLs as the primary field
    • Document deprecation of deletedCacheRequests
  • Add test coverage

    • Verify both deletedURLs and deletedCacheRequests return consistent values

Rationale

  • Runtime behavior and existing tests already establish deletedURLs as the de facto API
  • Renaming runtime to match types would risk breaking existing JavaScript consumers
  • Removing deletedCacheRequests from types would break existing TypeScript users

This approach:

  • aligns types with actual behavior
  • avoids breaking changes
  • provides a clear migration path

Notes

  • deletedCacheRequests is now deprecated and can be removed in a future major release
  • deletedURLs is more semantically accurate (array of URL strings rather than Request objects)

Testing

  • Existing tests pass unchanged
  • Added assertions to ensure both properties return identical values

Risk

Low , this is an additive, backward-compatible change with no impact on runtime logic or precaching behavior

@google-cla
Copy link
Copy Markdown

google-cla bot commented Mar 27, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@Ujjwaljain16
Copy link
Copy Markdown
Author

waiting for the review

@Ujjwaljain16
Copy link
Copy Markdown
Author

@swissspidy can i get the review?

@Ujjwaljain16
Copy link
Copy Markdown
Author

CI test failing due to version mismatch unrelated to my changes

@swissspidy
Copy link
Copy Markdown
Collaborator

Thanks for the PR. I don't have much capacity right now, but that unrelated test failure would definitely need fixing first in another PR.

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.

Bug: Incorrect type definition of CleanupResult

2 participants