Skip to content

Add connection links via a dedicated #/connect route#1828

Draft
kmcginnes wants to merge 1 commit into
aws:mainfrom
kmcginnes:url-connection-params
Draft

Add connection links via a dedicated #/connect route#1828
kmcginnes wants to merge 1 commit into
aws:mainfrom
kmcginnes:url-connection-params

Conversation

@kmcginnes

@kmcginnes kmcginnes commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Description

Lets external applications deep-link into Graph Explorer with a connection preconfigured, via a dedicated #/connect route:

#/connect?graphDbUrl=...&queryEngine=...&awsRegion=...&serviceType=...&name=...

The route resolves the params against the existing connections into one of four intents, acts on it, then redirects to the graph canvas so the connect URL never lingers in history:

  • none — the params target the active connection; nothing to do.
  • activate — the params match an existing connection; switch to it silently, the same no-prompt operation as clicking it in the connections list.
  • create — no match; open the create form prefilled but fully editable. This is the trust gate for the untrusted endpoint details a link can carry, and the only path that can introduce a new database.
  • invalid — the link's graphDbUrl failed validation; warn with a toast and ignore it.

Key design decisions:

  • Auth posture is part of connection identity. Matching folds in IAM on/off (and, when on, region and service type) alongside graphDbUrl and queryEngine, so a link requesting IAM never silently reuses a plaintext connection to the same endpoint, or vice versa — a mismatch falls through to the create form.
  • graphDbUrl is validated as an http(s) URL with zod; a malformed or non-http link is ignored.
  • The proxy base URL is derived from document.baseURI rather than window.location.origin, so a link produces a working proxy connection on path-hosted deployments (e.g. a Neptune notebook served at /proxy/9250/explorer/ resolves the proxy to /proxy/9250).

How to read this

  • Start with core/urlConnectionParams.ts — the contract core (parse / match / build / resolve) and the four-intent model.
  • core/useUrlConnectionIntent.ts resolves the current route's params against live connection state.
  • routes/Connect/Connect.tsx is the route that acts on the intent and redirects.
  • Supporting: useActivateConnection extracted from ConnectionRow, and CreateConnection gains an initialValues prop for prefill.

Decision record in docs/adr/20260612-connection-links.md, named with the YYYYMMDD-slug ADR convention introduced separately in #1835.

Validation

  • pnpm checks passes (lint, format, types).
  • pnpm test / pnpm coverage green; the connect feature is covered by unit tests for the contract core, the intent hook, and the route (activate / create / none / invalid).
  • Manually tested the create, silent-switch, no-op, auth-mismatch, and invalid-link flows.

Related Issues

Check List

  • I confirm that my contribution is made under the terms of the Apache 2.0 license.
  • I have verified pnpm checks passes with no errors.
  • I have verified pnpm test passes with no failures.
  • I have covered new added functionality with unit tests if necessary.
  • I have updated documentation if necessary.

@kmcginnes kmcginnes mentioned this pull request Jun 16, 2026
5 tasks
@kmcginnes kmcginnes force-pushed the url-connection-params branch from 8f60441 to fb3eafb Compare June 16, 2026 20:55
External applications can deep-link into Graph Explorer with a connection
preconfigured: #/connect?graphDbUrl=...&queryEngine=...&awsRegion=...&serviceType=...&name=...

The route resolves the params against existing connections into one of four
intents and acts on it, then redirects to the graph canvas so the connect URL
never lingers in history:

- none — the params target the active connection; nothing to do.
- activate — the params match an existing connection; switch to it silently,
  the same no-prompt operation as clicking it in the connections list.
- create — no match; open the create form prefilled but fully editable. This
  is the trust gate for the untrusted endpoint details a link can carry, and
  the only path that can introduce a new database.
- invalid — the link's graphDbUrl failed validation; warn with a toast and
  ignore it.

Matching identity folds in auth posture (IAM on/off, and when on, region and
service type) alongside graphDbUrl and queryEngine, so a link requesting IAM
never silently reuses a plaintext connection to the same endpoint, or vice
versa — a mismatch falls through to the create form.

graphDbUrl is validated as an http(s) URL with zod; a malformed or non-http
link is ignored. The proxy base URL is derived from document.baseURI rather
than window.location.origin so a link produces a working proxy connection on
path-hosted deployments (e.g. a Neptune notebook at /proxy/9250/explorer/
resolves the proxy to /proxy/9250).

Contract core lives in core/urlConnectionParams.ts (parse/match/build/resolve)
and core/useUrlConnectionIntent.ts. Documented in the connections feature page,
the security reference, CONTEXT.md, and an ADR.
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