Skip to content

feat(test): add BATS unit tests and smoke tests for review loops#3

Merged
rlorenzo merged 3 commits into
mainfrom
bats-testing
Mar 21, 2026
Merged

feat(test): add BATS unit tests and smoke tests for review loops#3
rlorenzo merged 3 commits into
mainfrom
bats-testing

Conversation

@rlorenzo
Copy link
Copy Markdown
Owner

  • BATS tests cover config parsing, prompt loading, agent flags, MCP config, and review status checks
  • Smoke tests run real agents as editor/reviewer against a fixture repo to catch CLI integration issues
  • Pre-commit runs unit tests; pre-push runs smoke tests
  • Shared helpers moved from bin/ scripts to lib/lib-review-loop

- BATS tests cover config parsing, prompt loading, agent
  flags, MCP config, and review status checks
- Smoke tests run real agents as editor/reviewer against a
  fixture repo to catch CLI integration issues
- Pre-commit runs unit tests; pre-push runs smoke tests
- Shared helpers moved from bin/ scripts to lib/lib-review-loop
Copilot AI review requested due to automatic review settings March 21, 2026 00:09
Copy link
Copy Markdown

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

Adds a BATS-based unit test suite plus agent-backed smoke tests to validate review-loop behavior end-to-end, and wires them into local git hooks.

Changes:

  • Introduces BATS unit tests covering config parsing, prompt loading, validation, and review status helpers.
  • Adds test/smoke to run real agents against a temporary fixture repo for CLI integration checks.
  • Moves common helper logic into lib/lib-review-loop and updates hooks/docs accordingly.

Reviewed changes

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

Show a summary per file
File Description
test/test_helper.bash Shared BATS setup/teardown and helper to source the library cleanly.
test/smoke New smoke-test runner that exercises real agents as editor/reviewer against a fixture repo.
test/run Convenience wrapper to run all .bats tests via the vendored BATS submodule.
test/plan-review-loop.bats CLI argument/validation tests for bin/plan-review-loop.
test/lib-review-loop.bats Unit tests for library functions (validation, config, prompt parsing, review status).
test/fixtures/review-issues.md Fixture review representing “needs work” with issue counts.
test/fixtures/review-clean.md Fixture review representing “good to go” with zero counts.
test/fixtures/prompt-with-frontmatter.md Prompt fixture containing YAML frontmatter.
test/fixtures/prompt-no-frontmatter.md Prompt fixture without frontmatter.
test/fixtures/prompt-blank-lines.md Prompt fixture for trimming leading/trailing blank lines.
test/code-review-loop.bats CLI argument/validation tests for bin/code-review-loop.
test/bats/bats-support Adds BATS helper library as a git submodule pointer.
test/bats/bats-core Adds BATS core as a git submodule pointer.
test/bats/bats-assert Adds BATS assert library as a git submodule pointer.
lib/lib-review-loop Centralizes review status helpers and plan improvement prompt builder.
bin/plan-review-loop Updates supported agent list and removes in-script duplicated helpers.
bin/code-review-loop Updates supported agent list and removes in-script duplicated helpers.
README.md Documents running unit tests and smoke tests, including submodule setup.
.pre-commit-config.yaml Adds local hooks: unit tests on pre-commit, smoke tests on pre-push.
.markdownlint-cli2.yaml Excludes test fixtures from markdownlint.
.gitmodules Declares BATS submodules used under test/bats/.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/test_helper.bash
Comment thread test/test_helper.bash
Comment thread .pre-commit-config.yaml
Comment thread test/plan-review-loop.bats
Comment thread test/code-review-loop.bats
@rlorenzo rlorenzo requested a review from Copilot March 21, 2026 00:33
Copy link
Copy Markdown

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

Copilot reviewed 20 out of 22 changed files in this pull request and generated 7 comments.

Comments suppressed due to low confidence (1)

test/smoke:1

  • The timeout watchdog kills only the direct agent PID; if the agent spawns children (common for CLIs), those processes may continue running after a timeout. Prefer running the agent in its own process group/session and killing the whole group on timeout, and/or escalate to SIGKILL after a short grace period if it’s still alive.
#!/usr/bin/env bash

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/lib-review-loop
Comment thread lib/lib-review-loop
Comment thread test/smoke
Comment thread test/smoke
Comment thread test/smoke
Comment thread test/smoke
Comment thread test/test_helper.bash
@rlorenzo rlorenzo requested a review from Copilot March 21, 2026 02:11
Copy link
Copy Markdown

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

Copilot reviewed 20 out of 22 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/smoke
Comment thread test/smoke
Comment thread lib/lib-review-loop
…rmat_elapsed test

Prevents smoke tests from failing when commit.gpgsign=true is set
globally. Allows 1-second tolerance in format_elapsed assertion to
avoid flaky test from clock skew between date calls.
@rlorenzo rlorenzo requested a review from Copilot March 21, 2026 05:49
Copy link
Copy Markdown

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

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


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/smoke
Comment thread test/smoke
@rlorenzo rlorenzo merged commit b4623f2 into main Mar 21, 2026
4 of 5 checks passed
@rlorenzo rlorenzo deleted the bats-testing branch March 21, 2026 06:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants