-
Notifications
You must be signed in to change notification settings - Fork 0
Enforce injected environment access in generated Rust projects #79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 8 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
7b11eab
Enforce injected environment access in Rust templates
c79aafc
Restore stable snapshot testing guidance
leynos e5ad1e8
Export test Rust flags once
leynos c83a45d
Align generated environment injection guidance
leynos 759c2d3
Compile environment example with warnings denied
leynos a0fd56c
Preserve mandatory Rustdoc flags in generated tests
leynos cb301ae
Reconcile Rustdoc and Polonius contracts after rebase
leynos 7259292
Document and verify generated lint policy
leynos e3e62eb
Clarify environment decision and lint guidance
leynos 6596ab5
Guard rendered contributor guidance
leynos 1c574fd
Align generated validation and migration guidance
leynos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| # ADR-005: Inject Process Environment Access | ||
|
|
||
| - Status: Accepted | ||
| - Date: 2026-08-02 | ||
| - Deciders: Agent template maintainers | ||
|
|
||
| ## Context and Decision | ||
|
|
||
| In the context of generated Rust projects whose behaviour depends on | ||
| environment variables, facing process-global reads that hide dependencies and | ||
| in-process mutation that makes parallel and property-based tests interfere, we | ||
| decided for injecting `mockable::Env`, constructing `mockable::DefaultEnv` only | ||
| at the production composition root, using `mockable::MockEnv` in tests, and | ||
| allowing `assert_cmd` to configure only isolated child processes, and against | ||
| direct `std::env` access in domain code, harness-process mutation, shared | ||
| locks, or serial-test attributes, to achieve explicit production signatures and | ||
| deterministic tests that remain safe under concurrency, accepting a small | ||
| adapter at each composition root and dependency parameters on environment-aware | ||
| behaviour. | ||
|
|
||
| ## Consequences | ||
|
|
||
| - Clippy rejects direct process-environment reads, iteration, and mutation; | ||
| sanctioned composition-root adapters require a narrow, reasoned expectation. | ||
| - Production code receives `mockable::Env`, composition roots construct | ||
| `mockable::DefaultEnv`, and tests use `mockable::MockEnv` without changing | ||
| the harness environment. | ||
| - Process-wide locks are prohibited because they serialize the suite without | ||
| removing the ambient dependency; only `assert_cmd` child-process environment | ||
| configuration is exempt. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.