Skip to content

Commit

Permalink
fix(api): disallow hashing we using a fixit command (#15026)
Browse files Browse the repository at this point in the history
  • Loading branch information
TamarZanzouri authored and Carlos-fernandez committed May 20, 2024
1 parent f269f86 commit df4764b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def hash_protocol_command_params(
The command hash, if the command is a protocol command.
`None` if the command is a setup command.
"""
if create.intent == CommandIntent.SETUP:
if create.intent in [CommandIntent.SETUP, CommandIntent.FIXIT]:
return None
# We avoid Python's built-in hash() function because it's not stable across
# runs of the Python interpreter. (Jira RSS-215.)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for hash_command_params."""
import pytest

from opentrons.protocol_engine import CommandIntent
from opentrons.protocol_engine import commands
Expand Down Expand Up @@ -66,10 +67,11 @@ def test_repeated_commands() -> None:
assert a_hash != b_hash


def test_setup_command() -> None:
"""Setup commands should always hash to None."""
@pytest.mark.parametrize("command_intent", [CommandIntent.SETUP, CommandIntent.FIXIT])
def test_setup_and_fixit_command(command_intent: CommandIntent) -> None:
"""Setup and fixit commands should always skip hashing."""
setup_command = commands.WaitForDurationCreate(
params=commands.WaitForDurationParams(seconds=123),
intent=CommandIntent.SETUP,
intent=command_intent,
)
assert hash_protocol_command_params(setup_command, None) is None

0 comments on commit df4764b

Please sign in to comment.