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

Remove PfG scaffolding and simplify content items. #4656

Merged
merged 13 commits into from
Mar 4, 2025

Conversation

KludgeKML
Copy link
Contributor

@KludgeKML KludgeKML commented Feb 24, 2025

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

What

Remove PfG scaffolding code

Why

PfG is now live, so we don't need the scaffolding that was necessary to test it before go-live. The ability to partially load landing page items from the local path has been made obsolete by #4366

Relies on / Cannot be merged before: alphagov/publishing-api#3153

@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4656 February 24, 2025 11:49 Inactive
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4656 February 24, 2025 12:01 Inactive
@KludgeKML KludgeKML force-pushed the remove-pfg-scaffolding-2 branch from 52841cd to 53ab22b Compare February 24, 2025 12:02
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4656 February 24, 2025 12:03 Inactive
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4656 February 24, 2025 12:57 Inactive
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4656 February 24, 2025 13:43 Inactive
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4656 February 24, 2025 13:52 Inactive
@KludgeKML KludgeKML force-pushed the remove-pfg-scaffolding-2 branch from 4506ff2 to 2b057f2 Compare February 24, 2025 13:54
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4656 February 24, 2025 13:54 Inactive
@KludgeKML KludgeKML force-pushed the remove-pfg-scaffolding-2 branch from 2b057f2 to bf07822 Compare February 24, 2025 13:56
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4656 February 24, 2025 13:56 Inactive
Copy link
Contributor

@leenagupte leenagupte left a comment

Choose a reason for hiding this comment

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

It's looking good, but I do have an inline question about a test setup.

)
GdsApi::Response.new(http_response)
end
subject(:landing_page) { ContentItemFactory.build(landing_page_example) }
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is ContentItemFactory.build being called here rather than described_class.new?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh yeah, this is just a failure to follow all the way down (I was fixated on removing the helper, forgot this example could go even further). Thanks! fixed now.

@KludgeKML KludgeKML force-pushed the remove-pfg-scaffolding-2 branch from bf07822 to a357f2d Compare February 24, 2025 16:28
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4656 February 24, 2025 16:28 Inactive
@KludgeKML KludgeKML marked this pull request as ready for review February 27, 2025 08:23
@KludgeKML KludgeKML force-pushed the remove-pfg-scaffolding-2 branch from a357f2d to 8572c67 Compare February 27, 2025 09:17
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4656 February 27, 2025 09:17 Inactive
@KludgeKML KludgeKML requested a review from leenagupte February 27, 2025 09:32
Copy link
Contributor

@leenagupte leenagupte left a comment

Choose a reason for hiding this comment

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

👍

@KludgeKML KludgeKML force-pushed the remove-pfg-scaffolding-2 branch from 8572c67 to 02c9a5f Compare March 3, 2025 09:56
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4656 March 3, 2025 09:57 Inactive
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4656 March 3, 2025 10:23 Inactive
@KludgeKML KludgeKML force-pushed the remove-pfg-scaffolding-2 branch from f05def0 to e4b584e Compare March 3, 2025 12:16
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4656 March 3, 2025 12:16 Inactive
@KludgeKML KludgeKML force-pushed the remove-pfg-scaffolding-2 branch from e4b584e to 7c44657 Compare March 3, 2025 17:21
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4656 March 3, 2025 17:22 Inactive
@KludgeKML KludgeKML force-pushed the remove-pfg-scaffolding-2 branch from 7c44657 to f1ff9c1 Compare March 4, 2025 09:15
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4656 March 4, 2025 09:16 Inactive
- add explicit before_action to set the content item once. Before
  this, the memoization on the last line would prevent building
  the content item once, but not querying the ContentItemLoader
  for it (this is largely fine because ContentItemLoader would
  cache calls to ContentStore, but we didn't need to invoke that
  code so many times)
- add attr_reader so that calls to content_item still work.
- for the moment, skip this in the landing_page_controller
  because of the scaffolding (which we'll be removing in a
  later commit).
KludgeKML added 12 commits March 4, 2025 09:30
- This meta-data about a content_item doesn't really need to
  be contained in it. It's only used in the content_items controller,
  so just save it there from the same response, and remove the
  delegation from the content_item.
- rename the before_action, since it's now getting two things.
- We now expect landing pages to be built entirely from content
  items, just like all other content items, so remove the param that
  allows us to pass another hash here. At this point, tests for landing
  page will be failing if they depend on the old scaffolding.
- attachments code was only added for the Chart block in landing
  pages, which did not in fact make it into production. We can put
  it back later, but for the moment we're not using it so we can cut
  out the tests, plus one used and one unused factory.
- Pass only the hash from the Api response to the content_item
  factory. Now only hashes should be being passed to content_item,
  so we lose the content_item_hash attribute and just use
  content_item_response.
- we pull in the improved example from alphagov/publishing-api#3153,
- this allows us to get rid of the setup hash, and stop
  stubbing the additional content path, since we want
  to get rid of that.
- we can remove the one block factory, since we're always
  loading data from the content store now, so that test
  and the previous are merged into one.
- We now no longer want anything to render when a content item
  doesn't exist, so we remove that test and leave it to standard
  behaviour.
- We've removed the attachment support from ContentItem for the
  time being, so remove that mock data.
- Using the same example as above, we can remove the mocked
  content item and the additional content path.
- rename content_item to landing_page_example to match previous
  tests.
- landing page content items are now fully available from
  content store (in practise) and publishing-api schemas
  (during tests), so this scaffolding is now no longer necessary.
- we no longer need to skip the before action.
@KludgeKML KludgeKML force-pushed the remove-pfg-scaffolding-2 branch from f1ff9c1 to 167df9b Compare March 4, 2025 09:30
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4656 March 4, 2025 09:31 Inactive
@KludgeKML KludgeKML merged commit 9202812 into main Mar 4, 2025
13 checks passed
@KludgeKML KludgeKML deleted the remove-pfg-scaffolding-2 branch March 4, 2025 13:15
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.

3 participants