Automated Quality Checkers
Relevant source files
The following files were used as context for generating this wiki page:
- src/services/quality-check/QualityChecker.js
- src/services/quality-check/validators/lighthouse-validator.js
- src/services/quality-check/validators/astro-leak-validator.js
- coverage/src/services/quality-check/QualityChecker.js.html
- src/services/quality-check/tests/quality-check-e2e.test.js
- scripts/alpha-verify-deployment.js
The Automated Quality Checkers system serves as a comprehensive validation orchestrator within the FusionOps pipeline. It implements a series of "Quality Gates" (QUAL-01 through QUAL-06) designed to inspect landing page output after transformations (such as anti-fingerprinting) but before final deployment to Cloudflare. Its primary purpose is to ensure technical compliance, performance standards, and security by catching issues like unprocessed environment variables or missing tracking markers.
This system acts as a blocking mechanism in the deployment workflow. If any validator identifies a "critical" failure, the deployment is halted, providing developers with specific remediation guidance and line context to fix the underlying issues.
Sources: src/services/quality-check/QualityChecker.js:1-6, src/services/quality-check/tests/quality-check-e2e.test.js:13-17
Architecture and Orchestration
The QualityChecker class is the central orchestrator that manages the execution flow of specialized validators. It processes the final HTML and CSS output, applying configuration-specific rules to determine if a build is "deploy-ready."
Validation Workflow
The workflow follows a sequential gate execution pattern where results are aggregated into a final report.
The checker distinguishes between "checks" (passed validations), "criticalFailures" (blocking issues), and "warnings" (non-blocking logs).
Sources: src/services/quality-check/QualityChecker.js:18-34, coverage/src/services/quality-check/QualityChecker.js.html:35-80
Specialized Validators
The system employs several domain-specific validators to handle different compliance categories.
Viewport and Responsive Layout (QUAL-01)
Ensures the viewport meta tag is present and correctly configured (e.g., width=device-width). This is critical for mobile responsiveness and SEO.
Sources: src/services/quality-check/QualityChecker.js:41-47, scripts/alpha-verify-deployment.js:63-71
Astro Expression Leaks (QUAL-03)
Scans the transformed HTML for unprocessed Astro environment variables or Vite expressions. This prevents sensitive configuration strings or undefined values from leaking into production.
Identified Leak Patterns:
import.meta.env.PUBLIC_${.*env.VITE_[A-Z_]+undefinedstring literals in JS blocks
Sources: src/services/quality-check/validators/astro-leak-validator.js, scripts/alpha-verify-deployment.js:88-105
Lighthouse Performance Enforcement (QUAL-05)
This is an asynchronous validator that evaluates the HTML against performance, accessibility, and SEO metrics. It enforces a standard (often 95+) for production builds. It includes a timeout mechanism to ensure the build pipeline does not hang indefinitely.
Sources: src/services/quality-check/QualityChecker.js:73-79, src/services/quality-check/tests/quality-check-e2e.test.js:304-315
Tracking and Ads Markers (QUAL-02 & QUAL-04)
Validates the presence of required tracking pixels (e.g., Voluum) and Google Ads markers.
Sources: src/services/quality-check/QualityChecker.js:49-55, scripts/alpha-verify-deployment.js:77-86
Data Model and Configuration
The checkers rely on a structured configuration object to toggle strictness and thresholds.
Validation Result Structure
Every validator returns a consistent result object:
| Field | Type | Description |
|---|---|---|
id | String | The gate ID (e.g., QUAL-01). |
passed | Boolean | Whether the check met the requirement. |
severity | String | critical (blocks deploy) or warning. |
message | String | Human-readable result or error message. |
details | Object | Optional line context or specific failure data. |
Sources: src/services/quality-check/tests/quality-check-e2e.test.js:358-380, coverage/src/services/quality-check/QualityChecker.js.html:82-90
Configuration Parameters
The validatePreDeploy method accepts a configuration object to customize behavior per site.
| Parameter | Category | Default | Description |
|---|---|---|---|
trackingConfig.required | Tracking | false | If true, missing pixels trigger critical failure. |
googleAdsConfig.required | Ads | false | If true, missing tags block deployment. |
lighthouseConfig.timeout | Performance | 5000 | Timeout in ms for Lighthouse analysis. |
Sources: src/services/quality-check/QualityChecker.js:21-33, src/services/quality-check/tests/quality-check-e2e.test.js:67-71
Implementation Details
The QualityChecker aggregates results by iterating through gates. The following snippet illustrates the synchronous/asynchronous mix in the pipeline:
// Gate 3: Astro expression leaks (QUAL-03)
const leakResult = checkAstroLeaks(htmlContent);
if (!leakResult.passed) {
results.criticalFailures.push(leakResult);
} else {
results.checks.push(leakResult);
}
// Gate 5: Lighthouse 95+ enforcement (QUAL-05) - ASYNC
const lighthouseResult = await checkLighthouseScores(htmlContent, config.lighthouseConfig || {});
if (!lighthouseResult.passed && lighthouseResult.severity === 'critical') {
results.criticalFailures.push(lighthouseResult);
}
Sources: coverage/src/services/quality-check/QualityChecker.js.html:57-79
Verification and Testing
The system is validated through E2E pipeline tests that simulate the flow from TemplateBuilder output through fingerprinting to the quality gates. Tests verify that:
- Viewport absence correctly identifies as
QUAL-01critical failure. - Astro leaks identify the specific unprocessed environment variable.
- Multiple critical failures are aggregated correctly in the summary.
- Non-critical issues (like optional tracking) appear as checks/warnings without blocking the build.
Sources: src/services/quality-check/tests/quality-check-e2e.test.js:106-115, src/services/quality-check/tests/quality-check-e2e.test.js:140-158
Summary
The Automated Quality Checkers system provides a robust safety net for the FusionOps deployment pipeline. By categorizing failures into critical blocks and informative warnings, it ensures that every landing page deployed meets high standards of performance (Lighthouse), security (Leak protection), and functional compliance (Tracking/Ads) while providing developers with the necessary context to resolve issues rapidly.