Skip to content

fix: parallelize news CDN scan and add timeout to prevent test failure#2682

Merged
pethers merged 1 commit into
mainfrom
copilot/fix-improve-test-timeout
May 22, 2026
Merged

fix: parallelize news CDN scan and add timeout to prevent test failure#2682
pethers merged 1 commit into
mainfrom
copilot/fix-improve-test-timeout

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 22, 2026

no-external-cdn.test.ts timed out scanning 5,499 HTML files sequentially against a 10s default timeout.

Changes

  • Batch parallel I/O: findForbidden now processes files in Promise.all batches of 100 instead of sequential await per file (~7s vs >10s)
  • Explicit timeout: Added 60_000ms timeout to the news article test case to accommodate CI environments with slower disk I/O
// Before: sequential reads — O(n) awaits
for (const f of files) {
  const text = await readFile(f, 'utf8');
}

// After: batched parallel — O(n/100) awaits
for (let i = 0; i < filtered.length; i += BATCH_SIZE) {
  const batch = filtered.slice(i, i + BATCH_SIZE);
  const results = await Promise.all(batch.map(async (f) => { ... }));
}

…meout

The no-external-cdn test was timing out because it sequentially read 5499
HTML files in the news/ directory. This change:
- Processes files in parallel batches of 100 (reduces I/O wait)
- Adds explicit 60s timeout (was defaulting to 10s)

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
@pethers pethers marked this pull request as ready for review May 22, 2026 15:37
Copilot AI review requested due to automatic review settings May 22, 2026 15:37
@github-actions github-actions Bot added testing Test coverage size-s Small change (10-50 lines) labels May 22, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🏷️ Automatic Labeling Summary

This PR has been automatically labeled based on the files changed and PR metadata.

Applied Labels: testing,size-s

Label Categories

  • 🗳️ Content: news, dashboard, visualization, intelligence
  • 💻 Technology: html-css, javascript, workflow, security
  • 📊 Data: cia-data, riksdag-data, data-pipeline, schema
  • 🌍 I18n: i18n, translation, rtl
  • 🔒 ISMS: isms, iso-27001, nist-csf, cis-controls
  • 🏗️ Infrastructure: ci-cd, deployment, performance, monitoring
  • 🔄 Quality: testing, accessibility, documentation, refactor
  • 🤖 AI: agent, skill, agentic-workflow

For more information, see .github/labeler.yml.

@github-actions
Copy link
Copy Markdown
Contributor

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

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

This PR improves the reliability of the “no external CDN” CI guard by speeding up the scan across thousands of rendered news HTML files and by setting an explicit per-test timeout suitable for slower CI disks.

Changes:

  • Parallelized findForbidden() file scanning using Promise.all in fixed-size batches (100 files per batch) instead of sequential await per file.
  • Added a 60_000ms timeout to the rendered news articles test to prevent Vitest default-timeout failures in CI.

@pethers pethers merged commit 2b6784c into main May 22, 2026
16 checks passed
@pethers pethers deleted the copilot/fix-improve-test-timeout branch May 22, 2026 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size-s Small change (10-50 lines) testing Test coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants