Conversation
|
I re-ran failing tests, but the test for AWS Pinpoint is still failing on an invalid country code. I think this came up previously in the past week or two and is almost uncertainly related to your PR. The good news is that the "no PII in logs" checker didn't encounter the string "pii" in a random chunk of Base64 this time. 😆 I've got to run but will see if I can investigate the remaining error tomorrow. |
|
This extra field on both events are not behind the feature flag (in_person_proofing_enforce_tmx) but is for an epic. |
|
This is now only failing due to the changelog checker. I'd just make the first category "Internal" and then keep the other two and resubmit. I had put some ramblings in Slack about the feature flag issue Gina raised. Let me know if I just made it more confusing instead of being helpful. |
Hi @daphnegold |
2b359d6 to
b988652
Compare
JackRyan1989
left a comment
There was a problem hiding this comment.
Looks good! Happy to approve if you think my comment isn't worth the squeeze.
There was a problem hiding this comment.
This looks good, but I would like to see a single test where the tmx_status value is tested to be something other than nil. I think this a nice to have for completeness and not necessarily blocking since you do this kind of test in the get_usps_proofing_results_job_spec.
There was a problem hiding this comment.
I discussed this with @n1zyy before when I asked for guidance on new tests I was considering writing and how far down the rabbit hole I should go. profile is undefined in this file. My feeling is that the issues with how profile is handled in different places, including if it can be nil, might be a larger issue and work outside the scope of this PR (if I remember correctly). I'm a bit fuzzy as the conversation happened a bit ago. Defer to whatever you both think.
There was a problem hiding this comment.
That's a good point. I think it's fine to leave as is then.
There was a problem hiding this comment.
My feeling is that the issues with how profile is handled in different places, including if it can be nil, might be a larger issue and work outside the scope of this PR (if I remember correctly). I'm a bit fuzzy as the conversation happened a bit ago. Defer to whatever you both think.
I think your read here, and above on analytics, is a good one. At some point we should make profile available here, but I agree that adding it in here would blow up the scope.
| allow(IdentityConfig.store).to receive(:get_usps_proofing_results_job_reprocess_delay_minutes). | ||
| and_return(reprocess_delay_minutes) | ||
| allow(IdentityConfig.store).to receive(:in_person_proofing_enforce_tmx). | ||
| and_return(in_person_proofing_enforce_tmx) |
There was a problem hiding this comment.
i think we should add a test that shows tmx_status getting logged in a analytics event
There was a problem hiding this comment.
oh oops, I see lower down there's a convo about this
There was a problem hiding this comment.
oh wait scratch that, on re-read I think that's specifically about the enrollment_helper file. In that case my comment still stands.
There was a problem hiding this comment.
So I think what actually might be my preferred solution here, and doesn't conflate concerns, is to write some tests in profile_spec.rb that test the helper. I should have done that when pulling the logic out into a separate helper method, probably, but I overlooked it because it was getting inadvertently tested everywhere it's implemented. But if we trust that the helper method in profile works appropriately, and we trust that the model for profile works appropriately, and we trust that the the analytics helper logs things appropriately, how important is it to have separate testing for each class consuming a method for a log event to test the output specifically?
On the other hand, maybe the answer is it is important, and I should do both. Including adding logic for profile to enrollment_helper_spec. I just think if we continue to add "logs x characteristic specifically" the test files will get a lot heavier. Should we test every combination? But we already have that precedent somewhat.
There was a problem hiding this comment.
Btw the analytics event does show up in the tests. They fail unless I accommodate the new log output. The output shows tmx_status: :threatmetrix_passed in the get_usps_proofing_results_job_spec and as tmx_status: nil in enrollment_helper_spec because a profile is not defined.
There was a problem hiding this comment.
i think that makes sense. Our convention has been to add the additional property to more of the analytics tests but I do agree with you that is does add a lot to the file (perhaps unnecessarily?).
There was a problem hiding this comment.
also might be an interesting topic for eng huddle - lightening our test files by reducing some redundancy
There was a problem hiding this comment.
I'm of the opinion that if things are being tested elsewhere, then no need to duplicate the tests. I think it is good to be explicit, but if you can point to a spec that is already covering the particular thing you want to test, then maybe that's enough? But IDK, I think this warrants a broader discussion (but I mean that discussion to take place outside of the scope of this ticket). So I second @svalexander's point above
|
Daphne is out today, so I'm going to go ahead and merge this. |
🎫 Ticket
Link to the relevant ticket:
LG-12000
🛠 Summary of changes
Added ThreatMetrix status logging to relevant analytics events:
Note:
profile.fraud_pending_reasonis an enum that contains statuses for review and reject, but not pass, which makes sense. The condition for pass isnil.Do we like
tmx_statusfor the log? I went with that, it was not specified in the ticket.📜 Testing Plan
Manual testing of
enrollment_helper.rblocallytail /log/events.log | jqtmx_statusand review that result is appropriateRun tests for
enrollment_helper_spec.rbandget_usps_proofing_results_job_spec.rbto confirm thattmx_statuslog is present.👀 Screenshots
Log tails
tmx pass

tmx review

tmx reject
