Skip to content

Conversation

@Khushi-Chaudhary04
Copy link
Contributor

🗒️ Description

The function get_project_root() in packages/testing/src/execution_testing/config/env.py previously relied only on traversing the directory tree to find the .git directory. This caused failures when running the eest make env command in environments where Git metadata is absent (e.g., in distributed Python packages or CI environments).

This PR introduces two fallback mechanisms to ensure the project root (where env.yaml is placed) can always be determined:

  1. It checks for the high-priority EEST_PROJECT_ROOT environment variable.
  2. If the variable is unset and .git is not found, it falls back to the Current Working Directory (Path.cwd()) and emits a warning.

🔗 Related Issues or PRs

Fixes #1674

✅ Checklist

Cute Animal Picture

cute

Comment on lines +53 to +54
print("Warning: .git directory not found. Falling back to current working directory.")
return Path.cwd().resolve()
Copy link
Contributor

Choose a reason for hiding this comment

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

Personally, I'd raise an exception rather than fallback to the current directory. It's too easy to create random env.yaml.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey @SamWilsn, thanks for the review!

That's a valid concern about the security risk. I went with the CWD fallback because of the user's intent: they are explicitly running eest make env.

For anyone using a packaged/non-git install, if we raise an exception, that command is effectively broken unless they know to manually set EEST_PROJECT_ROOT. The CWD fallback makes make env usable out-of-the-box and ensures the file is created where they ran the command, fulfilling their request.

If the team (cc @danceratopz) prefers strict compliance over out-of-the-box usability for the make env command, I'm happy to switch to raising an exception instead. Just let me know the policy direction!

"""

# 1. Environment Variable Check
env_root = os.environ.get("EEST_PROJECT_ROOT")
Copy link
Contributor

Choose a reason for hiding this comment

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

More a question for @danceratopz , but instead of configuring this through an environment variable, would it make sense to remove the ENV_PATH global entirely, and instead thread the path through from StateTestProvider/RPCRequest/create_default_env?

If ethereum-execution-testing is installed (possibly in a root-owned directory), there is no sane default location for the file.

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.

Fix target directory for env.yaml with eest make env when ran from package

2 participants