Skip to content
This repository is currently being migrated. It's locked while the migration is in progress.

next-build tests#23352

Open
zachbutton wants to merge 8 commits into
mainfrom
zbutton/next-build-tests
Open

next-build tests#23352
zachbutton wants to merge 8 commits into
mainfrom
zbutton/next-build-tests

Conversation

@zachbutton
Copy link
Copy Markdown
Contributor

@zachbutton zachbutton commented Jan 29, 2026

Description

Relates to #23261

Generated description

Introduces PR tests of next-build.

It runs a few queries against Drupal, then tests static export of next-build pages.

It reads the configured content types from next-build/envs/.env.tugboat, then queries drupal for 3 pages from each of those content types. For those N*3 pages, they become part of the next-build static export run.

There is support for "always tested" pages. The following page is always tested in this PR:
/salt-lake-city-health-care/news-releases/new-data-shows-veterans-increased-use-of-online-va
https://dsva.slack.com/archives/CT4GZBM8F/p1768922422122319?thread_ts=1768875969.502519&cid=CT4GZBM8F

Notes:

This test will NOT run in this PR. The PR checks are configured to run against the target branch's config, in this case main. This test will not start running until after merging into main.

Thus, I made this supporting PR (do not merge) which changes that and causes the next-build test to run, so you can see the result here: #23414

To demonstrate that it fails when it should, this PR revert-revert's a known failure: #23353

❗ An admin will have to mark this test as required, because although the test fails at the correct time, it will not actually block a PR.

Testing

To test locally,

va.gov-cms> ddev composer va:next:install

# sync up local test pages with tugboat
va.gov-cms> cat next/envs/.env.tugboat | grep "FEATURE_NEXT_BUILD_CONTENT_" >> next/envs/.env.example

# run the tests
va.gov-cms> ddev composer va:test:next-build local

Definition of Done

  • Documentation has been updated, if applicable.
  • Tests have been added if necessary.
  • Automated tests have passed.
  • Code Quality Tests have passed.
  • Acceptance Criteria in related issue are met.
  • Manual Code Review Approved.
  • If there are field changes, front end output has been thoroughly checked.

Select Team for PR review

  • CMS Team
  • Public websites
  • Facilities
  • User support
  • Accelerated Publishing

Is this PR blocked by another PR?

  • DO NOT MERGE

Does this PR need review from a Product Owner

  • Needs PO review

CMS user-facing announcement

Is an announcement needed to let editors know of this change?

  • Yes, and it's written in issue ____ and queued for publication.
    • Merge and ping the UX writer so they are ready to publish after deployment
  • Yes, but it hasn't yet been written
    • Don't merge yet -- ping the UX writer to write and queue content
  • No announcement is needed for this code change.
    • Merge & carry on unburdened by announcements

@github-actions
Copy link
Copy Markdown

Checking composer.lock changes...

@zachbutton zachbutton force-pushed the zbutton/next-build-tests branch from 9a8fc8e to 1c94a41 Compare January 29, 2026 23:37
@va-cms-bot va-cms-bot temporarily deployed to Tugboat January 29, 2026 23:37 Destroyed
@github-actions
Copy link
Copy Markdown

Checking composer.lock changes...

@va-cms-bot va-cms-bot temporarily deployed to Tugboat January 29, 2026 23:57 Destroyed
@github-actions
Copy link
Copy Markdown

Checking composer.lock changes...

@zachbutton zachbutton added the DO NOT MERGE Do not merge this PR label Jan 29, 2026
@va-cms-bot va-cms-bot temporarily deployed to Tugboat January 30, 2026 08:33 Destroyed
@va-cms-bot va-cms-bot temporarily deployed to Tugboat January 31, 2026 08:27 Destroyed
@va-cms-bot va-cms-bot temporarily deployed to Tugboat February 1, 2026 08:27 Destroyed
@va-cms-bot va-cms-bot temporarily deployed to Tugboat February 2, 2026 08:28 Destroyed
@zachbutton zachbutton force-pushed the zbutton/next-build-tests branch from ca05a23 to e8b6fb1 Compare February 2, 2026 20:48
@va-cms-bot va-cms-bot temporarily deployed to Tugboat February 2, 2026 20:49 Destroyed
@zachbutton zachbutton force-pushed the zbutton/next-build-tests branch from e8b6fb1 to 36d9d43 Compare February 2, 2026 23:56
@va-cms-bot va-cms-bot temporarily deployed to Tugboat February 2, 2026 23:56 Destroyed
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 2, 2026

Checking composer.lock changes...

@va-cms-bot va-cms-bot temporarily deployed to Tugboat February 3, 2026 00:21 Destroyed
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 3, 2026

Checking composer.lock changes...

@va-cms-bot va-cms-bot temporarily deployed to Tugboat February 3, 2026 00:33 Destroyed
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 3, 2026

Checking composer.lock changes...

@zachbutton zachbutton force-pushed the zbutton/next-build-tests branch 2 times, most recently from 5bc538c to ce97073 Compare February 3, 2026 00:46
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 3, 2026

Checking composer.lock changes...

@va-cms-bot va-cms-bot temporarily deployed to Tugboat February 3, 2026 00:46 Destroyed
@zachbutton zachbutton force-pushed the zbutton/next-build-tests branch from ce97073 to c3193fa Compare February 3, 2026 01:28
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 3, 2026

Checking composer.lock changes...

@va-cms-bot va-cms-bot temporarily deployed to Tugboat February 3, 2026 01:28 Destroyed
@zachbutton zachbutton force-pushed the zbutton/next-build-tests branch from c3193fa to f3aefad Compare February 3, 2026 01:49
@zachbutton zachbutton force-pushed the zbutton/next-build-tests branch from e6e1486 to a9eb856 Compare February 4, 2026 18:39
@va-cms-bot va-cms-bot temporarily deployed to Tugboat February 4, 2026 18:39 Destroyed
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 4, 2026

Checking composer.lock changes...

@zachbutton zachbutton force-pushed the zbutton/next-build-tests branch from a9eb856 to fcc0cbd Compare February 4, 2026 18:59
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 4, 2026

Checking composer.lock changes...

@va-cms-bot va-cms-bot temporarily deployed to Tugboat February 4, 2026 18:59 Destroyed
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 4, 2026

GitHub Workflows (.github/workflows/*.yml)

Have you...

  • pinned all affected GitHub Actions at a specific commit by SHA?
  • reviewed the source code of the action at the commit you are pinning?
  • confirmed that no GitHub security measures are being bypassed?
  • checked for any injection of user content into protected contexts?
  • reviewed Security hardening for GitHub Actions?
  • reviewed GitHub Workflows?

@zachbutton zachbutton marked this pull request as ready for review February 4, 2026 19:57
@zachbutton zachbutton requested review from a team as code owners February 4, 2026 19:57
Copilot AI review requested due to automatic review settings February 4, 2026 19:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new CI/Tugboat test to exercise Next Build’s integration points with CMS (JSON:API + Decoupled Router) and validates a static export against a curated set of pages.

Changes:

  • Introduces tests/scripts/next-build.sh to run Router/JSON:API checks and a targeted Next Build static export.
  • Registers a new va:test:next-build composer script and a corresponding va/tests/next-build task in tests.yml.
  • Ensures the new task is set to “pending” like other required Tugboat checks via the GitHub workflow.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.

File Description
tests/scripts/next-build.sh Implements Router/JSON:API smoke tests plus a Next Build static export using cherry-picked paths.
tests.yml Adds the va/tests/next-build task and includes it in pending-status setup and default deps.
composer.json Adds va:test:next-build script entry to invoke the new shell script.
.github/workflows/set-tugboat-tests-pending.yml Adds va/tests/next-build to the list of checks set to pending on PRs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +73 to +83
$@
exit_code=$?

echo

if [ "$exit_code" = "0" ]; then
echo "[PASSED $name]"
return 0
else
echo "[FAILED $name]"
((FAILURES++))
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

set -e is enabled globally, but this harness is written to continue running and aggregate failures. As written, any failing test command at line 73 will terminate the script before $? is captured, and even if that’s fixed the first ((FAILURES++)) will exit the script because it returns status 1 when incrementing from 0 under set -e. Either drop global -e for this script, or wrap the test invocation and the failure counter increment in constructs that won’t trigger errexit (e.g., if ...; then / else, or temporarily set +e). Also invoke the command as "$@" to preserve argument boundaries.

Suggested change
$@
exit_code=$?
echo
if [ "$exit_code" = "0" ]; then
echo "[PASSED $name]"
return 0
else
echo "[FAILED $name]"
((FAILURES++))
if "$@"; then
echo
echo "[PASSED $name]"
return 0
else
echo
echo "[FAILED $name]"
FAILURES=$((FAILURES + 1))

Copilot uses AI. Check for mistakes.
Comment on lines +156 to +162
router_has_uuid() {
local uuid
uuid=$(router_get_uuid "$1") || return 1
[[ -n "$uuid" && "$uuid" != "null" ]]

printf "$uuid... "
}
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

This function relies on a standalone [[ ... ]] test for success. With set -e enabled, a false condition will terminate the entire script instead of returning non-zero to run_test. Make this check explicitly control flow (e.g., [[ ... ]] || return 1) so failures are reported correctly.

Copilot uses AI. Check for mistakes.
local body
body=$(http_get "${DRUPAL_ADDRESS}${endpoint}") || return 1

echo $body | jq -rj '.data[0].id'
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

echo $body | jq ... will word-split/glob-expand the JSON and can also be misinterpreted as echo options (e.g., if JSON starts with -n), causing jq parsing failures or incorrect output. Feed jq the variable without echo and with proper quoting (e.g., via a here-string or printf '%s').

Suggested change
echo $body | jq -rj '.data[0].id'
jq -rj '.data[0].id' <<<"$body"

Copilot uses AI. Check for mistakes.
Comment on lines +100 to +101
body=$(http_get "${DRUPAL_ADDRESS}/jsonapi/node/${content_type}?page[limit]=${limit}&filter[status]=1" 2>/dev/null) || return 0
jq -r '.data[].attributes.path.alias // empty' <<<"$body" 2>/dev/null
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

get_sample_paths swallows any HTTP/JSON:API errors (|| return 0 and redirects stderr), which can silently drop an enabled content type from SSG_CHERRY_PICKED_PATHS and let the export test pass without covering that type. Consider returning non-zero (or at least logging a warning and tracking a failure) when the JSON:API request fails.

Suggested change
body=$(http_get "${DRUPAL_ADDRESS}/jsonapi/node/${content_type}?page[limit]=${limit}&filter[status]=1" 2>/dev/null) || return 0
jq -r '.data[].attributes.path.alias // empty' <<<"$body" 2>/dev/null
body=$(http_get "${DRUPAL_ADDRESS}/jsonapi/node/${content_type}?page[limit]=${limit}&filter[status]=1") || {
echo "Warning: Failed to fetch sample paths for content type '${content_type}' from JSON:API at ${DRUPAL_ADDRESS}" >&2
((FAILURES++))
return 1
}
jq -r '.data[].attributes.path.alias // empty' <<<"$body"

Copilot uses AI. Check for mistakes.
Comment on lines +106 to +110
local env_file="${repo_root}/next/envs/.env.${APP_ENV:-example}"
if [[ ! -f "$env_file" ]]; then
echo "Warning: env file not found: $env_file" >&2
return
fi
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

If the Next Build env file is missing, the script only emits a warning and continues, which can make the export test run with just ALWAYS_TEST_PAGES and not validate configured content types. Treat a missing env file as a hard failure for this test so it can’t pass in a misconfigured environment.

Copilot uses AI. Check for mistakes.
Comment thread composer.json
Comment on lines +562 to +563
"! ./scripts/should-run-directly.sh || ./tests/scripts/next-build.sh \"$@\"",
"./scripts/should-run-directly.sh || ddev composer va:test:next-build -- \"$@\""
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

These script lines add an extra empty argument when composer forwards arguments to the command (because "$@" expands to empty in this context), which shifts positional parameters for next-build.sh (e.g., composer va:test:next-build tugboat would likely arrive as $1="", $2="tugboat"). This makes the env override unreliable. Prefer omitting "$@" here and rely on Composer’s normal argument forwarding to append args to the command.

Suggested change
"! ./scripts/should-run-directly.sh || ./tests/scripts/next-build.sh \"$@\"",
"./scripts/should-run-directly.sh || ddev composer va:test:next-build -- \"$@\""
"! ./scripts/should-run-directly.sh || ./tests/scripts/next-build.sh",
"./scripts/should-run-directly.sh || ddev composer va:test:next-build --"

Copilot uses AI. Check for mistakes.
@va-cms-bot va-cms-bot temporarily deployed to Tugboat February 5, 2026 08:26 Destroyed
@va-cms-bot va-cms-bot temporarily deployed to Tugboat February 6, 2026 08:28 Destroyed
@va-cms-bot va-cms-bot temporarily deployed to Tugboat February 7, 2026 08:26 Destroyed
@va-cms-bot va-cms-bot temporarily deployed to Tugboat February 8, 2026 08:26 Destroyed
@va-cms-bot va-cms-bot temporarily deployed to Tugboat February 9, 2026 08:27 Destroyed
@va-cms-bot va-cms-bot temporarily deployed to Tugboat February 10, 2026 08:27 Destroyed
@va-cms-bot va-cms-bot temporarily deployed to Tugboat February 11, 2026 08:24 Destroyed
@va-cms-bot va-cms-bot temporarily deployed to Tugboat February 12, 2026 08:24 Destroyed
@va-cms-bot va-cms-bot temporarily deployed to Tugboat February 13, 2026 08:25 Destroyed
@va-cms-bot
Copy link
Copy Markdown
Collaborator

Cypress Accessibility Violations

/test-data-quos

ID: button-name
Impact: critical
Tags: cat.name-role-value, wcag2a, wcag412, section508, section508.22.a, TTv5, TT6.a, EN-301-549, EN-9.4.1.2, ACT
Description: Ensure buttons have discernible text
Help: Buttons must have discernible text
Nodes:

  • HTML: <button class="proofing-element-help" role="tooltip" data-proofing-help-title="About 'Page introduction' field" data-proofing-help="Add an introduction that helps visitors understand if information on the page is relevant to them."> <span aria-hidden="true">i</span> </button>
    Impact: critical
    Target: .field--name-field-intro-text-limited-html > .field__label > .proofing-element-help[role="tooltip"]
    Summary: Fix any of the following:
    Element does not have inner text that is visible to screen readers
    aria-label attribute does not exist or is empty
    aria-labelledby attribute does not exist, references elements that do not exist or references elements that are empty
    Element has no title attribute
    Element does not have an implicit (wrapped) <label>
    Element does not have an explicit <label>
    Element's default semantics were not overridden with role="none" or role="presentation"

  • HTML: <button class="proofing-element-help" role="tooltip" data-proofing-help-title="About 'Generate a table of contents from major headings' field" data-proofing-help="By checking this box, all h2's below this point on the page will be linked with with anchor links. This helps users navigate content on very long pages. Do not check this box unless there is at least 2 h2's on the page.">
    Impact: critical
    Target: .field--name-field-table-of-contents-boolean > .field__label > .proofing-element-help[role="tooltip"]
    Summary: Fix any of the following:
    Element does not have inner text that is visible to screen readers
    aria-label attribute does not exist or is empty
    aria-labelledby attribute does not exist, references elements that do not exist or references elements that are empty
    Element has no title attribute
    Element does not have an implicit (wrapped) <label>
    Element does not have an explicit <label>
    Element's default semantics were not overridden with role="none" or role="presentation"

  • HTML: <button class="proofing-element-help" role="tooltip" data-proofing-help-title="About 'Main content' field" data-proofing-help="The main body of the page, which appears below the featured content."> <span aria-hidden="true">i</span> </button>
    Impact: critical
    Target: button[data-proofing-help-title="About 'Main content' field"]
    Summary: Fix any of the following:
    Element does not have inner text that is visible to screen readers
    aria-label attribute does not exist or is empty
    aria-labelledby attribute does not exist, references elements that do not exist or references elements that are empty
    Element has no title attribute
    Element does not have an implicit (wrapped) <label>
    Element does not have an explicit <label>
    Element's default semantics were not overridden with role="none" or role="presentation"

@va-cms-bot va-cms-bot temporarily deployed to Tugboat February 17, 2026 08:21 Destroyed
@va-cms-bot va-cms-bot temporarily deployed to Tugboat February 18, 2026 08:25 Destroyed
@va-cms-bot va-cms-bot temporarily deployed to Tugboat February 19, 2026 08:27 Destroyed
@va-cms-bot va-cms-bot temporarily deployed to Tugboat February 20, 2026 08:19 Destroyed
@va-cms-bot va-cms-bot temporarily deployed to Tugboat February 21, 2026 08:20 Destroyed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DO NOT MERGE Do not merge this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants