@marimo-team/frontend 0.25.2-dev121 → 0.25.2-dev122

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/frontend",
3
- "version": "0.25.2-dev121",
3
+ "version": "0.25.2-dev122",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -10,6 +10,7 @@ import {
10
10
  import { Provider } from "jotai";
11
11
  import type React from "react";
12
12
  import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
13
+ import { requestId } from "@/__tests__/branded";
13
14
  import { MockRequestClient } from "@/__mocks__/requests";
14
15
  import { ModalProvider } from "@/components/modal/ImperativeModal";
15
16
  import { TooltipProvider } from "@/components/ui/tooltip";
@@ -129,7 +130,7 @@ describe("NotebookMenuDropdown", () => {
129
130
  }));
130
131
  invalidateDataSourceDiscovery();
131
132
  vi.spyOn(DiscoverDataSources, "request").mockResolvedValue({
132
- request_id: "request-id",
133
+ request_id: requestId("request-id"),
133
134
  sources: [],
134
135
  });
135
136
  });
@@ -142,7 +143,7 @@ describe("NotebookMenuDropdown", () => {
142
143
 
143
144
  it("shows detected databases in the add connection submenu", async () => {
144
145
  vi.mocked(DiscoverDataSources.request).mockResolvedValue({
145
- request_id: "request-id",
146
+ request_id: requestId("request-id"),
146
147
  sources: [POSTGRES_SOURCE],
147
148
  });
148
149
 
@@ -172,7 +173,7 @@ describe("NotebookMenuDropdown", () => {
172
173
 
173
174
  it("shows detected storage in the add remote storage submenu", async () => {
174
175
  vi.mocked(DiscoverDataSources.request).mockResolvedValue({
175
- request_id: "request-id",
176
+ request_id: requestId("request-id"),
176
177
  sources: [S3_SOURCE],
177
178
  });
178
179
 
@@ -2,6 +2,7 @@
2
2
 
3
3
  import { render, screen } from "@testing-library/react";
4
4
  import { afterEach, describe, expect, it, vi } from "vitest";
5
+ import { requestId } from "@/__tests__/branded";
5
6
  import { TooltipProvider } from "@/components/ui/tooltip";
6
7
  import { DownloadStorage } from "@/core/storage/request-registry";
7
8
  import { StorageFileViewer } from "../storage-file-viewer";
@@ -41,7 +42,7 @@ describe("StorageFileViewer", () => {
41
42
 
42
43
  it("renders TOML from generic storage metadata as read-only TOML", async () => {
43
44
  const request = vi.spyOn(DownloadStorage, "request").mockResolvedValue({
44
- request_id: "request-id",
45
+ request_id: requestId("request-id"),
45
46
  url: "https://example.com/pyproject.toml?signature=secret",
46
47
  });
47
48
  vi.stubGlobal(
@@ -8,6 +8,7 @@ import { EditorState, type Extension } from "@codemirror/state";
8
8
  import { EditorView } from "@codemirror/view";
9
9
  import { DuckDBDialect } from "@marimo-team/codemirror-sql/dialects";
10
10
  import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
11
+ import { requestId } from "@/__tests__/branded";
11
12
  import type { CellId } from "@/core/cells/ids";
12
13
  import type {
13
14
  CompletionConfig,
@@ -1106,7 +1107,7 @@ describe("CustomSqlParser", () => {
1106
1107
  const request = vi.spyOn(ValidateSQL, "request").mockResolvedValue({
1107
1108
  error: null,
1108
1109
  parse_result: { success: false, errors: [error] },
1109
- request_id: "request-id",
1110
+ request_id: requestId("request-id"),
1110
1111
  validate_result: null,
1111
1112
  });
1112
1113
  const state = EditorState.create({
@@ -1150,7 +1151,7 @@ describe("CustomSqlParser", () => {
1150
1151
  vi.spyOn(ValidateSQL, "request").mockResolvedValue({
1151
1152
  error: null,
1152
1153
  parse_result: { success: false, errors: [error] },
1153
- request_id: "request-id",
1154
+ request_id: requestId("request-id"),
1154
1155
  validate_result: null,
1155
1156
  });
1156
1157
  const state = EditorState.create({
@@ -1194,7 +1195,7 @@ describe("CustomSqlParser", () => {
1194
1195
  const request = vi.spyOn(ValidateSQL, "request").mockResolvedValue({
1195
1196
  error: null,
1196
1197
  parse_result: { success: false, errors: [error] },
1197
- request_id: "request-id",
1198
+ request_id: requestId("request-id"),
1198
1199
  validate_result: null,
1199
1200
  });
1200
1201
  const state = createNamedConnectionState({
@@ -1,5 +1,7 @@
1
1
  /* Copyright 2026 Marimo. All rights reserved. */
2
2
  import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
3
+ import { requestId } from "@/__tests__/branded";
4
+ import type { DataSourceDiscoveryResult } from "@/core/kernel/messages";
3
5
  import { connectionAtom } from "@/core/network/connection";
4
6
  import { store } from "@/core/state/jotai";
5
7
  import { ConnectionState } from "@/core/websocket/types";
@@ -41,7 +43,7 @@ describe("fetchDataSourceDiscovery", () => {
41
43
  it("shares a single in-flight request across concurrent callers", async () => {
42
44
  const request = vi
43
45
  .spyOn(DiscoverDataSources, "request")
44
- .mockResolvedValue({ request_id: "request-id", sources: [] });
46
+ .mockResolvedValue({ request_id: requestId("request-id"), sources: [] });
45
47
 
46
48
  await Promise.all([
47
49
  fetchDataSourceDiscovery(),
@@ -55,7 +57,7 @@ describe("fetchDataSourceDiscovery", () => {
55
57
  it("re-runs discovery after the cache is invalidated", async () => {
56
58
  const request = vi
57
59
  .spyOn(DiscoverDataSources, "request")
58
- .mockResolvedValue({ request_id: "request-id", sources: [] });
60
+ .mockResolvedValue({ request_id: requestId("request-id"), sources: [] });
59
61
 
60
62
  await fetchDataSourceDiscovery();
61
63
  invalidateDataSourceDiscovery();
@@ -68,7 +70,10 @@ describe("fetchDataSourceDiscovery", () => {
68
70
  const request = vi
69
71
  .spyOn(DiscoverDataSources, "request")
70
72
  .mockRejectedValueOnce(new Error("boom"))
71
- .mockResolvedValueOnce({ request_id: "request-id", sources: [] });
73
+ .mockResolvedValueOnce({
74
+ request_id: requestId("request-id"),
75
+ sources: [],
76
+ });
72
77
 
73
78
  await expect(fetchDataSourceDiscovery()).rejects.toThrow("boom");
74
79
  await expect(fetchDataSourceDiscovery()).resolves.toEqual([]);
@@ -77,16 +82,18 @@ describe("fetchDataSourceDiscovery", () => {
77
82
 
78
83
  it("does not clear a newer cache entry when an invalidated request fails", async () => {
79
84
  let rejectFirstRequest: ((error: Error) => void) | undefined;
80
- const firstRequest = new Promise<{
81
- request_id: string;
82
- sources: DetectedDataSource[];
83
- }>((_resolve, reject) => {
84
- rejectFirstRequest = reject;
85
- });
85
+ const firstRequest = new Promise<DataSourceDiscoveryResult>(
86
+ (_resolve, reject) => {
87
+ rejectFirstRequest = reject;
88
+ },
89
+ );
86
90
  const request = vi
87
91
  .spyOn(DiscoverDataSources, "request")
88
92
  .mockReturnValueOnce(firstRequest)
89
- .mockResolvedValueOnce({ request_id: "request-id", sources: [] });
93
+ .mockResolvedValueOnce({
94
+ request_id: requestId("request-id"),
95
+ sources: [],
96
+ });
90
97
 
91
98
  const staleResult = fetchDataSourceDiscovery().catch((error) => error);
92
99
  await vi.waitFor(() => expect(request).toHaveBeenCalledTimes(1));
@@ -116,7 +123,7 @@ describe("fetchDataSourceDiscovery", () => {
116
123
  }),
117
124
  ];
118
125
  vi.spyOn(DiscoverDataSources, "request").mockResolvedValue({
119
- request_id: "request-id",
126
+ request_id: requestId("request-id"),
120
127
  sources,
121
128
  });
122
129
 
@@ -7,7 +7,7 @@ import { throwNotImplemented } from "@/utils/functions";
7
7
  import { Logger } from "@/utils/Logger";
8
8
  import { generateUUID } from "@/utils/uuid";
9
9
  import { initialNotebookState, notebookAtom } from "../cells/cells";
10
- import type { CommandMessage } from "../kernel/messages";
10
+ import type { ClientCommand } from "../kernel/messages";
11
11
  import type { EditRequests, RunRequests } from "../network/types";
12
12
  import { store as defaultStore } from "../state/jotai";
13
13
  import { getMarimoExportContext } from "../static/export-context";
@@ -392,7 +392,7 @@ export class IslandsPyodideBridge implements RunRequests, EditRequests {
392
392
  // The kernel uses msgspec to parse control requests, which requires a 'type'
393
393
  // field for discriminated union deserialization.
394
394
  private async putControlRequest(
395
- operation: CommandMessage,
395
+ operation: ClientCommand,
396
396
  session?: AppSession,
397
397
  ): Promise<void> {
398
398
  session ??= await this.getActiveSession();
@@ -55,7 +55,7 @@ export type Capabilities =
55
55
  export type CacheInfoFetched = NotificationMessageData<"cache-info">;
56
56
 
57
57
  export type NotificationMessage = schemas["KnownUnions"]["notification"];
58
- export type CommandMessage = schemas["KnownUnions"]["command"];
58
+ export type ClientCommand = schemas["KnownUnions"]["command"];
59
59
 
60
60
  export type NotificationMessageType = NotificationMessage["op"];
61
61
  export interface NotificationPayload {
@@ -11,7 +11,7 @@ import { reloadSafe } from "@/utils/reload-safe";
11
11
  import { generateUUID } from "@/utils/uuid";
12
12
  import { createModuleWorker } from "@/utils/worker";
13
13
  import { notebookIsRunningAtom } from "../cells/cells";
14
- import type { CommandMessage } from "../kernel/messages";
14
+ import type { ClientCommand } from "../kernel/messages";
15
15
  import { getInitialAppMode } from "../mode";
16
16
  import { API } from "../network/api";
17
17
  import { withDevAssetUrl } from "../network/export-asset-url";
@@ -711,7 +711,7 @@ export class PyodideBridge implements RunRequests, EditRequests {
711
711
  public listStorageEntries = throwNotImplemented;
712
712
  public downloadStorage = throwNotImplemented;
713
713
 
714
- private async putControlRequest(operation: CommandMessage) {
714
+ private async putControlRequest(operation: ClientCommand) {
715
715
  await this.rpc.proxy.request.bridge({
716
716
  functionName: "put_control_request",
717
717
  payload: operation,
@@ -3,7 +3,7 @@ import type { PyodideInterface } from "pyodide";
3
3
  import type { WasmRuntimeConfig } from "../runtime-config";
4
4
  import type { UserConfig } from "@/core/config/config-schema";
5
5
  import type {
6
- CommandMessage,
6
+ ClientCommand,
7
7
  NotificationPayload,
8
8
  } from "@/core/kernel/messages";
9
9
  import type { JsonString } from "@/utils/json/base64";
@@ -74,7 +74,7 @@ export interface WasmController {
74
74
  }
75
75
 
76
76
  export interface RawBridge {
77
- put_control_request(operation: CommandMessage): Promise<string>;
77
+ put_control_request(operation: ClientCommand): Promise<string>;
78
78
  put_input(input: string): Promise<string>;
79
79
  code_complete(request: CodeCompletionRequest): Promise<string>;
80
80
  read_code(): Promise<{ contents: string }>;