Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add finer control of file mods/deletion checks. Resolves #65 #66

Merged
merged 12 commits into from
Dec 20, 2023

Conversation

annakrystalli
Copy link
Member

@annakrystalli annakrystalli commented Dec 19, 2023

Hey @LucieContamin & @elray1 !

I've taken all your comments on board and introduced two new arguments tovalidate_pr() for controlling modification/deletions checks performed on model output and model metadata files.

  • file_modify_check, which controls whether modification/deletion checks are performed and what is retuned if modifications/deletions detected. It takes the following options:
    • "error": Appends a <error/check_error> condition class object for each applicable modified/deleted file.
    • "warning": Appends a <warning/check_warning> condition class object for each applicable modified/deleted file.
    • "message": Appends a <message/check_info> condition class object for each
      applicable modified/deleted file.
    • "none": No modification/deletion checks performed.
  • allow_submit_window_mods, which controls whether modifications/deletions of model output files are allowed within their submission windows.

They main issue I hit that ended up in some more time and complicated code than I hoped for is summarised as a note in the function docs too:

Note that to establish relative submission windows when performing modification/deletion checks and allow_submit_window_mods is TRUE, the reference date is taken as the round_id extracted from the file path (i.e. submit_window_ref_date_from is always set to "file_path"). This is because we cannot extract dates from columns of deleted files. If hub submission window reference dates do not match round IDs in file paths, currently allow_submit_window_mods will not work correctly and is best set to FALSE. This only relates to hubs/rounds where submission windows are determined relative to a reference date and not when explicit submission window start and end dates are provided in the config.

Up to now and by default in ths PR, relative submission windows have been determined using contents of the file (which follows how the config files are set up to give the reference column name relative to which the window is determined). So far this date always matched the round ID in the file path so I opted for the option above to get round the problem described.
This does mean that two submission checks (one when we check whether the submission falls within the submission window as part of validate_submission (which is also used separately, locally by users) and once now when allow_submit_window_mods = TRUE and mods/deletions are detected) use two different sources of reference date to calculate the window (the former uses the file contents to follow how config is structured more faithfully and allow more flexibility while the later the file path to allow for checking deleted file windows).

I obviously don't love this duplication and difference in ref date source but I dislike the thought of introducing irrelevant arguments to validate_submission in order to pass upstream arguments from validate_pr as well introducing functionality to handle deleted files in validate_submission more.

I feel the separation of the task of checking and alerting about mods & deletions to validate_pr() is correct and I've tried to handle the idiosyncrasies of checking for submission windows on deleted files as best I could, especially through documentation but if you have a better suggestion or can envisage a big problem I've overlooked let me know!

@gioco
Copy link

gioco commented Dec 19, 2023

Hi, we are experiencing an issue related to this.
Contributing teams shall be allowed to modify their submission while within the submission window. Is there a way to allow it with the former version of the code (the one in the main branch)?
If not, can you provide an estimate about when the PR will be merged and the allow_submit_window_mods parameter enabled?
Thank you very much!

@annakrystalli
Copy link
Member Author

annakrystalli commented Dec 19, 2023

Hi @gioco ! Hopefully this will be merged within the next couple of days.

Just to clarify, the issue your team's are having is they are submitting files, the files are getting merged and they are committing modified versions after that but within the submission window?
And you want that to be allowed?

That is not possible with the current version of the code (it is quite strict) but will be with this PR. You can just ignore those errors for the time being though.

@gioco
Copy link

gioco commented Dec 19, 2023

Hi Anna, yes exactly.
We have a workflow that automatically merges the submission if all validations are passed.
A team submitted forecasts yesterday, and today wants to update them. Submission window closes tomorrow, and we want updates to be allowed while the submission window is still "open".
Thank you very much for your prompt reply.

@annakrystalli
Copy link
Member Author

So yes, sadly, checks will fail currently so might need to do some manual merging just for a couple of days.

You could also see whether you could briefly set your Github Action to install the hubValidations package from this branch instead of the main branch and change it back when the PR is merged. A little risky though as this PR hasn't been reviewed yet.

@gioco
Copy link

gioco commented Dec 19, 2023

Will go with the manual merges for this couple of days!
Thanks!

@LucieContamin
Copy link
Contributor

I like this new functionality, we often also have updates during a "round" of submission. It seems to be all good, the function documentation is clear. Thanks @annakrystalli !

Copy link
Contributor

@elray1 elray1 left a comment

Choose a reason for hiding this comment

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

Thanks! Here is a summary:

  • one one-character typo :)
  • how is all of this controlled? Should we add documentation describing relevant settings (if any) that can be specified in a hub's validations config? OK with me if we add a separate issue for this so we can merge this in sooner.
  • I have a request to add a little more documentation in the future -- it took some time for me to work through what was happening in check_pr_modf_del_files, and this would have been easier with just a few comments. (it's ok with me if you don't go back and do this now)

R/validate_pr.R Outdated Show resolved Hide resolved
Co-authored-by: Evan Ray <[email protected]>
@annakrystalli
Copy link
Member Author

@annakrystalli
Copy link
Member Author

Hello again @elray1 !

As we're planning to push this through quickly, I spent some time thinking ahead to exceptions and refactored validate_pr and internal functions to be more robust, specifically by handling errors in calculating submission windows at the individual file level, so that it doesn't cause an execution error at validate_pr level. I also added more better/tests.

I made some other minor improvements and added more comments so hopefully, between that and the refactoring, it should be much easier to follow what's going on.

If you could take a quick look at just this file: https://github.com/Infectious-Disease-Modeling-Hubs/hubValidations/blob/474f8b66c661696945310535dbb542ec6fa7437c/R/validate_pr.R

I'd really appreciate it. Then we can go ahead and merge in! 🎉

Copy link
Contributor

@elray1 elray1 left a comment

Choose a reason for hiding this comment

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

I read through again, looks good. thanks!

@annakrystalli annakrystalli merged commit 6881679 into main Dec 20, 2023
10 checks passed
@annakrystalli annakrystalli deleted the mod-delete-alert branch December 20, 2023 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants