Skip to content

docs: add CI mode section to README#27

Merged
mickamy merged 4 commits intomainfrom
docs/ci-mode
Mar 12, 2026
Merged

docs: add CI mode section to README#27
mickamy merged 4 commits intomainfrom
docs/ci-mode

Conversation

@mickamy
Copy link
Copy Markdown
Owner

@mickamy mickamy commented Mar 11, 2026

No description provided.

Copilot AI review requested due to automatic review settings March 11, 2026 23:08
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

Adds documentation for running sql-tap in a CI-friendly “collect and report” mode so teams can fail builds on detected N+1 or slow queries.

Changes:

  • Document the new -ci flag in the sql-tap usage section.
  • Add a “CI mode” README section with a suggested shell workflow and sample report output.

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

Comment thread README.md Outdated
Comment on lines +184 to +193
# Start sql-tap in CI mode (background)
sql-tap -ci localhost:9091 &
CI_PID=$!

# Run your tests through the proxy
DATABASE_URL="postgres://user:pass@localhost:5433/db" go test ./...

# Stop sql-tap — prints report and exits 0 (clean) or 1 (problems found)
kill $CI_PID
wait $CI_PID
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

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

The CI mode example assumes sql-tapd (the proxy + gRPC server) is already running, but the snippet only starts sql-tap. Consider adding an explicit step (or a short note) showing how to start sql-tapd and clarifying that the test DB connection must point at the sql-tapd --listen address.

Suggested change
# Start sql-tap in CI mode (background)
sql-tap -ci localhost:9091 &
CI_PID=$!
# Run your tests through the proxy
DATABASE_URL="postgres://user:pass@localhost:5433/db" go test ./...
# Stop sql-tap — prints report and exits 0 (clean) or 1 (problems found)
kill $CI_PID
wait $CI_PID
# Start sql-tapd (proxy + gRPC server)
# --listen is the address your tests will connect to
# --db is the address of the real database
sql-tapd --listen localhost:5433 --db "postgres://user:pass@localhost:5432/db" &
TAPD_PID=$!
# Start sql-tap in CI mode (background), pointing at sql-tapd's gRPC address
sql-tap -ci localhost:9091 &
CI_PID=$!
# Run your tests through the proxy (same address as --listen above)
DATABASE_URL="postgres://user:pass@localhost:5433/db" go test ./...
# Stop sql-tap — prints report and exits 0 (clean) or 1 (problems found)
kill $CI_PID
wait $CI_PID
# Stop sql-tapd proxy
kill $TAPD_PID
wait $TAPD_PID

Copilot uses AI. Check for mistakes.
Comment thread README.md Outdated
CI_PID=$!

# Run your tests through the proxy
DATABASE_URL="postgres://user:pass@localhost:5433/db" go test ./...
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

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

The Postgres DSN in the CI snippet omits sslmode=disable, while earlier examples in this README include it (and many local Postgres setups will fail without it). Consider aligning the CI example DSN with the earlier Postgres examples to reduce copy/paste failures.

Suggested change
DATABASE_URL="postgres://user:pass@localhost:5433/db" go test ./...
DATABASE_URL="postgres://user:pass@localhost:5433/db?sslmode=disable" go test ./...

Copilot uses AI. Check for mistakes.
Comment thread README.md Outdated
Comment on lines +192 to +193
kill $CI_PID
wait $CI_PID
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

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

In many CI scripts that use set -e, kill $CI_PID will fail the job if sql-tap has already exited (e.g., due to a connection error) or if the PID is missing. Consider making the cleanup more robust (e.g., using a trap and/or ignoring a failed kill) so the example works reliably in CI.

Suggested change
kill $CI_PID
wait $CI_PID
kill "$CI_PID" 2>/dev/null || true
wait "$CI_PID" 2>/dev/null || true

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.


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

@mickamy mickamy merged commit fe72b94 into main Mar 12, 2026
9 checks passed
@mickamy mickamy deleted the docs/ci-mode branch March 12, 2026 00:12
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