Skip to content

Fix unit tests after agentic-workflow modularisation#1932

Merged
pethers merged 3 commits intomainfrom
copilot/fix-broken-unit-tests
Apr 22, 2026
Merged

Fix unit tests after agentic-workflow modularisation#1932
pethers merged 3 commits intomainfrom
copilot/fix-broken-unit-tests

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 22, 2026

What changed

  • Removed unused AW_DIR / REQUIRED_SKILLS / TRANSLATION_REQUIRED_SKILLS flagged by tsc --noEmit
  • Deleted all 16 legacy it.skip(... LEGACY) tests in tests/workflow-architecture.test.ts that only existed to document the pre-modular architecture:
    • 3× skills-listed-in-workflow-body (Required Skills block)
    • 2× inline Playwright / cross-reference validation steps
    • 1× inline EXISTING=$(ls …) dedup bash snippet
    • 1× per-workflow search_anforanden minister-response reference
    • SHARED_PROMPT_PATTERNS.md skill inventory
    • political-analysis.md / stakeholder-perspectives.md prompt references
    • fix-analysis-references.ts wiring
    • 1× numeric 7/10 quality-score gate
    • generate-news-enhanced.ts wiring
    • 3× File Ownership Contract + validate-file-ownership.ts wiring
  • Active tests retain brief inline // LEGACY: … comments that document the architectural transition they supersede (kept — these are context for the live assertion, not skipped stubs)
  • tests/agentic-workflow-mcp-queries.test.ts, tests/network-diagnostics.test.ts, tests/scb-mcp-integration.test.ts had no skipped tests to purge
  • Checks
    • npx tsc --project tsconfig.scripts.json --noEmit — clean ✅
    • npm test4324 passed / 0 skipped (was 4324 passed / 16 skipped) ✅
    • npm run lint — 0 errors (pre-existing warnings unchanged) ✅

@pethers pethers marked this pull request as ready for review April 22, 2026 11:02
Copilot AI review requested due to automatic review settings April 22, 2026 11:02
@github-actions github-actions Bot added testing Test coverage size-xl Extra large change (> 1000 lines) labels Apr 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-xl

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

@pethers
Copy link
Copy Markdown
Member

pethers commented Apr 22, 2026

@copilot TypeScript & JavaScript Testing / Unit Tests (Vitest) (pull_request)
TypeScript & JavaScript Testing / Unit Tests (Vitest) (pull_request)Failing after 47s

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

Updates unit tests to reflect the new modular agentic-workflow architecture where key rules live in imported bounded-context prompt modules under .github/prompts/, so assertions validate the effective prompt (workflow body + imports) rather than only the workflow body.

Changes:

  • Introduce readWorkflowWithImports() helper and migrate multiple tests to validate against the effective prompt surface.
  • Replace brittle prose-match assertions with import-based structural checks for concerns moved into shared prompt modules.
  • Mark removed/obsolete pre-modular concepts as skipped legacy tests to preserve contract history without failing CI.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/workflow-architecture.test.ts Updates workflow contract assertions to read effective prompt and reflects modularized concerns; adds prompt-module existence checks.
tests/scb-mcp-integration.test.ts Reads effective prompt for SCB safety guidance now defined in shared modules.
tests/network-diagnostics.test.ts Reads effective prompt for MCP health-gate + noop policy rules now defined in shared modules; updates diagnostics assertions accordingly.
tests/helpers/workflow-imports.ts Adds helper to resolve workflow imports: and concatenate workflow + module content for effective-prompt assertions.
tests/agentic-workflow-mcp-queries.test.ts Migrates MCP query-pattern assertions to effective prompt and replaces legacy shared-pattern assumptions with prompt-module checks.

const __dirname = path.dirname(__filename);

const WORKFLOWS_DIR = path.join(__dirname, '..', '.github', 'workflows');
const AW_DIR = path.join(__dirname, '..', '.github', 'aw');
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

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

AW_DIR is now declared but never used. With noUnusedLocals enabled and CI running tsc --project tsconfig.scripts.json --noEmit, this will fail type-checking. Remove AW_DIR or reintroduce a use for it.

Suggested change
const AW_DIR = path.join(__dirname, '..', '.github', 'aw');

Copilot uses AI. Check for mistakes.
Comment thread tests/workflow-architecture.test.ts Outdated
const __dirname = path.dirname(__filename);

const WORKFLOWS_DIR = path.join(__dirname, '..', '.github', 'workflows');
const AW_DIR = path.join(__dirname, '..', '.github', 'aw');
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

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

AW_DIR is declared but never used. With noUnusedLocals enabled in tsconfig.scripts.json (and enforced in CI), this will fail type-checking. Remove the constant or use it (e.g., in the legacy .github/aw assertions).

Suggested change
const AW_DIR = path.join(__dirname, '..', '.github', 'aw');

Copilot uses AI. Check for mistakes.
@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

@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

@pethers pethers merged commit 973a974 into main Apr 22, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size-xl Extra large change (> 1000 lines) testing Test coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants