Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
19f6897
feat: add RuntimeClient, RuntimeProvider, and ConnectRPC proto gen (P…
ericpgreen2 Feb 24, 2026
ba367e8
feat: add TanStack Query hook code generator (Phase 2)
ericpgreen2 Feb 24, 2026
8cdc22d
feat: update invalidation and query matching for dual key formats (Ph…
ericpgreen2 Feb 24, 2026
3aaa80d
fix: resolve type errors in generated query hooks
ericpgreen2 Feb 24, 2026
366c809
fix: prevent reactive loop in runtime store bridge
ericpgreen2 Feb 24, 2026
13adf06
feat: add JSON bridge to v2 code generator (Phase 4)
ericpgreen2 Feb 24, 2026
243dd49
feat: add generic TData support to v2 query hooks for select transforms
ericpgreen2 Feb 24, 2026
a77cf00
fix: strip undefined values before proto fromJson in JSON bridge
ericpgreen2 Feb 24, 2026
369e0b5
fix: emit default values in proto toJson to match gRPC-Gateway output
ericpgreen2 Feb 24, 2026
301244f
fix: deep-strip undefined values in `stripUndefined` for nested reque…
ericpgreen2 Feb 24, 2026
840e757
feat: port request queue to ConnectRPC transport interceptor
ericpgreen2 Feb 25, 2026
ae800e0
refactor: migrate connectors and column-profile to v2 RuntimeClient
ericpgreen2 Feb 24, 2026
d760301
refactor: migrate more connectors components to v2 RuntimeClient
ericpgreen2 Feb 24, 2026
133a411
refactor: migrate column-profile, canvas, and remaining connectors to…
ericpgreen2 Feb 24, 2026
fafeda1
fix: restore select transforms now that v2 hooks support generic TData
ericpgreen2 Feb 24, 2026
46ae340
refactor: migrate chart providers and canvas leaf components to v2 Ru…
ericpgreen2 Feb 24, 2026
25a80d1
refactor: add runtimeClient to dashboard StateManagers and migrate co…
ericpgreen2 Feb 24, 2026
8392af2
refactor: migrate dashboard time-series and selector modules to v2 Ru…
ericpgreen2 Feb 24, 2026
b65d646
refactor: migrate dashboard Svelte components from runtime store to u…
ericpgreen2 Feb 24, 2026
e7bc93b
fix: update test infrastructure for v2 ConnectRPC hooks
ericpgreen2 Feb 24, 2026
2267e4d
refactor: migrate export and pivot-query modules from runtime store t…
ericpgreen2 Feb 24, 2026
d4e0b17
refactor: migrate time controls and time ranges from runtime store to…
ericpgreen2 Feb 24, 2026
bfe9b4b
refactor: migrate canvas, explores, and state-managers from runtime s…
ericpgreen2 Feb 24, 2026
5947503
refactor: thread `RuntimeClient` through `.ts` query factories and re…
ericpgreen2 Feb 24, 2026
fb10785
refactor: migrate web-common features from `runtime` store to `Runtim…
ericpgreen2 Feb 25, 2026
fe3b390
fix: update conversation tests to use mock `RuntimeClient`
ericpgreen2 Feb 25, 2026
2102ddd
refactor: migrate remaining `.ts` modules from runtime store to Runti…
ericpgreen2 Feb 25, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ proto.generate:
cd proto && buf generate --exclude-path rill/ui
cd proto && buf generate --template buf.gen.openapi-admin.yaml --path rill/admin
cd proto && buf generate --template buf.gen.openapi-runtime.yaml --path rill/runtime
cd proto && buf generate --template buf.gen.runtime.yaml --path rill/runtime
cd proto && buf generate --template buf.gen.local.yaml --path rill/local
cd proto && buf generate --template buf.gen.ui.yaml
go run -ldflags="-X main.Version=$(shell git describe --tags $(shell git rev-list --tags --max-count=1))" \
Expand All @@ -65,5 +66,6 @@ proto.generate:
scripts/convert-openapi-v2-to-v3/convert.go --force --public-only \
proto/gen/rill/admin/v1/admin.swagger.yaml proto/gen/rill/admin/v1/public.openapi.yaml
npm run generate:runtime-client -w web-common
npm run generate:query-hooks -w web-common
npm run generate:client -w web-admin

16 changes: 16 additions & 0 deletions proto/buf.gen.runtime.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: v2
managed:
enabled: true
override:
- file_option: go_package_prefix
value: github.com/rilldata/rill/proto/gen
disable:
- module: buf.build/googleapis/googleapis
file_option: go_package_prefix
- module: buf.build/envoyproxy/protoc-gen-validate
file_option: go_package_prefix
plugins:
- remote: buf.build/connectrpc/es:v1.4.0
out: ../web-common/src/proto/gen
opt:
- target=ts
17 changes: 12 additions & 5 deletions web-admin/src/features/bookmarks/ExploreBookmarks.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
import { createUrlForExploreYAMLDefaultState } from "@rilldata/web-common/features/dashboards/stores/get-explore-state-from-yaml-config.ts";
import { createRillDefaultExploreUrlParamsV2 } from "@rilldata/web-common/features/dashboards/url-state/get-rill-default-explore-url-params.ts";
import { ResourceKind } from "@rilldata/web-common/features/entity-management/resource-selectors.ts";
import { useRuntimeClient } from "@rilldata/web-common/runtime-client/v2";
import { createQuery } from "@tanstack/svelte-query";
import { writable } from "svelte/store";

const runtimeClient = useRuntimeClient();

export let organization: string;
export let project: string;
export let metricsViewName: string;
Expand All @@ -26,17 +29,21 @@

// Get url params for the explore based on yaml defaults.
// This is used for home bookmarks button when there is no explicit home bookmark created.
const urlForExploreYAMLDefaultState =
createUrlForExploreYAMLDefaultState(exploreNameStore);
const urlForExploreYAMLDefaultState = createUrlForExploreYAMLDefaultState(
runtimeClient,
exploreNameStore,
);

// Rill opinionated url params that are removed from url to keep the url short.
// To keep bookmarks exhaustive, these are added on top of current url params while creating bookmarks.
const rillDefaultExploreURLParams =
createRillDefaultExploreUrlParamsV2(exploreNameStore);
const rillDefaultExploreURLParams = createRillDefaultExploreUrlParamsV2(
runtimeClient,
exploreNameStore,
);

// Transformer for legacy bookmark data that was stored in proto format.
const exploreBookmarkLegacyDataTransformer =
createExploreBookmarkLegacyDataTransformer(exploreNameStore);
createExploreBookmarkLegacyDataTransformer(runtimeClient, exploreNameStore);

// Stable query object for bookmarks for this explore
const bookmarksQuery = createQuery(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { getMetricsViewTimeRangeFromExploreQueryOptions } from "@rilldata/web-co
import { getTimeControlState } from "@rilldata/web-common/features/dashboards/time-controls/time-control-store.ts";
import { convertPartialExploreStateToUrlParams } from "@rilldata/web-common/features/dashboards/url-state/convert-partial-explore-state-to-url-params.ts";
import { getExploreValidSpecQueryOptions } from "@rilldata/web-common/features/explores/selectors.ts";
import type { RuntimeClient } from "@rilldata/web-common/runtime-client/v2";
import type {
V1ExploreSpec,
V1MetricsViewSpec,
Expand All @@ -12,13 +13,14 @@ import { createQuery } from "@tanstack/svelte-query";
import { derived, type Readable } from "svelte/store";

export function createExploreBookmarkLegacyDataTransformer(
client: RuntimeClient,
exploreNameStore: Readable<string>,
) {
const validSpecQuery = createQuery(
getExploreValidSpecQueryOptions(exploreNameStore),
getExploreValidSpecQueryOptions(client, exploreNameStore),
);
const timeRangeQuery = createQuery(
getMetricsViewTimeRangeFromExploreQueryOptions(exploreNameStore),
getMetricsViewTimeRangeFromExploreQueryOptions(client, exploreNameStore),
);

return derived(
Expand Down
4 changes: 2 additions & 2 deletions web-admin/src/features/projects/download-report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
createQueryServiceExportReport,
type RpcStatus,
} from "@rilldata/web-common/runtime-client";
import { runtime } from "@rilldata/web-common/runtime-client/runtime-store";
import {
createMutation,
type CreateMutationOptions,
Expand All @@ -17,6 +16,7 @@ export type DownloadReportRequest = {
reportId: string;
executionTime: string;
originBaseUrl: string;
host: string;
};

export function createDownloadReportMutation<
Expand Down Expand Up @@ -48,7 +48,7 @@ export function createDownloadReportMutation<
originBaseUrl: data.originBaseUrl,
},
});
const downloadUrl = `${get(runtime).host}${exportResp.downloadUrlPath}`;
const downloadUrl = `${data.host}${exportResp.downloadUrlPath}`;
window.open(downloadUrl, "_self");
};

Expand Down
18 changes: 10 additions & 8 deletions web-admin/src/features/projects/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
useResourceV2,
} from "@rilldata/web-common/features/entity-management/resource-selectors";
import { queryClient } from "@rilldata/web-common/lib/svelte-query/globalQueryClient";
import type { Runtime } from "@rilldata/web-common/runtime-client/runtime-store";
import { derived, type Readable } from "svelte/store";

export function getProjectPermissions(orgName: string, projName: string) {
Expand Down Expand Up @@ -137,13 +136,16 @@ export async function fetchProjectDeploymentDetails(
return {
projectPermissions: projResp.projectPermissions,
project: projResp.project,
runtime: <Runtime>{
host: projResp.deployment?.runtimeHost,
instanceId: projResp.deployment?.runtimeInstanceId,
jwt: {
token: projResp.jwt,
authContext: token ? "magic" : "user",
},
runtime: {
host: projResp.deployment?.runtimeHost ?? "",
instanceId: projResp.deployment?.runtimeInstanceId ?? "",
jwt: projResp.jwt
? {
token: projResp.jwt,
receivedAt: Date.now(),
authContext: (token ? "magic" : "user") as string,
}
: undefined,
},
};
}
Expand Down
42 changes: 26 additions & 16 deletions web-admin/src/routes/[organization]/[project]/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@
import { viewAsUserStore } from "@rilldata/web-admin/features/view-as-user/viewAsUserStore";
import ErrorPage from "@rilldata/web-common/components/ErrorPage.svelte";
import { metricsService } from "@rilldata/web-common/metrics/initMetrics";
import RuntimeProvider from "@rilldata/web-common/runtime-client/RuntimeProvider.svelte";
import RuntimeProvider from "@rilldata/web-common/runtime-client/v2/RuntimeProvider.svelte";
import { RUNTIME_ACCESS_TOKEN_DEFAULT_TTL } from "@rilldata/web-common/runtime-client/constants";
import type { HTTPError } from "@rilldata/web-common/runtime-client/fetchWrapper";
import type { AuthContext } from "@rilldata/web-common/runtime-client/runtime-store";
import type { AuthContext } from "@rilldata/web-common/runtime-client/v2/runtime-client";
import type { CreateQueryOptions } from "@tanstack/svelte-query";
import { queryClient } from "@rilldata/web-common/lib/svelte-query/globalQueryClient.ts";
import { getRuntimeServiceListResourcesQueryKey } from "@rilldata/web-common/runtime-client";
Expand Down Expand Up @@ -205,6 +205,20 @@
: "user"
) as AuthContext;

// Derive effective runtime connection props
$: effectiveHost =
mockedUserId && mockedUserDeploymentCredentials
? mockedUserDeploymentCredentials.runtimeHost
: projectData?.deployment?.runtimeHost;
$: effectiveInstanceId =
mockedUserId && mockedUserDeploymentCredentials
? mockedUserDeploymentCredentials.instanceId
: projectData?.deployment?.runtimeInstanceId;
$: effectiveJwt =
mockedUserId && mockedUserDeploymentCredentials
? mockedUserDeploymentCredentials.accessToken
: projectData?.jwt;

// Load telemetry client with relevant context
$: if (project && $user.data?.user?.id) {
metricsService?.loadCloudFields({
Expand Down Expand Up @@ -247,19 +261,15 @@
: "There was an error deploying your project. Please contact support."}
/>
{:else if isProjectAvailable}
<RuntimeProvider
instanceId={mockedUserId && mockedUserDeploymentCredentials
? mockedUserDeploymentCredentials.instanceId
: projectData.deployment.runtimeInstanceId}
host={mockedUserId && mockedUserDeploymentCredentials
? mockedUserDeploymentCredentials.runtimeHost
: projectData.deployment.runtimeHost}
jwt={mockedUserId && mockedUserDeploymentCredentials
? mockedUserDeploymentCredentials.accessToken
: projectData.jwt}
{authContext}
>
<slot />
</RuntimeProvider>
{#key `${effectiveHost}::${effectiveInstanceId}`}
<RuntimeProvider
host={effectiveHost}
instanceId={effectiveInstanceId}
jwt={effectiveJwt}
{authContext}
>
<slot />
</RuntimeProvider>
{/key}
{/if}
{/if}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
reportId,
executionTime,
originBaseUrl: window.location.origin,
host: $runtime.host,
},
});
}
Expand Down
1 change: 1 addition & 0 deletions web-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"lint": "prettier --check . && eslint .",
"format": "prettier --write .",
"generate:runtime-client": "svelte-kit sync && orval --config ./orval.config.ts",
"generate:query-hooks": "tsx scripts/generate-query-hooks.ts",
"generate:sveltekit": "svelte-kit sync",
"generate:template-schema": "ts-json-schema-generator --path 'src/features/canvas/components/types.ts' --type TemplateSpec -o ../runtime/parser/data/component-template-v1.json",
"test": "vitest run",
Expand Down
81 changes: 81 additions & 0 deletions web-common/scripts/generate-query-hooks-config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/**
* Classification config for the query hooks code generator.
* Determines whether each RPC method produces a query or mutation hook,
* or should be skipped entirely (streaming methods).
*/

export type MethodClassification = "query" | "mutation" | "skip";

/**
* Per-service overrides. Methods not listed here fall through to the
* service-level default classifier.
*/
export const methodOverrides: Record<
string,
Record<string, MethodClassification>
> = {
QueryService: {
// Semantically write operations
export: "mutation",
exportReport: "mutation",
query: "mutation",
// Streaming
queryBatch: "skip",
},
RuntimeService: {
// Streaming
watchFiles: "skip",
watchLogs: "skip",
watchResources: "skip",
completeStreaming: "skip",
// Explicitly classified as queries (despite not matching Get/List prefix)
issueDevJWT: "query",
analyzeConnectors: "query",
analyzeVariables: "query",
queryResolver: "query",
},
ConnectorService: {
// All methods are queries (no overrides needed)
},
};

/**
* Default classifier for methods not in the override map.
* RuntimeService uses prefix-based classification; other services default to query.
*/
export function classifyMethod(
serviceName: string,
methodName: string,
): MethodClassification {
// Check overrides first
const overrides = methodOverrides[serviceName];
if (overrides && methodName in overrides) {
return overrides[methodName];
}

// Service-specific defaults
if (serviceName === "RuntimeService") {
const queryPrefixes = [
"get",
"list",
"ping",
"health",
"instanceHealth",
];
const lowerMethod = methodName.charAt(0).toLowerCase() + methodName.slice(1);
if (queryPrefixes.some((p) => lowerMethod.startsWith(p))) {
return "query";
}
return "mutation";
}

if (serviceName === "QueryService") {
return "query";
}

if (serviceName === "ConnectorService") {
return "query";
}

return "query";
}
Loading
Loading