Let a version carry metadata and explicit parent versions - #9
Open
TheGreatAxios wants to merge 1 commit into
Open
Let a version carry metadata and explicit parent versions#9TheGreatAxios wants to merge 1 commit into
TheGreatAxios wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
artifact_version.metadata(jsonb, nullable, opaque to the package) andartifact_version.parent_version_ids(text[], nullable).artifact.metadatamirrors the current version's value the waytitle/content/versionalready do. New forward-only migration0004_version_metadata; the expected-shape catalogue is updated so an existing database adopts cleanly with no backfill.createArtifact,writeArtifactVersionandfindOrVersionArtifactaccept both fields optionally;getArtifactVersionandlistArtifactVersionsreturn them on every version. Omittedmetadataon a revision carries the prior value forward like an omitted title;parentVersionIdsis 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.