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

bug 1383113: switch from getattr to getitem notation in breakpad rules #5355

Merged
merged 3 commits into from Apr 27, 2020
Merged

bug 1383113: switch from getattr to getitem notation in breakpad rules #5355

merged 3 commits into from Apr 27, 2020

Conversation

willkg
Copy link
Collaborator

@willkg willkg commented Apr 27, 2020

This switches from getattr notation to getitem notation in the breakpad processor rules. We're transitioning off of DotDict and dict doesn't support getattr notation.

I did this in a few passes:

  • switch from getattr to getitem in the breakpad.py file and get tests to pass
  • remove DotDict usage in the test_breakpad.py file and get tests to pass
  • read through both files for anything I missed

To test:

  1. run tests and linting
  2. process some crashes

This switches from getattr notation to getitem notation in the breakpad
processor rules. We're transitioning off of DotDict and dict doesn't
support getattr notation.
or processed_crash.cpu_arch != "x86"
processed_crash.get("product", "") != "Firefox"
or not processed_crash.get("os_name", "").startswith("Windows")
or processed_crash.get("cpu_arch", "") != "x86"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll add a note to myself to ask Gabriele and find out if this is still true. It might not be.

)
if frames and frames[0].get("module", False):
# there is a module at the top of the stack, we don't want this
return False

signature = processed_crash.get("signature", "")
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This rule needs to run after mdsw and after signature generation. That should be denoted in the class docstring.

@@ -464,28 +449,34 @@ def test_success_all_types_of_signatures(self, mocked_subprocess_module):
"Small | js::irregexp::ExecuteCode<T>",
]
for signature in signatures:
processed_crash = DotDict(base_processed_crash)
processed_crash.signature = signature
processed_crash = copy.copy(base_processed_crash)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

All these copies need to be deepcopies because the rules are changing the processed crash in deep and existentially meaningful ways.

The processed crash is deep and wonderful and doing a shallow copy means
that tests may not be testing what they think they're testing.
@willkg
Copy link
Collaborator Author

willkg commented Apr 27, 2020

self-r+

@willkg willkg merged commit 4ae88dc into mozilla-services:master Apr 27, 2020
@willkg willkg deleted the 1383113-getitem-breakpad branch April 27, 2020 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant