Skip to content

Add comprehensive test suite for WorkflowGenerator #5

@tsavo-at-pieces

Description

@tsavo-at-pieces

Overview

The WorkflowGenerator class — which renders CI workflows for all consumer repos — has zero test coverage. This is the highest-priority gap in the package. The multi-platform feature (v0.11.0) shipped with no automated verification.

What Needs Tests

P0 — Must Have

  1. validate() coverage — 6 validation rules, 0 tested

    • Missing dart_sdk, wrong type, missing features, wrong type
    • Invalid platforms entries, platforms as non-List
    • Invalid secrets type, personal_access_token_secret type
    • Empty platforms list (currently silent fallback to ubuntu)
  2. loadCiConfig() coverage — 5 code paths, 0 tested

    • File missing → returns null
    • Valid JSON without ci section → returns null
    • Valid JSON with ci section → returns Map
    • Malformed JSON → throws StateError
    • ci not a Map → throws StateError
  3. render() single vs multi-platform — the highest-risk path

    • No platforms key → single-platform analyze-and-test job on ubuntu
    • platforms: ["ubuntu"] → same single-platform output
    • platforms: ["ubuntu", "macos"] → multi-platform with analyze + test matrix
    • platforms: ["ubuntu", "macos-arm64", "macos-x64", "windows"] → 4-platform matrix
  4. _preserveUserSections() round-trip — data loss prevention

    • Non-empty user sections survive regeneration
    • Empty user sections stay empty
    • Multiple independent sections preserved
  5. Backward compatibility — config without platforms produces output identical to pre-v0.11.0

P1 — Should Have

  1. Feature flag combinations (proto, lfs, format_check, analysis_cache, managed_analyze, managed_test)
  2. Secrets env block rendering with and without secrets
  3. Sub-packages rendering and filtering
  4. Rendered YAML is syntactically valid (parse with package:yaml)
  5. Platform alias mapping (macos = macos-arm64macos-latest, macos-x64macos-15-intel)
  6. Multi-platform: proto/lfs steps only in analyze job, not test matrix
  7. _processTemplated round-trip idempotency

Acceptance Criteria

  • test/workflow_generator_test.dart created with all P0 tests
  • All P1 tests added
  • dart test passes from package directory
  • No existing functionality broken

Metadata

Metadata

Labels

P0-criticalCritical priority - must fix immediatelyarea/ci-cdCI/CD workflow generationtestingTest coverage and quality

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions