fix(mdcode): emit an empty source for a logical-only KC entity - #368
Merged
libei merged 1 commit intoAug 30, 2026
Merged
Conversation
A logical-only model (no bindings) pushed to Knowledge Catalog is rejected by the live server: INVALID_ARGUMENT: Failed to parse the data provided in Aspect .../aspectTypes/semantic-entity against its template: Required field missing source. The semantic-entity aspect template requires the `source` record (with its `resources` list); an entity with an empty dataSource was emitting no `source` block at all, so the write failed. GoogleCloudPlatform#367 verified logical-only push only with --validate-only and offline tests, so this was not caught. Emit `source: {resources: []}` for a logical-only entity instead of omitting it. An empty list is the honest "no binding yet"; the reader already treats it the same as an absent source. Output is unchanged for a bound entity. Verified live against the autopush Knowledge Catalog instance: `kcmd push --target kc` on a logical-only model now writes all entries and `kcmd pull` round-trips.
libei
added a commit
to libei/knowledge-catalog
that referenced
this pull request
Aug 30, 2026
…rm#367/GoogleCloudPlatform#368) A --target kc push now accepts a purely logical model (no bindings, no deployment target) and publishes it to Knowledge Catalog. Update the guide: - README: deployment target and sources are required only for a graph leg; a --target kc push governs the logical model and needs neither. - reference: the deployment-target and live-source checks are graph-scoped; the KC leg accepts a logical-only model (an omitted source publishes with no linked resource; an unbound: placeholder is written verbatim). - owl-import: an imported model can be published to Knowledge Catalog as-is; binding is required only to deploy a graph.
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.
Problem
A logical-only semantic model (no bindings, no deployment target) pushed to Knowledge Catalog is rejected by the live server:
The
semantic-entityaspect template requires thesourcerecord (with itsresourceslist). The emitter omitted thesourceblock entirely for an entity with an emptydataSource, so the write failed.#367 (logical-only KC push) was verified only with
--validate-onlyand offline unit tests — one of which explicitly assertedsourceisundefined— so the live write path was never exercised and this slipped through.Fix
Emit
source: {resources: []}for a logical-only entity instead of omitting it. An empty list is the honest "no binding yet"; the pull reader already treats it the same as an absent source (dataSourcebecomes''). Output is unchanged for a bound entity.Updated the one unit test that pinned the old omit behavior.
Verification
tscclean.kcmd push --target kcon a purely logical model now writes all 5 entries + 2 links, andkcmd pullround-trips.Context
Prerequisite for the semantic-model codelab's "govern the logical model before you bind it" step (docs PR #364), which could not run live without this.