From 04ce36d575d96c1631d629cb176b40dac280f9be Mon Sep 17 00:00:00 2001 From: dirtydishes Date: Thu, 21 May 2026 09:07:22 -0400 Subject: [PATCH] fix(types): normalize sibling imports for next build --- ...26-05-21-fix-types-imports-next-build.html | 234 ++++++++++++++++++ packages/types/src/desktop-ai.ts | 4 +- packages/types/src/events.ts | 2 +- packages/types/src/index.ts | 12 +- packages/types/src/live.ts | 4 +- packages/types/src/options-flow.ts | 2 +- packages/types/src/synthetic-market.ts | 6 +- 7 files changed, 249 insertions(+), 15 deletions(-) create mode 100644 docs/turns/2026-05-21-fix-types-imports-next-build.html diff --git a/docs/turns/2026-05-21-fix-types-imports-next-build.html b/docs/turns/2026-05-21-fix-types-imports-next-build.html new file mode 100644 index 0000000..691e196 --- /dev/null +++ b/docs/turns/2026-05-21-fix-types-imports-next-build.html @@ -0,0 +1,234 @@ + + + + + + Fix packages/types imports for Next build + + + +
+
+
Turn Document · 2026-05-21 · islandflow-c8f
+

Fix shared type imports for Next build

+

+ Resolved the web production build failure on the Electron/Codex branch by normalizing + sibling imports in packages/types/src. The fix keeps the change surface + narrow: only TypeScript module specifiers changed, with no runtime contract updates. +

+
+ +
+

Summary

+

+ The shared type package was exporting and importing local files with explicit + .ts suffixes. Next 16 type-checking rejected that layout during + bun --cwd=apps/web run build. This turn removed those suffixes across the + affected files and verified that the web production build now completes successfully. +

+
+ +
+

Changes Made

+
    +
  • Updated packages/types/src/index.ts to re-export sibling modules without explicit .ts suffixes.
  • +
  • Updated sibling imports in desktop-ai.ts, events.ts, live.ts, options-flow.ts, and synthetic-market.ts.
  • +
  • Left all schemas, exported names, and runtime behavior unchanged.
  • +
  • Added this turn document under docs/turns/.
  • +
+
+ +
+

Context

+

+ Recent Electron/Codex work introduced a new packages/types/src/desktop-ai.ts + surface and switched the package to source-based workspace exports. That was compatible + with the desktop runtime path, but the web production build still runs under Next's + stricter TypeScript pipeline, which flagged the explicit .ts sibling imports. +

+
+ +
+

Important Implementation Details

+
    +
  • The fix intentionally stops at module specifiers; it does not alter package exports, tsconfig flags, or build tooling.
  • +
  • This keeps the desktop branch behavior stable while making the source package consumable by Next's type-checking rules.
  • +
  • The check for remaining explicit local .ts imports in packages/types/src now returns no matches.
  • +
+
+ +
+

Relevant Diff Snippets

+

+ Snippets below use unified diff formatting compatible with tools documented by + diffs.com. +

+
diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts
+-export * from "./events.ts";
+-export * from "./live.ts";
+-export * from "./options-flow.ts";
++export * from "./events";
++export * from "./live";
++export * from "./options-flow";
+
diff --git a/packages/types/src/desktop-ai.ts b/packages/types/src/desktop-ai.ts
+-} from "./events.ts";
+-import { OptionFlowFiltersSchema } from "./options-flow.ts";
++} from "./events";
++import { OptionFlowFiltersSchema } from "./options-flow";
+
+ +
+

Expected Impact for End-Users

+

+ The Electron/Codex branch can now produce a successful web build again, which unblocks + shipping and testing of the desktop AI settings and Copilot surfaces without a separate + manual tsconfig workaround. +

+
+ +
+

Validation

+
    +
  • rg -n "from "\\./.*\\.ts"|from '\\./.*\\.ts'|export \\* from "\\./.*\\.ts"|export \\* from '\\./.*\\.ts'" packages/types/src returned no matches after the patch.
  • +
  • bun test packages/types/tests passed: 12 tests, 0 failures.
  • +
  • bun install completed successfully in this worktree so the web build could run.
  • +
  • bun --cwd=apps/web run build completed successfully on Next 16.2.6.
  • +
+
+ +
+

Issues, Limitations, and Mitigations

+
    +
  • This fix is scoped to the current source import strategy. If the package later moves to compiled output exports, the import policy should be revisited deliberately.
  • +
  • The original failure was branch-specific, so validation was performed on lavender/codex-login-management-electron rather than main.
  • +
+
+ +
+

Follow-up Work

+
    +
  • Consider adding a lightweight lint or script check that rejects new explicit sibling .ts imports in packages/types/src.
  • +
  • No additional product follow-up is required for islandflow-c8f once this branch is reviewed and merged.
  • +
+
+
+ + diff --git a/packages/types/src/desktop-ai.ts b/packages/types/src/desktop-ai.ts index ecec773..c3e8e9a 100644 --- a/packages/types/src/desktop-ai.ts +++ b/packages/types/src/desktop-ai.ts @@ -5,8 +5,8 @@ import { FlowPacketSchema, OptionPrintSchema, SmartMoneyEventSchema -} from "./events.ts"; -import { OptionFlowFiltersSchema } from "./options-flow.ts"; +} from "./events"; +import { OptionFlowFiltersSchema } from "./options-flow"; export const IslandflowAiReasoningEffortSchema = z.enum([ "none", diff --git a/packages/types/src/events.ts b/packages/types/src/events.ts index b61e88e..0556bd8 100644 --- a/packages/types/src/events.ts +++ b/packages/types/src/events.ts @@ -1,5 +1,5 @@ import { z } from "zod"; -import { OptionNbboSideSchema, OptionTypeSchema, OptionsSignalModeSchema } from "./options-flow.ts"; +import { OptionNbboSideSchema, OptionTypeSchema, OptionsSignalModeSchema } from "./options-flow"; export const EventMetaSchema = z.object({ source_ts: z.number().int().nonnegative(), diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts index 22b60bc..2e01011 100644 --- a/packages/types/src/index.ts +++ b/packages/types/src/index.ts @@ -1,6 +1,6 @@ -export * from "./events.ts"; -export * from "./live.ts"; -export * from "./options-flow.ts"; -export * from "./sp500.ts"; -export * from "./synthetic-market.ts"; -export * from "./desktop-ai.ts"; +export * from "./events"; +export * from "./live"; +export * from "./options-flow"; +export * from "./sp500"; +export * from "./synthetic-market"; +export * from "./desktop-ai"; diff --git a/packages/types/src/live.ts b/packages/types/src/live.ts index 9b60c34..10ac486 100644 --- a/packages/types/src/live.ts +++ b/packages/types/src/live.ts @@ -12,11 +12,11 @@ import { OptionNBBOSchema, OptionPrintSchema, SmartMoneyEventSchema -} from "./events.ts"; +} from "./events"; import { OptionFlowFiltersSchema, optionFlowFilterKey -} from "./options-flow.ts"; +} from "./options-flow"; export const CursorSchema = z.object({ ts: z.number().int().nonnegative(), diff --git a/packages/types/src/options-flow.ts b/packages/types/src/options-flow.ts index 0530ffd..75dd581 100644 --- a/packages/types/src/options-flow.ts +++ b/packages/types/src/options-flow.ts @@ -1,5 +1,5 @@ import { z } from "zod"; -import type { FlowPacket, OptionNBBO, OptionPrint } from "./events.ts"; +import type { FlowPacket, OptionNBBO, OptionPrint } from "./events"; export const SyntheticMarketModeSchema = z.enum(["realistic", "active", "firehose"]); export type SyntheticMarketMode = z.infer; diff --git a/packages/types/src/synthetic-market.ts b/packages/types/src/synthetic-market.ts index c46036b..ea30c86 100644 --- a/packages/types/src/synthetic-market.ts +++ b/packages/types/src/synthetic-market.ts @@ -1,7 +1,7 @@ import { z } from "zod"; -import type { SmartMoneyProfileId } from "./events.ts"; -import type { SyntheticMarketMode } from "./options-flow.ts"; -import { SP500_SYMBOLS } from "./sp500.ts"; +import type { SmartMoneyProfileId } from "./events"; +import type { SyntheticMarketMode } from "./options-flow"; +import { SP500_SYMBOLS } from "./sp500"; const SYNTHETIC_PROFILE_WEIGHT_VALUES = [0.6, 1.0, 1.6] as const; const SYNTHETIC_COVERAGE_WINDOW_VALUES = [10, 20, 30] as const;