Repository navigation
Description
Summary
S3Object has no storage class. x-amz-storage-class on PutObject is not recorded, ListObjectsV2
does not report one, and InvalidObjectState — the error a GET of an archived object returns — does
not exist.
Verified against 103c843 (v0.76.0):
$ grep -rn "StorageClass\|InvalidObjectState" --include="*.go" emulator/ | grep -v _test
(no matches)
Why this matters to me
objectfs is built for research computing, where the whole
economic argument is tiering: hot data on STANDARD, cold data on GLACIER/DEEP_ARCHIVE. It has a
CostOptimizer that issues in-place CopyObject calls to transition storage class, and a
ValidateWrite that checks tier constraints.
An audit found two defects there I currently cannot test:
ValidateWritechecks the wrong size. It validates the uncompressed length against the
per-tier billing minimum, which S3 applies to the stored length — so it always passes the writes
it exists to reject.- A tier transition strips
Content-Encoding.CopyObjectdoes not preserve it unless
explicitly re-specified, and objectfs relies on that header to know how to decode the object. So a
cost optimisation silently renders compressed objects unreadable. That's a data-integrity bug
reachable purely through a metadata operation, and it needs an emulator that models both storage
class and the copy semantics to catch.
Separately: a GET of a GLACIER object must fail with InvalidObjectState, not return the bytes.
objectfs currently has no handling for that at all, and the FUSE layer would map the resulting error
to EIO. Whether that's the right answer (versus EAGAIN or blocking on a restore) is a design
question I'd like to resolve against a mock that actually produces the error.
What I need
StorageClass stringonS3Object, set from thex-amz-storage-classrequest header on
PutObject / CreateMultipartUpload / CopyObject, defaulting toSTANDARDwhen absent. Valid
values:STANDARD,REDUCED_REDUNDANCY,STANDARD_IA,ONEZONE_IA,INTELLIGENT_TIERING,
GLACIER_IR,GLACIER,DEEP_ARCHIVE,EXPRESS_ONEZONE. An unrecognised value is
400 InvalidStorageClass.- Reported back as
x-amz-storage-classon GetObject/HeadObject responses (real S3 omits the
header forSTANDARD) and as<StorageClass>inListObjectsV2/ListObjectVersions. GET/HEADof aGLACIERorDEEP_ARCHIVEobject returns403 InvalidObjectStatewith
the standard XML body, unless a restore is active.GLACIER_IRreads normally — it's
instant-retrieval, and conflating the two is the exact mistake I want the emulator to catch me
making.CopyObjectrecords the target storage class fromx-amz-storage-class, which is the
transition mechanism objectfs uses.
Optional, and I'd defer it unless it's cheap: RestoreObject plus
x-amz-restore: ongoing-request="true" → "false", expiry-date="...". Being able to test the
restore state machine would be valuable eventually, but InvalidObjectState alone unblocks me.
The one that would be most useful to get exactly right
CopyObject's metadata semantics, because that's where the live bug is:
- With
x-amz-metadata-directive: COPY(the default), user metadata is copied — but real S3 does
not carry overContent-Encoding/Content-Type/Content-Dispositionunless the request
restates them. - With
REPLACE, only what the request specifies survives.
If substrate models that faithfully, my CopyObject-strips-the-encoding bug becomes a failing test
rather than a production surprise.
Acceptance
Round-trip test per storage class (put → head → list, asserting the header and the XML element),
a 403 InvalidObjectState test for GLACIER and DEEP_ARCHIVE with GLACIER_IR asserted to succeed,
an InvalidStorageClass test, and a CopyObject test asserting Content-Encoding is dropped under
COPY and preserved when restated.
Activity
feat(s3): honor the Range header on GetObject and HeadObject (#396) (#…
scttfrdmn commentedon Jul 31, 2026
Implemented in #409 (stacked on #408). Everything in the acceptance criteria is in, but three points in the issue text turned out to contradict the AWS reference, and two of them invert acceptance tests you asked for. Flagging them here since one bears directly on the live
objectfsbug.1.
COPYpreservesContent-Encoding— the headline claim is invertedYou wrote:
The API reference says the opposite. On
x-amz-metadata-directive:and the only exception it names:
The User Guide (
UsingMetadata.html) confirms what "all metadata" covers:and its table lists
Content-Encoding,Content-Type,Content-DispositionandCache-Controlas user-controlled (modifiable: Yes).Your bug is real, but it's
REPLACE, notCOPY. Same page:A
CostOptimizerthat transitions tiers with an in-placeCopyObjectis changing user-configurable metadata, so if it (or the SDK/console path it goes through) sendsREPLACE, everything it does not restate is dropped — includingContent-Encoding. That's the reachable loss, and it's now tested in both directions. Worth checking which directive your transition actually sends: if it'sCOPYand you're still losing the encoding against real S3, that's a different bug than either of us modeled.Substrate previously dropped
Content-Encodingon every copy regardless of directive, which coincidentally matched your assertion. That's fixed, so the emulator now distinguishes the two paths.2.
HEADof aGLACIERobject is200, not403You asked for:
API_HeadObject.html's Errors section lists onlyNoSuchKey(404), and its Example 6 says:API_GetObject.htmldoes listInvalidObjectState/ 403. So it's GET → 403, HEAD → 200, and the asymmetry is the point:HEADsucceeding is how you discover aGETneeds a restore first without paying for a retrieval. Implementing403onHEADwould have given you a test that passes here and fails against AWS — the exact failure mode you filed these issues to prevent.HEADreports the class and the size on an archived object;GET(ranged or not) is the403.3. A copy does not inherit the source's storage class
So an unqualified copy of a
STANDARD_IAobject yieldsSTANDARD. Worth knowing if any of your copy paths omit the header expecting a passthrough.Enum
Accepting all thirteen documented values, four more than your list:
OUTPOSTS,SNOW,FSX_OPENZFS,FSX_ONTAP. They carry no distinct behaviour, but rejecting a value real S3 accepts is the same class of defect as accepting one it rejects.Message strings
InvalidStorageClass→The storage class you specified is not valid.(400)InvalidObjectState→The action is not valid for the object's storage class(403), the wording fromAPI_GetObject.html's sample response. The SDK's generated description is the more general "the current state of the object"; the sample-response form is the storage-class-specific one.The Intelligent-Tiering variant (
The action is not valid for the object's access tier, with<StorageClass>and<AccessTier>children) is not emulated, since access tiers aren't modeled.Deferred, as you allowed
RestoreObjectandx-amz-restore. An archived object stays unreadable for the run; a copy to a non-archival class stands in for a restore. Say the word if you need the real thing and I'll file it separately.chore(release): v0.80.0 (#423)