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

fix(api-client, react-api-client, app, robot-server): support multiple recovery policies during a run #16950

Merged
merged 14 commits into from
Nov 22, 2024

Conversation

mjhuff
Copy link
Contributor

@mjhuff mjhuff commented Nov 22, 2024

Overview

Closes RQA-3670

We need to support the client ignoring several different classes of errors in a single run, which means the app needs to know the current recovery policy and be able to modify. This PR adds the necessary infrastructure to support that.

Test Plan and Hands on Testing

  • Test using the steps in RQA-3670.
  • Check the new OpenAPI docs and make sure they look correct.

Changelog

On the server, add a new GET /runs/{id}/errorRecoveryPolicy endpoint to complement the existing PUT endpoint. This turns out to be a little annoying because, so far, we have not actually been preserving that information, and we didn't have a super clean place to add it. This PR does it in a quick and dirty way.

On the client, use that to let the "ignore all errors of this type" button do a read-modify-write sequence, where it reads the current errors we're ignoring, appends the new one to the list, and writes the new list.

Review requests

See comments below.

Risk assessment

Medium? See comment below about RunDataManager being a singleton now.

@mjhuff mjhuff requested a review from a team November 22, 2024 15:36
@mjhuff mjhuff changed the title feat(api-client): add bindings for GET errorRecoveryPolicy fix(api-client, react-api-client, app, robot-server): support multiple recovery policies during a run Nov 22, 2024
@mjhuff mjhuff force-pushed the support-multiple-ignore-all-policies branch 2 times, most recently from 4fc6904 to be544dc Compare November 22, 2024 16:46
@mjhuff mjhuff force-pushed the support-multiple-ignore-all-policies branch 2 times, most recently from 9153f5d to 91ed2a5 Compare November 22, 2024 17:05
Comment on lines +164 to +167
# todo(mm, 2024-11-22): Storing the list of error recovery rules is outside the
# responsibilities of this class. It's also clunky for us to store it like this
# because we need to remember to clear it whenever the current run changes.
# This error recovery mapping stuff probably belongs in RunOrchestratorStore.
Copy link
Contributor

Choose a reason for hiding this comment

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

I tried doing this, but then we gotta move the call to error_recovery_mapping.create_error_recovery_policy_from_rules(), too, and it was feeling a bit too churny for 8.2.0.

Comment on lines 168 to 182
return RunDataManager(
run_orchestrator_store=run_orchestrator_store,
run_store=run_store,
error_recovery_setting_store=error_recovery_setting_store,
task_runner=task_runner,
runs_publisher=runs_publisher,
)
run_data_manager = _run_data_manager_accessor.get_from(app_state)

if run_data_manager is None:
run_data_manager = RunDataManager(
run_orchestrator_store=run_orchestrator_store,
run_store=run_store,
error_recovery_setting_store=error_recovery_setting_store,
task_runner=task_runner,
runs_publisher=runs_publisher,
)
_run_data_manager_accessor.set_on(app_state, run_data_manager)

return run_data_manager
Copy link
Contributor

Choose a reason for hiding this comment

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

RunDataManager needs to be a singleton now that it has some state of its own that needs to carry across different HTTP requests.

In general, this kind of change is not trivially safe. Before, the RunDataManager was picking up fresh values of task_runner, run_orchestrator_store, etc. on every HTTP request, and now it's not, and it's possible for that to affect behavior. I don't see anything where it would matter in this case, but double-check my thinking.

Copy link
Contributor

@SyntaxColoring SyntaxColoring left a comment

Choose a reason for hiding this comment

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

TypeScript changes look good to me. Thanks!

@mjhuff mjhuff marked this pull request as ready for review November 22, 2024 17:42
@mjhuff mjhuff requested review from a team as code owners November 22, 2024 17:42
@mjhuff mjhuff requested review from ncdiehl11, sfoster1 and a team and removed request for a team and ncdiehl11 November 22, 2024 17:42
@mjhuff mjhuff requested a review from TamarZanzouri November 22, 2024 17:43
Copy link
Member

@sfoster1 sfoster1 left a comment

Choose a reason for hiding this comment

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

Looks good, if this is critical for the release

@mjhuff
Copy link
Contributor Author

mjhuff commented Nov 22, 2024

Tested on a protocol with different kinds of ignorable errors, confirmed it's working:

Screenshot 2024-11-22 at 1 05 47 PM

@mjhuff mjhuff merged commit 7e6c8ee into chore_release-8.2.0 Nov 22, 2024
34 checks passed
@mjhuff mjhuff deleted the support-multiple-ignore-all-policies branch November 22, 2024 18:29
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