Menu

#3483 Fix/precache cleanupresult compat

open
nobody
None
2026-05-04
2026-03-27
Anonymous
No

Originally created by: Ujjwaljain16

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

Related

Tickets: #3400

Discussion

  • Anonymous

    Anonymous - 2026-03-27

    Originally posted by: google-cla[bot]

    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.

     
  • Anonymous

    Anonymous - 2026-03-28

    Originally posted by: Ujjwaljain16

    waiting for the review

     
  • Anonymous

    Anonymous - 2026-03-28

    Originally posted by: Ujjwaljain16

    @swissspidy can i get the review?

     
  • Anonymous

    Anonymous - 2026-03-28

    Originally posted by: Ujjwaljain16

    CI test failing due to version mismatch unrelated to my changes

     
  • Anonymous

    Anonymous - 2026-03-30

    Originally posted by: swissspidy

    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.

     

Log in to post a comment.