{
  "slug": "mutate-time-and-mutate-canonical-accept-tarball-layeroption-776ec8fe4871",
  "title": "mutate.Time and mutate.Canonical accept tarball.LayerOption",
  "tools": [
    "crane"
  ],
  "tags": [
    "agent"
  ],
  "introduced_at": "2026-08-25T18:26:11.000Z",
  "announced_at": "2026-08-25T18:26:11.000Z",
  "effective_at": null,
  "date_basis": "source-publication",
  "status": "unknown",
  "how": {
    "incantation": "When rebuilding an image and needing to preserve its layer compression or media type, pass the matching `tarball.LayerOption` values to `mutate.Time` or `mutate.Canonical`, then set the image and config media types with `mutate.MediaType` and `mutate.ConfigMediaType` as needed.",
    "examples": [
      "img, err := mutate.Time(img, t, tarball.WithCompression(compression.ZStd), tarball.WithMediaType(types.OCILayerZStd))\nif err != nil { return err }\nimg = mutate.MediaType(img, types.OCIManifestSchema1)\nimg = mutate.ConfigMediaType(img, types. OCIConfigJSON)",
      "img, err := mutate.Canonical(img, tarball.WithCompression(compression.ZStd), tarball.WithMediaType(types.OCILayerZStd))\nif err != nil { return err }\nimg = mutate.MediaType(img, types.OCIManifestSchema1)\nimg = mutate.ConfigMediaType(img, types.OCIConfigJSON)"
    ],
    "gotchas": [
      "Version: v0.22.0",
      "mutate.Time(img, t, opts...) (required): `img` is the image to mutate; `t` is the timestamp applied to image timestamps; `opts` are optional variadic `tarball.LayerOption` values. Layers default to dockerv2+gzip unless options say otherwise.",
      "mutate.Canonical(img, opts...) (required): `img` is the image to canonicalize; `opts` are optional variadic `tarball.LayerOption` values.",
      "tarball.WithCompression(comp): Overrides compression for uncompressed tarballs. For ZStd, use together with `WithMediaType(types.OCILayerZStd)`.",
      "tarball.WithMediaType(mt): Overrides the layer media type. No mutual-exclusion rule documented.",
      "mutate.MediaType(img, mt) (required): Sets the image media type.",
      "mutate.ConfigMediaType(img, mt) (required): Sets the image config media type.",
      "With no options passed, output is byte identical to before.",
      "`Time` and `Canonical` can no longer be assigned to a `func(v1.Image) (v1.Image, error)` variable."
    ]
  },
  "why_it_matters": "When rebuilding an image while preserving its layer codec and media types, pass the required layer options and update the manifest and config media types.",
  "before": "Before this change, `mutate.Time` and `mutate.Canonical` accepted no layer options; rebuilt layers were dockerv2+gzip by default.",
  "sources": [
    "https://github.com/google/go-containerregistry/releases/tag/v0.22.0",
    "https://github.com/google/go-containerregistry/pull/2403",
    "https://pkg.go.dev/github.com/google/go-containerregistry@v0.22.0/pkg/v1/mutate",
    "https://pkg.go.dev/github.com/google/go-containerregistry@v0.22.0/pkg/v1/tarball"
  ],
  "rank": 0.93032,
  "judge": {
    "publish": true,
    "judge_model": "codex-cli/gpt-6-luna+typesafe/jev-1.13.0",
    "prompt_version": "extract-v7+enrich-v2+judge-v2x3+jev-publish-v1"
  },
  "review_state": "approved",
  "provenance": {
    "run_id": "wave1-20261014",
    "verdict_id": "wave1-20261014:wave1-20261014-589de323e1b6cc91-0:gate",
    "evidence_hash": "c7ae1664dfcca7a8fa18d2bccb84ac78123b607830f3e1b30982c961afee3ad6"
  },
  "review": {
    "draft_hash": "52023899290be3303762a698193327b2b45fb757ff7b096d31fdf9905017a147",
    "reviewer": "publication-gate",
    "reviewed_at": "2026-10-07T00:00:00.000Z",
    "decision": "wave1-20261014:gate",
    "reason": "3 of 3 judge runs approved with p_yes >= 0.9 (mean 0.93 >= 0.9; 2 needed) and Jev gave 0.67 (>= 0.6 needed)."
  }
}
