Skip to content

feat: support addressing objects by versionId - #1341

Open
TylerHillery wants to merge 11 commits into
masterfrom
tyler/feat/object-versioning-wave-1
Open

feat: support addressing objects by versionId#1341
TylerHillery wants to merge 11 commits into
masterfrom
tyler/feat/object-versioning-wave-1

Conversation

@TylerHillery

@TylerHillery TylerHillery commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

Feature

What is the current behavior?

Currently we don't allow users to specify version id

What is the new behavior?

Can now pin get, head, info, sign, copy, move, delete, and deleteObjectets to a specific object version via versionId. Also added additional indexes.

Additional context

Left out S3 API changes for now as well. Will be done in a follow up PR.

Only one version can exist per object today, so versionId just reselects the same object you'd already get by default but this lays groundwork for real multi-version support later.

@TylerHillery
TylerHillery force-pushed the tyler/feat/object-versioning-wave-1 branch from 455fc8e to 72f2b66 Compare August 21, 2026 02:49
@TylerHillery
TylerHillery marked this pull request as ready for review August 21, 2026 02:50
@TylerHillery
TylerHillery requested a review from a team as a code owner August 21, 2026 02:50
Copilot AI lite review requested due to automatic review settings August 21, 2026 02:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds API-level and storage-layer support for pinning object operations to a specific object version via versionId / sourceVersionId, laying groundwork for multi-version objects while keeping current behavior intact.

Changes:

  • Extend object routes (get/head/info, signed URLs, copy/move, delete) to accept a version identifier and pass it through to storage lookups.
  • Update storage/database lookup and update paths to optionally filter by version, and include versionId in signed download tokens.
  • Add new tenant migration indexes to support version-aware addressing and future versioning constraints.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/test/object.test.ts Adds integration tests covering version-pinned get/info/public get/copy/move/delete and signed URL flows.
src/storage/object.ts Plumbs optional version IDs through findObject, deleteObject, copyObject, moveObject, and signed URL creation.
src/storage/database/pg.ts Extends findObject and updateObject queries to optionally constrain by version.
src/storage/database/adapter.ts Updates the Database interface to accept optional version parameters for findObject and updateObject.
src/internal/database/migrations/types.ts Registers new migration IDs for added object/version indexes.
src/internal/auth/jwt.ts Extends SignedToken to optionally carry versionId.
src/http/routes/object/moveObject.ts Accepts sourceVersionId and forwards it to storage move operation.
src/http/routes/object/getSignedURL.ts Accepts versionId for signed URL generation and forwards it to storage signing.
src/http/routes/object/getSignedObject.ts Uses versionId from verified token to fetch the pinned object version before rendering.
src/http/routes/object/getPublicObject.ts Accepts versionId query param and passes it to object lookup.
src/http/routes/object/getObjectInfo.ts Extends query schema and passes versionId to object info lookup.
src/http/routes/object/getObject.ts Accepts versionId query param and passes it to object lookup.
src/http/routes/object/deleteObject.ts Accepts versionId query param and forwards it to storage delete operation.
src/http/routes/object/copyObject.ts Accepts sourceVersionId and forwards it to storage copy operation.
migrations/tenant/0064-objects-key-version-index.sql Adds a unique index on (bucket_id, name, version) to support version addressing.
migrations/tenant/0065-objects-current-version-index.sql Adds a unique index enforcing a single current (unarchived) row per (bucket_id, name).
migrations/tenant/0066-objects-null-version-index.sql Adds a unique partial index for non-versioned objects keyed by (bucket_id, name).
Suppressed comments (1)

src/storage/database/pg.ts:1191

  • version is gated by a truthy check, so a provided empty string (e.g. ?versionId=) would be ignored and the lookup would fall back to the unpinned object. Use an undefined check so any provided value participates in the WHERE clause.
    if (version) {

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/storage/database/pg.ts Outdated
@coveralls

coveralls commented Aug 21, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 32666241045

Coverage increased (+0.04%) to 81.203%

Details

  • Coverage increased (+0.04%) from the base build.
  • Patch coverage: 68 of 68 lines across 14 files are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 13160
Covered Lines: 11113
Line Coverage: 84.45%
Relevant Branches: 7827
Covered Branches: 5929
Branch Coverage: 75.75%
Branches in Coverage %: Yes
Coverage Strength: 612.48 hits per line

💛 - Coveralls

Comment thread src/storage/object.ts
@TylerHillery
TylerHillery force-pushed the tyler/feat/object-versioning-wave-1 branch from 922e71e to 2f920dc Compare August 21, 2026 12:11
Comment thread src/storage/database/pg.ts
Comment thread src/storage/database/pg.ts Outdated
@TylerHillery
TylerHillery force-pushed the tyler/feat/object-versioning-wave-1 branch from efd3bda to 39413e4 Compare August 23, 2026 21:01
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.

3 participants