Skip to content

ci: add CI job to run post-script unit tests #43

Description

@fullsend-ai-retro

What happened

PR #29 added seven post-script test files totaling 3,086 lines:

  • scripts/post-code-test.sh (788 lines)
  • scripts/post-review-test.sh (683 lines)
  • scripts/post-triage-test.sh (455 lines)
  • scripts/validate-output-schema-test.sh (380 lines)
  • scripts/post-prioritize-test.sh (327 lines)
  • scripts/post-retro-test.sh (286 lines)
  • scripts/post-fix-test.sh (167 lines)

These tests exercise critical post-script logic (PR title rewriting, comment posting, schema validation, error handling) using mock gh commands. However, no CI job runs them. The only CI workflow (lint.yml) has a test job that runs pre-commit run --all-files — it does not execute any of these test scripts.

This means a regression in any post-script (e.g., a broken regex in PR title rewriting, a missing error guard in schema validation) would not be caught until it fails during a live agent run.

What could go better

These tests represent significant investment in correctness verification for the most security-sensitive parts of the agent pipeline (the post-scripts handle GitHub API mutations, token usage, and content sanitization). Not running them in CI undermines that investment.

Confidence: High. The test scripts exist, they are self-contained (use mocks, no network access needed), and there is no CI job that invokes them. This is verifiable from the workflow file and the test script headers (each includes a comment like "Run from the repo root: bash scripts/post-retro-test.sh").

Proposed change

Add a new job to .github/workflows/lint.yml (or create a dedicated test.yml workflow) that runs all post-script tests:

script-tests:
  runs-on: ubuntu-24.04
  steps:
    - uses: actions/checkout@<sha>  # SHA-pinned
    - name: Run post-script tests
      run: |
        for test in scripts/*-test.sh; do
          echo "::group::${test}"
          bash "${test}"
          echo "::endgroup::"
        done

The tests require bash, jq, and standard Unix tools — all available on ubuntu-24.04 without additional setup. Some tests may also need python3 for JSON schema validation (check validate-output-schema-test.sh dependencies).

Validation criteria

After the change:

  1. All seven test scripts pass in the new CI job on the current main branch
  2. Introducing a deliberate regression in any post-script (e.g., removing a required field check in post-retro.sh) causes the corresponding test to fail in CI
  3. The CI job completes within a reasonable time (these are unit tests with mocks, expected under 60 seconds total)

Generated by retro agent from #29

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions