Skip to content

os datasource list-tables/introspect/validate are non-functional — CLI reads pre-#3843 flat envelope #10675

Description

@baozhoutao

Found by QA run #10663 driving cli.datasource-introspect-codegen against a live showcase boot at framework 79ebb37.

Symptom

All three os datasource subcommands are broken on the happy path:

  • os datasource list-tables showcase_externalNo remote tables found. (exit 0), while the server returns two tables.
  • os datasource introspect showcase_external --table customersError: Failed to generate draft (exit 2).
  • os datasource validate showcase_externalNo federated objects to validate. (exit 0) even against induced drift the server flags as missing_column region severity:error — a silent CI-breaking pass.
  • Unknown datasource → TypeError: first argument must be a string or instance of Error (exit 1, a crash rather than the server's error text).

Root cause

The commands read the pre-#3843flat response shape (body.tables / body.draft / body.results, and body.error as a string), but the server emits the current wrapped envelope from packages/types/src/response-envelope.ts: sendOk{success:true, data:{…}}, sendError{success:false, error:{code,message}}. So payloads (nested under data) read as undefined, and passing the error object to oclif's this.error(...) crashes. Mechanism at list-tables.ts:42-48, introspect.ts:53-63, validate.ts:43-53. This is these commands' first functional coverage — they never worked against the current envelope.

Reproduction

  1. Boot showcase on a scratch port, mint an admin token.
  2. os datasource list-tables showcase_external --url <U> --token <T>No remote tables found. exit 0; oracle GET /api/v1/datasources/showcase_external/external/tables = {success:true,data:{tables:[{"name":"customers","columnCount":7},{"name":"orders","columnCount":7}]}}.
  3. os datasource introspect showcase_external --table customers …Error: Failed to generate draft exit 2; oracle POST …/tables/customers/draft returns data.draft.source.
  4. Induce drift (rename customers.region in the fixture DB), os datasource validate …No federated objects to validate. exit 0; oracle POST …/external/validate = ok:false … missing_column region.

Suggested fix

Unwrap the envelope in all three commands: read body.data.tables|draft|results and body.error?.message. Secondary quality gap: even once unwrapped, the generated draft fails os build as-is (object name lacks ${namespace}_ prefix; no sharingModel).

QA-source: #10663 · integration-system.external-schema-introspection · CLI lane (the introspection feature's CLI door)

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions