Skip to content

S3: Cache-Control, Content-Disposition and Content-Language are unmodeled #430

Closed

Description

@scttfrdmn

Split out of #406, where it was suggested as a follow-on. It is not the same
three-line parity fix that #406 was, which is why it gets its own issue.

The gap

S3Object has no fields at all for Cache-Control, Content-Disposition or
Content-Language. Substrate accepts these headers on write and silently discards
them, so GetObject/HeadObject never report them.

Real AWS persists all three as object metadata and returns them on every read. A
consumer serving assets through S3 — cache lifetimes, attachment; filename= download
names, per-language variants — gets no signal here that its metadata is being dropped.
Worse than a wrong value: a test asserting "the download filename survives an upload"
passes while verifying nothing, because the write appears to succeed.

Why it's larger than #406

#406 was one field on an existing struct where the read path already emitted the
header. This needs, per header:

  1. A new field on S3Object.
  2. Emission in objectResponseHeaders.
  3. Capture in putObject.
  4. COPY-vs-REPLACE handling in resolveCopyMetadata — with a real design question
    about x-amz-metadata-directive semantics for each header.
  5. The multipart carry: recorded on S3MultipartUpload at CreateMultipartUpload
    and copied onto the object at CompleteMultipartUpload, since Complete accepts
    no object-metadata headers.

Four headers × five sites, and (4) is not mechanical. Expires is worth deciding on
in the same pass — it's the fourth header in this family and AWS treats it as
metadata too, though its Expires vs ExpiresString history in the SDKs makes it
the awkward one.

Notes for whoever picks this up

  • Read headers with headerValueFold, not direct map access — AWSRequest is also
    built in-process (betty_cfn.go constructs literals directly), so casing isn't
    guaranteed, and RFC 9110 header names are case-insensitive regardless.
  • Persistence is plain json.Marshal with no DisallowUnknownFields anywhere, so
    adding fields is backward- and forward-compatible with recorded state.
  • Doing all four (or five) headers in one pass is the point. The two write paths
    drifting apart on a single header is exactly what S3: CreateMultipartUpload drops Content-Encoding, so multipart objects lose it #406 was, and a shared resolution
    helper covering the whole family is what prevents a repeat.

Acceptance criteria

  • Cache-Control, Content-Disposition, Content-Language persist through
    PutObject and are returned by GetObject and HeadObject.
  • Same through CreateMultipartUpload → CompleteMultipartUpload.
  • CopyObject honors x-amz-metadata-directive for each; the COPY-vs-REPLACE
    semantics are documented.
  • A decision recorded on Expires — implemented or explicitly deferred with a
    reason.
  • Absent headers are not emitted (no empty-string headers on the response).
  • docs/services.md multipart subsection updated: the not-modeled list shrinks
    accordingly.

Activity

  1. added
    type: feature
    area: s3
    priority: medium
    on Aug 1, 2026
  2. added this to the v0.83.0 milestone on Aug 1, 2026
  3. scttfrdmn commented on Aug 1, 2026

    @scttfrdmn
    OwnerAuthor

    Shipped in v0.83.0 (go get github.com/scttfrdmn/[email protected]).

    The release notes and CHANGELOG.md record the reasoning behind each decision, including where substrate deliberately stops short of what was suggested here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: s3priority: mediumtype: feature

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions