Skip to content

feat(storage): add bounded conditional-create uploads - #371

Draft
primetimeindy wants to merge 3 commits into
tigrisdata:mainfrom
primetimeindy:feat/bounded-conditional-create
Draft

primetimeindy wants to merge 3 commits into
tigrisdata:mainfrom
primetimeindy:feat/bounded-conditional-create

Conversation

@primetimeindy

@primetimeindy primetimeindy commented Oct 14, 2026 •

Copy link
Copy Markdown

Summary

Adds an opt-in create-only upload path:

  • SDK: put(key, body, { ifAbsent: true }).
  • CLI: tigris objects put BUCKET KEY FILE --if-absent --access private.
  • Sends If-None-Match: * on the actual single-part PUT. Conflicts remain errors, with no unconditional fallback.
  • Supports known-size string, Buffer and Blob bodies up to 5 MiB. The CLI buffers regular-file input with a 5 MiB plus one-byte ceiling.
  • Preserves existing defaults, allowOverwrite behavior, cp and native authentication code.
  • Exports the existing memfs constants and fstatSync APIs so browser bundling remains compatible.

allowOverwrite: false currently performs a HEAD precheck before an ordinary upload. This additive option closes the check-then-write race without silently changing that existing API.

Current verification, head 72d7077

  • Frozen pnpm 10.34.6 install, lifecycle hooks disabled, fresh isolated dependencies; AWS client-s3/lib-storage 3.1150.0 matches the lockfile.
  • 75 unique tests passed, retry disabled and no skips: 15 SDK tests, 10 native conditional CLI tests, 13 browser-shim tests and 37 existing CLI parser/upload tests.
  • Three new test files are discovered by the unchanged repository Vitest configurations.
  • SDK tests run actual AWS serialization, signing and retry middleware with synthetic credentials and an in-memory transport. They check conditional/private headers, conflicts without unconditional fallback, a simulated foreign-object race, exact size limits, unsupported inputs and existing defaults.
  • CLI tests exercise the actual specs/Commander parser, dispatch and upload handler with inert auth/storage boundaries. Browser-shaped tests use the actual memfs/stream shims and verify bounded bytes, descriptor cleanup, read failure and input rejection.
  • Storage/IAM builds, CLI Node/browser builds and declarations, storage/CLI typechecks and relevant Biome checks passed locally.
  • Independent review reran all 75 tests, browser bundling and CLI typecheck. A read-only RED control removing only the two added exports reproduced both original browser linkage errors.
  • Tests and builds ran with macOS OS-level network denial and an isolated HOME. No native credentials, live authentication or storage operations were exercised.

Hosted CI

Current-head run: https://github.com/tigrisdata/storage/actions/runs/38593140094

Observed action_required, zero jobs, awaiting maintainer approval. No hosted CI success is claimed. This PR remains draft.

Remaining limits

  • Local runtime is Node 22.23.2 on macOS, not the Ubuntu/Node 24 hosted environment. Full workspace CI/cloud integration and actual browser-engine execution remain unverified.
  • Native OAuth/bootstrap is unchanged and excluded from tests. Handler-level pre-auth refusal does not attest bootstrap behavior.
  • Boolean options rely on the typed API/native flag contract, not arbitrary-input runtime validation.
  • Symlinks to regular files are accepted. Buffering bounds the upload but does not establish immutable source-path custody.
  • No live Tigris conditional-write semantics, IAM authorization, bucket consistency, archival recovery or deployment is claimed.

An earlier standalone harness remains included for serialization diagnostics. The repository-native tests now provide the regular test-runner coverage; the initial dependency-version mismatch has been resolved in the verification above.

This is a draft for maintainer feedback. Is the bounded opt-in interface appropriate, or would maintainers prefer broader multipart support in a separate change?

Assisted by GPT-6.1-sol and GPT-6-astra through Hermes Agent.

Expose opt-in SDK ifAbsent and CLI --if-absent for single-part uploads up to 5 MiB, preserving existing defaults.

Assisted-by: GPT-6.1-sol via Hermes Agent
Assisted-by: GPT-6.1-sol via Hermes Agent
Export existing memfs descriptor APIs and add lock-exact SDK, native CLI, and browser-shim regression tests.

Assisted-by: GPT-6.1-sol via Hermes Agent
@primetimeindy

Copy link
Copy Markdown
Author

The current head, 72d7077, includes the browser shim compatibility repair and regression tests integrated with the normal Vitest configurations. Local frozen-lock verification and independent review passed 75 unique tests, with network denied and no live credentials. The PR description now records the exact scope and limitations.

Could a maintainer approve the pending workflow run https://github.com/tigrisdata/storage/actions/runs/38593140094 and review the bounded ifAbsent / --if-absent API? GitHub currently reports action_required with no jobs. I have kept this draft and have not attempted to bypass the approval gate. Please use only your approved CI/test environment; this request does not ask you to expose credentials to this fork.

No hosted CI pass or live Tigris qualification is claimed.

@designcode

Copy link
Copy Markdown
Collaborator

@primetimeindy We have implemented this in #423. Shall I close this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants