carlos / platform Public

store-versioning

Opt-in object-store versioning for app, environment and private stores (discussion #1372; Paul, 2026-11-22: build it here, for Slopbox).

Status: held for one ruling from Paul (stopping rule 2), not merged.

  • Code review (Astra): - Round 1: NOT READY (3 P1, 3 P2), all fixed. - Round 2: NOT READY, one P1: version listings without URL encoding. It is in round 1's recovery family, so rule 2 applies and the options are on #1380. Round 2's four P2s are fixed and confirmed.
  • Census: approved, posted on #280.
  • Copy review: two Astra passes (Luna is refused on this account), applied.
  • CI: green at 8a67586ff.

Findings: docs/superpowers/reviews/CODEX-FINDINGS-store-versioning.md.

Change from the first description: there is no off. Versioning is permanent once on, and carlos store versioning is on|status.

Spec: docs/superpowers/specs/2026-11-22-store-versioning-design.md.

What changes

  • Record: an additive versioning block on the store record (enabled, keep_days, at, by). It is never removed; off is a suspend.
  • Walks (internal/objstore): an optional Versioner interface (AWS and in-memory). The grant walk versions a new store's bucket before minting its first key, and converges a block added to an existing store before the healthy short-circuit. ConvergeVersioningIn does only that step. Teardown of a versioned store empties every version and delete marker. A backend with no Versioner is refused before anything is created.
  • Store credential: every store user's policy gains unconditional Denies on s3:DeleteObjectVersion, retention/legal hold/governance bypass, PutBucketVersioning, PutLifecycleConfiguration, Put/DeleteBucketPolicy, object lock, replication and DeleteBucket. The boundary is unchanged and never allowed any of these.
  • Lifecycle: one platform rule (carlos-noncurrent-versions) that expires noncurrent versions after keep_days (30 to 365, default 30, never lowered), with no NewerNoncurrentVersions cap. A lifecycle rule the platform did not write is never replaced.
  • Console doors: POST/GET .../store/versioning (the POST takes a person only), GET .../store/versions?key=, POST .../store/restore. The store create body takes versioning, the store reply carries the block, and the instances manifest gains store_versioning, so private stores are born versioned.
  • Restore is a server-side CopyObject of the old version as a new current version, with no tags. It never deletes.
  • Media conversion and browser uploads refuse a versioned store, and versioning refuses a store that uses either.
  • Sizing: a versioned store is sized by every version (ListObjectVersions), so noncurrent bytes are metered and count towards plan limits.
  • Deployment switch: CARLOS_STORE_VERSIONING=1 (on objstore.Deployment). It is refused without a backend and with CARLOS_STORE_ENDPOINT (AWS S3 only).
  • IAM (infra/modules/region-host): store_versioning (default false) adds a customer-managed host_store_versioning policy: five bucket actions, DeleteObjectVersion / GetObjectVersion / PutObject on store objects, and a Deny of versioning and lifecycle writes on the deployment and data buckets. It uses the same dedicated-prefix preconditions as store_conversion. The default plans no change.
  • CLI: carlos store versioning on|off|status, carlos store versions, carlos store restore, store create --versioning [--keep-days], instances enable --store-versioning. The docs and parity rows are updated.

Tests

  • objstore: the history Denys hold for every policy shape, and the policy fits IAM's 2,048-character limit. Grant ordering (versioned before mint), healthy-store convergence, the non-Versioner refusal, the foreign-rule refusal, ConvergeVersioningIn touching only the bucket, teardown emptying versions, and the purge guard ignoring the block. AWS adapter stubs cover the rule-first ordering, the exact-rule match, EmptyVersions, ListVersions and RestoreVersion's encoding.
  • TestVersionedContractMinio, a new CI fixture in 30-minio-contract: against a real MinIO, the scoped credential is refused version deletes (single and multi), suspending versioning, lifecycle and bucket policy writes, and bucket deletion, and root still sees every version. TestMinioFixtureTracksHistoryDenies keeps the fixture's policy in step with storePolicyJSON.
  • console: every door's refusals, person-only setter, keep_days rules, the declared store applied at grant, create --versioning, the restore flow including an undelete, the media refusal, sizing, private stores born versioned, and the enable flag. Claim fixtures are included.
  • root CLI: wire shapes and printers.
  • tofu: store_versioning.tftest.hcl.

CI

Green at c953103e49795730d39c0a0a891b54b567db3e9e: the gate, the tofu tests (store_versioning.tftest.hcl 11/11), the MinIO contract step with TestVersionedContractMinio, staticcheck, code-health, race and gitleaks. One run hit TestDemoClaimKeptHeadless, and one hit a race-step internal/edge asset test. Neither touches this branch, and both passed on the rerun.

Census

Card docs/superpowers/notes/census-proposal-store-versioning.md: the region-host main.tf and variables.tf bodies, the new tftest file, and envelopes for ., internal/objstore, internal/provision and region-host. No root read is added.

Before it can ship

  1. Round 1 review of the spec and branch (Astra), and a census verdict on #280.
  2. Copy review of the deck and docs.
  3. Merge.
  4. A release tag, then a ?ref= bump in carloku-infrastructure, then tofu apply with store_versioning = true. That apply is an IAM change in production and needs Paul's scoped approval.
  5. CARLOS_STORE_VERSIONING=1 on the console.

🤖 Generated with Claude Code

Commits 16
Discussions 1 1 open
Tasks 0/0 done

Activity