Skip to content

cost: Standard PUT is 10x low, storage is 7.4% low, and the drift test checks one field of six #209

Closed

Description

@scttfrdmn

Every cost figure ObjectFS reports is wrong, in three independent ways. These are separable from the Pricing API work (#183) and cheaper — they are arithmetic and reconciliation, no new dependency, no network call. Fix them first; #183 then replaces a correct static table rather than an incorrect one.

1. Standard PUT is 10× low

// internal/storage/s3/pricing_manager.go:126
"PUT": { TierStandard: 0.0005, ... }     // per 1000 requests

// internal/cost/pricing.go:47 — the same rate, correct
PutRequest: 0.000005,  // $0.005 / 1000

AWS charges $0.005 per 1,000 PUTs in us-east-1. pricing_manager.go says $0.0005 per 1,000. A write-heavy workload's request cost is understated by 10×, and the two tables in this repo disagree with each other about it.

internal/cost/pricing.go:48's comment claims "These match the values in internal/storage/s3/tiers.go and pricing_manager.go." It does not.

2. pricing_drift_test.go cannot catch it

The drift test compares only StoragePerGBMonth against StorageTierInfo.CostPerGBMonth. Request rates, retrieval rates, and early-deletion minimums are not compared, which is why a 10× error in a request rate sat in a repo that has a test specifically for rate-table drift.

Extend it to every field both tables define. A drift test that covers one field of six reads as coverage of the table.

3. Storage is billed in decimal GB, computed in binary

// internal/cost/calculator.go:118-124
// byteToGB converts bytes to gigabytes (binary: 1 GB = 1 073 741 824 bytes).
return float64(bytes) / (1024 * 1024 * 1024)

AWS bills GB-months decimal (10⁹ bytes). Dividing by 2³⁰ understates every storage cost by ~7.4% — and the comment shows the choice was deliberate, so this needs the unit fixed and the comment corrected, or someone will "fix" it back.

And the rates live in five places

internal/cost/pricing.go, internal/cost/reporter.go, internal/storage/s3/tiers.go, internal/storage/s3/doc.go, internal/analytics/model.go all carry storage rates. Five copies is why two of them disagree. Consolidate to one table that the others read — that consolidation is also the prerequisite that makes #183 a single-site change instead of five.

Verification: a drift test covering every shared field across all rate definitions; a calculator test asserting a known byte count against a hand-computed decimal-GB cost; and the SDK/analytics figures checked against the same table, since #182 notes sdks/python/client.py:525-531 returns a hardcoded hit_rate: 0.85 as telemetry and the cost surfaces deserve the same scrutiny.

Activity

  1. added
    type: bug
    priority: high
    area: cost
    on Aug 2, 2026
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: costpriority: hightype: bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions