Skip to content

Change overaggressive error to warning in check_existing_capacity#333

Open
idelder wants to merge 1 commit into
mainfrom
fix/check_existing_capacity
Open

Change overaggressive error to warning in check_existing_capacity#333
idelder wants to merge 1 commit into
mainfrom
fix/check_existing_capacity

Conversation

@idelder
Copy link
Copy Markdown
Collaborator

@idelder idelder commented Jun 2, 2026

As the myopic sequencer moves forward, it checks whether previously built capacity survived thus far. If any existing capacity is not seen in the previous period's net capacity output (e.g., was retired early, or survival curved down under the threshold) then that process is removed from the myopic efficiency table and therefore is no longer a valid process going forward.

HOWEVER, these are still pulled into the existing capacity parameter for accounting purposes. This all works out fine except that I had previously put in a check that will not-so-helpfully tell users that their existing capacity should be a valid process but isn't (because previous myopic horizons decided to retire it early) then raise a ValueError and crash the run.

Changing this error to a warning fixes the issue. In perfect foresight, this should always be a bug but not necessarily a deadly bug so a warning should cover that anyway.

Summary by CodeRabbit

  • Bug Fixes
    • Improved error handling for capacity entries with lifetimes extending into future periods. The system now logs a warning and continues operation instead of halting with an error, allowing workflows to proceed more smoothly.

Signed-off-by: Davey Elder <iandavidelder@gmail.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 2, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3a866840-88ff-41f2-84a2-7df1d9f990b2

📥 Commits

Reviewing files that changed from the base of the PR and between e8bf144 and 02a0228.

📒 Files selected for processing (1)
  • temoa/components/technology.py

Walkthrough

This PR modifies error handling in the check_existing_capacity function within temoa/components/technology.py. When an existing capacity entry has a lifetime extending into future periods but lacks a corresponding valid process, the code now emits a warning instead of raising a ValueError exception.

Changes

Capacity validation error handling

Layer / File(s) Summary
Error handling downgrade in capacity validation
temoa/components/technology.py
When existing capacity lifetimes extend into future periods but lack valid process references, validation now logs a warning and continues instead of raising a ValueError.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title directly and clearly describes the main change: converting an overaggressive error to a warning in the check_existing_capacity function, which matches the core objective of preventing fatal crashes.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/check_existing_capacity

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 2, 2026

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
temoa/components/technology.py 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant