markbates / markbates/configatron
Leaks in configatron.temp
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 593
- Forks
- 74
- PR merge metrics
- No merged PRs in 30d
Description
We've faced an issue with `configatron.temp` due to unexpected side effect
```ruby
# config changes in rspec case
# leaked into other
configatron.temp do
#leaks
configs.each { |config| configatron.origins[config.origin_id] = { app_id: '123' } }
# doesn't leak
# configatron.origins = configs.map { |cfg| [cfg.origin_id, { app_id: '123' }] }.to_h
example.run
end
```
After skimming through source code of `configatron.temp`, I humbly suggest authors to consider implementation of `configatron.temp` with `Marshal.dump` and `Marshal.load`, which looks like straightforward solution with rather strong guarantees.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the source implementation of configatron.temp and reproduce the shown RSpec-style mutation case. Verify whether nested changes to configatron.origins persist after the block while reassignment does not. Define done as temporary configuration restoring all nested state without leaking into later examples, then assess the proposed Marshal approach against the existing behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100