Read e2e env through Config and ban process.env in app and e2e source#217

open1
dev
deslop/no-process-env
opened20d agobyAAviddaram
View on GitHubTwo-way sync enabledPR last imported 20d ago

The e2e Target layer read TEST_LOGIN_KEY and E2E_BASE_URL straight from process.env and died by hand when the key was missing. scenario.ts read GIT_COMMIT the same way. Nothing kept process.env out of Worker code either. There it reads nothing: Alchemy binds only the Config a Worker yields during construction.

Those three reads now go through Config. A new override in lint.config.ts turns on effecttsgo/process-env and effecttsgo/process-env-in-effect at error for apps/*/src, packages/*/src and e2e/src.

diff
1 e2e/src/target.ts Target.layer
2- const baseUrl = process.env.E2E_BASE_URL ?? "https://staging.tranzfer.app";
3- const key = process.env.TEST_LOGIN_KEY;
4- if (key === undefined) return yield* Effect.die(new Error("TEST_LOGIN_KEY is required ..."));
5+ const baseUrl = yield* Config.String("E2E_BASE_URL").pipe(Config.withDefault("https://staging.tranzfer.app"));
6+ const key = yield* Config.String("TEST_LOGIN_KEY");
7 e2e/src/scenario.ts result.json
8- revision: process.env.GIT_COMMIT ?? "unknown",
9+ revision: yield* Config.String("GIT_COMMIT").pipe(Config.withDefault("unknown")),

Rule hits: 3 on origin/dev (target.ts:40, target.ts:41, scenario.ts:155), 0 after this change. It stays off in build tooling (vite.config.ts, scripts/), infra/, and e2e/gates/upload.test.ts, which needs GATE at module scope to pick a gate.

Checks: vp check --quiet, vp run test, vp run build. I also ran vp run --filter @tranzfer/e2e test with no TEST_LOGIN_KEY, and the layer now fails with ConfigError ... at ["TEST_LOGIN_KEY"]. The preview's e2e run covers the set path.

Checks

5 successful · 2 skipped · 1 neutral
All checks passed
c40dcf2

Added 1 commit

  • Read e2e env through Config and ban process.env in app and e2e sourcec40dcf2
Synced from GitHub

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 311ee9c6-09e4-4f01-83ef-2a72feb5d4b9

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Synced from GitHub

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

The PR moves three e2e environment reads to Config and adds lint errors for direct process.env reads in app, package, and e2e source.

  • E2E targets load their address and login key through Config.
  • Lint rejects direct environment reads in app, package, and e2e source.
  • Scenario results get their revision through Config.

No actionable issues were found. Checks were limited to source review; tests and builds were not run.

Reviews (1) · Last reviewed commit: "Read e2e env through Config and ban proc..." · Reviewed by Greptile