Skip to content
This repository has been archived by the owner on Jan 31, 2018. It is now read-only.

[bug 1175123] Initial implementation of Trigger suggester #643

Merged
merged 1 commit into from Aug 25, 2015
Merged

[bug 1175123] Initial implementation of Trigger suggester #643

merged 1 commit into from Aug 25, 2015

Conversation

willkg
Copy link
Member

@willkg willkg commented Aug 20, 2015

Implements the Trigger suggester which allows analyzers to set up
trigger rules for adding suggestions to feedback that match those rules.

r?

@willkg
Copy link
Member Author

willkg commented Aug 20, 2015

This is described at: https://wiki.mozilla.org/Firefox/Input/Trigger_suggester

There are a few things that aren't done yet that will be done under different bugs. I figured it's worth splitting this out into parts and this is the minimum viable initial part.

Outstanding things that will be covered by other bugs:

  1. templated urls
  2. trigger rule tester
  3. list of available locales for trigger rule form

To review:

  1. review the code for oddities
  2. run the tests

I've gone through and done the hand testing of creating rules and then creating feedback that matches and doesn't match rules to make sure that works. If you want to do that, too, that's cool, but don't feel like you have to. We'll push this out and if there are issues we didn't catch in review, we can fix them as we find them.

@willkg
Copy link
Member Author

willkg commented Aug 20, 2015

@mythmon Can you work through this? It's like 900 lines of code, but some of that is boilerplate and similar to the SUMO suggester. Sometime in the next week would be cool.

@@ -17,4 +17,4 @@ def get_redirectors():
return list(_REDIRECTORS)


from .base import build_redirect_url, Redirector
from .base import build_redirect_url, Redirector, RedirectParseError
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this a "import for export" type of thing? I don't see it in the __all__ definition above.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oops. It should be in the __all__.

@mythmon
Copy link
Contributor

mythmon commented Aug 20, 2015

That's all I've got for today. I'll do another quick check tomorrow, and pull it down and run it.

This looks good. It seems like the suggestion/redirect provider stuff you did paid off pretty well.

@willkg
Copy link
Member Author

willkg commented Aug 21, 2015

^^^ Fixes based on your comments.

@willkg
Copy link
Member Author

willkg commented Aug 24, 2015

Er, that has fixes based on your comments except for writing up a comma-separated string field. I'll fiddle with that today to see if it's a good value.

@willkg
Copy link
Member Author

willkg commented Aug 25, 2015

^^^ Rewrote the code using ListField (model field) and StringListField (form field). I like it. I think it's easier to work with than the previous iteration.

@mythmon Can you look at that?

# This takes a unicode and reconsistutes it into Python base
# types.
return ast.literal_eval(value)
except Exception as exc:
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you catch SyntaxError here, instead of all Exceptions?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't know if SyntaxError is the only possible exception that can be thrown here. Regardless, I think I want to treat all exceptions as ValidationErrors, so seems better to keep it like this.

@willkg
Copy link
Member Author

willkg commented Aug 25, 2015

^^^ Addresses your last set of comments:

  • add assertion and test for list-ish-ness
  • add docstrings (some of which copied from the django docs because might as well)
  • remove a method that wasn't used (no clue why i added it in the first place (which is not confidence-creating))
  • remove errant print statements

@mythmon
Copy link
Contributor

mythmon commented Aug 25, 2015

This looks good. I got the tests working before, and they all passed. The new model and form fields stuff looks well enough tested, and only a little goofy. I didn't test it myself, because I couldn't get Persona to work locally (I should fix that), but I'm sure we can test it in prod.

r+

@willkg
Copy link
Member Author

willkg commented Aug 25, 2015

^^^ That squashed all the commits into one. Travis is green. I'll go through it once more, but I think we're good to go now.

Implements the Trigger suggester which allows analyzers to set up
trigger rules for adding suggestions to feedback that match those rules.

Also implements ListField (model field) and StringListField (form field)
for storing lists of things in the db.
@willkg
Copy link
Member Author

willkg commented Aug 25, 2015

^^^ Removes a function that was never used. I'll wait for Travis then land it.

willkg added a commit that referenced this pull request Aug 25, 2015
[bug 1175123] Initial implementation of Trigger suggester
@willkg willkg merged commit 9556e2d into mozilla:master Aug 25, 2015
@willkg
Copy link
Member Author

willkg commented Aug 25, 2015

LANDED!

Thank you so much for reviewing this!

@willkg willkg deleted the 1175123-trigger branch August 25, 2015 21:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants