Skip to content

Conversation

Brendonovich
Copy link
Member

@Brendonovich Brendonovich commented Oct 15, 2025

Summary by CodeRabbit

  • Refactor

    • Simplified workflow RPC secret handling to read directly from the server environment for more reliable startup.
  • Chores

    • Updated environment variables: replaced REMOTE_WORKFLOW_* with WORKFLOWS_RPC_* (WORKFLOWS_RPC_URL optional; WORKFLOWS_RPC_SECRET required).
    • Action: Update deployment environments to use the new variable names.

Copy link
Contributor

coderabbitai bot commented Oct 15, 2025

Walkthrough

Replaces REMOTE_WORKFLOW_* env keys with WORKFLOWS_RPC_* (URL optional, SECRET required) and changes the web server’s WorkflowRpcSecret service from an Effect.Config-based redacted mapping to a synchronous provider that uses serverEnv().WORKFLOWS_RPC_SECRET.

Changes

Cohort / File(s) Summary
Server service wiring
apps/web/lib/server.ts
Replace WorkflowRpcSecret service effect that mapped Config.redacted(Config.string("WORKFLOWS_RPC_SECRET")) with a sync provider returning { authSecret: Redacted.make(serverEnv().WORKFLOWS_RPC_SECRET) }; add serverEnv import.
Env schema
packages/env/server.ts
Remove REMOTE_WORKFLOW_URL and REMOTE_WORKFLOW_SECRET; add WORKFLOWS_RPC_URL (z.string().optional()) and WORKFLOWS_RPC_SECRET (z.string(), required).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant WebApp as Web App
  participant Env as serverEnv()
  participant SecretSvc as WorkflowRpcSecret

  Note over WebApp,Env: Startup initialization
  WebApp->>Env: read WORKFLOWS_RPC_SECRET
  Env-->>WebApp: return secret string
  WebApp->>SecretSvc: sync provider -> { authSecret: Redacted.make(secret) }
  SecretSvc-->>WebApp: service available
  Note over SecretSvc: Replaces prior Effect.Config.redacted + Effect.map flow
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

A rabbit nibbles at the config root,
I find a secret wrapped and neat,
Old tunnels closed, new burrows shoot,
WORKFLOWS_RPC beats steady feet.
Hop—sync ready, services meet. 🥕

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title specifically references using t3-env for the WORKFLOWS_RPC_URL, which is a concrete part of the changeset and is not generic or off-topic, so it correctly relates to the modifications made. Although it does not cover every aspect of the update, it still captures a real and important part of the change.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch workflow-t3-env

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dfdad98 and 7b2bf3e.

📒 Files selected for processing (1)
  • apps/web/lib/server.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Use a 2-space indent for TypeScript code.
Use Biome for formatting and linting TypeScript/JavaScript files by running pnpm format.

Use strict TypeScript and avoid any; leverage shared types

Files:

  • apps/web/lib/server.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx,js,jsx}: Use kebab-case for filenames for TypeScript/JavaScript modules (e.g., user-menu.tsx).
Use PascalCase for React/Solid components.

Files:

  • apps/web/lib/server.ts
apps/web/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

On the client, always use useEffectQuery or useEffectMutation from @/lib/EffectRuntime; never call EffectRuntime.run* directly in components.

Files:

  • apps/web/lib/server.ts
apps/web/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

apps/web/**/*.{ts,tsx}: Use TanStack Query v5 for all client-side server state and fetching in the web app
Mutations should call Server Actions directly and perform targeted cache updates with setQueryData/setQueriesData
Run server-side effects via the ManagedRuntime from apps/web/lib/server.ts using EffectRuntime.runPromise/runPromiseExit; do not create runtimes ad hoc
Client code should use helpers from apps/web/lib/EffectRuntime.ts (useEffectQuery, useEffectMutation, useRpcClient); never call ManagedRuntime.make inside components

Files:

  • apps/web/lib/server.ts
🧬 Code graph analysis (1)
apps/web/lib/server.ts (1)
packages/env/server.ts (1)
  • serverEnv (84-88)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Build Desktop (aarch64-apple-darwin, macos-latest)
  • GitHub Check: Build Desktop (x86_64-pc-windows-msvc, windows-latest)
  • GitHub Check: Analyze (rust)
🔇 Additional comments (1)
apps/web/lib/server.ts (1)

59-61: Nice fix on the secret wrapping.

Wrapping the env secret with Redacted.make restores the expected Redacted<string> type, so Redacted.value(authSecret) stays safe and the service remains type-correct.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/web/lib/server.ts (1)

64-67: Inconsistent migration: WORKFLOWS_RPC_URL should also use serverEnv().

The PR migrates to t3-env for workflow configuration, and WORKFLOWS_RPC_SECRET now uses serverEnv() (line 58). However, WORKFLOWS_RPC_URL still reads from the Effect Config system via Config.option(). This creates an inconsistent approach where some workflow configuration comes from t3-env and some from Effect Config.

For consistency and to fully complete the migration indicated by the PR title "use t3-env for WORKFLOWS_RPC_URL", update this to read from serverEnv() as well.

Apply this diff to use serverEnv() consistently:

-		const url = Option.getOrElse(
-			yield* Config.option(Config.string("WORKFLOWS_RPC_URL")),
-			() => "http://127.0.0.1:42169",
-		);
+		const url = serverEnv().WORKFLOWS_RPC_URL ?? "http://127.0.0.1:42169";
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b200fe4 and dfdad98.

📒 Files selected for processing (2)
  • apps/web/lib/server.ts (2 hunks)
  • packages/env/server.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Use a 2-space indent for TypeScript code.
Use Biome for formatting and linting TypeScript/JavaScript files by running pnpm format.

Use strict TypeScript and avoid any; leverage shared types

Files:

  • packages/env/server.ts
  • apps/web/lib/server.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx,js,jsx}: Use kebab-case for filenames for TypeScript/JavaScript modules (e.g., user-menu.tsx).
Use PascalCase for React/Solid components.

Files:

  • packages/env/server.ts
  • apps/web/lib/server.ts
apps/web/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

On the client, always use useEffectQuery or useEffectMutation from @/lib/EffectRuntime; never call EffectRuntime.run* directly in components.

Files:

  • apps/web/lib/server.ts
apps/web/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

apps/web/**/*.{ts,tsx}: Use TanStack Query v5 for all client-side server state and fetching in the web app
Mutations should call Server Actions directly and perform targeted cache updates with setQueryData/setQueriesData
Run server-side effects via the ManagedRuntime from apps/web/lib/server.ts using EffectRuntime.runPromise/runPromiseExit; do not create runtimes ad hoc
Client code should use helpers from apps/web/lib/EffectRuntime.ts (useEffectQuery, useEffectMutation, useRpcClient); never call ManagedRuntime.make inside components

Files:

  • apps/web/lib/server.ts
🧬 Code graph analysis (1)
apps/web/lib/server.ts (1)
packages/env/server.ts (1)
  • serverEnv (84-88)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Build Desktop (aarch64-apple-darwin, macos-latest)
  • GitHub Check: Build Desktop (x86_64-pc-windows-msvc, windows-latest)
  • GitHub Check: Analyze (rust)
🔇 Additional comments (2)
packages/env/server.ts (1)

70-71: LGTM! Environment schema correctly updated.

The new WORKFLOWS_RPC_URL (optional) and WORKFLOWS_RPC_SECRET (required) variables are properly defined and align with the PR objectives to migrate from REMOTE_WORKFLOW_* naming.

apps/web/lib/server.ts (1)

4-4: LGTM! Import added correctly.

The serverEnv import from @cap/env is properly added to support the new synchronous environment access pattern.

@Brendonovich Brendonovich merged commit 0d5700f into main Oct 15, 2025
15 checks passed
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