LG-6066: Stub out React entry-point for new IdV API routes#6177
Conversation
There was a problem hiding this comment.
we do this very often! I like the idea of DRY-ing it
There was a problem hiding this comment.
I'm slightly wary of the dynamic send 😬
There was a problem hiding this comment.
I'm slightly wary of the dynamic
send😬
Any ideas for an alternative? Allowlist? Method on IdentityConfig like IdentityConfig.enabled?(key) ?
Edit: Maybe checking keys on IdentityStore.store and gracefully falling back to false ?
There was a problem hiding this comment.
Since it's a struct you can use brackets:
IdentityConfig.store[:feature_name_symbol]
There was a problem hiding this comment.
Ope, brackets throws an error but apparently .dig does not!
IdentityConfig.store.dig(:feature_symbole_name)
There was a problem hiding this comment.
After a bit of chatting with @mitchellhenke to better understand the concern, I came up with an alternative in def6403 which I think is a little more balanced in terms of convenience vs. explicitness.
app/controllers/idv_controller.rb
Outdated
scripts/changelog_check.rb
Outdated
config/routes.rb
Outdated
There was a problem hiding this comment.
I had to bring back the feature flag guarding for this route, since we're going to have some conflicting route definitions between the current and in-development flows. This only happened now because originally I had mistakenly created the first route for /verify/password (currently /verify/review), but the ticket was meant for personal key (both before and after being /verify/personal_key).
There was a problem hiding this comment.
what if we add a /v2 in there or some other prefix so that we don't have conflicting routes?
There was a problem hiding this comment.
We could. I was also contemplating if there's a better name than "verify", since... it's pretty overused at this point. I couldn't come up with something I loved, though maybe something incorporating "identity" and/or "proofing".
There was a problem hiding this comment.
Went with "v2" in 6a81f95. We can revisit later if we come up with a better idea.
6a81f95 to
bee7044
Compare
bee7044 to
fc7fb1b
Compare
by popular demand
**Why**: Until it's ready to at least be remotely functional in local development
**Why**: Because that's the goal of LG-6066
**Why**: So that someone unfamiliar can have a basic understanding of its purpose
**Why**: Avoid issues with environment-specific configuration
**Why**: Less magical and open with forwarding of config keys, more explicit with callable behavior
[skip changelog]
fc7fb1b to
446e4b5
Compare
app/controllers/verify_controller.rb
Outdated
| class VerifyController < ApplicationController | ||
| include RenderConditionConcern | ||
|
|
||
| render_if -> { IdentityConfig.store.idv_api_enabled }, only: [:show] |
There was a problem hiding this comment.
still love this, another idea I have for the name:
| render_if -> { IdentityConfig.store.idv_api_enabled }, only: [:show] | |
| check_or_render_not_found -> { IdentityConfig.store.idv_api_enabled }, only: [:show] |
There was a problem hiding this comment.
still love this, another idea I have for the name:
Would the idea be to emphasize the actual behavior of render_not_found?
I could also imagine:
| render_if -> { IdentityConfig.store.idv_api_enabled }, only: [:show] | |
| render_not_found_unless -> { IdentityConfig.store.idv_api_enabled }, only: [:show] |
Or:
| render_if -> { IdentityConfig.store.idv_api_enabled }, only: [:show] | |
| render_not_found_if -> { !IdentityConfig.store.idv_api_enabled }, only: [:show] |
There was a problem hiding this comment.
I also sort of wonder if it would be so bad to just have the complete logic here, if the concern is concealing too much.
| render_if -> { IdentityConfig.store.idv_api_enabled }, only: [:show] | |
| before_action { render_not_found if !IdentityConfig.store.idv_api_enabled }, only: [:show] |
There was a problem hiding this comment.
Went with proposed rename to keep this moving along. Can always come back to it later.
There was a problem hiding this comment.
Makes sense! We have a bunch of similar code we could refactor all at once too -- did we file a followup ticket?
There was a problem hiding this comment.
We have a bunch of similar code we could refactor all at once too -- did we file a followup ticket?
We did now! See LG-6157.
| routes.draw do | ||
| get 'index' => 'anonymous#index' | ||
| get 'show' => 'anonymous#show' | ||
| end |
There was a problem hiding this comment.
do we need this? I think anonymous controllers "just work" without it usually
There was a problem hiding this comment.
It works by default for index, but not for show. Not sure why, tbh 🤷 I put both just for completeness, even though index was technically optional.
1) RenderConditionConcern#show renders 404
Failure/Error: subject(:response) { get :show }
ActionController::UrlGenerationError:
No route matches {:action=>"show", :controller=>"anonymous"}
# ./spec/controllers/concerns/render_condition_concern_spec.rb:52:in `block (3 levels) in <top (required)>'
# ./spec/controllers/concerns/render_condition_concern_spec.rb:55:in `block (3 levels) in <top (required)>'
There was a problem hiding this comment.
A bit of light sleuthing, maybe index is available since it's set up as the default action handler.
Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>
https: //github.com//pull/6177#discussion_r849771392 Co-Authored-By: Zach Margolis <zbmargolis@gmail.com>
Why: To give us a foundation to start building out the new API-driven identity verification front-end.
Screenshot: