Skip to content

fix(mdcode): emit an empty source for a logical-only KC entity - #368

Merged
libei merged 1 commit into
GoogleCloudPlatform:mainfrom
libei:fix/kc-logical-source-resources
Aug 30, 2026
Merged

fix(mdcode): emit an empty source for a logical-only KC entity#368
libei merged 1 commit into
GoogleCloudPlatform:mainfrom
libei:fix/kc-logical-source-resources

Conversation

@libei

@libei libei commented Aug 30, 2026

Copy link
Copy Markdown
Collaborator

Problem

A logical-only semantic model (no bindings, no deployment target) pushed to Knowledge Catalog is rejected by the live server:

INVALID_ARGUMENT: Failed to parse the data provided in Aspect
  projects/.../aspectTypes/semantic-entity against its template:
  Required field missing source.

The semantic-entity aspect template requires the source record (with its resources list). The emitter omitted the source block entirely for an entity with an empty dataSource, so the write failed.

#367 (logical-only KC push) was verified only with --validate-only and offline unit tests — one of which explicitly asserted source is undefined — 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 (dataSource becomes ''). Output is unchanged for a bound entity.

Updated the one unit test that pinned the old omit behavior.

Verification

  • 577 semantic tests green; tsc clean.
  • Live against the autopush Knowledge Catalog instance: kcmd push --target kc on a purely logical model now writes all 5 entries + 2 links, and kcmd pull round-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.

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
libei merged commit 40295b7 into GoogleCloudPlatform:main Aug 30, 2026
7 checks passed
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant