Skip to content

[AGE-2882] Add artifact DB stores - #1439

Merged
rutvij-menavlikar merged 10 commits into
rutvij/age-2882_1from
rutvij/age-2882_2
Nov 19, 2026
Merged

rutvij-menavlikar merged 10 commits into
rutvij/age-2882_1from
rutvij/age-2882_2

Conversation

@rutvij-menavlikar

@rutvij-menavlikar rutvij-menavlikar commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Stacked on #1435. Adds IArtifactStore with Postgres and SQLite implementations — only the operations the push/pull flow needs once the object store lands. Not wired into main.ts yet; that comes with the first consumer.

Linear: AGE-2882

Changes

  • src/db/artifactStore.ts: records, inputs, ArtifactSlugConflictError, IArtifactStore.
  • createArtifact / getArtifact (by tenant + slug).
  • createVersion: allocates the next version as pending. Storage keys include the version number, so file rows are written at commit.
  • commitVersion: records uploaded files, flips pending → committed, advances latest_version monotonically — one transaction.
  • failVersion: flips pending → failed.
  • getVersion: version + files (each with created_at); checks the artifact is in the tenant first (for pull/serve).
  • commitVersion sets artifact_file.created_at at commit; callers don't pass it.
  • Kysely table types for both dialects; changeset updated.

How was this tested?

  • Shared contract suite (tests/db/artifactStoreContractSuite.ts), 4 tests: SQLite pass; Postgres pass against a throwaway DB on the devtest RDS (PG 17.11).
  • tsc --noEmit (src + tests/db), eslint, prettier on changed files.

Checklist

  • I have read the contributing guidelines
  • pnpm build, pnpm test, pnpm typecheck, pnpm lint:ci, and pnpm format:check pass locally
  • Tests added/updated where it makes sense
  • No hand-edits to generated code (packages/trueforge-sdk, python/trueforge_sdk, .github/fern/openapi/openapi.json, docs/openapi.json) — fork PRs omit SDK regen; maintainers regenerate after merge
  • Docs / .env.example updated if configuration or behavior changed

Note

Medium Risk
New schema and transactional versioning semantics affect future push/pull flows, but behavior is isolated behind IArtifactStore and covered by contract tests; no runtime wiring in this PR.

Overview
Introduces IArtifactStore and dual Postgres/SQLite implementations for artifact metadata and versioned file manifests (bytes still assumed in object storage). Callers can create/get artifacts by tenant + slug, list a subject’s artifacts with token pagination, and run a pending → committed/failed version lifecycle: allocate version numbers, commit file rows and bump latest_version monotonically (Postgres serializes concurrent version writes with row locks), or fail pending versions and fetch a version with its files—all scoped by tenant.

Migrations and Kysely types add artifact, artifact_version, and artifact_file tables; artifact_list_idx now includes created_by_subject subject_id to match listing queries. A shared contract test suite exercises both backends. Stores are not wired into the app entrypoint yet.

Reviewed by Cursor Bugbot for commit 9853c78. Bugbot is set up for automated code reviews on this repo. Configure here.

rutvij-menavlikar and others added 2 commits November 19, 2026 18:59
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
rutvij-menavlikar and others added 5 commits November 19, 2026 19:10
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
rutvij-menavlikar and others added 2 commits November 19, 2026 21:18
Co-authored-by: Cursor <cursoragent@cursor.com>
[AGE-2886] Add listArtifacts to artifact stores
@rutvij-menavlikar
rutvij-menavlikar merged commit 9e9efaa into rutvij/age-2882_1 Nov 19, 2026
1 of 5 checks passed
@rutvij-menavlikar
rutvij-menavlikar deleted the rutvij/age-2882_2 branch November 19, 2026 15:51

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 9853c78. Configure here.

"@truefoundry/trueforge": patch
---

Add artifact listing to the artifact stores.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

PR adds two changeset files

Low Severity

This PR adds artifact-apis.md and also edits artifact-store-tables.md. Only one changeset file is allowed per PR; extra files and edits to a parent stacked changeset should be folded into a single patch file for this change.

Additional Locations (1)
Fix in Cursor Fix in Web

Triggered by learned rule: Prereleases use rc tags only

Reviewed by Cursor Bugbot for commit 9853c78. Configure here.

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.

1 participant