Files
apple--containerization/Sources/ContainerizationOCI
Maxime Grenu 86171acece ContainerizationOCI: raise Reference name limit to 255 to match OCI spec (#541)
## What

Raise the constant from 127 to 255 in `Reference.swift` and update the
derived `referenceTotalLengthMax` accordingly.

## Why

Closes #453.

The [OCI distribution
spec](https://github.com/opencontainers/distribution-spec/blob/main/spec.md)
states that the **name** component of an image reference (registry host
+ repository path) may be at most 255 bytes. The previous hard-coded
limit of 127 characters incorrectly rejected valid references that used
long registry hostnames or deep path hierarchies.

The old `referenceTotalLengthMax = 255` was also inconsistent: with a
127-char name cap, a 255-char total reference would only allow a very
short tag. The new value is derived explicitly as `nameTotalLengthMax
(255) + separator (1) + tagLengthMax (128) = 384`.

## How

- `nameTotalLengthMax`: 127 → 255
- `tagLengthMax`: new constant (128) documenting the maximum tag length
already enforced by the tag regex (`{0,127}` + leading char = 128
chars).
- `referenceTotalLengthMax`: computed from the two constants above (384)
rather than hard-coded to 255.

## Testing

Added three new cases in `ReferenceTests.swift`:
-  Name of 128 characters (registry + path) — previously rejected, now
accepted
-  Name of exactly 255 characters — at the OCI spec maximum, accepted
-  Name of 256 characters — one over the limit, rejected
2026-02-20 11:37:42 -08:00
..