feat(sync): bring the shared modules up to constructive-db main - #109
Merged
Conversation
Syncs the SQL sources, plans and tests of the shared modules from constructive-db/pgpm-modules (the repo where they are actively developed) into upstream, keeping upstream's module versions and the api_modules work that only exists here.
🤖 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:
|
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
Upstreams every change the shared modules have accumulated in
constructive-io/constructive-db@main(where they are actually developed) since the lastfeat: sync packages from constructive-db/pgpm-modules. Nothing is authored here: for each module thedeploy/,verify/,revert/,pgpm.plan,extensions.jsonand__tests__/trees are taken from constructive-db, thenpgpm packageregeneratessql/. Version metadata (package.json,*.control,Makefile) is untouched, so every module keeps its upstream version — the regenerated files are still--0.33.0/0.33.1.sql.The drift was two-way, so this is a merge and not a copy. Direction was decided per file by last-modified date, then verified by reading the diff:
Kept from upstream (newer here, would have been deleted by a blind copy):
api_modulessurface —metaschema_modules_public.api_surface_module(api_modules_table_id/_name+ FK) and theapp_scope.routing_tables()columns/joins that read it;metaschema-modules/__tests__(information_schema→pg_constraintrewrite,testTimeout) andencrypted-secrets-table/__tests__.Taken from constructive-db (notable ones):
function-resolution— the catalog fast-path generation replaces the probe generation:probe.sqlis deleted,catalog_location.sqladded, andresolve()now returnsowner_database_idand answers from the typed functions catalog with one indexed read per frame database (FUNCTION_RESOLUTION_CATALOG_UNAVAILABLE/FR001when a frame database hosts function modules but no catalog). Plan requires moveprobe→catalog_locationaccordingly.partman— declarativeextensions.jsonreplaces theextensions/pg_partmandeploy/verify/revert triple and its plan entry (the pg_partman schema,createSchemaand grants are now declared, not scripted).pgpm-partman.controlkeeps itspg_partmanrequirement.app-scope—frames()re-keys the fall-throughdatabaseframe by the execution database, so rows a tenant touches on a shared plane are keyed by the tenant'sdatabase_id, not the platform database hosting the plane.database-jobs—enqueue/add_jobtake an explicitdb_id uuid DEFAULT jwt_private.current_database_id()instead of reading the claim inside the body, so a caller can act on behalf of another database.metaschema-schema— newmetaschema_public.derivesanddomain_typetables, plusis_valid_step_up,policy,tableandembedding_chunkschanges.metaschema-modules—catalog_module.buckets_table_id,storage_module.catalog_module_id,billing_module.default_meter_catalog.Two things had to change for this to be green.
PGPM_VERSION: 4.33.0→5.18.0.extensions.jsonis the pgpm 5 way of declaring an external extension; the 4.33 CLI reads the file (Installing external extension: pg_partman) but does not honourschema/createSchema, sopgpm test-packages --full-cycledied onALTER DEFAULT PRIVILEGES IN SCHEMA partmanwith3F000 schema "partman" does not exist. constructive-db has been on pgpm 5 for a while; the workspace already declares"pgpm": "^5".A test fixture fix, pre-existing breakage in constructive-db's copies (that repo does not run the vendored module tests in CI, this repo does):
catalog_module.buckets_table_idisNOT NULL DEFAULT uuid_nil()behind an FK tometaschema_public.tableand there is nouuid_nil()sentinel row, so every insert infunction-resolution's two suites failed (30 of 34 tests). Themetaschema-modulesFK snapshot moves458 → 459for that same new constraint.Consumer-side re-vendor: constructive-io/constructive-db#2634.
Link to Devin session: https://app.devin.ai/sessions/60b2dc2dcb71403f9388d9785a9a78cf
Requested by: @pyramation