arXiv / arxiv-submission-ui

User interface of NG submit system.
MIT License
2 stars 6 forks source link

Refactor of workflow and flow_control #166

Closed bdc34 closed 4 years ago

bdc34 commented 4 years ago

This refactors workflow and flow_control to make the logic more explicit, to be more readable and maintainable.

FIXED: Tests now pass.

The noteworthy changes are:

  1. Refactored workflow definitions to be independent for testablity and clarity.
  2. Split workflow processing with a submission out from workflow definition.
  3. Refactored flow_control.py to isolate logic about submission, controller result, action => flow_control decision.
  4. Changed the controllers and flow_control to no longer use BadRequest Exception and HTTP status as a single for form invalid to the flow_control and submit.routes.ui.ui.handle(). There are now functions in flow_control.py that controllers can use to mark a response as ready for next stage etc. At first I thought this was an unfortunate dependency but then it was clear that the controller actually depended on how the flow_control.py was expecting responses to be marked.

Some other changes:

  1. Delete controllers split from file/package add controllers.
  2. Change to how "seen" state of flow control is saved to make it more explicit. (Seen state is saved on the session, not on the submission. This has usability implications. A user will loose the seen state if the move to a different device. My first impression of this is that it will cause bugs in the field that we won't notice during testing.)
  3. Removed path() from submit.routes.ui.ui to make the blueprint definitions more explicit about taking a parameter of submission_id.