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

broadcast: report invalid settings #6574

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

oliver-sanders
Copy link
Member

@oliver-sanders oliver-sanders commented Jan 24, 2025

broadcast: report invalid settings

  • We already report invalid cycle points and namespaces.
  • However, we have been relying on client-side validation for settings (which doesn't apply to the GraphQL mutation).
  • This also raises the potential for inter-version compatibility issues going unreported.
  • This commit explicitly handles invalid settings in the same way as invalid cycle points and namespaces so that they are reported back to the user.
  • Closes the issue part of command validation: broadcasts #6429.
  • Additionally:
    • This change also strips duplicate entries from broadcast reports.
    • And fixes the CLI options in broadcast report to match cylc broadcast.

Check List

  • I have read CONTRIBUTING.md and added my name as a Code Contributor.
  • Contains logically grouped changes (else tidy your branch by rebase).
  • Does not contain off-topic changes (use other PRs for other changes).
  • Applied any dependency changes to both setup.cfg (and conda-environment.yml if present).
  • Tests are included (or explain why tests are not needed).
  • Changelog entry included if this is a change that can affect users
  • Cylc-Doc pull request opened if required at cylc/cylc-doc/pull/XXXX.
  • If this is a bug fix, PR should be raised against the relevant ?.?.x branch.

@oliver-sanders oliver-sanders added the could be better Not exactly a bug, but not ideal. label Jan 24, 2025
@oliver-sanders oliver-sanders self-assigned this Jan 24, 2025
@oliver-sanders oliver-sanders force-pushed the 6429 branch 2 times, most recently from b111fc7 to 3c02de1 Compare February 26, 2025 10:07
* We already report invalid cycle points and namespaces.
* However, we have been relying on client-side validation for settings
  (which doesn't apply to the GraphQL mutation).
* This also raises the potential for inter-version compatibility issues
  going unreported.
* This commit explicitly handles invalid settings in the same way as
  invalid cycle points and namespaces so that they are reported back to
  the user.
* Closes the issue part of cylc#6429.
* Additionally:
  * This change also strips duplicate entries from broadcast reports.
  * And fixes the CLI options in broadcast report to match `cylc
    broadcast`.
@oliver-sanders oliver-sanders added this to the 8.5.0 milestone Feb 26, 2025
@oliver-sanders oliver-sanders marked this pull request as ready for review February 26, 2025 10:29
@oliver-sanders
Copy link
Member Author

Note to self, if #6554 is merged before this, change the code to return the invalid broadcast to the user rather than just logging it server side:

https://github.com/cylc/cylc-flow/pull/6554/files#diff-713a6d5d5fb4768549c43ae7920483b64760ac4e1c5ef68206b9111cf688d15eR295-R306

@wxtim
Copy link
Member

wxtim commented Mar 11, 2025

Note to self, if #6554 is merged before this, change the code to return the invalid broadcast to the user rather than just logging it server side:

https://github.com/cylc/cylc-flow/pull/6554/files#diff-713a6d5d5fb4768549c43ae7920483b64760ac4e1c5ef68206b9111cf688d15eR295-R306

6554 has been merged.

Comment on lines +59 to +63
ret = []
for item in iterable:
if item not in ret:
ret.append(item)
return ret
Copy link
Member

@wxtim wxtim Mar 11, 2025

Choose a reason for hiding this comment

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

If you do this you can also do away with a bit of the documentation too: There's no point having the same doctest for both functions.

Suggested change
ret = []
for item in iterable:
if item not in ret:
ret.append(item)
return ret
return list(iter_uniq(iterable))

Copy link
Member Author

Choose a reason for hiding this comment

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

(note, this is a code move from the resolvers module)

I suspect it's probably more efficient to build a list directly, than to build a set, then build a list from the set.

Copy link
Member

@wxtim wxtim left a comment

Choose a reason for hiding this comment

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

1 small suggestion.

  • Manually tested as working.
  • Read - seems reasonable.
  • Still needs to reject run mode if workflow is in simulation, or dummy mode.

@wxtim wxtim self-requested a review March 11, 2025 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
could be better Not exactly a bug, but not ideal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants