Skip to content

feat(saas-ui): the datasources panel offers what the connector catalog admits and names the rest - #1214

Closed
antoinetoussaint-byte wants to merge 3 commits into
mainfrom
issue-1211-catalog-in-the-kit
Closed

antoinetoussaint-byte wants to merge 3 commits into
mainfrom
issue-1211-catalog-in-the-kit

Conversation

@antoinetoussaint-byte

@antoinetoussaint-byte antoinetoussaint-byte commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Refs #1211, gap (c), the client half: the kit reads the catalog the contract says a client offers and flags providers by. This is independent of #108, of the cursor PR #1213, and of the key-pattern PR #1216, and it is based on main.

Scope changed since this PR was opened. The object-storage connect form, its shared CollectionField and the upload connect call moved to #1216, where the form takes the bucket key filter the owner asked for (#1211 (d)). This PR now does only the catalog read.

What changes

  • DatasourcesPanel reads GetDatasourceCatalog through a new optional DatasourceClient.getCatalog, which datasourceClientOverTransport and createDatasourceClient both implement, so the portal gets it with no portal change. A provider with accepts_new_sources gets its connect action; today that is Connect GitHub. Every other provider is named under the Sources header with the host's own gap sentence, plus "Its operations can still be connected" where the catalog says accepts_operations. Without that clause the HTTP API line misread as "cannot be connected at all".
  • Fallbacks. A client without getCatalog, or whose read failed, offers Connect GitHub alone, as before. An empty catalog offers nothing, because that is the host admitting nothing rather than a missing answer. The host refuses an unadmitted provider either way.
  • New exports: useDatasourceCatalog and the DatasourceProviderView type. Both are additive.
  • The kit moves to 0.12.16 (@codefly-dev/saas-ui, and @codefly-dev/ui, which is co-versioned with it). v0.0.105 released 0.12.15, so the gate needs a new version for this change. It is a patch, because the change is additive. The workspace package-lock.json was regenerated by npm install --package-lock-only, not edited by hand. feat(accounts,saas-ui): a bucket source takes include and exclude key patterns, applied before any fetch #1216 makes the same bump, so whichever lands second rides 0.12.16 with no further change.

Reuse

  • Reused: GetDatasourceCatalog as served (no proto change), the existing connect button and form, and the kit's query conventions.
  • Deliberately not done: a generic form rendered from config_fields. The host's non-conformant registrations declare no fields, and one form per provider is simpler than a renderer with one consumer.

Fix or hack

A fix at the owner: the kit is where the contract's "a client offers … and flags …" is implemented. No stopgap.

Verified

  • Kit: tsc, ESLint and the full kit suite (349 tests). New panel tests cover offer and flag, the operations clause, and GitHub withheld when not admitted. The gateway routing inventory includes getCatalog, and the gateway-bound panel tests now answer the catalog read.
  • Portal: tsc, plus the type-primitive and inventory gates.
  • node scripts/ci/kit-version.mjs check passes on this branch merged into current main (which contains the v0.0.105 tag): @codefly-dev/ui@0.12.16, @codefly-dev/saas-ui@0.12.16. My earlier claim that no bump was needed was checked against a base that predated that tag.
  • Live, under codefly run service --fixture dev-admin, on the earlier revision of this PR: a headless browser logged in as the fixture admin and opened Admin → Data sources. The page called /saas.accounts.v1.DatasourceService/GetDatasourceCatalog through the portal proxy (200), showed only Connect GitHub, and listed HTTP API (with the operations clause), Web crawler and Object storage with the host's sentences. The later commit only removed code the page never rendered, because the host refuses object storage.

Not verified

  • The portal's pipeline vitest project: four onboarding tests fail locally with "Codefly did not provide the frontend gateway context". They need what codefly injects and do not touch the kit; I did not run them on main to compare.
  • A "Couldn't verify collection permissions" banner showed on the live page. This change does not touch that call, and the only failing request I saw was a 400 on /v1/auth/refresh. I did not check whether main shows the same banner.

Merge order

This PR and #1216 add kit lines at the same anchors (a client call, a hook, the export lists, the README hooks line). Whichever lands second needs a trivial rebase; nothing conflicts in meaning.

Docs

packages/saas-ui/README.md: how the panel decides what it offers, and the new hook.

🤖 Generated with Claude Code

antoinetoussaint-byte and others added 2 commits October 21, 2026 16:59
…g admits and names the rest

The panel reads GetDatasourceCatalog through the client's optional getCatalog:
a provider that accepts new sources gets its connect action, and every one that
takes none is listed with the host's gap sentence. A client without the
catalog, or whose read failed, offers GitHub alone as before. An object-storage
connect form joins the GitHub one, sharing an extracted CollectionField; it is
offered only once the catalog admits the provider.

Refs #1211

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… change for the key-pattern one

The catalog change keeps what it is for: the panel reads GetDatasourceCatalog,
offers what it admits and names the rest with the host's reason. The
object-storage connect form, its shared collection field and the upload
connect call move to the change that gives a bucket source its key filter,
which the form now carries; the panel mounts it once the host admits the
provider. Nothing here offered it before, because the host refuses the
provider today.

Refs #1211

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…105 published

The catalog read changes saas-ui's published bytes, and v0.0.105 already
released 0.12.15, so the kit-version gate needs a new version. A patch,
because the change is additive; @codefly-dev/ui moves with it (the kit is
co-versioned), and the workspace lockfile is regenerated by npm, not edited.

Refs #1211

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@antoinetoussaint-byte

Copy link
Copy Markdown
Contributor Author

Do not rebase this. It is 22 commits behind main and DIRTY, but a rebase would be the wrong move.

Checked against #1235 (315dd360, 24/24 green, 0 behind main): that branch built the catalog transport — gateway.ts:97 async getCatalog(), types.ts:474 getCatalog?(), and catalog.ts — and nothing calls it. It does not touch datasources-panel.tsx. So this PR is not superseded; it is the consumer of that surface, and #1235 is currently carrying a dead path without it.

The two files that matter here are queries.ts (useDatasourceCatalog, disabled when the client lacks getCatalog, retry: false, infinite staleTime) and datasources-panel.tsx (offerGitHub gating the Connect button on acceptsNewSources, and refusedProviders naming each provider that takes none with the host's own gap reason). Roughly 50 lines.

Recommended: fold those into #1235 and close this, which makes #1235's surface live and saves this branch a conflict resolution plus its own review and strict-main CI cycle for two files. Drop 0e1bf4ef (kit 0.12.16) — #1235 is already at kit 0.13.3 and saas-sdk 0.3.37 via eee04f9f.

Full reasoning and the evidence for the rest of the #1211 family is on #1235: #1235 (comment)

🤖 Generated with Claude Code

@antoinetoussaint-byte

Copy link
Copy Markdown
Contributor Author

Correction to my previous comment — it was wrong. I said #1235 ships getCatalog with no caller and that this PR is its consumer. It isn't, and this PR is superseded.

datasources/connect-source.tsx (313 lines, on main) already holds the consumer: :29 useDatasourceCatalog(client, orgId) with enabled: !!client.getCatalog, :58 the no-catalog fallback, :76 <section aria-label="Source providers">, :85–:88 rendering provider.gap for a provider whose acceptsNewSources is false, and :165 aria-label={\Connect ${provider.displayName}`}— a connect action per provider.datasources-panel.tsx:41imports it and uses it at:382`.

I had grepped only datasources-panel.tsx, queries.ts, catalog.ts and gateway.ts, found nothing, and reported that as 'nothing calls it'. connect-source.tsx was never in the set I looked at.

So this PR's behaviour is carried, in a better shape: the catalog is rendered generically, one action per accepting provider plus each refused provider's gap sentence. This PR's offerGitHub = catalog.isSuccess ? accepts("github") : true and flat refusedProviders list hardcode the one connector the generic version no longer needs to name, so folding it in would be a regression. No rebase, no fold.

Like #1213 (head 413084a9) and #1216 (head 4762aa8d), both contained outright in #1235's branch, this is finished work. Recommend closing all three.

Full correction: #1235 (comment)

🤖 Generated with Claude Code

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