From cbd3cab7c8e630a13f928a9357e4e0add4b57759 Mon Sep 17 00:00:00 2001 From: "Jon R. Humphrey" Date: Tue, 12 Mar 2024 16:43:08 +0000 Subject: [PATCH 1/7] fix: resolves missing ppd doc issue also includes permanent redirections for outdated variances of the ppd doc path value --- config/routes.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config/routes.rb b/config/routes.rb index fa10994..f475f22 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -9,7 +9,9 @@ get 'landing/hpi', to: 'landing#hpi' get 'doc/hpi', to: 'doc#hpi', as: 'hpi_doc' get 'doc/ukhpi', to: redirect('/app/ukhpi/doc', status: 302) - get 'doc/ppd', to: 'doc#ppd', as: 'ppd_doc' + get 'app/doc/ppd', to: 'doc#ppd', as: 'ppd_doc' + get 'doc/ppd', to: redirect('/app/doc/ppd', status: 301) + get 'app/root/doc/ppd', to: redirect('app/doc/ppd', status: 301) get 'doc/ukhpi-dsd', to: redirect('/app/ukhpi/doc/ukhpi-dsd', status: 302) get 'doc/ukhpi-user-guide', to: redirect('/app/ukhpi/doc/ukhpi-user-guide', status: 302) get 'doc/accessibility', to: 'doc#accessibility' From 1f73fa2460cb0994ab7fdc598d3f3f2fc7f56a9d Mon Sep 17 00:00:00 2001 From: "Jon R. Humphrey" Date: Tue, 12 Mar 2024 16:54:57 +0000 Subject: [PATCH 2/7] test: updated ppd doc link tests first test verifies older link redirects permanently, second test verifies redirection also is permanent, third test ensures the link responds with success status (200), and fourth test ensures the page's opening content is what's expected --- test/integration/documentation_test.rb | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/test/integration/documentation_test.rb b/test/integration/documentation_test.rb index bb212a5..168756c 100644 --- a/test/integration/documentation_test.rb +++ b/test/integration/documentation_test.rb @@ -14,8 +14,24 @@ class DocumentationTest < ActionDispatch::IntegrationTest assert_equal(302, response.status) end - test 'PPD docs page' do + test 'older PPD doc link redirects with permanent 301 status' do get '/doc/ppd' + assert_equal(301, response.status) + end + + test 'old PPD doc link redirects with permanent 301 status' do + get '/app/root/doc/ppd' + assert_equal(301, response.status) + end + + test 'ppd_doc_path variable links correctly' do + get ppd_doc_path + assert_response :success + end + + test 'ppd doc loads correctly' do + get ppd_doc_path assert_select 'h1', 'Price Paid Linked Data' + assert_select 'h2', 'What does the Price Paid Dataset consist of?' end end From eb4b934ecc89968613195229dbfacad701cd33ff Mon Sep 17 00:00:00 2001 From: "Jon R. Humphrey" Date: Tue, 12 Mar 2024 16:55:46 +0000 Subject: [PATCH 3/7] style: rubocop automatic fixes --- app/controllers/application_controller.rb | 1 - config/initializers/sentry.rb | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 7dc66f6..9df9271 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -28,5 +28,4 @@ def set_locale def change_default_caching_policy expires_in 5.minutes, public: true, must_revalidate: true if Rails.env.production? end - end diff --git a/config/initializers/sentry.rb b/config/initializers/sentry.rb index 623e854..ae6a3ce 100644 --- a/config/initializers/sentry.rb +++ b/config/initializers/sentry.rb @@ -3,7 +3,7 @@ if ENV['SENTRY_API_KEY'] Sentry.init do |config| config.dsn = ENV['SENTRY_API_KEY'] - config.environment = ENV['DEPLOYMENT_ENVIRONMENT'] || Rails.env + config.environment = ENV.fetch('DEPLOYMENT_ENVIRONMENT') { Rails.env } config.enabled_environments = %w[production] config.release = Version::VERSION config.breadcrumbs_logger = %i[active_support_logger http_logger] From 623fdfbc19eb0685c6c0afe588c35feee607e1b0 Mon Sep 17 00:00:00 2001 From: "Jon R. Humphrey" Date: Tue, 12 Mar 2024 16:56:07 +0000 Subject: [PATCH 4/7] build: updated gem system update version --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index c7ba76b..11d86f1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,7 @@ RUN apk add --update \ nodejs \ tzdata \ && rm -rf /var/cache/apk/* \ - && gem update --system \ + && gem update --system 3.4.22 \ && gem install bundler:$BUNDLER_VERSION \ && bundle config --global frozen 1 From 5cb87521257c4fea02da6c75a89ad9bd1cce562e Mon Sep 17 00:00:00 2001 From: "Jon R. Humphrey" Date: Tue, 12 Mar 2024 16:56:24 +0000 Subject: [PATCH 5/7] build: updated version PATCH cadence --- app/lib/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/lib/version.rb b/app/lib/version.rb index 30b1795..4b828a8 100644 --- a/app/lib/version.rb +++ b/app/lib/version.rb @@ -3,7 +3,7 @@ module Version MAJOR = 1 MINOR = 7 - REVISION = 5 + REVISION = 6 SUFFIX = nil VERSION = "#{MAJOR}.#{MINOR}.#{REVISION}#{SUFFIX && ".#{SUFFIX}"}" end From f345a8f78540dd9812e66997be6bcd7b7e0c84a0 Mon Sep 17 00:00:00 2001 From: "Jon R. Humphrey" Date: Tue, 12 Mar 2024 16:59:53 +0000 Subject: [PATCH 6/7] docs: Updated CHANGELOG --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 92eb554..b638806 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,14 @@ This app presents the landing page experience for landregistry.data.gov.uk, including the SPARQL Qonsole +## 1.7.6 - 2024-03-12 + +- (Jon) Reconfigured the old ppd doc routes to permanently redirect to `app/doc/ppd` + as well as set the `ppd_doc_path` variable to point to the same reconfigured + route; alongside adding tests querying the new route to ensure the route is + valid and contains the expected content as well as tests to verify the old + routes redirect with 301 permanent status + ## 1.7.5 - 2023-11-23 - (Jon) Updated the `lr_common_styles` gem to the latest 1.9.3 patch release. From 7e69aadbc870ed74f46eefab17c8b442e732f813 Mon Sep 17 00:00:00 2001 From: "Jon R. Humphrey" Date: Wed, 13 Mar 2024 08:56:26 +0000 Subject: [PATCH 7/7] fix: reset redirects to 302 temporary as a safety precaution --- CHANGELOG.md | 4 ++-- config/routes.rb | 4 ++-- test/integration/documentation_test.rb | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b638806..b63e3d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +5,11 @@ including the SPARQL Qonsole ## 1.7.6 - 2024-03-12 -- (Jon) Reconfigured the old ppd doc routes to permanently redirect to `app/doc/ppd` +- (Jon) Reconfigured the old ppd doc routes to temporarily redirect to `app/doc/ppd` as well as set the `ppd_doc_path` variable to point to the same reconfigured route; alongside adding tests querying the new route to ensure the route is valid and contains the expected content as well as tests to verify the old - routes redirect with 301 permanent status + routes redirect with 302 temporary status ## 1.7.5 - 2023-11-23 diff --git a/config/routes.rb b/config/routes.rb index f475f22..2af466a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -10,8 +10,8 @@ get 'doc/hpi', to: 'doc#hpi', as: 'hpi_doc' get 'doc/ukhpi', to: redirect('/app/ukhpi/doc', status: 302) get 'app/doc/ppd', to: 'doc#ppd', as: 'ppd_doc' - get 'doc/ppd', to: redirect('/app/doc/ppd', status: 301) - get 'app/root/doc/ppd', to: redirect('app/doc/ppd', status: 301) + get 'doc/ppd', to: redirect('/app/doc/ppd', status: 302) + get 'app/root/doc/ppd', to: redirect('app/doc/ppd', status: 302) get 'doc/ukhpi-dsd', to: redirect('/app/ukhpi/doc/ukhpi-dsd', status: 302) get 'doc/ukhpi-user-guide', to: redirect('/app/ukhpi/doc/ukhpi-user-guide', status: 302) get 'doc/accessibility', to: 'doc#accessibility' diff --git a/test/integration/documentation_test.rb b/test/integration/documentation_test.rb index 168756c..edad6d7 100644 --- a/test/integration/documentation_test.rb +++ b/test/integration/documentation_test.rb @@ -14,14 +14,14 @@ class DocumentationTest < ActionDispatch::IntegrationTest assert_equal(302, response.status) end - test 'older PPD doc link redirects with permanent 301 status' do + test 'older PPD doc link redirects with permanent 302 status' do get '/doc/ppd' - assert_equal(301, response.status) + assert_equal(302, response.status) end - test 'old PPD doc link redirects with permanent 301 status' do + test 'old PPD doc link redirects with permanent 302 status' do get '/app/root/doc/ppd' - assert_equal(301, response.status) + assert_equal(302, response.status) end test 'ppd_doc_path variable links correctly' do