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

docs(api,robot-server): Document errors list as having no more than 1 element #13191

Merged
merged 4 commits into from
Jul 31, 2023

Conversation

SyntaxColoring
Copy link
Contributor

@SyntaxColoring SyntaxColoring commented Jul 28, 2023

Overview

In the public (HTTP-facing) models for runs and analyses, you can access the errors of individual commands. In addition, there's an array of top-level errors. That top-level array is used to indicate fatal errors, including those that happen in between commands.

This documents, officially, that the top-level array will only ever have zero elements or one element. It will never contain multiple errors. The fact that it's an array, instead of a nullable object, is just a historical quirk.

This goes towards RSS-146 by clarifying how we should expose different kinds of run failures.

Rationale

  • There is no use for errors to have multiple elements today.

    This array is left over from a time before individual commands held their own errors. Today, commands have a self-contained error field, but in þe olden tymes, they had an errorId reference that pointed into this array. This was problematic for a few reasons, such as inherent duplication.

    PR #9715 fixed this. Since then, errors has only had up to 1 element.

  • Having multiple elements is confusing, and muddies what the field is supposed to be doing, conceptually. One internal comment describes it as "a list of fatal errors." But there can only be one fatal error, by definition.

  • For the case where multiple things contributed to a run's failure, and we want to convey them all, we now have @sfoster1's EnumeratedError architecture. We should commit to that tree-based API instead of keeping around a competing array-based API.

  • According to @shlokamin, the app just does, and has always just done, something like errors[0].

  • If we really need to have multiple elements in this list later on, we can just revert this documentation change. We can do that revert without breaking any clients.

Test Plan

None needed.

Changelog

Update the public HTTP documentation in run and analysis models, and internal comments.

Review requests

Do we agree with this?

Risk assessment

No risk.

@SyntaxColoring SyntaxColoring requested a review from a team as a code owner July 28, 2023 17:22
@SyntaxColoring SyntaxColoring added docs robot-svcs Falls under the purview of the Robot Services squad (formerly CPX, Core Platform Experience). protocol-engine Ticket related to the Protocol Engine project and associated HTTP APIs labels Jul 28, 2023
@SyntaxColoring SyntaxColoring requested review from a team July 28, 2023 17:23
@codecov
Copy link

codecov bot commented Jul 28, 2023

Codecov Report

Merging #13191 (3fe2149) into edge (9a499f9) will decrease coverage by 0.01%.
Report is 2 commits behind head on edge.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             edge   #13191      +/-   ##
==========================================
- Coverage   72.55%   72.55%   -0.01%     
==========================================
  Files        2398     2398              
  Lines       66084    66083       -1     
  Branches     7368     7368              
==========================================
- Hits        47950    47949       -1     
  Misses      16370    16370              
  Partials     1764     1764              
Flag Coverage Δ
g-code-testing 96.44% <ø> (ø)
notify-server 89.13% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
...t-server/robot_server/protocols/analysis_models.py 100.00% <ø> (ø)
robot-server/robot_server/runs/run_models.py 100.00% <ø> (ø)

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 to me!

@SyntaxColoring
Copy link
Contributor Author

Got an in-person approval from @sanni-t.

@SyntaxColoring SyntaxColoring merged commit 8a947dd into edge Jul 31, 2023
25 checks passed
@SyntaxColoring SyntaxColoring deleted the errors_list_0_or_1 branch July 31, 2023 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs protocol-engine Ticket related to the Protocol Engine project and associated HTTP APIs robot-svcs Falls under the purview of the Robot Services squad (formerly CPX, Core Platform Experience).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants