Skip to content

feat(frontend): add frontend CI workflow gates for lint, tests, a11y, build, and budgets (issue #46)#74

Merged
AminN77 merged 4 commits intomainfrom
task/46-frontend-ci-workflow
Apr 24, 2026
Merged

feat(frontend): add frontend CI workflow gates for lint, tests, a11y, build, and budgets (issue #46)#74
AminN77 merged 4 commits intomainfrom
task/46-frontend-ci-workflow

Conversation

@AminN77
Copy link
Copy Markdown
Owner

@AminN77 AminN77 commented Apr 24, 2026

Summary

  • add path-scoped .github/workflows/frontend.yml for pull_request + push to main when frontend/** or backend/openapi/** changes, with PR concurrency cancellation to stop superseded runs
  • implement frontend CI jobs for lint (ESLint + Prettier), typecheck, test (Vitest), e2e (Playwright route smoke on built app), a11y (Playwright + axe wcag21aa), build, and bundle-budget
  • add supporting scripts and checks: split route smoke vs a11y Playwright specs and add test:bundle-budget script enforcing the Design Principles §8 JS gzip budgets against built app entry chunks

Test plan

  • cd frontend && pnpm lint
  • cd frontend && pnpm typecheck
  • cd frontend && pnpm test
  • cd frontend && pnpm build
  • cd frontend && pnpm test:bundle-budget
  • cd frontend && pnpm e2e:ci
  • cd frontend && pnpm a11y

Required checks (repo owner action)

Please add/confirm these required checks in branch protection for main:

  • lint
  • typecheck
  • test
  • e2e
  • a11y
  • build
  • bundle-budget

Rollback plan

  • revert this PR to remove the frontend CI workflow and supporting scripts/spec split
  • if rollback is permanent, remove the new workflow from required checks list in branch protection

Linked issue

Made with Cursor

Summary by CodeRabbit

  • New Features

    • Frontend CI workflow to run lint, typecheck, tests, build, bundle-budget checks, E2E, and accessibility on relevant frontend changes.
    • New npm scripts to run E2E, accessibility, and bundle-budget checks.
  • Tests

    • Added a WCAG 2.1 AA accessibility spec for the hello-world smoke route.
    • Updated hello-world E2E to verify rendering (theme-specific preview button) and broadened Playwright test discovery to the top-level tests directory.

Add a dedicated frontend GitHub Actions workflow with lint/typecheck/test/e2e/a11y/build/bundle-budget gates, plus supporting scripts and test split so CI enforces WCAG and performance budgets on relevant PRs.

Made-with: Cursor
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 24, 2026

Warning

Rate limit exceeded

@AminN77 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 0 minutes and 53 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 0 minutes and 53 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3cfc70f6-7603-4851-a9a2-21de4cef2a12

📥 Commits

Reviewing files that changed from the base of the PR and between 9c4a9c3 and a29764b.

📒 Files selected for processing (4)
  • .github/workflows/frontend.yml
  • frontend/scripts/check-bundle-budget.mjs
  • frontend/tests/a11y/hello-world.a11y.spec.ts
  • frontend/tests/e2e/hello-world.spec.ts
📝 Walkthrough

Walkthrough

Adds a path-scoped Frontend CI GitHub Actions workflow plus supporting frontend tooling: new CI jobs (lint, typecheck, tests, build, bundle-budget, E2E, a11y), package scripts, Playwright config update, a bundle-budget checker script, and new/updated Playwright tests.

Changes

Cohort / File(s) Summary
CI Workflow
\.github/workflows/frontend.yml
New Frontend CI workflow triggered on pushes to main and PRs touching frontend/** or backend/openapi/**. Jobs: lint+format, typecheck, unit tests, build, bundle-budget, Playwright E2E, and Playwright WCAG 2.1 AA a11y. Uses pnpm install with caching and pinned pnpm/action-setup.
Frontend scripts & config
frontend/package.json, frontend/playwright.config.ts
Adds scripts e2e:ci, a11y, and test:bundle-budget; changes Playwright testDir from ./tests/e2e to ./tests.
Bundle budget checker
frontend/scripts/check-bundle-budget.mjs
New Node script that reads Next.js client reference manifest, locates route entries, gzips and deduplicates chunk files, sums gzipped sizes per budget, logs PASS/FAIL, and exits non‑zero on budget failures.
Playwright tests
frontend/tests/a11y/hello-world.a11y.spec.ts, frontend/tests/e2e/hello-world.spec.ts
Adds Axe-based WCAG 2.1 AA accessibility test for hello-world (light/dark). Updates E2E test to focus on rendering (button visibility) and removes Axe usage.

Sequence Diagram(s)

sequenceDiagram
    participant GH as "GitHub (Push/PR)"
    participant CI as "GitHub Actions\nFrontend CI"
    participant Repo as "Checkout + pnpm install"
    participant Lint as "Lint + Format Job"
    participant TC as "Typecheck Job"
    participant Test as "Unit Test Job"
    participant Build as "Build Job (Next.js)"
    participant Bundle as "Bundle-budget Checker"
    participant E2E as "Playwright E2E Job"
    participant A11Y as "Playwright A11Y Job"

    GH->>CI: Trigger on frontend/** or backend/openapi/** changes
    CI->>Repo: Checkout repo & install pnpm deps
    par Parallel lint/typecheck/test
        CI->>Lint: Run pnpm lint + pnpm format
        CI->>TC: Run pnpm typecheck
        CI->>Test: Run pnpm test
    end
    CI->>Build: Run pnpm build (Next.js)
    Build->>CI: Build artifacts
    par After build: bundle / e2e / a11y
        CI->>Bundle: Run pnpm test:bundle-budget
        CI->>E2E: Install Playwright Chromium -> Run pnpm e2e:ci
        CI->>A11Y: Install Playwright Chromium -> Run pnpm a11y
    end
    CI->>GH: Report status (pass/fail)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding a frontend CI workflow with specific gates (lint, tests, a11y, build, budgets) and directly references the linked issue #46.
Description check ✅ Passed The description covers most required sections: summary of changes, test plan with checkmarks, rollback plan, linked issue, and change type context; however, it lacks explicit Change Type checkboxes and Risk/Mitigation sections from the template.
Linked Issues check ✅ Passed All functional requirements from issue #46 are met: workflow at .github/workflows/frontend.yml with correct triggers, all seven jobs (lint, typecheck, test, e2e, a11y, build, bundle-budget), pnpm caching, wcag21aa enforcement, and concurrency cancellation.
Out of Scope Changes check ✅ Passed All changes directly support the workflow objectives: CI configuration, package scripts, Playwright configuration, bundle-budget script, and spec reorganization (e2e vs a11y) are all within scope.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch task/46-frontend-ci-workflow

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
frontend/tests/a11y/hello-world.a11y.spec.ts (1)

10-16: Add a keyboard walk-through to the a11y gate.

This job only scans after the theme switch, so keyboard reachability and focus behavior on the interactive control still go untested. A small Tab + focus assertion for the Preview {theme} button in each theme would close that gap.

As per coding guidelines: Ensure keyboard reachability and visible focus on every interactive element (WCAG 2.1 AA).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/tests/a11y/hello-world.a11y.spec.ts` around lines 10 - 16, The
accessibility scan loop currently only runs Axe after switching themes; add a
keyboard walk-through that tabs to and asserts focus/visible focus on the
"Preview {theme}" interactive control for each theme. After setting the
data-theme in the loop (inside the same block that runs Axe), simulate a Tab key
press via Playwright (e.g., page.keyboard.press or page.press) and then locate
the button by its accessible name text "Preview {theme}" (use the same theme
variable) and assert it is document.activeElement and/or has visible focus
styling (use page.evaluate to check document.activeElement === button or
page.waitForSelector with :focus). Ensure these checks run for each theme before
or after the AxeBuilder call so keyboard reachability and focus behavior are
validated for the "Preview {theme}" button.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/frontend.yml:
- Around line 27-34: The workflow steps currently call actions/setup-node@v4
before pnpm/action-setup@v4 which breaks pnpm caching; update each job so the
step using "uses: pnpm/action-setup@v4" runs before the step using "uses:
actions/setup-node@v4" (i.e., swap the order of those two steps in every job
instance), keeping existing inputs (node-version-file, cache: pnpm,
cache-dependency-path and pnpm version) unchanged.

In `@frontend/scripts/check-bundle-budget.mjs`:
- Around line 13-16: The current bundle check uses appEntries =
["[project]/src/app/dashboard/page", "[project]/src/app/jobs/page",
"[project]/src/app/page"] which lets the marketing home page fallback mask a
missing console entry and incorrectly pass the "console" 250 KB gate; update the
logic that builds or validates appEntries (the symbol appEntries and the
"console" config) so that the console measurement only includes explicit console
entry paths (e.g., dashboard/jobs console entries) and does not silently fall
back to "[project]/src/app/page"; if an expected console entry is missing, have
the check either fail with a clear error or explicitly skip the console gate (do
not reuse src/app/page), and apply the same change to the other similar blocks
(lines handling entries in the 56-79 region) to avoid false positives.

---

Nitpick comments:
In `@frontend/tests/a11y/hello-world.a11y.spec.ts`:
- Around line 10-16: The accessibility scan loop currently only runs Axe after
switching themes; add a keyboard walk-through that tabs to and asserts
focus/visible focus on the "Preview {theme}" interactive control for each theme.
After setting the data-theme in the loop (inside the same block that runs Axe),
simulate a Tab key press via Playwright (e.g., page.keyboard.press or
page.press) and then locate the button by its accessible name text "Preview
{theme}" (use the same theme variable) and assert it is document.activeElement
and/or has visible focus styling (use page.evaluate to check
document.activeElement === button or page.waitForSelector with :focus). Ensure
these checks run for each theme before or after the AxeBuilder call so keyboard
reachability and focus behavior are validated for the "Preview {theme}" button.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: cfa7b4f5-63d8-4df2-a5d9-b2c2d6793644

📥 Commits

Reviewing files that changed from the base of the PR and between 74fb3dc and 7d5f310.

📒 Files selected for processing (6)
  • .github/workflows/frontend.yml
  • frontend/package.json
  • frontend/playwright.config.ts
  • frontend/scripts/check-bundle-budget.mjs
  • frontend/tests/a11y/hello-world.a11y.spec.ts
  • frontend/tests/e2e/hello-world.spec.ts

Comment thread .github/workflows/frontend.yml Outdated
Comment thread frontend/scripts/check-bundle-budget.mjs
Install pnpm before setup-node in frontend workflow jobs for stable pnpm cache resolution, and tighten bundle-budget logic so console checks never reuse the marketing entry.

Made-with: Cursor
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
.github/workflows/frontend.yml (1)

23-146: Consider consolidating repeated setup/install steps.

All jobs duplicate the same checkout + pnpm + node + install block. A reusable workflow or matrix strategy would reduce drift and maintenance cost.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/frontend.yml around lines 23 - 146, Multiple jobs (lint,
typecheck, test, build, bundle-budget, e2e, a11y) duplicate the same checkout +
pnpm/action-setup + actions/setup-node + Install dependencies steps; extract
these shared steps into a single reusable unit and reference it from each job to
DRY the workflow: either create a reusable workflow (workflow_call) that runs
the common steps and call it from each job, or define a separate job like
setup_common that performs checkout, pnpm/action-setup, actions/setup-node and
pnpm install and then use needs and job-level uses (or a matrix) so other jobs
(lint, typecheck, test, build, bundle-budget, e2e, a11y) depend on it and omit
the duplicated steps.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@frontend/scripts/check-bundle-budget.mjs`:
- Around line 6-16: The BUDGETS configuration (e.g., the "marketing" entry in
BUDGETS) must support a required flag and the budget-resolution logic that
currently "skips when no entry matches" must instead fail for required budgets;
add a required: true property to budgets that must be enforced and update the
resolution/check routine (the code that iterates BUDGETS and matches appEntries
against the manifest) to exit non-zero or throw an error when a required budget
cannot be resolved, while keeping non-required budgets backward-compatible
(still warn/skip).
- Around line 56-69: The current loop uses budget.appEntries.find(...) to stop
at the first matching entry; instead, compute all matching entries by using
budget.appEntries.filter(...) and then for each matched entry call
entryFiles(manifest, entry) and gzipBytesForFiles(files) to measure gzipped
size, then enforce the budget across all matches (e.g., fail if any entry's
gzipped size > budget.maxBytes or compare against the max of those sizes).
Update the logic around the matchingEntry variable to iterate over the matched
entries, aggregate results (or check any over budget), and log/skipping behavior
accordingly using BUDGETS, entryFiles, and gzipBytesForFiles.

---

Nitpick comments:
In @.github/workflows/frontend.yml:
- Around line 23-146: Multiple jobs (lint, typecheck, test, build,
bundle-budget, e2e, a11y) duplicate the same checkout + pnpm/action-setup +
actions/setup-node + Install dependencies steps; extract these shared steps into
a single reusable unit and reference it from each job to DRY the workflow:
either create a reusable workflow (workflow_call) that runs the common steps and
call it from each job, or define a separate job like setup_common that performs
checkout, pnpm/action-setup, actions/setup-node and pnpm install and then use
needs and job-level uses (or a matrix) so other jobs (lint, typecheck, test,
build, bundle-budget, e2e, a11y) depend on it and omit the duplicated steps.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d3c076da-04d3-42cc-9284-de94ba10f98c

📥 Commits

Reviewing files that changed from the base of the PR and between 7d5f310 and f06b765.

📒 Files selected for processing (2)
  • .github/workflows/frontend.yml
  • frontend/scripts/check-bundle-budget.mjs

Comment thread frontend/scripts/check-bundle-budget.mjs
Comment thread frontend/scripts/check-bundle-budget.mjs Outdated
AminN77 added 2 commits April 24, 2026 09:48
Make bundle-budget fail when required entries are unresolved and evaluate all matched entries per budget so no route can bypass size enforcement.

Made-with: Cursor
Add required/multi-entry budget enforcement and align CI format check to stable scoped files with formatted scripts/tests so frontend gates pass consistently.

Made-with: Cursor
@AminN77 AminN77 merged commit 503b7f6 into main Apr 24, 2026
11 checks passed
@AminN77 AminN77 deleted the task/46-frontend-ci-workflow branch April 24, 2026 08:05
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.

[Task]: Add frontend CI workflow (lint, typecheck, test, a11y, build, bundle budget)

1 participant