department-of-veterans-affairs / va.gov-team

Public resources for building on and in support of VA.gov. Visit complete Knowledge Hub:
https://depo-platform-documentation.scrollhelp.site/index.html
281 stars 202 forks source link

[FE] Logged-in homepage: Beta/opt-in technical discovery/scoping #10476

Closed Samara-Strauss closed 4 years ago

Samara-Strauss commented 4 years ago

Background

In the fall of 2019, our team had intended to build a beta/opt-in feature but ultimately got sidetracked by other work. This kind of feature would be great to have in place for the logged-in homepage redesign; however, whether we actually pursue this work depends on whether we have the capacity to do so. In theory, the design phase for the LIH work will take a couple of months, during which we could be implementing and testing an opt-in feature. My hope would be that beta/opt-in would be done before we needed to start build on the logged-in homepage itself and would be a good way to keep Sandra/Erik busy while they were waiting for LIH designs to come down the pipeline.

What I'm hoping to accomplish: I'm not willing to sign up our team for this work if we don't reasonably think we could finish the effort in a couple of months.

Let's use this ticket to:

Note: Ultimately, I think this work would be owned by the platform.

Tasks

Acceptance criteria

erikphansen commented 4 years ago

@Samara-Strauss I'm reading this and had a clarifying question. My memory of when we talked about this last year the idea was basically "now that Flipper is a thing, can we re-do the beta opt-in feature to allow users to add themselves to the list of users who have access to a feature gated by Flipper?" Does that sound right to you?

annaswims commented 4 years ago

In the back end we have a BetaRegistrationsController that will show/create/destroy beta registrations. I think it hasn't been used for a while but can be used for this.

Then, in flipper.rb

Flipper.register(:beta_user_for_foo_feature_group) do |user|
  #user is nil if the user is not logged in
  user.respond_to?(:uuid) &&  BetaRegistration.where(feature: "beta_user_for_foo_feature", user_uuid: user.uuid).present?
end

Then, enable the group beta_user_for_foo_feature in the flipper interface.

Screen Shot 2020-08-19 at 1 32 53 PM

it looks like you may need to update the whitelist in the routes also.

annaswims commented 4 years ago

As far as the front end goes, I think there's some code for Beta Enrollment that is still good. The front end just needs to call

GET/POST/DELETE /v0/beta_registration/beta_user_for_foo_feature.

Samara-Strauss commented 4 years ago

My memory of when we talked about this last year the idea was basically "now that Flipper is a thing, can we re-do the beta opt-in feature to allow users to add themselves to the list of users who have access to a feature gated by Flipper?" Does that sound right to you?

@erikphansen yes, that is correct. We had talked about the idea of allowing people opt-in/opt-out to a beta feature without additional manual work from anyone on our team.

I do want to call attention to what @annaswims posted above, though. I didn't realize until recently that some sort of beta functionality was apparently used on Vets.gov or for the Vets.gov --> VA.gov transition. Will you take a look into that code and create some brief documentation on what that existing code does/doesn't do?

annaswims commented 4 years ago

Ah, I was writing at the same time @erikphansen was. What I was describing was a combination of the old "beta enrollment" with the new Flipper feature toggle.

If you make a "group" in flipper, it can be "anyone who has clicked beta enrollment". Flipper looks for any of the conditions to be true. So, you could to a rollout with a few beta users, and an additional "x% of users".

Samara-Strauss commented 4 years ago

Thanks @annaswims!!

erikphansen commented 4 years ago

@annaswims that's super helpful. I'm not seeing Swagger docs for the beta_registration endpoints. Are those APIs still active, just not documented? Based on the FE work that uses the beta registration feature, it looks like we don't use the GET endpoint at all (at least not directly); instead doing a POST adds that feature name to list of available services that come back from the GET user/ call. Which is fine, but whatever code is being used to add data to the available services can probably stop doing that.

@Samara-Strauss we could pretty easily try this out for Profile 2.0. Anna laid out the BE technical requirements pretty clearly. We'd just need to decide where to put a button for a user to opt in/opt out of Profile 2.0. It might be worth doing this is the most barebones way possible and actually hide it behind a feature flag. So meta.

Samara-Strauss commented 4 years ago

@erikphansen awesome, thanks for this!

Anything else you need from this ticket, or is this free to close?

annaswims commented 4 years ago

I think it's been quite a while since we've used beta_registration, but it looks like the code is still there and it's just not documented in swagger.

erikphansen commented 4 years ago

@Samara-Strauss I think it's safe to close this. We can regroup and talk about next steps to implement Anna's ideas for a test feature flag.