Skip to content

refactor!: remove ADJUSTMENT from FACILITY_INPUTS#1339

Merged
tj098895 merged 1 commit intomainfrom
remove_facility_adjustment
Jan 26, 2026
Merged

refactor!: remove ADJUSTMENT from FACILITY_INPUTS#1339
tj098895 merged 1 commit intomainfrom
remove_facility_adjustment

Conversation

@tj098895
Copy link
Copy Markdown
Contributor

@tj098895 tj098895 commented Jan 23, 2026

ADJUSTMENT in FACILITY_INPUTS has been of little usage, and it is easy to manipulate data oneself, instead of ecalc providing this functionality.

Refs: equinor/ecalc-internal#1425

Type of Work

  • Patch: X.Y.Z+1. NEGLIGIBLE visible changes, does not change input or output - OR changes behaviour. Use chore:, refactor: etc
  • Minor: X.Y+1.Z. Minor changes, might ADD new input (YAML), or other backwards-compatible changes. Use feat:, fix:
  • Major: X+1.Y.Z. Major and most likely BREAKING changes, wo. backwards compatibility, or removing temporary backwards compatibility functionality. Use ! or BREAKING:.

See here (internal): https://github.com/equinor/ecalc-internal/discussions/1044

Have you remembered and considered?

  • IF FEAT: I have remembered to update documentation
  • IF FIX OR FEAT: I have remembered to update manual changelog (docs/drafts/next.draft.md)
  • IF BREAKING: I have remembered to update migration guide (docs/docs/migration_guides/)
  • IF BREAKING: I have committed with BREAKING: in footer or ! in header
  • I have added tests (if not, comment why)
  • I have used conventional commits syntax (if you squash, make sure that conventional commit is used)
  • I have included the Github issue nr in the footer!

What is this PR all about?

What else did you consider?

Between the lines?

@tj098895 tj098895 requested review from a team as code owners January 23, 2026 10:50
@tj098895 tj098895 force-pushed the remove_facility_adjustment branch from 3c51ab7 to e8b54ed Compare January 23, 2026 11:11
@tj098895
Copy link
Copy Markdown
Contributor Author

Screenshot 2026-01-23 at 13 26 01

Information to user in this version about removal of ADJUSTMENT, and how to fix. Will remove altogether in next version (?). Should we "do more"? To remove in next version, or keep?

Comment on lines +56 to +68
def validate_adjustment(self):
if current_version() >= Version(
14
): # Just break all yaml to make sure we remember to remove ADJUSTMENT altogether
raise ValueError(
"ADJUSTMENT is no longer valid in libeCalc v14.0 and has been removed. See the migration guide on how to migrate."
)

if self.adjustment is not None: # < 14 we give error if ADJUSTMENT is used
raise ValueError(
"ADJUSTMENT was removed in libeCalc v13.0 and is no longer supported. See the migration guide on how to migrate."
)
return self
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to before validator and remove adjustment definition above? That way we will get validation errors in json-schema.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed. Ok now?

@tj098895 tj098895 force-pushed the remove_facility_adjustment branch from e8b54ed to 635d400 Compare January 26, 2026 11:46
Comment on lines +51 to +56
adjustment = values.get("ADJUSTMENT")

if adjustment is not None:
raise ValueError(
"ADJUSTMENT along with FACTOR and CONSTANT was removed in libeCalc v13.0 and is no longer supported. See the migration guide on how to migrate."
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
adjustment = values.get("ADJUSTMENT")
if adjustment is not None:
raise ValueError(
"ADJUSTMENT along with FACTOR and CONSTANT was removed in libeCalc v13.0 and is no longer supported. See the migration guide on how to migrate."
)
if isinstance(values, dict) and "ADJUSTMENT" in values:
raise ValueError(
"ADJUSTMENT along with FACTOR and CONSTANT was removed in libeCalc v13.0 and is no longer supported. See the migration guide on how to migrate."
)

If values is not dict it's handled by pydantic

@tj098895 tj098895 force-pushed the remove_facility_adjustment branch from 635d400 to 203130b Compare January 26, 2026 12:02
ADJUSTMENT in FACILITY_INPUTS has been of little usage,
and it is easy to manipulate data oneself, instead of
ecalc providing this functionality.

Refs: equinor/ecalc-internal#1425
@tj098895 tj098895 force-pushed the remove_facility_adjustment branch from 203130b to 8471c67 Compare January 26, 2026 12:49
@tj098895 tj098895 merged commit 2cdd20e into main Jan 26, 2026
22 checks passed
@tj098895 tj098895 deleted the remove_facility_adjustment branch January 26, 2026 13:08
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.

3 participants