Repository navigation
Description
Summary
TierValidator.ValidateWrite enforces the storage tier's MinObjectSize as a hard write
gate. AWS's per-tier minimums are billing minimums, not API restrictions, so this
rejects writes S3 would accept. Because the FUSE layer creates directories and files as
zero-byte objects, every mkdir and every file creation fails on any IA or Glacier tier.
Background
internal/storage/s3/tiers.go ValidateWrite:
minSize := tv.tierInfo.MinObjectSize
if tv.constraints.MinObjectSize > 0 {
minSize = tv.constraints.MinObjectSize
}
if dataSize < minSize {
return fmt.Errorf("object size %d bytes is below minimum %d bytes for %s tier",
dataSize, minSize, tv.tier)
}StorageTiers sets MinObjectSize to 128 KB for STANDARD_IA, ONEZONE_IA, GLACIER_IR,
and INTELLIGENT_TIERING, and 40 KB for GLACIER and DEEP_ARCHIVE. PutObject calls it
before doing anything else.
S3 accepts a 1-byte STANDARD_IA object and bills it as 128 KB — the minimum is a pricing
floor, not a validation rule. Meanwhile internal/fuse/filesystem.go creates both
directories (Mkdir) and files (Create) with:
n.fs.backend.PutObject(ctx, childPath, []byte{})Zero bytes. So on a mount configured for any of those six tiers, the filesystem cannot
create anything at all.
Implementation
Downgrade the tier-default minimum to a WARN log reporting actual size versus billed size,
and return nil. Keep the hard error only when the operator explicitly set
TierConstraints.MinObjectSize — that is a deliberate policy choice and should still be
enforced.
Apply the same treatment to ValidateSize in internal/storage/s3/backend.go. Update the
package tests that currently assert the error is returned.
Acceptance Criteria
-
ValidateWritereturns nil for a 0-byte write onSTANDARD_IAand logs a billing warning -
ValidateWritestill errors whenTierConstraints.MinObjectSizeis explicitly set - The warning includes both actual and billed size
-
ValidateSizebehaves consistently - Existing tier tests updated to match the new contract
-
go test -race ./internal/storage/s3/...passes - On a mount against a real
STANDARD_IAbucket,mkdirandtouchboth succeed
Dependencies
None. Must land before any IA-tier integration test, which would otherwise fail at
mkdir during setup.
Activity
scttfrdmn commentedon Jul 30, 2026
Correction:
ValidateSizedoes not exist, and this defect is currently latentTwo adjustments.
Wrong function name. The issue references
ValidateSize; grep finds no such function. The intended target isValidateObjectForTier(internal/storage/s3/backend.go:974).The defect is latent, not live — and that changes the ordering.
StorageTierhas no configuration surface on the mount path.config.S3Config(internal/config/config.go:241-248) declares onlyRegion,Endpoint,Profile,UseAcceleration,ForcePathStyle, andCostOptimization— there is no tier field, andbuildS3Config(internal/adapter/adapter.go) does not setStorageTier. So a real mount runs withStorageTier: "", andNewTierValidator(tiers.go:136-142) silently maps the unknown value toSTANDARD, whoseMinObjectSizeis0. The write gate never fires today.That does not make the bug less real — it makes it a trap primed to fire. The moment anyone adds tier configuration (a natural companion to #158), every
mkdirand every file creation breaks on IA and Glacier tiers, becauseMkdirandCreateboth callPutObject(ctx, childPath, []byte{}). The failure would surface as "ObjectFS is broken on IA tiers" immediately after an unrelated-looking config change.Suggested adjustment
priority: critical— not for current impact, but because it gates correct tier support, and the fix is a few lines.PutObjectsucceeds onSTANDARD_IA, so the trap cannot be re-armed later.config.S3Config.Profileis also declared and never plumbed — nothing reads it, soAWS_PROFILEin config is silently ignored. Belongs with the config-plumbing work in C0-3: Plumb parallel-read and pool-size settings through buildS3Config #156, and is a separate user-visible surprise.Also worth confirming during the fix that
NewTierValidatorsilently downgrading an unrecognized tier toSTANDARDis intended. A typo in a tier name currently produces no error and writes to the wrong (more expensive) tier. Arguably it should reject unknown tiers outright.scttfrdmn commentedon Aug 2, 2026
Additional defect in the same function: the size it checks is the wrong size (M23)
Still open, so recording this here rather than filing separately — it is the same three lines.
TierValidator.ValidateWrite(internal/storage/s3/tiers.go:163-173) comparesdataSizeagainsttierInfo.MinObjectSize. Its caller isbackend.go:737:dataat that point is the uncompressed buffer. ButMinObjectSizemodels an AWS billing minimum, and AWS applies that minimum to the stored object size — which, with compression on, is smaller. So the gate always passes writes it exists to reject: a 200 KB file that compresses to 60 KB passes the 128 KB check for STANDARD_IA and is then billed as 128 KB.This makes the defect worse than a no-op, because the direction of the error is the expensive one. The check exists to stop a write that will be billed above its size, and it is guaranteed to miss exactly those writes.
Relevant to this issue's resolution: once
MinObjectSizeis a billing warning rather than a gate, the warning must be computed on the post-compression length or it will warn about the wrong files — silent on the ones that will actually be over-billed, noisy on ones that will not. That means the check has to move to where the stored length is known, i.e. after the compression step, not atPutObjectentry.Two related notes:
128 * 1024and40 * 1024(tiers.go:67,77,97,107,117,127). AWS states these minimums as 128 KB and 40 KB decimal — 128,000 and 40,000 bytes. The binary values are 2.4% high, so the warning fires slightly late. Same decimal-vs-binary question asbyteToGBininternal/cost/calculator.go(Real AWS Pricing API integration — and the 10x-low Standard PUT rate the static tables disagree on #183).STANDARDhasMinObjectSize: 0(tiers.go:57), so nothing fires by default. That is why this shipped — but it also means the fix is safe to make without changing default behavior.backend.go:2055is a second caller (ValidateTierWrite) with the same issue.fix: three tier "minimums" AWS does not publish, and the 7.4% under e…
scttfrdmn commentedon Aug 3, 2026
Confirmed still live, and #229 changed the shape of it — worth recording before anyone picks this up, because the issue text describes six tiers and only three remain.
What #229 already resolved
#229 found that three of the six
MinObjectSizevalues were not AWS minimums at all: AWS publishes no minimum billable object size forGLACIER,DEEP_ARCHIVE, orINTELLIGENT_TIERING. The archive classes' 40 KB is per-object overhead AWS bills in addition to the object, and Intelligent-Tiering's 128 KB is a monitoring-eligibility threshold. Those three now haveMinObjectSize: 0and warn about the real cost instead.So this issue's write gate is gone on those three for a reason that has nothing to do with the gate: the input was wrong, not the enforcement.
What is still broken
The remaining three —
STANDARD_IA,ONEZONE_IA,GLACIER_IR— carry a real AWS 128 KB billable minimum. The number is correct; the enforcement is what this issue is about. Measured just now against the substrate-backed harness, one backend per tier, zero-bytePutObject:internal/fuse/filesystem.go:531still creates directories withPutObject(ctx, childPath, []byte{}, nil), so on a mount configured for any of those three tiersmkdircannot succeed — the summary's claim holds, on half as many tiers.ValidateWrite's own doc comment ininternal/storage/s3/tiers.go:292-301already names this issue as the remaining work and states why refusing is ObjectFS policy rather than S3 behavior.Revised acceptance criteria
The originals still apply, with
STANDARD_IAas the right example tier. Two additions from what #229 learned:STANDARD_IA,ONEZONE_IA, andGLACIER_IR, not one of them. Two of the tier MinObjectSize values are not AWS minimums: GLACIER/DEEP_ARCHIVE have none, INTELLIGENT_TIERING has none #229's lesson was that per-tier values drift independently and a single-tier test cannot see it