Repository navigation
Description
Summary
NewClientManager hardcodes INTELLIGENT_TIERING for the CargoShip transporter, ignoring
cfg.StorageTier. Since the standard path honors the configured tier, an object's storage
class ends up depending on which upload path it happened to take.
Background
internal/storage/s3/client.go NewClientManager:
cargoConfig := awsconfig.S3Config{
Bucket: bucket,
StorageClass: awsconfig.StorageClassIntelligentTiering, // Intelligent tiering
MultipartThreshold: cfg.MultipartThreshold,
MultipartChunkSize: cfg.MultipartChunkSize,
Concurrency: cfg.MultipartConcurrency,
}A mount configured for DEEP_ARCHIVE writes INTELLIGENT_TIERING through the transporter and
DEEP_ARCHIVE through the standard client — a cost and lifecycle discrepancy that varies per
object. ConvertTierToCargoShipStorageClass in internal/storage/s3/tiers.go already exists
and is exactly the right call.
Scope limit worth knowing before starting. CargoShip's config.StorageClass
([email protected]/pkg/aws/config/config.go) defines only six constants: STANDARD,
STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE. The AWS SDK
([email protected]/types/enums.go) defines thirteen, including EXPRESS_ONEZONE, FSX_ONTAP,
FSX_OPENZFS, SNOW, and OUTPOSTS. So:
ConvertTierToStorageClasscan gain the newer classes — but that also needs new
Tier*constants andStorageTiersentries, becauseNewTierValidatorsilently downgrades
an unrecognized tier to STANDARD, which would make a typo look like it worked.ConvertTierToCargoShipStorageClasscannot, absent an upstream change. Note the
existingGLACIER_IR → GLACIERarm is already a lossy substitution of this kind.
Implementation
- Call
ConvertTierToCargoShipStorageClass(cfg.StorageTier)instead of the hardcoded constant. - When the configured tier has no faithful CargoShip equivalent, skip the transporter and
use the standard path rather than silently substituting a different storage class. Log the
decision at INFO. Wrong tier is a billing and durability problem; slower upload is not. - Add
EnableCargoShipOptimizationtobuildS3Config— it defaults true in
s3.NewDefaultConfigbut is false on the mount path today, so the transporter is never
constructed there at all. - Optionally revisit the
GLACIER_IR → GLACIERsubstitution under the same rule as (2).
Adding the newer AWS storage classes to ConvertTierToStorageClass is genuinely useful but
is a separate change with its own StorageTiers work; keep it out of this issue unless it
comes for free.
Acceptance Criteria
- The CargoShip transporter receives the storage class derived from
cfg.StorageTier - A tier CargoShip cannot express falls back to the standard path, with an INFO log, and
never silently uploads under a different storage class -
EnableCargoShipOptimizationreaches the backend frombuildS3Config - Table-driven test covers every tier in
StorageTiers, asserting either a faithful
CargoShip class or the documented fallback -
go test -race ./internal/storage/s3/... ./internal/adapter/...passes - Integration check: an object uploaded to a
STANDARD_IA-configured mount reports
StorageClass: STANDARD_IAfromHeadObject
Dependencies
Blocked on C0-1 (#153). Item 3 activates the CargoShip path on the mount, which is
exactly what makes the Content-Encoding corruption reachable. Do not plumb the flag first.
Activity
scttfrdmn commentedon Jul 30, 2026
Correction: the proposed fix targets dead code
Follow-up verification against the vendored dependency shows the fix as written would have no effect, and the real lever is narrower than described.
ConvertTierToCargoShipStorageClassis already dead code on this path.backend.gocomputescargoStorageClass := ConvertTierToCargoShipStorageClass(effectiveTier)and sets it on theArchive, but CargoShip ignores it.Transporter.optimizeStorageClass([email protected]/pkg/aws/s3/transporter.go:143) opens with:ObjectFS never sets
AccessPatternorRetentionDayson theArchiveit builds, so this first branch always wins andarchive.StorageClassis never read. The per-object tier is discarded; the per-clientawsconfig.S3Config.StorageClassdecides everything.Consequence for the fix. The only effective change is the hardcoded
StorageClass: awsconfig.StorageClassIntelligentTieringinNewClientManager(internal/storage/s3/client.go:121) — a per-client setting. That means the CargoShip path cannot honor per-object tier decisions at all, including any downgrade computed byHandleStandardTierOverhead. Setting it correctly fromcfg.StorageTierfixes the configured-tier case but leaves per-object variation unsupportable.Two viable routes:
StorageClassfromcfg.StorageTierand skip the transporter for any object whose effective tier differs from the client default. Correct, no upstream change, loses the optimization for the divergent minority.AccessPattern/RetentionDaysto steeroptimizeStorageClassinto its other branches. Fragile — it means encoding our tier decision as a hint and hoping the upstream heuristic reproduces it. Not recommended.Either way, delete or repurpose the now-provably-dead
ConvertTierToCargoShipStorageClasscall so the code stops implying a per-object tier is honored.Unchanged: the six-constant limit on
awsconfig.StorageClass([email protected]/pkg/aws/config/config.go:186-191) versus thirteen in the AWS SDK still holds, and the lossyGLACIER_IR -> GLACIERarm (tiers.go:273-274) is still a wrong-tier substitution worth removing.Also note the ordering hazard is now sharper. This issue plumbs
EnableCargoShipOptimizationintobuildS3Config, which is what first makes the CargoShip branch reachable from a real mount. That branch carries the #153 corruption. #153 must land first.scttfrdmn commentedon Aug 2, 2026
Fixed in v0.10.1. The CargoShip upload path now converts the effective tier with
ConvertTierToCargoShipStorageClassand setsArchive.StorageClass, so a configured tier reaches the transporter instead of being dropped.