Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

config.test.ts

1,282 lines43.8 KB

1// @effect-diagnostics nodeBuiltinImport:off
2import * as NodeChildProcess from "node:child_process";
3import * as NodeEvents from "node:events";
4import * as NodeFS from "node:fs";
5import * as NodeOS from "node:os";
6​
7import { assert, expect, it } from "@effect/vitest";
8import * as ConfigProvider from "effect/ConfigProvider";
9import * as Effect from "effect/Effect";
10import * as FileSystem from "effect/FileSystem";
11import * as Layer from "effect/Layer";
12import * as Option from "effect/Option";
13import * as Path from "effect/Path";
14import * as Redacted from "effect/Redacted";
15import * as Result from "effect/Result";
16import * as Schema from "effect/Schema";
17​
18import {
19 DesktopBackendBootstrap,
20 type DesktopBackendBootstrap as DesktopBackendBootstrapValue,
21} from "@t3tools/contracts";
22import * as NetService from "@t3tools/shared/Net";
23import { DEFAULT_SIGNAL_EXPORT } from "@t3tools/shared/observability";
24import * as OtelEnvironment from "@t3tools/shared/otelEnvironment";
25import * as NodeServices from "@effect/platform-node/NodeServices";
26import { deriveServerPaths } from "../config.ts";
27import { resolveServerConfig } from "./config.ts";
28​
29const deriveExplicitServerPaths = (baseDir: string, devUrl: URL | undefined) =>
30 deriveServerPaths(baseDir, devUrl, { baseDirIsExplicit: true });
31​
32const minimalDesktopFlags = (baseDir: string) => ({
33 mode: Option.some("desktop" as const),
34 port: Option.some(4888),
35 host: Option.none<string>(),
36 baseDir: Option.some(baseDir),
37 cwd: Option.none<string>(),
38 devUrl: Option.none<URL>(),
39 noBrowser: Option.none<boolean>(),
40 bootstrapFd: Option.none<number>(),
41 autoBootstrapProjectFromCwd: Option.none<boolean>(),
42 logWebSocketEvents: Option.none<boolean>(),
43 tailscaleServeEnabled: Option.none<boolean>(),
44 tailscaleServePort: Option.none<number>(),
45});
46​
47const encodeDesktopBootstrap = Schema.encodeEffect(Schema.fromJsonString(DesktopBackendBootstrap));
48const encodeUnknownJson = Schema.encodeEffect(Schema.fromJsonString(Schema.Unknown));
49​
50const makeDesktopBootstrap = (
51 overrides: Partial<DesktopBackendBootstrapValue> = {},
52): DesktopBackendBootstrapValue => ({
53 mode: "desktop",
54 noBrowser: true,
55 port: 4888,
56 t3Home: "/tmp/t3-bootstrap-home",
57 host: "127.0.0.1",
58 desktopBootstrapToken: "desktop-bootstrap-token",
59 tailscaleServeEnabled: false,
60 tailscaleServePort: 443,
61 ...overrides,
62});
63​
64const liveProcess = Effect.acquireRelease(
65 Effect.promise(async () => {
66 const child = NodeChildProcess.spawn(process.execPath, ["-e", "process.stdin.resume()"], {
67 stdio: ["pipe", "ignore", "ignore"],
68 });
69 await NodeEvents.EventEmitter.once(child, "spawn");
70 return child;
71 }),
72 (child) =>
73 Effect.promise(async () => {
74 const exited = NodeEvents.EventEmitter.once(child, "exit");
75 child.kill();
76 await exited;
77 }),
78);
79​
80it.layer(NodeServices.layer)("cli config resolution", (it) => {
81 const defaultObservabilityConfig = {
82 traceMinLevel: "Info",
83 traceTimingEnabled: true,
84 traceBatchWindowMs: 1_000,
85 traceMaxBytes: 10 * 1024 * 1024,
86 traceMaxFiles: 10,
87 otlpTracesUrl: undefined,
88 otlpMetricsUrl: undefined,
89 otlpLogsUrl: undefined,
90 otlpTracesExport: DEFAULT_SIGNAL_EXPORT,
91 otlpMetricsExport: DEFAULT_SIGNAL_EXPORT,
92 otlpLogsExport: DEFAULT_SIGNAL_EXPORT,
93 otelEnvironment: OtelEnvironment.none,
94 devAllowedOrigins: [],
95 } as const;
96​
97 const openBootstrapFd = Effect.fn(function* (payload: DesktopBackendBootstrapValue) {
98 const fs = yield* FileSystem.FileSystem;
99 const filePath = yield* fs.makeTempFileScoped({ prefix: "t3-bootstrap-", suffix: ".ndjson" });
100 const encoded = yield* encodeDesktopBootstrap(payload);
101 yield* fs.writeFileString(filePath, `${encoded}\n`);
102 return yield* Effect.acquireRelease(
103 Effect.sync(() => NodeFS.openSync(filePath, "r")),
104 // Without a /proc or /dev/fd path to reopen, the reader consumes the fd
105 // itself (autoClose), so on Windows it is already closed here.
106 (fd) =>
107 Effect.sync(() => {
108 try {
109 NodeFS.closeSync(fd);
110 } catch (error) {
111 if ((error as NodeJS.ErrnoException).code !== "EBADF") throw error;
112 }
113 }),
114 );
115 });
116​
117 it.effect("keeps stale records and supervised startup out of the manual launch preflight", () =>
118 Effect.gen(function* () {
119 const fs = yield* FileSystem.FileSystem;
120 const path = yield* Path.Path;
121 const root = yield* fs.makeTempDirectoryScoped({ prefix: "t3-cli-preflight-" });
122 const child = yield* liveProcess;
123 assert(child.pid !== undefined);
124 for (const [name, pid, mode, rejectRunningServer] of [
125 ["stale", 2_147_483_647, "web", true],
126 ["own-pid", process.pid, "web", true],
127 ["desktop", child.pid, "desktop", true],
128 ["serve", child.pid, "web", false],
129 ] as const) {
130 const baseDir = path.join(root, name);
131 const stateDir = path.join(baseDir, "userdata");
132 yield* fs.makeDirectory(stateDir, { recursive: true });
133 yield* fs.writeFileString(
134 path.join(stateDir, "server-runtime.json"),
135 yield* encodeUnknownJson({
136 version: 1,
137 pid,
138 port: 3773,
139 origin: "http://127.0.0.1:3773",
140 startedAt: "2026-10-01T00:00:00.000Z",
141 }),
142 );
143 const cwd = path.join(root, `${name}-project`);
144 const configResult = yield* resolveServerConfig(
145 {
146 ...minimalWebFlags(baseDir),
147 mode: Option.some(mode),
148 port: Option.some(8788),
149 cwd: Option.some(cwd),
150 },
151 Option.none(),
152 { rejectRunningServer },
153 ).pipe(
154 Effect.provide(
155 Layer.merge(
156 NetService.layer,
157 ConfigProvider.layer(ConfigProvider.fromEnv({ env: {} })),
158 ),
159 ),
160 Effect.result,
161 );
162 assert(Result.isSuccess(configResult));
163 expect(configResult.success.cwd).toBe(cwd);
164 expect(yield* fs.exists(cwd)).toBe(true);
165 }
166 }),
167 );
168​
169 it.effect(
170 "refuses a manual web launch when a runtime record belongs to another live process",
171 () =>
172 Effect.gen(function* () {
173 const fs = yield* FileSystem.FileSystem;
174 const path = yield* Path.Path;
175 const baseDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-cli-preflight-live-" });
176 const child = yield* liveProcess;
177 assert(child.pid !== undefined);
178 const stateDir = path.join(baseDir, "userdata");
179 yield* fs.makeDirectory(stateDir, { recursive: true });
180 yield* fs.writeFileString(
181 path.join(stateDir, "server-runtime.json"),
182 yield* encodeUnknownJson({
183 version: 1,
184 pid: child.pid,
185 port: 3773,
186 origin: "http://127.0.0.1:3773",
187 startedAt: "2026-10-01T00:00:00.000Z",
188 }),
189 );
190 const cwd = path.join(baseDir, "project");
191 const error = yield* resolveServerConfig(
192 { ...minimalWebFlags(baseDir), cwd: Option.some(cwd) },
193 Option.none(),
194 { rejectRunningServer: true },
195 ).pipe(
196 Effect.provide(
197 Layer.merge(
198 NetService.layer,
199 ConfigProvider.layer(ConfigProvider.fromEnv({ env: {} })),
200 ),
201 ),
202 Effect.flip,
203 );
204 expect(String(error)).toContain("A T3 Code server is already running");
205 expect(String(error)).toContain(`pid ${child.pid}`);
206 expect(yield* fs.exists(cwd)).toBe(false);
207 }),
208 );
209​
210 it.effect("enables a trimmed reusable auth token only for web dev mode", () =>
211 Effect.gen(function* () {
212 const baseDir = yield* FileSystem.FileSystem.pipe(
213 Effect.flatMap((fs) => fs.makeTempDirectoryScoped({ prefix: "t3-cli-dev-auth-" })),
214 );
215 const flags = {
216 mode: Option.some("web" as const),
217 port: Option.some(8788),
218 host: Option.none<string>(),
219 baseDir: Option.some(baseDir),
220 cwd: Option.none<string>(),
221 devUrl: Option.some(new URL("http://127.0.0.1:5173")),
222 noBrowser: Option.none<boolean>(),
223 bootstrapFd: Option.none<number>(),
224 autoBootstrapProjectFromCwd: Option.none<boolean>(),
225 logWebSocketEvents: Option.none<boolean>(),
226 tailscaleServeEnabled: Option.none<boolean>(),
227 tailscaleServePort: Option.none<number>(),
228 };
229 const layerConfig = ConfigProvider.layer(
230 ConfigProvider.fromEnv({
231 env: {
232 T3CODE_DEV_AUTH_TOKEN: " reusable-dev-auth-token-that-is-long-enough ",
233 },
234 }),
235 );
236 const web = yield* resolveServerConfig(flags, Option.none()).pipe(
237 Effect.provide(Layer.mergeAll(layerConfig, NetService.layer)),
238 );
239 const desktop = yield* resolveServerConfig(
240 { ...flags, mode: Option.some("desktop" as const) },
241 Option.none(),
242 ).pipe(Effect.provide(Layer.mergeAll(layerConfig, NetService.layer)));
243​
244 expect(web.devAuthToken).toBeDefined();
245 if (web.devAuthToken === undefined) {
246 return yield* Effect.die("Expected reusable dev auth token.");
247 }
248 expect(Redacted.value(web.devAuthToken)).toBe("reusable-dev-auth-token-that-is-long-enough");
249 expect(desktop.devAuthToken).toBeUndefined();
250 }),
251 );
252​
253 it.effect("does not expose an invalid reusable auth token", () =>
254 Effect.gen(function* () {
255 const secret = "short-secret";
256 const baseDir = yield* FileSystem.FileSystem.pipe(
257 Effect.flatMap((fs) => fs.makeTempDirectoryScoped({ prefix: "t3-cli-dev-auth-invalid-" })),
258 );
259 const flags = {
260 mode: Option.some("web" as const),
261 port: Option.some(8788),
262 host: Option.none<string>(),
263 baseDir: Option.some(baseDir),
264 cwd: Option.none<string>(),
265 devUrl: Option.some(new URL("http://127.0.0.1:5173")),
266 noBrowser: Option.none<boolean>(),
267 bootstrapFd: Option.none<number>(),
268 autoBootstrapProjectFromCwd: Option.none<boolean>(),
269 logWebSocketEvents: Option.none<boolean>(),
270 tailscaleServeEnabled: Option.none<boolean>(),
271 tailscaleServePort: Option.none<number>(),
272 };
273 const layerConfig = ConfigProvider.layer(
274 ConfigProvider.fromEnv({ env: { T3CODE_DEV_AUTH_TOKEN: secret } }),
275 );
276 const error = yield* resolveServerConfig(flags, Option.none()).pipe(
277 Effect.provide(Layer.mergeAll(layerConfig, NetService.layer)),
278 Effect.flip,
279 );
280 const desktop = yield* resolveServerConfig(
281 { ...flags, mode: Option.some("desktop" as const) },
282 Option.none(),
283 ).pipe(Effect.provide(Layer.mergeAll(layerConfig, NetService.layer)));
284 const staticWeb = yield* resolveServerConfig(
285 { ...flags, devUrl: Option.none() },
286 Option.none(),
287 ).pipe(Effect.provide(Layer.mergeAll(layerConfig, NetService.layer)));
288​
289 expect(String(error)).not.toContain(secret);
290 const serialized = yield* encodeUnknownJson(error);
291 expect(serialized).not.toContain(secret);
292 expect(desktop.devAuthToken).toBeUndefined();
293 expect(staticWeb.devAuthToken).toBeUndefined();
294 }),
295 );
296​
297 it.effect("falls back to effect/config values when flags are omitted", () =>
298 Effect.gen(function* () {
299 const { join } = yield* Path.Path;
300 const baseDir = join(NodeOS.tmpdir(), "t3-cli-config-env-base");
301 const derivedPaths = yield* deriveExplicitServerPaths(
302 baseDir,
303 new URL("http://127.0.0.1:5173"),
304 );
305 const resolved = yield* resolveServerConfig(
306 {
307 mode: Option.none(),
308 port: Option.none(),
309 host: Option.none(),
310 baseDir: Option.none(),
311 cwd: Option.none(),
312 devUrl: Option.none(),
313 noBrowser: Option.none(),
314 bootstrapFd: Option.none(),
315 autoBootstrapProjectFromCwd: Option.none(),
316 logWebSocketEvents: Option.none(),
317 tailscaleServeEnabled: Option.none(),
318 tailscaleServePort: Option.none(),
319 },
320 Option.none(),
321 ).pipe(
322 Effect.provide(
323 Layer.mergeAll(
324 ConfigProvider.layer(
325 ConfigProvider.fromEnv({
326 env: {
327 T3CODE_LOG_LEVEL: "Warn",
328 T3CODE_MODE: "desktop",
329 T3CODE_PORT: "4001",
330 T3CODE_HOST: "0.0.0.0",
331 T3CODE_HOME: baseDir,
332 VITE_DEV_SERVER_URL: "http://127.0.0.1:5173",
333 T3CODE_DEV_ALLOWED_ORIGINS:
334 "https://host.example.ts.net, https://phone.example.ts.net ",
335 T3CODE_NO_BROWSER: "true",
336 T3CODE_AUTO_BOOTSTRAP_PROJECT_FROM_CWD: "false",
337 T3CODE_LOG_WS_EVENTS: "true",
338 },
339 }),
340 ),
341 NetService.layer,
342 ),
343 ),
344 );
345​
346 expect(resolved).toEqual({
347 logLevel: "Warn",
348 ...defaultObservabilityConfig,
349 mode: "desktop",
350 port: 4001,
351 cwd: process.cwd(),
352 baseDir,
353 ...derivedPaths,
354 host: "0.0.0.0",
355 staticDir: undefined,
356 devUrl: new URL("http://127.0.0.1:5173"),
357 devAllowedOrigins: ["https://host.example.ts.net", "https://phone.example.ts.net"],
358 noBrowser: true,
359 startupPresentation: "browser",
360 desktopBootstrapToken: undefined,
361 autoBootstrapProjectFromCwd: false,
362 logWebSocketEvents: true,
363 tailscaleServeEnabled: false,
364 tailscaleServePort: 443,
365 });
366 assert.equal(resolved.stateDir, join(baseDir, "userdata"));
367 }),
368 );
369​
370 it.effect("uses CLI flags when provided", () =>
371 Effect.gen(function* () {
372 const { join } = yield* Path.Path;
373 const baseDir = join(NodeOS.tmpdir(), "t3-cli-config-flags-base");
374 const derivedPaths = yield* deriveExplicitServerPaths(
375 baseDir,
376 new URL("http://127.0.0.1:4173"),
377 );
378 const resolved = yield* resolveServerConfig(
379 {
380 mode: Option.some("web"),
381 port: Option.some(8788),
382 host: Option.some("127.0.0.1"),
383 baseDir: Option.some(baseDir),
384 cwd: Option.none(),
385 devUrl: Option.some(new URL("http://127.0.0.1:4173")),
386 noBrowser: Option.some(true),
387 bootstrapFd: Option.none(),
388 autoBootstrapProjectFromCwd: Option.some(true),
389 logWebSocketEvents: Option.some(true),
390 tailscaleServeEnabled: Option.some(true),
391 tailscaleServePort: Option.some(8443),
392 },
393 Option.some("Debug"),
394 ).pipe(
395 Effect.provide(
396 Layer.mergeAll(
397 ConfigProvider.layer(
398 ConfigProvider.fromEnv({
399 env: {
400 T3CODE_LOG_LEVEL: "Warn",
401 T3CODE_MODE: "desktop",
402 T3CODE_PORT: "4001",
403 T3CODE_HOST: "0.0.0.0",
404 T3CODE_HOME: join(NodeOS.tmpdir(), "ignored-base"),
405 VITE_DEV_SERVER_URL: "http://127.0.0.1:5173",
406 T3CODE_NO_BROWSER: "false",
407 T3CODE_AUTO_BOOTSTRAP_PROJECT_FROM_CWD: "false",
408 T3CODE_LOG_WS_EVENTS: "false",
409 },
410 }),
411 ),
412 NetService.layer,
413 ),
414 ),
415 );
416​
417 expect(resolved).toEqual({
418 logLevel: "Debug",
419 ...defaultObservabilityConfig,
420 mode: "web",
421 port: 8788,
422 cwd: process.cwd(),
423 baseDir,
424 ...derivedPaths,
425 host: "127.0.0.1",
426 staticDir: undefined,
427 devUrl: new URL("http://127.0.0.1:4173"),
428 noBrowser: true,
429 startupPresentation: "browser",
430 desktopBootstrapToken: undefined,
431 autoBootstrapProjectFromCwd: true,
432 logWebSocketEvents: true,
433 tailscaleServeEnabled: true,
434 tailscaleServePort: 8443,
435 });
436 assert.equal(resolved.dbPath, join(baseDir, "userdata", "statev2.sqlite"));
437 }),
438 );
439​
440 it.effect("preserves explicit false CLI boolean flags over env and bootstrap values", () =>
441 Effect.gen(function* () {
442 const { join } = yield* Path.Path;
443 const baseDir = join(NodeOS.tmpdir(), "t3-cli-config-false-flags");
444 const fd = yield* openBootstrapFd(
445 makeDesktopBootstrap({
446 noBrowser: true,
447 tailscaleServeEnabled: false,
448 tailscaleServePort: 443,
449 }),
450 );
451 const derivedPaths = yield* deriveExplicitServerPaths(
452 baseDir,
453 new URL("http://127.0.0.1:4173"),
454 );
455​
456 const resolved = yield* resolveServerConfig(
457 {
458 mode: Option.some("web"),
459 port: Option.some(8788),
460 host: Option.some("127.0.0.1"),
461 baseDir: Option.some(baseDir),
462 cwd: Option.none(),
463 devUrl: Option.some(new URL("http://127.0.0.1:4173")),
464 noBrowser: Option.some(false),
465 bootstrapFd: Option.none(),
466 autoBootstrapProjectFromCwd: Option.some(false),
467 logWebSocketEvents: Option.some(false),
468 tailscaleServeEnabled: Option.none(),
469 tailscaleServePort: Option.none(),
470 },
471 Option.none(),
472 ).pipe(
473 Effect.provide(
474 Layer.mergeAll(
475 ConfigProvider.layer(
476 ConfigProvider.fromEnv({
477 env: {
478 T3CODE_BOOTSTRAP_FD: String(fd),
479 T3CODE_NO_BROWSER: "true",
480 T3CODE_AUTO_BOOTSTRAP_PROJECT_FROM_CWD: "true",
481 T3CODE_LOG_WS_EVENTS: "true",
482 },
483 }),
484 ),
485 NetService.layer,
486 ),
487 ),
488 );
489​
490 expect(resolved).toEqual({
491 logLevel: "Info",
492 ...defaultObservabilityConfig,
493 mode: "web",
494 port: 8788,
495 cwd: process.cwd(),
496 baseDir,
497 ...derivedPaths,
498 host: "127.0.0.1",
499 staticDir: undefined,
500 devUrl: new URL("http://127.0.0.1:4173"),
501 noBrowser: false,
502 startupPresentation: "browser",
503 desktopBootstrapToken: "desktop-bootstrap-token",
504 autoBootstrapProjectFromCwd: false,
505 logWebSocketEvents: false,
506 tailscaleServeEnabled: false,
507 tailscaleServePort: 443,
508 });
509 }),
510 );
511​
512 it.effect("uses bootstrap envelope values as fallbacks when flags and env are absent", () =>
513 Effect.gen(function* () {
514 const { join, resolve } = yield* Path.Path;
515 // The resolver absolutises the configured home, so the expectation must
516 // carry the host's drive on Windows.
517 const baseDir = resolve("/tmp/t3-bootstrap-home");
518 const fd = yield* openBootstrapFd(
519 makeDesktopBootstrap({
520 port: 4888,
521 host: "127.0.0.2",
522 t3Home: "/tmp/t3-bootstrap-home",
523 noBrowser: true,
524 desktopBootstrapToken: "desktop-token",
525 desktopTelemetryFd: 4,
526 desktopTelemetryControlFd: 5,
527 tailscaleServeEnabled: false,
528 tailscaleServePort: 443,
529 otlpTracesUrl: "http://localhost:4318/v1/traces",
530 otlpMetricsUrl: "http://localhost:4318/v1/metrics",
531 otlpLogsUrl: "http://localhost:4318/v1/logs",
532 }),
533 );
534 const derivedPaths = yield* deriveServerPaths(baseDir, undefined);
535​
536 const resolved = yield* resolveServerConfig(
537 {
538 mode: Option.none(),
539 port: Option.none(),
540 host: Option.none(),
541 baseDir: Option.none(),
542 cwd: Option.none(),
543 devUrl: Option.none(),
544 noBrowser: Option.none(),
545 bootstrapFd: Option.none(),
546 autoBootstrapProjectFromCwd: Option.none(),
547 logWebSocketEvents: Option.none(),
548 tailscaleServeEnabled: Option.none(),
549 tailscaleServePort: Option.none(),
550 },
551 Option.none(),
552 ).pipe(
553 Effect.provide(
554 Layer.mergeAll(
555 ConfigProvider.layer(
556 ConfigProvider.fromEnv({
557 env: {
558 T3CODE_BOOTSTRAP_FD: String(fd),
559 },
560 }),
561 ),
562 NetService.layer,
563 ),
564 ),
565 );
566​
567 expect(resolved).toEqual({
568 logLevel: "Info",
569 ...defaultObservabilityConfig,
570 otlpTracesUrl: "http://localhost:4318/v1/traces",
571 otlpMetricsUrl: "http://localhost:4318/v1/metrics",
572 otlpLogsUrl: "http://localhost:4318/v1/logs",
573 mode: "desktop",
574 port: 4888,
575 cwd: process.cwd(),
576 baseDir,
577 ...derivedPaths,
578 host: "127.0.0.2",
579 staticDir: resolved.staticDir,
580 devUrl: undefined,
581 noBrowser: true,
582 startupPresentation: "browser",
583 desktopBootstrapToken: "desktop-token",
584 desktopTelemetryFd: 4,
585 desktopTelemetryControlFd: 5,
586 resourceMonitorPath: undefined,
587 autoBootstrapProjectFromCwd: false,
588 logWebSocketEvents: false,
589 tailscaleServeEnabled: false,
590 tailscaleServePort: 443,
591 });
592 assert.equal(join(baseDir, "userdata"), resolved.stateDir);
593 assert.equal(resolved.desktopTelemetryFd, 4);
594 assert.equal(resolved.desktopTelemetryControlFd, 5);
595 }),
596 );
597​
598 it.effect("carries the desktop's shell environment handoff only when the envelope sets it", () =>
599 Effect.gen(function* () {
600 const fs = yield* FileSystem.FileSystem;
601 const baseDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-cli-config-shell-env-" });
602 const resolveWith = Effect.fn(function* (overrides: Partial<DesktopBackendBootstrapValue>) {
603 const fd = yield* openBootstrapFd(makeDesktopBootstrap(overrides));
604 return yield* resolveServerConfig(
605 {
606 ...minimalDesktopFlags(baseDir),
607 bootstrapFd: Option.some(fd),
608 },
609 Option.none(),
610 ).pipe(
611 Effect.provide(
612 Layer.mergeAll(
613 ConfigProvider.layer(ConfigProvider.fromEnv({ env: {} })),
614 NetService.layer,
615 ),
616 ),
617 );
618 });
619​
620 assert.equal((yield* resolveWith({})).shellEnvironmentPrepared, undefined);
621 assert.equal(
622 (yield* resolveWith({ shellEnvironmentPrepared: true })).shellEnvironmentPrepared,
623 true,
624 );
625 }),
626 );
627​
628 it.effect("creates derived runtime directories during config resolution", () =>
629 Effect.gen(function* () {
630 const fs = yield* FileSystem.FileSystem;
631 const path = yield* Path.Path;
632 const baseDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-cli-config-dirs-" });
633 const customCwd = path.join(baseDir, "nested", "project");
634​
635 const resolved = yield* resolveServerConfig(
636 {
637 mode: Option.some("desktop"),
638 port: Option.some(4888),
639 host: Option.none(),
640 baseDir: Option.some(baseDir),
641 cwd: Option.some(customCwd),
642 devUrl: Option.some(new URL("http://127.0.0.1:5173")),
643 noBrowser: Option.none(),
644 bootstrapFd: Option.none(),
645 autoBootstrapProjectFromCwd: Option.none(),
646 logWebSocketEvents: Option.none(),
647 tailscaleServeEnabled: Option.none(),
648 tailscaleServePort: Option.none(),
649 },
650 Option.none(),
651 ).pipe(
652 Effect.provide(
653 Layer.mergeAll(
654 ConfigProvider.layer(ConfigProvider.fromEnv({ env: {} })),
655 NetService.layer,
656 ),
657 ),
658 );
659​
660 for (const directory of [
661 customCwd,
662 resolved.stateDir,
663 resolved.logsDir,
664 resolved.providerLogsDir,
665 resolved.terminalLogsDir,
666 resolved.attachmentsDir,
667 resolved.worktreesDir,
668 path.dirname(resolved.serverTracePath),
669 ]) {
670 expect(yield* fs.exists(directory)).toBe(true);
671 }
672 expect(resolved.cwd).toBe(path.resolve(customCwd));
673 }),
674 );
675​
676 it.effect("applies flag then env precedence over bootstrap envelope values", () =>
677 Effect.gen(function* () {
678 const { join } = yield* Path.Path;
679 const baseDir = join(NodeOS.tmpdir(), "t3-cli-config-env-wins");
680 const fd = yield* openBootstrapFd(
681 makeDesktopBootstrap({
682 port: 4888,
683 host: "127.0.0.2",
684 t3Home: "/tmp/t3-bootstrap-home",
685 noBrowser: false,
686 desktopBootstrapToken: "desktop-token",
687 tailscaleServeEnabled: false,
688 tailscaleServePort: 443,
689 }),
690 );
691 const derivedPaths = yield* deriveExplicitServerPaths(
692 baseDir,
693 new URL("http://127.0.0.1:4173"),
694 );
695​
696 const resolved = yield* resolveServerConfig(
697 {
698 mode: Option.none(),
699 port: Option.some(8788),
700 host: Option.some("127.0.0.1"),
701 baseDir: Option.none(),
702 cwd: Option.none(),
703 devUrl: Option.some(new URL("http://127.0.0.1:4173")),
704 noBrowser: Option.none(),
705 bootstrapFd: Option.none(),
706 autoBootstrapProjectFromCwd: Option.none(),
707 logWebSocketEvents: Option.none(),
708 tailscaleServeEnabled: Option.none(),
709 tailscaleServePort: Option.none(),
710 },
711 Option.some("Debug"),
712 ).pipe(
713 Effect.provide(
714 Layer.mergeAll(
715 ConfigProvider.layer(
716 ConfigProvider.fromEnv({
717 env: {
718 T3CODE_MODE: "web",
719 T3CODE_BOOTSTRAP_FD: String(fd),
720 T3CODE_HOME: baseDir,
721 T3CODE_NO_BROWSER: "true",
722 T3CODE_AUTO_BOOTSTRAP_PROJECT_FROM_CWD: "true",
723 T3CODE_LOG_WS_EVENTS: "true",
724 },
725 }),
726 ),
727 NetService.layer,
728 ),
729 ),
730 );
731​
732 expect(resolved).toEqual({
733 logLevel: "Debug",
734 ...defaultObservabilityConfig,
735 mode: "web",
736 port: 8788,
737 cwd: process.cwd(),
738 baseDir,
739 ...derivedPaths,
740 host: "127.0.0.1",
741 staticDir: undefined,
742 devUrl: new URL("http://127.0.0.1:4173"),
743 noBrowser: true,
744 startupPresentation: "browser",
745 desktopBootstrapToken: "desktop-token",
746 autoBootstrapProjectFromCwd: true,
747 logWebSocketEvents: true,
748 tailscaleServeEnabled: false,
749 tailscaleServePort: 443,
750 });
751 }),
752 );
753​
754 it.effect("falls back to persisted observability settings when env vars are absent", () =>
755 Effect.gen(function* () {
756 const fs = yield* FileSystem.FileSystem;
757 const path = yield* Path.Path;
758 const baseDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-cli-config-settings-" });
759 const derivedPaths = yield* deriveExplicitServerPaths(baseDir, undefined);
760 yield* fs.makeDirectory(path.dirname(derivedPaths.settingsPath), { recursive: true });
761 yield* fs.writeFileString(
762 derivedPaths.settingsPath,
763 `${JSON.stringify({
764 observability: {
765 otlpTracesUrl: "http://localhost:4318/v1/traces",
766 otlpMetricsUrl: "http://localhost:4318/v1/metrics",
767 otlpLogsUrl: "http://localhost:4318/v1/logs",
768 },
769 })}\n`,
770 );
771​
772 const resolved = yield* resolveServerConfig(
773 {
774 mode: Option.some("desktop"),
775 port: Option.some(4888),
776 host: Option.none(),
777 baseDir: Option.some(baseDir),
778 cwd: Option.none(),
779 devUrl: Option.none(),
780 noBrowser: Option.none(),
781 bootstrapFd: Option.none(),
782 autoBootstrapProjectFromCwd: Option.none(),
783 logWebSocketEvents: Option.none(),
784 tailscaleServeEnabled: Option.none(),
785 tailscaleServePort: Option.none(),
786 },
787 Option.none(),
788 ).pipe(
789 Effect.provide(
790 Layer.mergeAll(
791 ConfigProvider.layer(ConfigProvider.fromEnv({ env: {} })),
792 NetService.layer,
793 ),
794 ),
795 );
796​
797 expect(resolved.otlpTracesUrl).toBe("http://localhost:4318/v1/traces");
798 expect(resolved.otlpMetricsUrl).toBe("http://localhost:4318/v1/metrics");
799 expect(resolved.otlpLogsUrl).toBe("http://localhost:4318/v1/logs");
800 expect(resolved).toEqual({
801 logLevel: "Info",
802 ...defaultObservabilityConfig,
803 otlpTracesUrl: "http://localhost:4318/v1/traces",
804 otlpMetricsUrl: "http://localhost:4318/v1/metrics",
805 otlpLogsUrl: "http://localhost:4318/v1/logs",
806 mode: "desktop",
807 port: 4888,
808 cwd: process.cwd(),
809 baseDir,
810 ...derivedPaths,
811 host: "127.0.0.1",
812 staticDir: resolved.staticDir,
813 devUrl: undefined,
814 noBrowser: true,
815 startupPresentation: "browser",
816 desktopBootstrapToken: undefined,
817 autoBootstrapProjectFromCwd: false,
818 logWebSocketEvents: false,
819 tailscaleServeEnabled: false,
820 tailscaleServePort: 443,
821 });
822 }),
823 );
824​
825 it.effect("zeroes an endpoint stored in Settings when the SDK is disabled", () =>
826 Effect.gen(function* () {
827 const fs = yield* FileSystem.FileSystem;
828 const path = yield* Path.Path;
829 const baseDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-cli-config-otel-off-" });
830 const derivedPaths = yield* deriveExplicitServerPaths(baseDir, undefined);
831 yield* fs.makeDirectory(path.dirname(derivedPaths.settingsPath), { recursive: true });
832 yield* fs.writeFileString(
833 derivedPaths.settingsPath,
834 `${JSON.stringify({
835 observability: {
836 otlpTracesUrl: "http://localhost:4318/v1/traces",
837 otlpMetricsUrl: "http://localhost:4318/v1/metrics",
838 otlpLogsUrl: "http://localhost:4318/v1/logs",
839 },
840 })}\n`,
841 );
842​
843 const resolved = yield* resolveServerConfig(
844 {
845 mode: Option.some("desktop"),
846 port: Option.some(4888),
847 host: Option.none(),
848 baseDir: Option.some(baseDir),
849 cwd: Option.none(),
850 devUrl: Option.none(),
851 noBrowser: Option.none(),
852 bootstrapFd: Option.none(),
853 autoBootstrapProjectFromCwd: Option.none(),
854 logWebSocketEvents: Option.none(),
855 tailscaleServeEnabled: Option.none(),
856 tailscaleServePort: Option.none(),
857 },
858 Option.none(),
859 ).pipe(
860 Effect.provide(
861 Layer.mergeAll(
862 ConfigProvider.layer(ConfigProvider.fromEnv({ env: { OTEL_SDK_DISABLED: "true" } })),
863 NetService.layer,
864 ),
865 ),
866 );
867​
868 expect(resolved.otlpTracesUrl).toBeUndefined();
869 expect(resolved.otlpMetricsUrl).toBeUndefined();
870 expect(resolved.otlpLogsUrl).toBeUndefined();
871 expect(resolved.otelEnvironment.disabled).toBe(true);
872 }),
873 );
874​
875 it.effect("lets T3CODE_OTEL_SDK_DISABLED=false override an ambient OTEL_SDK_DISABLED=true", () =>
876 Effect.gen(function* () {
877 const fs = yield* FileSystem.FileSystem;
878 const path = yield* Path.Path;
879 const baseDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-cli-config-otel-on-" });
880 const derivedPaths = yield* deriveExplicitServerPaths(baseDir, undefined);
881 yield* fs.makeDirectory(path.dirname(derivedPaths.settingsPath), { recursive: true });
882 yield* fs.writeFileString(
883 derivedPaths.settingsPath,
884 `${JSON.stringify({
885 observability: {
886 otlpTracesUrl: "http://localhost:4318/v1/traces",
887 },
888 })}\n`,
889 );
890​
891 const resolved = yield* resolveServerConfig(
892 {
893 mode: Option.some("desktop"),
894 port: Option.some(4888),
895 host: Option.none(),
896 baseDir: Option.some(baseDir),
897 cwd: Option.none(),
898 devUrl: Option.none(),
899 noBrowser: Option.none(),
900 bootstrapFd: Option.none(),
901 autoBootstrapProjectFromCwd: Option.none(),
902 logWebSocketEvents: Option.none(),
903 tailscaleServeEnabled: Option.none(),
904 tailscaleServePort: Option.none(),
905 },
906 Option.none(),
907 ).pipe(
908 Effect.provide(
909 Layer.mergeAll(
910 ConfigProvider.layer(
911 ConfigProvider.fromEnv({
912 env: { T3CODE_OTEL_SDK_DISABLED: "false", OTEL_SDK_DISABLED: "true" },
913 }),
914 ),
915 NetService.layer,
916 ),
917 ),
918 );
919​
920 expect(resolved.otelEnvironment.disabled).toBe(false);
921 expect(resolved.otlpTracesUrl).toBe("http://localhost:4318/v1/traces");
922 }),
923 );
924​
925 it.effect("forces noBrowser and disables auto-bootstrap for headless startup presentation", () =>
926 Effect.gen(function* () {
927 const { join } = yield* Path.Path;
928 const baseDir = join(NodeOS.tmpdir(), "t3-cli-config-headless-base");
929 const derivedPaths = yield* deriveExplicitServerPaths(baseDir, undefined);
930​
931 const resolved = yield* resolveServerConfig(
932 {
933 mode: Option.some("web"),
934 port: Option.some(3773),
935 host: Option.none(),
936 baseDir: Option.some(baseDir),
937 cwd: Option.none(),
938 devUrl: Option.none(),
939 noBrowser: Option.none(),
940 bootstrapFd: Option.none(),
941 autoBootstrapProjectFromCwd: Option.none(),
942 logWebSocketEvents: Option.none(),
943 tailscaleServeEnabled: Option.none(),
944 tailscaleServePort: Option.none(),
945 },
946 Option.none(),
947 {
948 startupPresentation: "headless",
949 },
950 ).pipe(
951 Effect.provide(
952 Layer.mergeAll(
953 ConfigProvider.layer(
954 ConfigProvider.fromEnv({
955 env: {
956 T3CODE_NO_BROWSER: "false",
957 T3CODE_AUTO_BOOTSTRAP_PROJECT_FROM_CWD: "true",
958 },
959 }),
960 ),
961 NetService.layer,
962 ),
963 ),
964 );
965​
966 expect(resolved).toEqual({
967 logLevel: "Info",
968 ...defaultObservabilityConfig,
969 mode: "web",
970 port: 3773,
971 cwd: process.cwd(),
972 baseDir,
973 ...derivedPaths,
974 host: undefined,
975 staticDir: resolved.staticDir,
976 devUrl: undefined,
977 noBrowser: true,
978 startupPresentation: "headless",
979 desktopBootstrapToken: undefined,
980 autoBootstrapProjectFromCwd: false,
981 logWebSocketEvents: false,
982 tailscaleServeEnabled: false,
983 tailscaleServePort: 443,
984 });
985 }),
986 );
987​
988 it.effect("decodes percent-encoded OTLP headers from env", () =>
989 Effect.gen(function* () {
990 const { join } = yield* Path.Path;
991 const baseDir = join(NodeOS.tmpdir(), "t3-cli-config-otlp-headers-base");
992​
993 const resolved = yield* resolveServerConfig(
994 {
995 mode: Option.some("web"),
996 port: Option.some(3773),
997 host: Option.none(),
998 baseDir: Option.some(baseDir),
999 cwd: Option.none(),
1000 devUrl: Option.none(),
1001 noBrowser: Option.none(),
1002 bootstrapFd: Option.none(),
1003 autoBootstrapProjectFromCwd: Option.none(),
1004 logWebSocketEvents: Option.none(),
1005 tailscaleServeEnabled: Option.none(),
1006 tailscaleServePort: Option.none(),
1007 },
1008 Option.none(),
1009 ).pipe(
1010 Effect.provide(
1011 Layer.mergeAll(
1012 ConfigProvider.layer(
1013 ConfigProvider.fromEnv({
1014 env: {
1015 T3CODE_OTLP_HEADERS: "authorization=Basic%20abc%3D%3D,x-tenant=t3",
1016 },
1017 }),
1018 ),
1019 NetService.layer,
1020 ),
1021 ),
1022 );
1023​
1024 expect(resolved.otlpTracesExport.headers).toEqual({
1025 authorization: "Basic abc==",
1026 "x-tenant": "t3",
1027 });
1028 }),
1029 );
1030​
1031 it.effect("keeps whitespace-separated pairs and literal equals signs in OTLP headers", () =>
1032 Effect.gen(function* () {
1033 const { join } = yield* Path.Path;
1034 const baseDir = join(NodeOS.tmpdir(), "t3-cli-config-otlp-headers-loose-base");
1035​
1036 const resolved = yield* resolveServerConfig(
1038 mode: Option.some("web"),
1039 port: Option.some(3773),
1040 host: Option.none(),
1041 baseDir: Option.some(baseDir),
1042 cwd: Option.none(),
1043 devUrl: Option.none(),
1044 noBrowser: Option.none(),
1045 bootstrapFd: Option.none(),
1046 autoBootstrapProjectFromCwd: Option.none(),
1047 logWebSocketEvents: Option.none(),
1048 tailscaleServeEnabled: Option.none(),
1049 tailscaleServePort: Option.none(),
1050 },
1051 Option.none(),
1052 ).pipe(
1053 Effect.provide(
1054 Layer.mergeAll(
1055 ConfigProvider.layer(
1056 ConfigProvider.fromEnv({
1057 env: {
1058 T3CODE_OTLP_HEADERS: "authorization=Bearer abc==, x-tenant=t3",
1059 T3CODE_OTLP_TRACES_URL: "http://collector.internal:4318",
1060 },
1061 }),
1062 ),
1063 NetService.layer,
1064 ),
1065 ),
1066 );
1067​
1068 expect(resolved.otlpTracesExport.headers).toEqual({
1069 authorization: "Bearer abc==",
1070 "x-tenant": "t3",
1071 });
1072 expect(resolved.otlpTracesUrl).toBe("http://collector.internal:4318");
1073 }),
1074 );
1075​
1076 it.effect("gives every signal the protocol named without one", () =>
1077 Effect.gen(function* () {
1078 const { join } = yield* Path.Path;
1079 const baseDir = join(NodeOS.tmpdir(), "t3-cli-config-otlp-protocol-base");
1080​
1081 const resolved = yield* resolveServerConfig(
1083 mode: Option.some("web"),
1084 port: Option.some(3773),
1085 host: Option.none(),
1086 baseDir: Option.some(baseDir),
1087 cwd: Option.none(),
1088 devUrl: Option.none(),
1089 noBrowser: Option.none(),
1090 bootstrapFd: Option.none(),
1091 autoBootstrapProjectFromCwd: Option.none(),
1092 logWebSocketEvents: Option.none(),
1093 tailscaleServeEnabled: Option.none(),
1094 tailscaleServePort: Option.none(),
1095 },
1096 Option.none(),
1097 ).pipe(
1098 Effect.provide(
1099 Layer.mergeAll(
1100 ConfigProvider.layer(
1101 ConfigProvider.fromEnv({ env: { T3CODE_OTLP_PROTOCOL: "http/protobuf" } }),
1102 ),
1103 NetService.layer,
1104 ),
1105 ),
1106 );
1107​
1108 expect([
1109 resolved.otlpTracesExport.protocol,
1110 resolved.otlpMetricsExport.protocol,
1111 resolved.otlpLogsExport.protocol,
1112 ]).toEqual(["http/protobuf", "http/protobuf", "http/protobuf"]);
1113 }),
1114 );
1115​
1116 it.effect("reads the OTLP logs URL from env", () =>
1117 Effect.gen(function* () {
1118 const { join } = yield* Path.Path;
1119 const baseDir = join(NodeOS.tmpdir(), "t3-cli-config-otlp-logs-url-base");
1120​
1121 const resolved = yield* resolveServerConfig(
1123 mode: Option.some("web"),
1124 port: Option.some(3773),
1125 host: Option.none(),
1126 baseDir: Option.some(baseDir),
1127 cwd: Option.none(),
1128 devUrl: Option.none(),
1129 noBrowser: Option.none(),
1130 bootstrapFd: Option.none(),
1131 autoBootstrapProjectFromCwd: Option.none(),
1132 logWebSocketEvents: Option.none(),
1133 tailscaleServeEnabled: Option.none(),
1134 tailscaleServePort: Option.none(),
1135 },
1136 Option.none(),
1137 ).pipe(
1138 Effect.provide(
1139 Layer.mergeAll(
1140 ConfigProvider.layer(
1141 ConfigProvider.fromEnv({
1142 env: { T3CODE_OTLP_LOGS_URL: "http://collector.internal:4318/v1/logs" },
1143 }),
1144 ),
1145 NetService.layer,
1146 ),
1147 ),
1148 );
1149​
1150 expect(resolved.otlpLogsUrl).toBe("http://collector.internal:4318/v1/logs");
1151 }),
1152 );
1153​
1154 const minimalWebFlags = (baseDir: string) => ({
1155 mode: Option.some("web" as const),
1156 port: Option.some(3773),
1157 host: Option.none<string>(),
1158 baseDir: Option.some(baseDir),
1159 cwd: Option.none<string>(),
1160 devUrl: Option.none<URL>(),
1161 noBrowser: Option.none<boolean>(),
1162 bootstrapFd: Option.none<number>(),
1163 autoBootstrapProjectFromCwd: Option.none<boolean>(),
1164 logWebSocketEvents: Option.none<boolean>(),
1165 tailscaleServeEnabled: Option.none<boolean>(),
1166 tailscaleServePort: Option.none<number>(),
1167 });
1168​
1169 it.effect(
1170 "resolves each signal's endpoint through T3CODE_OTLP_*_URL, an OTEL endpoint, the bootstrap envelope, and persisted Settings, in that order",
1171 () =>
1172 Effect.gen(function* () {
1173 const fs = yield* FileSystem.FileSystem;
1174 const path = yield* Path.Path;
1175 const baseDir = yield* fs.makeTempDirectoryScoped({
1176 prefix: "t3-cli-config-otel-precedence-",
1177 });
1178 const derivedPaths = yield* deriveExplicitServerPaths(baseDir, undefined);
1179 yield* fs.makeDirectory(path.dirname(derivedPaths.settingsPath), { recursive: true });
1180 yield* fs.writeFileString(
1181 derivedPaths.settingsPath,
1182 `${JSON.stringify({ observability: { otlpLogsUrl: "http://settings:4318/v1/logs" } })}\n`,
1183 );
1184​
1185 const fd = yield* openBootstrapFd(
1186 makeDesktopBootstrap({
1187 otlpMetricsUrl: "http://bootstrap:4318/v1/metrics",
1188 otlpLogsUrl: "",
1189 }),
1190 );
1191​
1192 const resolved = yield* resolveServerConfig(
1194 ...minimalWebFlags(baseDir),
1195 mode: Option.some("desktop"),
1196 port: Option.some(4888),
1197 bootstrapFd: Option.some(fd),
1198 },
1199 Option.none(),
1200 ).pipe(
1201 Effect.provide(
1202 Layer.mergeAll(
1203 ConfigProvider.layer(
1204 ConfigProvider.fromEnv({
1205 env: {
1206 T3CODE_OTLP_TRACES_URL: "http://t3:4318/v1/traces",
1207 T3CODE_OTLP_HEADERS: "x-key=secret",
1208 OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: "http://otel-traces:4318/custom",
1209 OTEL_EXPORTER_OTLP_METRICS_ENDPOINT: "http://otel-metrics:4318/custom",
1210 OTEL_EXPORTER_OTLP_HEADERS: "x-key=otel",
1211 },
1212 }),
1213 ),
1214 NetService.layer,
1215 ),
1216 ),
1217 );
1218​
1219 expect(resolved.otlpTracesUrl).toBe("http://t3:4318/v1/traces");
1220 expect(resolved.otlpTracesExport.headers).toEqual({ "x-key": "secret" });
1221 expect(resolved.otlpMetricsUrl).toBe("http://otel-metrics:4318/custom");
1222 expect(resolved.otlpMetricsExport).toEqual({
1223 ...DEFAULT_SIGNAL_EXPORT,
1224 protocol: "http/protobuf",
1225 headers: { "x-key": "otel" },
1226 });
1227 expect(resolved.otlpLogsUrl).toBe("http://settings:4318/v1/logs");
1228 expect(resolved.otlpLogsExport.headers).toEqual({ "x-key": "secret" });
1229 }),
1230 );
1231​
1232 it.effect(
1233 "exports nothing for a signal an OTEL endpoint claimed with a protocol or headers that do not read",
1234 () =>
1235 Effect.gen(function* () {
1236 const fs = yield* FileSystem.FileSystem;
1237 const path = yield* Path.Path;
1238 const baseDir = yield* fs.makeTempDirectoryScoped({
1239 prefix: "t3-cli-config-otel-off-",
1240 });
1241 const derivedPaths = yield* deriveExplicitServerPaths(baseDir, undefined);
1242 yield* fs.makeDirectory(path.dirname(derivedPaths.settingsPath), { recursive: true });
1243 yield* fs.writeFileString(
1244 derivedPaths.settingsPath,
1245 `${JSON.stringify({ observability: { otlpLogsUrl: "http://settings:4318/v1/logs" } })}\n`,
1246 );
1247​
1248 const fd = yield* openBootstrapFd(
1249 makeDesktopBootstrap({ otlpMetricsUrl: "http://bootstrap:4318/v1/metrics" }),
1250 );
1251​
1252 const resolved = yield* resolveServerConfig(
1254 ...minimalWebFlags(baseDir),
1255 mode: Option.some("desktop"),
1256 port: Option.some(4888),
1257 bootstrapFd: Option.some(fd),
1258 },
1259 Option.none(),
1260 ).pipe(
1261 Effect.provide(
1262 Layer.mergeAll(
1263 ConfigProvider.layer(
1264 ConfigProvider.fromEnv({
1265 env: {
1266 T3CODE_OTLP_TRACES_URL: "http://t3:4318/v1/traces",
1267 OTEL_EXPORTER_OTLP_ENDPOINT: "http://otel:4318",
1268 OTEL_EXPORTER_OTLP_HEADERS: "x-key=%zz",
1269 },
1270 }),
1271 ),
1272 NetService.layer,
1273 ),
1274 ),
1275 );
1276​
1277 expect(resolved.otlpTracesUrl).toBe("http://t3:4318/v1/traces");
1278 expect(resolved.otlpMetricsUrl).toBeUndefined();
1279 expect(resolved.otlpLogsUrl).toBeUndefined();
1280 }),
1281 );
1282});