Skip to content

Commit

Permalink
VACMS-16888: Adds exception handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
omahane committed Mar 3, 2025
2 parents a9143f7 + bd466ed commit b71d8e5
Show file tree
Hide file tree
Showing 52 changed files with 717 additions and 397 deletions.
19 changes: 4 additions & 15 deletions .github/ISSUE_TEMPLATE/runbook-facility-url-change.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ When does this request need to be live:
- [ ] Link the related facility closure / rename issue.
- [ ] Create a URL redirect in the [vsp-platform-revproxy](https://github.com/department-of-veterans-affairs/vsp-platform-revproxy) repo in `template-rendering/revproxy-vagov/vars/redirects.yml`
- [ ] Add the "Awaiting redirect" flag to the facility node with a revision log message that includes a link to this ticket, preserving the node's current moderation state.
- [ ] Redirects deploy daily except Friday at 10am ET, or by requesting OOB deploy (of the revproxy job to prod) in #vfs-platform-support. After deploy, validate that the URL redirect is deployed. (Note: In the event of a facility closure or a name change, validate that this occurs before making the Lighthouse csv changes.)
- [ ] Redirects deploy daily except Friday at 10am ET, or by requesting OOB deploy (of the revproxy job to prod) in #vfs-platform-support. After deploy, validate that the URL redirect is deployed.
- [ ] Update this ticket with a comment that the redirect has been deployed.
- [ ] Remove the "Awaiting redirect" flag on the facility node with a revision log message that includes a link to this ticket, preserving the node's current moderation state.
- [ ] Notify helpdesk via comment on ticket or Slack message in #cms-support that changes are ready for review.
Expand All @@ -37,14 +37,9 @@ When does this request need to be live:

### Instructions for canonical URL change
- [ ] Verify that the new URL for the facility is published and accessible on VA.gov.
- [ ] Contact Lighthouse via Slack at #cms-lighthouse channel that this facility requires a canonical link in the following format (replacing the placeholder data with the actual API Id and VA.gov URL):
- `vha_691GM,https://www.va.gov/greater-los-angeles-health-care/locations/oxnard-va-clinic/`
- [ ] Add the "Awaiting CSV" flag to the facility node with a revision log message that includes a link to this ticket.
- [ ] Let Help desk know this has been done, if not done by Help desk.

#### Wait (days or weeks, potentially)
- [ ] After the canonical link has been added to the websites.csv and you have confirmation from Lighthouse that the CSV has been deployed, validate that the change has deployed by checking that the Facility Locator has been updated with the new url.
- [ ] Update this ticket with a comment that the CSV change has been deployed.
#### After next nightly Facilities migration to Lighthouse
- [ ] Validate that the change has deployed by checking that the Facility Locator has been updated with the new url.

#### URL change example (update with actual ID and URL)
| Facility API ID | Full VA.gov URL |
Expand All @@ -53,13 +48,7 @@ When does this request need to be live:

### 2. Canonical URL removal (if removed from VAST)
### Instructions for canonical URL removal
- [ ] Try to find the facility via the Facility Locator, using the Facility API ID (e.g. https://va.gov/find-locations/facility/"facility_api_id"). If it is not available, proceed.
- [ ] Contact Lighthouse via Slack at #cms-lighthouse channel that this facility requires a canonical link to be removed in the following format (replacing the placeholder data with the actual API Id and VA.gov URL):
- `vha_691GM,https://www.va.gov/greater-los-angeles-health-care/locations/oxnard-va-clinic/`
- [ ] Try to find the facility via the Facility Locator, using the Facility API ID (e.g. https://va.gov/find-locations/facility/"facility_api_id"). If it is not available, close this ticket.

**Note: there's no check to see if it's not returning anything, as it should already be not showing anything in the Facility Locator.**

#### URL removal example (update with actual ID and URL to remove)
| Facility API ID | Full VA.gov URL |
| --- | --- |
| vha_691GM | https://www.va.gov/greater-los-angeles-health-care/locations/oxnard-va-clinic |
15 changes: 5 additions & 10 deletions .github/ISSUE_TEMPLATE/runbook-vamc-facility-new.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,14 @@ Please let us know when your draft content is complete, so that we can wrap up t
- [ ] When editor has prepared content and let help desk know, proceed to the remaining steps.


#### Drupal Admin steps (CMS Engineer or Help desk) _Help desk will complete these steps or escalate to request help from CMS engineering._
#### Drupal Admin steps (_Help desk will complete these steps or escalate to request help from CMS engineering._)
- [ ] Update the facility **Meta description** field, using the following format: "Get address and hours, parking and transportation information, and health services offered at [facility name]."
- [ ] Move the facility link in the health care system menu to its place in the alphabetized list (medical centers first, then clinics).
- [ ] Drupal Admin bulk publishes nodes and facility.
- [ ] Contact Lighthouse via Slack at #cms-lighthouse channel that this facility requires a canonical link in the following format (replace the placeholder data with the actual API Id and VA.gov URL):
- `vha_XXX`,https://www.va.gov/SYSTEM-health-care/locations/PATH/`
- [ ] Add the "Awaiting CSV" flag to the facility node with a revision log message that includes a link to this ticket.
- [ ] Let Help desk know this has been done, if not done by Help desk.

#### Wait (days or weeks, potentially)
- [ ] After the canonical link has been added to the websites.csv and you have confirmation from Lighthouse that the CSV has been deployed, validate that the change has deployed by checking that the Facility Locator has been updated with the new url.
- [ ] Update this ticket with a comment that the CSV change has been deployed.
- [ ] Edit facility node and remove `New facility` and "Awaiting CSV" flags with a revision log message that includes a link to this ticket.

#### After the next nightly Facilities migration to Lighthouse
- [ ] Validate that the change has deployed by checking that the Facility Locator has been updated with the new url.
- [ ] Edit facility node and remove `New facility` flag with a revision log message that includes a link to this ticket.

#### CMS Help desk (wrap up)
- [ ] Notify editor and any other stakeholders.
15 changes: 5 additions & 10 deletions .github/ISSUE_TEMPLATE/runbook-vet-center-new.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,12 @@ Facility API ID: <insert_facility_API_ID>

**Drupal Admin steps**
- [ ] Bulk publish the nodes and facility.
- [ ] Contact Lighthouse via Slack at #cms-lighthouse channel that this facility requires a canonical link in the following format (replacing the placeholder data with the actual API Id and VA.gov URL):
- `vha_691GM,https://www.va.gov/greater-los-angeles-health-care/locations/oxnard-va-clinic/`
- [ ] Add the "Awaiting CSV" flag to the facility node with a revision log message that includes a link to this ticket.
- [ ] Let Help desk know this has been done, if not done by Help desk.

#### Wait (days or weeks, potentially)
- [ ] After the canonical link has been added to the websites.csv and you have confirmation from Lighthouse that the CSV has been deployed, validate that the change has deployed by checking that the Facility Locator has been updated with the new url.
- [ ] Update this ticket with a comment that the CSV change has been deployed.
- [ ] Edit facility node and remove `New facility` and "Awaiting CSV" flags with a revision log message that includes a link to this ticket.
#### After next nightly Facilities migration to Lighthouse
- [ ] Validate that the change has deployed by checking that the Facility Locator has been updated with the new url.
- [ ] Edit facility node and remove `New facility` flag with a revision log message that includes a link to this ticket.
- [ ] Let Help desk know this has been done, if not done by Help desk.

#### CMS Help desk (wrap up)
- [ ] 11. Upgrade the Vet Center Director and Outreach Specialist accounts to the publisher role for that Vet Center.
- [ ] 12. Notify editor and any other stakeholders.
- [ ] Upgrade the Vet Center Director and Outreach Specialist accounts to the publisher role for that Vet Center.
- [ ] Notify editor and any other stakeholders.
2 changes: 1 addition & 1 deletion .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
NODE_TLS_REJECT_UNAUTHORIZED: 0

- name: Cypress run
uses: cypress-io/github-action@18a6541367f4580a515371905f499a27a44e8dbe # v6.7.12
uses: cypress-io/github-action@1052aa98bbbe4f55210f844878213c07d9c8c399 # v6.7.13
with:
wait-on: "${{ inputs.preview_url }}"
command: 'npm run test:cypress:parallel'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/default-branch-datadog-metrics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
env:
GITHUB_REPOSITORY: "${{ github.repository }}"
- name: Send Metrics to DataDog.
uses: masci/datadog@a5d283e78e33a688ed08a96ba64440505e645a8c # v1.7.1
uses: masci/datadog@748e7a8235b5dd4f467cc27dc77cc0c71d78563b # v1.8.0
with:
api-key: ${{ secrets.DATADOG_API_KEY }}
api-url: https://api.ddog-gov.com
Expand Down Expand Up @@ -150,7 +150,7 @@ jobs:
echo "Lines Denominator: ${lines_denominator}";
- name: Send Metrics to DataDog.
uses: masci/datadog@a5d283e78e33a688ed08a96ba64440505e645a8c # v1.7.1
uses: masci/datadog@748e7a8235b5dd4f467cc27dc77cc0c71d78563b # v1.8.0
with:
api-key: ${{ secrets.DATADOG_API_KEY }}
api-url: https://api.ddog-gov.com
Expand Down Expand Up @@ -271,7 +271,7 @@ jobs:
echo "nonpublic_class_constants=$(jq '.nonPublicClassConstants' phploc.json)" >> $GITHUB_OUTPUT
- name: Send Metrics to DataDog.
uses: masci/datadog@a5d283e78e33a688ed08a96ba64440505e645a8c # v1.7.1
uses: masci/datadog@748e7a8235b5dd4f467cc27dc77cc0c71d78563b # v1.8.0
with:
api-key: ${{ secrets.DATADOG_API_KEY }}
api-url: https://api.ddog-gov.com
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@
"symfony/phpunit-bridge": "^7.1",
"symfony/process": "^6.3",
"symfony/routing": "^6.3",
"va-gov/content-build": "0.0.3687",
"va-gov/content-build": "^0.0.3692",
"vlucas/phpdotenv": "^5.6",
"webflo/drupal-finder": "1.3.1",
"webmozart/path-util": "^2.3",
Expand Down
14 changes: 7 additions & 7 deletions composer.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "ada32d5f69e1bd4e9ecb9d0277032bfc",
"content-hash": "925bf2cf10cc9ee4a3dccb0375811f80",
"packages": [
{
"name": "asm89/stack-cors",
Expand Down Expand Up @@ -26907,16 +26907,16 @@
},
{
"name": "va-gov/content-build",
"version": "v0.0.3687",
"version": "v0.0.3692",
"source": {
"type": "git",
"url": "https://github.com/department-of-veterans-affairs/content-build.git",
"reference": "5cb5b37f4bfadd218e32bce98e0caa6b235d518e"
"reference": "c068208c8015cc7fbab3e7598356b2eda483c5fc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/department-of-veterans-affairs/content-build/zipball/5cb5b37f4bfadd218e32bce98e0caa6b235d518e",
"reference": "5cb5b37f4bfadd218e32bce98e0caa6b235d518e",
"url": "https://api.github.com/repos/department-of-veterans-affairs/content-build/zipball/c068208c8015cc7fbab3e7598356b2eda483c5fc",
"reference": "c068208c8015cc7fbab3e7598356b2eda483c5fc",
"shasum": ""
},
"type": "node-project",
Expand All @@ -26943,9 +26943,9 @@
"description": "Front-end for VA.gov. This repository contains the code that generates the www.va.gov website. It contains a Metalsmith static site builder that uses a Drupal CMS for content. This file is here to publish releases to https://packagist.org/packages/va-gov/content-build, so that the CMS CI system can install it and update it using standard composer processes, and so that we can run tests across both systems. See https://github.com/department-of-veterans-affairs/va.gov-cms for the CMS repo, and stand by for more documentation.",
"support": {
"issues": "https://github.com/department-of-veterans-affairs/content-build/issues",
"source": "https://github.com/department-of-veterans-affairs/content-build/tree/v0.0.3687"
"source": "https://github.com/department-of-veterans-affairs/content-build/tree/v0.0.3692"
},
"time": "2025-02-19T16:18:39+00:00"
"time": "2025-02-26T22:06:38+00:00"
},
{
"name": "vlucas/phpdotenv",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ dependencies:
- field.field.node.va_form.field_alert
- field.field.node.va_form.field_benefit_categories
- field.field.node.va_form.field_last_saved_by_an_editor
- field.field.node.va_form.field_meta_tags
- field.field.node.va_form.field_va_form_administration
- field.field.node.va_form.field_va_form_deleted
- field.field.node.va_form.field_va_form_deleted_date
Expand Down Expand Up @@ -161,6 +160,7 @@ content:
field_widget_display_settings:
view_mode: default
selection_mode: selection_append
show_latest_revision: false
third_party_settings: { }
field_benefit_categories:
type: options_buttons
Expand Down Expand Up @@ -352,7 +352,6 @@ content:
third_party_settings: { }
hidden:
created: true
field_meta_tags: true
langcode: true
promote: true
status: true
Expand Down
9 changes: 0 additions & 9 deletions config/sync/core.entity_view_display.node.va_form.default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ dependencies:
- field.field.node.va_form.field_alert
- field.field.node.va_form.field_benefit_categories
- field.field.node.va_form.field_last_saved_by_an_editor
- field.field.node.va_form.field_meta_tags
- field.field.node.va_form.field_va_form_administration
- field.field.node.va_form.field_va_form_deleted
- field.field.node.va_form.field_va_form_deleted_date
Expand All @@ -32,7 +31,6 @@ dependencies:
- entity_reference_revisions
- field_group
- link
- metatag
- options
- text
- user
Expand Down Expand Up @@ -107,13 +105,6 @@ content:
third_party_settings: { }
weight: 18
region: content
field_meta_tags:
type: metatag_empty_formatter
label: above
settings: { }
third_party_settings: { }
weight: 1
region: content
field_va_form_language:
type: list_default
label: above
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ dependencies:
- field.field.node.va_form.field_alert
- field.field.node.va_form.field_benefit_categories
- field.field.node.va_form.field_last_saved_by_an_editor
- field.field.node.va_form.field_meta_tags
- field.field.node.va_form.field_va_form_administration
- field.field.node.va_form.field_va_form_deleted
- field.field.node.va_form.field_va_form_deleted_date
Expand Down Expand Up @@ -165,7 +164,6 @@ hidden:
field_alert: true
field_benefit_categories: true
field_last_saved_by_an_editor: true
field_meta_tags: true
field_va_form_language: true
field_va_form_link_teasers: true
field_va_form_name: true
Expand Down
2 changes: 0 additions & 2 deletions config/sync/core.entity_view_display.node.va_form.teaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ dependencies:
- field.field.node.va_form.field_alert
- field.field.node.va_form.field_benefit_categories
- field.field.node.va_form.field_last_saved_by_an_editor
- field.field.node.va_form.field_meta_tags
- field.field.node.va_form.field_va_form_administration
- field.field.node.va_form.field_va_form_deleted
- field.field.node.va_form.field_va_form_deleted_date
Expand Down Expand Up @@ -48,7 +47,6 @@ hidden:
field_alert: true
field_benefit_categories: true
field_last_saved_by_an_editor: true
field_meta_tags: true
field_va_form_administration: true
field_va_form_deleted: true
field_va_form_deleted_date: true
Expand Down
21 changes: 0 additions & 21 deletions config/sync/field.field.node.va_form.field_meta_tags.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ dependencies: { }
id: node__campaign_landing_page
label: 'Content: Campaign Landing Page'
tags:
description: '[node:field_clp_why_this_matters:value]'
og_image: '[node:field_hero_image:entity:image:3_2_medium_thumbnail:url]'
twitter_cards_image: '[node:field_hero_image:entity:image:3_2_medium_thumbnail:url]'
2 changes: 1 addition & 1 deletion config/sync/metatag.metatag_defaults.node__va_form.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ dependencies: { }
id: node__va_form
label: 'Content: VA form'
tags:
description: '[node:field_va_form_usage:value]'
description: '[node:field_va_form_name:value]'
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Drupal\va_gov_backend\Deploy\LoadMaintenanceFileTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException;

/**
Expand All @@ -30,8 +31,12 @@ public function run(Request $request, string $app_root, string $site_path) {
$html = preg_replace('/\{\{\s*update_duration\s*\}\}/', $expected_update_duration, $html);
$headers = [
'Content-Type' => 'text/html',
'Retry-After' => 120,
];
throw new ServiceUnavailableHttpException(120, $html, NULL, 503, $headers);
$response = new Response($html, 503, $headers);
$response->send();
// We need to throw an exception to stop the request.
throw new ServiceUnavailableHttpException();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,21 @@ public function processOne(string $key, mixed $item, array &$sandbox): string {
if (empty($original_extension)) {
return "No extension found for paragraph id $item";
}
$phone_parent_field_name = $phone_paragraph->get('parent_field_name')->value;
// Don't try to change 'field_phone_numbers_paragraph'.
if ($phone_parent_field_name === 'field_phone_numbers_paragraph') {
return "The phone data from 'field_phone_numbers_paragraph' '$item' on 'health_care_local_health_service' has already been migrated to the Service location paragraph previously. This is a vestigial field that is unused.";
}
$number_only_extension = $this->replaceNonNumerals($original_extension);
if ($original_extension === $number_only_extension) {
return "No change to extension $original_extension in paragraph id $item";
return "No change to extension '$original_extension' in paragraph id $item";
}
$phone_paragraph->set(name: 'field_phone_extension', value: $number_only_extension);
$phone_paragraph->save();
return "Extension updated for paragraph id $item from '$original_extension' to '$number_only_extension'";
}
catch (\Exception $e) {
$message = "Exception during update of paragraph id $item with extension: $original_extension";
$message = "Exception during update of paragraph id $item with extension: '$original_extension'";
return $message;
}

Expand All @@ -98,15 +103,15 @@ public function processOne(string $key, mixed $item, array &$sandbox): string {
*/
public static function replaceNonNumerals(string $extension): string {

$pattern_to_ignore = '/(^\d+[,|;]\s?\d+)|(^\d+\sor\s\d+)|(^\d+\/\d+)|(^\d+\sthen\s\d+)/';
$pattern_to_ignore = '/(^\d+[,|;]\s?\d+)|(^\d+\sor\s\d+)|(^\d+\/\d+)|(^\d+\sthen\s\d+)/i';

// If the extension contains two numbers separate numbers, don't change it.
if (preg_match($pattern_to_ignore, $extension) > 0) {
return $extension;
}

// Remove non-numerical characters from the extension.
$just_numbers = preg_replace('/[^0-9]/', '', $extension);
$just_numbers = trim(preg_replace('/[^0-9]/', '', $extension));

return $just_numbers;
}
Expand Down
Loading

0 comments on commit b71d8e5

Please sign in to comment.