Skip to content

Refactor: move verification methods up to Expedition class - #410

Merged
j-atkins merged 7 commits into
mainfrom
expedition-verification
Oct 20, 2026
Merged

j-atkins merged 7 commits into
mainfrom
expedition-verification

Conversation

@j-atkins

@j-atkins j-atkins commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Note

This PR is part of a stack of three related PRs (#410, #411 , #412 ). Each one builds on the one before it. I will request reviews for each in turn.

This PR refactors the schedule and instrument verification methods, moving them up to the Expedition class level, which owns all three of the schedule, ship and instruments config classes, which are all used in the schedule verification.

Therefore, schedule.verify(ship_speed, instruments_config, ...) becomes expedition.verify_schedule(...) and instruments_config.verify(...) becomes expedition.verify_instruments_config().

Also splits the long verification methods into different helpers.

This step is taken to make subsequent PRs in the stack easier to implement (i.e. #411 and #412).

…ing whether schedule or instr config; use more helper functions
@j-atkins j-atkins changed the title Move schedule verification methods up to Expedition class Refactor: move schedule verification methods up to Expedition class Oct 19, 2026
@j-atkins j-atkins changed the title Refactor: move schedule verification methods up to Expedition class Refactor: move verification methods up to Expedition class Oct 19, 2026
@j-atkins
j-atkins marked this pull request as ready for review October 20, 2026 07:07

@erikvansebille erikvansebille left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good - a few comments below

Comment thread src/virtualship/models/expedition.py Outdated
def verify_schedule(
self,
ignore_land_test: bool = False,
*,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What is this star needed for?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is so that every parameter after it is is keyword-only, intended to make the calls more readable. Given we don't do this consistently across the codebase though I'll remove it (done in 200fe42) to avoid confusion/keep it separate from this PR.

Comment thread src/virtualship/models/expedition.py Outdated

`ship_speed` overrides the configured speed, for checking a prospective speed that has not been saved yet (e.g. in `plan` app).
"""
print("\nVerifying route... ")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should this then be "Verifying expedition"? Or would it still make more sense to refer to the "route" here, from a users perspective?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes I suppose "expedition" is better terminology, will change!

Comment thread src/virtualship/models/expedition.py Outdated
"""
Verify the feasibility and correctness of the expedition's schedule.

`ship_speed` overrides the configured speed, for checking a prospective speed that has not been saved yet (e.g. in `plan` app).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Make clear that the provided ship_speed should (also) be in knots?

Comment thread src/virtualship/models/expedition.py Outdated
def verify(self, instruments_in_expedition: Collection[InstrumentType]) -> None:
"""
Verify instrument configurations against the schedule.
Verify instrument configurations against the instruments actually being deployed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why the extra space before "instrument" here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Just a typo from making edits, now fixed.

@j-atkins
j-atkins merged commit 54eaa3d into main Oct 20, 2026
12 checks passed
@j-atkins
j-atkins deleted the expedition-verification branch October 20, 2026 08:56
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.

2 participants