sync: port the machine, repository and image module tables from constructive-db - #120
Merged
Merged
Conversation
…ructive-db constructive-db vendors these modules under pgpm-modules/ and edits them in place, so the two trees drift until someone ports the changes back (last done in #119). Two modules had drift: types and metaschema-modules. types gains upload_ids(upload[]) -> text[], the one indexable expression for a column holding many uploads: a scalar upload column answers "which file is this?" with (value ->> 'id') and a btree expression index serves it, an array cannot, so storage garbage collection and the files-to-document sync trigger both key off this function and file_ref_field emits a GIN index over it. IMMUTABLE (index expressions must be) and it drops elements with no id, since an upload naming only a url is not a reference to a files row. metaschema-modules gains three module tables the platform now provisions -- image_module (central container image catalog), repository_module (repositories, events, workflows, builds, partitioned build_steps, local change requests) and machine_module (enrolled machines, sessions, append-only command ledger) -- plus internal_config_module and k8s_admission_module, and the @module_table provenance comments and agent/catalog/resource/route column additions that landed on constructive-db main since #119. config_secrets_user_module exists only upstream and is kept; jwt-claims, metaschema-schema and object-store still carry unported drift, out of scope here. sql/ artifacts regenerated with pgpm package; metaschema-modules snapshots re-recorded against the ported deploy tree. A publish needs a version bump -- 0.41.0 is already released and these changes add objects to it.
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
… fixtures catalog_module gained a NOT NULL redirects_table_id whose uuid_nil() default cannot satisfy the new FK to metaschema_public."table", same as its sibling module-table columns, so the fixture inserts must name it.
…re drift from constructive-db Backlog that predates this sync: current_database_id marked LEAKPROOF, a derived policy's column_refs persisted on metaschema_public.policy, predicate calls carrying schema and name separately, and the immutable-objects delete trigger returning OLD. Artifacts repackaged for the three modules.
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.
Summary
constructive-db vendors these modules under
pgpm-modules/and edits them in place, so the two trees drift until someone ports the changes back (last done in #119). Two modules had drift:typesandmetaschema-modules.types— one new change:upload_ids(upload[]) -> text[]. It exists because an array of uploads has no indexable "which file is this?" expression. A scalaruploadcolumn answers that with(value ->> 'id'), which a btree expression index serves; an array cannot, so storage GC and the files→document sync trigger both key off this function, andmetaschema_generators.file_ref_fieldemits a GIN index over it:CREATE INDEX … USING gin (upload_ids(attachments)); -- GC / sync then ask: WHERE upload_ids(col) && ARRAY[NEW.id::text]IMMUTABLE STRICT(an index expression must be immutable) and it drops elements with noid— an upload naming only aurl, which the domain allows, is not a reference to afilesrow, so it contributes nothing rather than a NULL that&&would have to reason about.metaschema-modules— three new module tables the platform now provisions:image_module— the central container image catalog.repository_module— repositories, events, workflows, builds, partitionedbuild_steps(step + test rows keyed into the build's log object by byte range), local change requests.machine_module— enrolled machines, sessions, and the append-only command ledger.Plus the backlog that landed on constructive-db
mainsince #119 and was never ported:internal_config_module,k8s_admission_module, the@module_tableprovenance comments on every module table (whattg_module_install_provenanceattributes to an install), and theagent/catalog/resource/routemodule column additions.Notes:
config_secrets_user_moduleexists only upstream and is kept (plan line reinserted in place).jwt-claims,metaschema-schemaandobject-storestill carry unported drift from constructive-db; out of scope here.sql/artifacts regenerated withpgpm package;metaschema-modulessnapshots re-recorded against the ported deploy tree; a newupload-ids.test.tscovers ordering, id-less elements, strictness, volatility and the GIN index path.Link to Devin session: https://app.devin.ai/sessions/45a3052973e44fb2b78bca5a8a161b2e
Requested by: @pyramation