EnergySystemsModellingLab / EnergySystemsModellingLab/MUSE2
Scary `.unwrap_or(MoneyPerFlow(0.0))`
- Dominant language
- Rust
- Stars
- 8
- Forks
- 5
- Avg merge
- 1d 2m
- Merged PRs (30d)
- 37
Description
There's an `.unwrap_or(MoneyPerFlow(0.0))` statement in `get_revenue_from_flows_with_filter` that I feel uneasy about every time I come across.
I don't think it's reasonable to broadly assume that if a price is missing then the price is zero. Not saying there's a bug here, as we probably are only doing this for commodities that are genuinely unpriced (e.g. OTH commodities), but I still think we should design this whole part of the code in a more intentional way, as otherwise it's easy to imagine a bug creeping in.
Contributor guide
Research direction
Start at get_revenue_from_flows_with_filter and trace how missing prices and unpriced commodities such as OTH are represented and consumed. Define an intentional rule for missing prices instead of assuming zero, then verify the affected revenue behavior across the relevant cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100