Skip to content

fix(mutate): make Time layer updates lazy - #2429

Merged
Subserial merged 4 commits into
google:mainfrom
amarkdotdev:lazy-mutate-time-1168
Sep 3, 2026
Merged

Subserial merged 4 commits into
google:mainfrom
amarkdotdev:lazy-mutate-time-1168

Conversation

@amarkdotdev

Copy link
Copy Markdown
Contributor

Summary

  • Defer layer timestamp rewrites in mutate.Time until a layer is actually read
  • Avoid upfront work for every layer when only some layers are consumed

Fixes #1168

Test plan

  • go test ./pkg/v1/mutate/... -run TestTime

@Subserial

Copy link
Copy Markdown

Can you recreate this PR on a more recent commit?

Defer layer timestamp rewrites until a layer is actually read, matching the
lazy pattern used by the cache package and avoiding upfront work for every
layer in an image.

Fixes google#1168

Signed-off-by: amarkdotdev <[email protected]>
Defer layer timestamp rewrites until a layer is actually read, matching the
lazy pattern used by the cache package and avoiding upfront work for every
layer in an image.

Rebased on latest main and preserved LayerOption support.

Fixes google#1168

Signed-off-by: Aaron <[email protected]>
@amarkdotdev

Copy link
Copy Markdown
Contributor Author

rebased onto latest main

@amarkdotdev
amarkdotdev force-pushed the lazy-mutate-time-1168 branch from b18ea41 to 8d01b16 Compare September 1, 2026 03:32
@codecov-commenter

codecov-commenter commented Sep 2, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 71.42857% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.67%. Comparing base (79af990) to head (a583be5).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pkg/v1/mutate/mutate.go 71.42% 5 Missing and 5 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2429      +/-   ##
==========================================
+ Coverage   59.48%   59.67%   +0.19%     
==========================================
  Files         167      167              
  Lines       11619    11666      +47     
==========================================
+ Hits         6911     6962      +51     
+ Misses       3836     3815      -21     
- Partials      872      889      +17     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

layerTime always returned a nil error; return only v1.Layer so
golangci-lint unparam passes on CI.

Signed-off-by: Aaron <[email protected]>
@amarkdotdev

Copy link
Copy Markdown
Contributor Author

Pushed a583be5: layerTime now returns only v1.Layer so golangci-lint unparam passes on the Lint check.

@Subserial
Subserial merged commit 969402f into google:main Sep 3, 2026
19 checks passed
social4hyq pushed a commit to social4hyq/homebrew-core that referenced this pull request Sep 20, 2026
crane 0.22.1

Created-by: HarmonybrewBot
Commit-by: HarmonybrewBot
Merged-by: HarmonybrewBot
Description: Created by `brew bump`

---

Created with `brew bump-formula-pr`.<details>
  <summary>release notes</summary>
  <pre>## What's Changed
* Reject non-canonical IP literals in all SSRF guards by @shaggyinsomniac in google/go-containerregistry#2426
* daemon: fix stale docker/docker reference in WithClient docs by @BobDu in google/go-containerregistry#2428
* build(deps): bump the go-deps group across 2 directories with 4 updates by @dependabot[bot] in google/go-containerregistry#2422
* authn: do not overwrite AuthConfig.Auth when username and password are empty by @nileshpatil6 in google/go-containerregistry#2420
* build(deps): bump the actions group across 1 directory with 8 updates by @dependabot[bot] in google/go-containerregistry#2423
* Support pulling images by sha512 digest by @BobDu in google/go-containerregistry#2427
* Allow empty label and annotation values in crane mutate by @theadsingh in google/go-containerregistry#2418
* fix(build): Use dependencies.gitSource in cloudbuild_v2.yaml by @tprussak in google/go-containerregistry#2434
* validate: support index attestation manifests and empty configs by @Subserial in google/go-containerregistry#2414
* name: improve error when parsing a reference with a URL scheme by @locker95 in google/go-containerregistry#2431
* fix(build): install binaries to /ko-app and add to PATH (#2424) by @tprussak in google/go-containerregistry#2436
* fix(release): honor declared Go toolchain by @rksharma-owg in google/go-containerregistry#2435
* remote: apply checkRedirectSSRF to writer-side HTTP clients by @locker95 in google/go-containerregistry#2432
* flatten: preserve config and layer media types when flattening by @Subserial in google/go-containerregistry#2438
* fix(mutate): make Time layer updates lazy by @amarkdotdev in google/go-containerregistry#2429
* build(deps): bump the go-deps group across 2 directories with 3 updates by @dependabot[bot] in google/go-containerregistry#2439
* remote: copy manifest annotations to referrers fallback tag descriptors by @codysoyland in google/go-containerregistry#2441

## New Contributors
* @shaggyinsomniac made their first contribution in google/go-containerregistry#2426
* @BobDu made their first contribution in google/go-containerregistry#2428
* @nileshpatil6 made their first contribution in google/go-containerregistry#2420
* @theadsingh made their first contribution in google/go-containerregistry#2418
* @locker95 made their first contribution in google/go-containerregistry#2431
* @rksharma-owg made their first contribution in google/go-containerregistry#2435
* @codysoyland made their first contribution in google/go-containerregistry#2441

**Full Changelog**: https://github.com/google/go-containerregistry/compare/v0.22.0...v0.22.1</pre>
  <p>View the full release notes at <a href="https://github.com/google/go-containerregistry/releases/tag/v0.22.1">https://github.com/google/go-containerregistry/releases/tag/v0.22.1</a>.</p>
</details>
<hr>

See merge request: Harmonybrew/homebrew-core!18250
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.

mutate.Time should be lazy

3 participants