Invert crop-residue nitrogen removal logic#548
Conversation
… removal. When residues are removed from the field they are included in the nitrogen removal
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughInvert crop-residue short-circuit: residues left on-field are excluded from nitrogen removal while residues removed from-field are included; a changeset was added and tests updated to reflect the new behavior. Changes
Sequence Diagram(s)(No sequence diagrams generated — change is a localized control-flow inversion within a single module and test updates.) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
.changeset/better-snakes-clap.md (1)
5-5: Tighten the changelog sentence.This is user-facing release-note text, so it is worth making it a bit clearer and using “crop residues” as two words.
✏️ Suggested wording
-Fix that when cropresidues are left they are not included in the nitrogen removal. When residues are removed from the field they are included in the nitrogen removal +Fix nitrogen removal for crop residues: residues left on the field are no longer counted as removed, while residues removed from the field are.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.changeset/better-snakes-clap.md at line 5, Update the changelog sentence in .changeset/better-snakes-clap.md to use “crop residues” (two words) and tighten the wording: replace the current lines mentioning "cropresidues" and "nitrogen removal" with a single clear sentence such as “Ensure crop residues left on the field are excluded from nitrogen removal calculations; when residues are removed from the field they are included in nitrogen removal.” Make sure the new text is user-facing and succinct.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@fdm-calculator/src/balance/nitrogen/removal/residue.ts`:
- Around line 42-43: The guard around the residue-removal calculation treats
null as "removed" because it only checks truthiness; change the condition so
null is excluded by explicitly guarding on cultivation.m_cropresidue (e.g.,
replace if (cultivation.m_cropresidue) with if (cultivation.m_cropresidue !==
false) or equivalent) so only an explicit false (residues removed) allows the
removal calculation to run; update the check in residue.ts where
cultivation.m_cropresidue is used to match the sibling implementations
(ammonia/residues and organic-matter/residues).
---
Nitpick comments:
In @.changeset/better-snakes-clap.md:
- Line 5: Update the changelog sentence in .changeset/better-snakes-clap.md to
use “crop residues” (two words) and tighten the wording: replace the current
lines mentioning "cropresidues" and "nitrogen removal" with a single clear
sentence such as “Ensure crop residues left on the field are excluded from
nitrogen removal calculations; when residues are removed from the field they are
included in nitrogen removal.” Make sure the new text is user-facing and
succinct.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: b6dfece9-8c34-4ca9-87b7-8a6bb7c2ce9f
📒 Files selected for processing (2)
.changeset/better-snakes-clap.mdfdm-calculator/src/balance/nitrogen/removal/residue.ts
|
@coderabbitai resume |
✅ Actions performedReviews resumed. |
Summary by CodeRabbit