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

Add ADR for storing responses in the query string #5212

Merged
merged 4 commits into from
Mar 9, 2021

Conversation

theseanything
Copy link
Contributor

@theseanything theseanything commented Mar 1, 2021

View rendered 🖼️

⚠️ This repo is Continuously Deployed: make sure you follow the guidance ⚠️

@bevanloon bevanloon temporarily deployed to smart-answer-adr-to-use-ia9h7f March 1, 2021 18:31 Inactive
@bevanloon bevanloon temporarily deployed to smart-answer-adr-to-use-ia9h7f March 1, 2021 18:48 Inactive
Copy link
Contributor

@ChrisBAshton ChrisBAshton left a comment

Choose a reason for hiding this comment

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

Sounds good to me 👍 I particularly like that it will unify the controller logic (benefits devs), and that we can be smarter about letting users edit their early responses (better user experience).

docs/arch/002-store-responses-in-query-string.md Outdated Show resolved Hide resolved
@bevanloon bevanloon temporarily deployed to smart-answer-adr-to-use-ia9h7f March 2, 2021 11:39 Inactive
@bevanloon bevanloon temporarily deployed to smart-answer-adr-to-use-ia9h7f March 2, 2021 11:42 Inactive
Copy link
Member

@kevindew kevindew left a comment

Choose a reason for hiding this comment

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

This sounds a good proposal for me 👍 there's a few areas I've got extra questions and opinions.

docs/arch/002-store-responses-in-query-string.md Outdated Show resolved Hide resolved
docs/arch/002-store-responses-in-query-string.md Outdated Show resolved Hide resolved
1. Rename `SessionAnswersController` to `FlowController` (as will be used to handle all flows)
1. Change `use_session` configuration option in flow definition to specify different response store types. e.g. `response_store :session`
1. Add functionality to store responses in query string
1. Migrate existing flows incrementally to use query string by specifying config option e.g. `response_store :query_string`
Copy link
Member

Choose a reason for hiding this comment

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

Will there be any backwards compatibility? i.e. once say https://www.gov.uk/marriage-abroad/y/afghanistan/uk/partner_british/opposite_sex is migrated would this 404? redirect me to start of a results page? back to start of Smart Answer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. We need to cover those who are in the middle of doing a flow, and old links that might be saved.

Feels like there's scale of effort vs disruption for users and depends on the amount of traffic (how many user's would be effected).

Most effort, minimal disruption:
Add logic to translate old urls into new query string based ones.

Medium effort, medium disruption:
Redirect all old URLs to the start page.

Low effort, high disruption:
Drop the old routes for old URLs and 404.

Safest approach would be to:

  1. Initially keep the existing controller to handle old URL requests (we can distinguish them by the extra /y/ vs /s/ segment after the flow name).
  2. Add routes for both URL types in the content item (for router).
  3. Update the start page to point to the query string based flow.
  4. Wait a period of time to let previous active users finish their current flow.
  5. Keep an eye on traffic to the old URLs
  6. Then decide on level of effort thats needed?

My gut feeling is we don't actually have that many people save URLs or link directly to results, and that we'd probably be fine to just redirect to the start page.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I think it's fine to have something that is intermediary and then remove. I think that could be neater too as we could set redirects in Publishing API for all the /y URL's at the point of removal and then not need any /y handling code in this app.

How do you feel about using this as a chance to change /s/ and /y/ to something more understandable? a quick idea I had is /flow/ ? Just a thought given it's going to be a bit disruptive anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup agree - should try and add the redirect in Publishing API. Would let us really clean everything up.

I think that's a good idea about renaming /s/ - I'm slightly worried about adding extra work to implement this change - (would have to migrating the existing session based answer (find-coronavirus-support) as well). I also wonder if it's worth, outside this ADR, thinking about whether we can remove it all together.

Copy link
Member

Choose a reason for hiding this comment

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

Great re: redirect

I think that's a good idea about renaming /s/ - I'm slightly worried about adding extra work to implement this change - (would have to migrating the existing session based answer (find-coronavirus-support) as well). I also wonder if it's worth, outside this ADR, thinking about whether we can remove it all together.

Yeah getting rid altogether sounds ideal but I agree that's out of the scope of this.

I think the renaming should be in the scope of this as /s/ will leave a bit of a smell behind. The s stands for session as I recall? Since every other Smart Answer needs migrating anyway it'd seem the extra work is very low since it'd be a different application of the same process. Only tricky thing seems to be agreeing on what the rename should be 😁

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, you are right it'll less work now than later. /flow/ does make sense - it's short and descriptive. Struggling to think of any alternatives, maybe /nodes/ (but prefer flow)?

Another thing is to make sure it's not confusing users who won't be familiar with these concepts.

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good - yeah it seems a step up from /y/ anyway for confusion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added a section talking about the prerequisite work to update /s/ to /flow/ - including suggested step of implementation.

docs/arch/002-store-responses-in-query-string.md Outdated Show resolved Hide resolved
Copy link
Contributor

@gclssvglx gclssvglx left a comment

Choose a reason for hiding this comment

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

Hi @theseanything - looks great. Just a couple of suggestions 👍

docs/arch/002-store-responses-in-query-string.md Outdated Show resolved Hide resolved
@bevanloon bevanloon temporarily deployed to smart-answer-adr-to-use-ia9h7f March 3, 2021 15:36 Inactive
This updates the background to give more context over how smart answers
resolves the current node with responses in the URL path.
@bevanloon bevanloon temporarily deployed to smart-answer-adr-to-use-ia9h7f March 3, 2021 15:54 Inactive
@bevanloon bevanloon temporarily deployed to smart-answer-adr-to-use-ia9h7f March 3, 2021 16:04 Inactive
@bevanloon bevanloon temporarily deployed to smart-answer-adr-to-use-ia9h7f March 5, 2021 10:47 Inactive
@theseanything
Copy link
Contributor Author

@kevindew I hope I've been able to clarify your questions. Let me know if there is anything else blocking this from going ahead.

@bevanloon bevanloon temporarily deployed to smart-answer-adr-to-use-ia9h7f March 5, 2021 15:42 Inactive
Copy link
Contributor

@gclssvglx gclssvglx left a comment

Choose a reason for hiding this comment

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

Fantastic work and an excellent description of what and why this change should be made.

Copy link
Member

@kevindew kevindew left a comment

Choose a reason for hiding this comment

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

Sounds good to me, nice one @theseanything

@theseanything
Copy link
Contributor Author

Thanks everyone for you comments and reviews 🎉

@theseanything theseanything merged commit 158391f into master Mar 9, 2021
@theseanything theseanything deleted the adr-to-use-query-string branch March 9, 2021 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants