Repository navigation
feat(mdcode): check each deployment's tables and the metric rules of the profile it names - #564
Open
feixufeixu wants to merge 1 commit into
Conversation
…the profile it names The profile check now also gives the warning about SQL kcmd cannot read in the profiles of the deployments push deploys, so it prints even when push stops at an earlier check, as under --no-deployment.
feixufeixu
added this pull request to stack #565
October 24, 2026 20:38
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.
A two-phase push, and
kcmd profilesfor a model that lists deployments, nowrefuse a deployment whose tables are outside the database it deploys to. The new
deploymentTableErrorsreads each entity's source from the profile thedeployment names, or from the model file for a deployment that names none.
It compares the database
databaseOfgives for each source with the target's:database, which the runtime queries alone.
dataset of any project.
Any other source fails, so a Cloud SQL table fails every deployment. An entity
with no source is skipped, and so is a deployment whose profile is a legacy
wrapper.
checkBeforeWritesruns the check on every deployment, whether or not--deploymentselects it, and under--no-deploymenttoo. In the report eacherror belongs to the deployment's profile.
A deployment that names a profile is now held to the metric rules of its
engine under that profile.
validateDeploymentsreads the profile frommodel.profiles, so it leaves out a legacy wrapper, and leaves a profile thatdoes not apply to the completeness check:
in
metrics_exclude, and one that reads a field it excludes or leavesunbound.
rule, with the keys the profile states.
checkBeforeWritesrunsvalidateDeploymentsonce for each profile thedeployments use. In the report each error belongs to that profile, and a
problem that two deployments on one profile share prints once, naming both. A
problem that deployments on different bindings share prints once for each
binding, so
kcmd profilesshows it under each profile.Push now also warns that
defaultis unbound when the model file's ownbindings are incomplete and every deployment names a profile, and
kcmd profilesprints the warning underdefault. A selected deployment's profilenow gets its warning about SQL kcmd cannot read from the profile check, as
under
--no-deployment, so a push that stops before that deployment's checksstill prints it.
Main's today's-path call to
validateDeploymentsinmodelFileBindingErrorsgoes, with the
joinsCheckedoption andunboundInline'sjoinsparameter.Since the previous PR, every model that lists deployments pushes in two
phases, so that call checked no deployment.
On a two-phase push, the BigQuery source probe now runs in the location of the
graph's dataset, where the graph's DDL runs. When a probe fails there and a
second probe with no location finds the table in another location, the error
names both locations. When push cannot read the dataset's location, the probe
lets BigQuery choose, as before.
On main, a plain push of a model that lists deployments deploys a Spanner
deployment whose model file binds a BigQuery table or a table in another Spanner
database. The Spanner DDL names each table without its database, so the graph
reads the target database's table of that name. Such a push now fails before
any write. A push that keeps today's path does not run the check. That path
still deploys such a graph for a vanilla model whose GOOGLE block lists
deploymentTargets, and for a legacy wrapper withdeployment_target:. Beforethis PR, a BigQuery table in another location failed the DDL dry run with
BigQuery's own message. It now fails the source probe with an error that names
its location.
The runtime's comments in store.ts no longer say push accepts a table outside
the store. store_agreement's 'Spanner beside BigQuery' case now expects push and
the report to refuse the BigQuery deployment that reads a Spanner table, and
its vanilla cases bind profile prod to a table in a second Spanner database.
Main's Cloud SQL test of the inline bindings now expects the model file's
dialect error. The table check refuses its BigQuery deployment before any
metric check, so its metric no longer tested the lookup.
Points to check:
requires a source in the profile for every concrete entity, so no entity
falls back to an unchecked model-file source.
only when it differs from the dataset's.
source: |block ends in a newline.profiledapplies the profile and prunes it, asdeploymentPlandoes, sothe metric rules skip exactly the metrics the deployment does not deploy
and read the keys the profile states.