Skip to content

Let a version carry metadata and explicit parent versions - #9

Open
TheGreatAxios wants to merge 1 commit into
mainfrom
artifact-version-metadata
Open

Let a version carry metadata and explicit parent versions#9
TheGreatAxios wants to merge 1 commit into
mainfrom
artifact-version-metadata

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Contributor

What

Adds artifact_version.metadata (jsonb, nullable, opaque to the package) and artifact_version.parent_version_ids (text[], nullable). artifact.metadata mirrors the current version's value the way title/content/version already do. New forward-only migration 0004_version_metadata; the expected-shape catalogue is updated so an existing database adopts cleanly with no backfill.

createArtifact, writeArtifactVersion and findOrVersionArtifact accept both fields optionally; getArtifactVersion and listArtifactVersions return them on every version. Omitted metadata on a revision carries the prior value forward like an omitted title; parentVersionIds is never carried forward, because lineage is explicit or absent.

Why

Hosts that build on this package keep side tables for what a version cannot hold: a stage, a content hash and size, provenance, and the exact versions a version was generated from. Solutions Builder has two such tables beside artifacts. With these two columns they go away, and lineage lives on the version that has it.

Tests

Round-trips for both fields, carry-forward semantics, arktype rejection of a non-object metadata or non-string-array parents, a migration test asserting the new columns, and an adopt test starting from a 0003-only database. Suite run against Postgres 17: 241 pass. Typecheck and build clean.

Hosts that build on artifacts keep side tables for what a version cannot
hold: a stage, a content hash, provenance, and which exact versions a
version was generated from. A nullable opaque metadata object on each
version, mirrored onto the artifact for the current version the way
title and content already are, and an explicit parent_version_ids array
that is never inferred from order, let those side tables go. Migration
0004 adds the columns; existing databases adopt with no backfill.
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