Preserve sibling input evidence when Config.all fails - #6939
Conversation
|
There was a problem hiding this comment.
Important
This PR currently contains only the failing regression test; the implementation fix described in the PR body is not present, so CI fails. Please add the Config.all fix before merging.
Reviewed changes
Reviewed the single new regression test in packages/effect/test/ConfigAllInputEvidence.test.ts against head 3e85f43 on branch audit/repro-core-config-all-input-evidence.
- Adds one focused test that reproduces the input-evidence bug: a nested
Config.allwith one sibling that reads provider input and another that fails currently causes an enclosingConfig.withDefaultto replace the whole group.
The test is sound. I ran pnpm test --run packages/effect/test/ConfigAllInputEvidence.test.ts and it fails as expected, returning the default value instead of the required-field error. Once packages/effect/src/Config.ts is updated so Config.all preserves sibling hasInput evidence, this test should pass.
⚠️ Implementation fix is still pending
The PR title and description promise a fix, but only the test has been pushed. The fix needs to land in packages/effect/src/Config.ts around the Config.all implementation (lines 414–427). Specifically, Config.all must collect all child results rather than short-circuiting on the first EvaluationFailure, so that resolveArray and resolveRecord can combine sibling hasInput flags and fail with hasInput=true when any sibling read input.
No implementation concerns were found in the test itself.
@v0 or keep the SHA fresh with Dependabot | Fix it ➔ | View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏

Summary
When a nested Config.all has at least one supplied value but another child fails, an enclosing withDefault can silently replace the entire parent with its fallback. A partially supplied group should fail; only a completely absent group should use the parent fallback.
Important
This PR starts with focused failing reproduction tests. Add the implementation fix to this same branch; CI is expected to fail until that fix is included.
Config.all loses sibling input evidence
Module:
ConfigAudit ID:
core-a-f-config-all-loses-input-evidenceSeverity / confidence: medium / high
What happens
When a nested Config.all has at least one supplied value but another child fails, an enclosing withDefault can silently replace the entire parent with its fallback. A partially supplied group should fail; only a completely absent group should use the parent fallback.
Why it happens
Config.all evaluates its children with Effect.all, which short-circuits on an EvaluationFailure before resolveArray or resolveRecord can combine sibling hasInput flags. A failing child with hasInput false can therefore erase evidence that another child successfully read provider input.
Expected behavior
Config.withDefault may replace a Config.all parent only when none of its children read provider input. If any child had input while a sibling is missing or fails, parsing must fail instead of defaulting the entire parent.
Relevant implementation
These links and excerpts are pinned to audit base
c9b56ab507f224426ee8388dc450da447ec4715f.packages/effect/src/Config.ts:415-427packages/effect/src/Config.ts:343-354packages/effect/src/Config.ts:431-469View problematic code at
packages/effect/src/Config.ts:415-427View exact lines on GitHub
View problematic code at
packages/effect/src/Config.ts:343-354View exact lines on GitHub
View problematic code at
packages/effect/src/Config.ts:431-469View exact lines on GitHub
Reproduction
pnpm test --run packages/effect/test/ConfigAllInputEvidence.test.tsObserved failure: The outer default incorrectly succeeded instead of preserving the partial-input failure.
Implementation handoff
The initial reproduction tests on this branch are the regression specification for the implementation fix that should follow in this PR.
pnpm test --run packages/effect/test/ConfigAllInputEvidence.test.tsAudit provenance
c9b56ab507f224426ee8388dc450da447ec4715fc9b56ab507f224426ee8388dc450da447ec4715fcore-a-f-config-all-loses-input-evidence