Repository navigation
feat(mdcode): push every model that lists deployments or has a sibling profile file in two phases, and report its errors - #563
Open
feixufeixu wants to merge 1 commit into
Conversation
…g profile file in two phases, and report its errors
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 plain
kcmd pushnow takes the two-phase path for a model that listsdeployments:, in the Google flavor or in a vanilla GOOGLE block, and for amodel that has a sibling profile file,
<model>.profile.<name>.yaml, soKnowledge Catalog receives every profile. A bare
--profiletakes two phasestoo, since cac gives it the value of an absent flag. For a model with no
deployments list,
--profile <name>,--all-profilesand--no-profilekeeptoday's path, and so does a model whose only profile files are in
<model>.profiles/. Push no longer callsdeploymentProfileError, whichrefused a deployment that names a profile, and loader.ts loses it.
On this path
default_profilechooses no binding, but the runtime reads it.So
defaultProfileCheckapplies it with its actions, as the runtime does, andruns push's own action checks on it. A legacy wrapper must merge and load. Push
warns when
default_profileis set and no deployment uses it, or when aselected deployment names no profile.
For a model that lists deployments,
kcmd profilesrunscheckBeforeWritesand prints the errors it returns, so it stops where a plain push stops. With
KC_V2_ASPECTS=1, it prints once each catalog warning push gives, such as oneabout a custom
ai_contextmember push leaves out of the catalog's model.b/570200480 makes kcmd keep the author's text for those values, which removes
the warning, so this PR only keeps the warning visible. The report also gives
the error for an aspect too large to store, under the model. Push refuses that
aspect in its catalog preflight, before any write. Each error is a
LocalCheckErrorthatbelongs to the whole push, to a model or to one of its profiles. A deployment's
errors go under the profile it uses, which is
defaultwhen it names none.Push and the report print each distinct error once. When push gives no error, a
profile that does not apply gets a
not shown:line that says why.A plain push of either kind of model now differs from today's path:
--no-kc. For a model that lists deployments it also refuses--profile,--all-profilesand--no-profile. The help text of the fourflags says so.
attached, before the graphs deploy. A Spanner graph that fails to deploy
now leaves the catalog written.
deployments both deploy. An AlloyDB deployment gets a note and deploys no
graph.
refused. Today's path deployed it.
default_profilenaming a legacy wrapper, today's path deployed thewrapper's table. This PR deploys the model file's table and warns.
Until the next PR:
database, as store_agreement's 'a deployment for a declared profile, under
default' case expects. A BigQuery deployment that reads a Spanner table
passes the local checks and fails the DDL dry run.
The generator warns about each metric they would refuse and leaves it out.
defaultis unbound when every deployment names aprofile.
validateDeploymentsinmodelFileBindingErrorsstays,though no model that lists deployments reaches it.
Main's tests that pushed a model that lists deployments with
--no-kc,--profile,--all-profilesor--no-profilenow use a plain push or--no-deployment, expect the refusal, or are removed where another test coversthe code. A test about today's path drops
deployments:, or moves its targetinto a legacy wrapper's
deployment_target:or a GOOGLE block'sdeploymentTargets. Tests of the refusal of a deployment that names a profilenow expect the two-phase result, or are removed. Main's pruning-note table
becomes one two-phase test of its source-check row. Its two
KC_V2_ASPECTSrows become one today's-path test that deploys through a legacy wrapper's
deployment_target:. Where a profiles.test.tscase needs today's path for a model with a sibling profile file, it adds
--profile default. The other cases take two phases and pass with no change towhat they expect. The exception is the aspect size case, which now expects its
error under the model. The AlloyDB error on today's path drops "push uses exactly
one deployment for now". Main's
--transpiletest of a vendor-only metric nowreads the model from the catalog preflight, since its model lists deployments
and pushes in two phases.
Points to check:
takesTwoPhasePath. Only a value other thantruecounts as passing--profile, andlocalProfileFilesgives a profile name only to a siblingprofile file.
listsDeploymentsreads the places the loader reads: thenative key, and each GOOGLE block whose
datais a string. Like theloader, it matches GOOGLE in any letter case.
profiles(), the!twoPhaseguards keep main's report for a scope whereno model lists deployments. With
--profile <name>, the report prints theother profiles' errors above the profiles, since any of them stops the push.