Skip to content

feat(runner): provide shared local flow runtime deps#1374

Open
Mateus Zitelli (MateusZitelli) wants to merge 4 commits into
mainfrom
wiz-shared-flow-runtime-deps
Open

feat(runner): provide shared local flow runtime deps#1374
Mateus Zitelli (MateusZitelli) wants to merge 4 commits into
mainfrom
wiz-shared-flow-runtime-deps

Conversation

@MateusZitelli

@MateusZitelli Mateus Zitelli (MateusZitelli) commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Stacked on #1372.

  • Add architecture-neutral FlowRuntimeDeps
  • Wire shared runtime deps into both web and Android flows
  • Add .env-backed local implementations for:
    • setEnvironmentVariable
    • fetchLatestEnvironmentVariables
  • Add lazy getInbox support using either:
    • EMAILER_URL, or
    • QA Wolf auth / API credentials
  • Wire runtime deps through normal runs, flows run --env, and worker subprocesses

Why

Local flows need the same runtime capabilities regardless of architecture. Email inbox access should work for Android and web flows, and should not eagerly load/configure email dependencies unless a flow actually calls getInbox.

Stack

Tests

  • bun run lint
  • bun run typecheck
  • bun run test src/commands/flows/flowRuntimeDeps.test.ts src/commands/flows/envVarDeps.test.ts src/domains/runner/runWebFlow.test.ts src/domains/runner/runAndroidFlow.test.ts src/commands/flows/runDefaults.handle.test.ts src/commands/flows/hybridRun.test.ts src/commands/flows/runDefaults.reporterWiring.test.ts

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

An error occurred during the review process. Please try again later.

Walkthrough

This PR introduces FlowRuntimeDeps, a shared runtime dependency bundle providing lazy email inbox access (getInbox) and environment variable persistence (setEnvironmentVariable, fetchLatestEnvironmentVariables) across web and Android flows. A new makeEnvVarDeps function implements atomic .env file read/write with process.env mirroring. createFlowRuntimeDeps constructs the bundle with lazy credential resolution (prioritizing EMAILER_URL, then API key, then platform identity). configureEmails is refactored to accept a typed EmailsConfig union and return the client; registerLazyEmailsClient now accepts an injected getInbox. The bundle is threaded through buildFlowsRunDeps, runStagedFlows, runWorker, and the default dependency factories for both staged and hybrid run paths.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • qawolf/cli#1376: Changes dotenv serialization to preserve non-POSIX keys via quoting, which directly underpins the round-trip correctness tested in the new makeEnvVarDeps tests (keys containing dots).
  • qawolf/cli#1381: Refactors runStagedFlows and buildFlowsRunDeps around staged dependency isolation — the same files this PR extends to thread flowRuntimeDeps.

Suggested reviewers

  • smonn
  • chajac
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch wiz-shared-flow-runtime-deps

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

@MateusZitelli Mateus Zitelli (MateusZitelli) marked this pull request as draft June 15, 2026 19:33
Base automatically changed from wiz-dotenv-core to main June 16, 2026 21:56
Re-apply flowRuntimeDeps/getInbox wiring onto main's runStagedFlows +
buildFlowsRunDeps architecture (main refactored the inline run path away).
- await async createFlowRuntimeDeps in flowRuntimeDeps tests
- add createFlowRuntimeDeps to runStagedFlows mock fixture
- restore dropped describe brace in runAndroidFlow tests
- update envVarDeps test to main's quote/round-trip dotenv contract
- use type-only import for createFlowRuntimeDeps in runStagedFlows (lint)
@chajac

Copy link
Copy Markdown
Contributor

Tested against node and binary versions only one addition needed is that some flows will call mail.inbox() which was failing.

@chajac Chase J (chajac) marked this pull request as ready for review June 30, 2026 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants