Repository navigation
Clarify auto-approve risk message and policy comment, add CI test workflow - #136
Conversation
…kflow - Risk stage message shows P numbers only when there is score history - Policy PR comment has a single verdict header with the review link - Tests for the risk message, daily cap, bot min level 0 and LLM edge cases - Manual livereview-tests workflow running make testall on staging DB - Skip known failing tests in testall; api DB tests use DATABASE_URL LiveReview Pre-Commit Check: vouched (iter:1, coverage:0%)
ea1d494 to
1fa76ef
Compare
Add Staging Test Workflow and Stabilize Test SuitesOverviewAdds a GitHub Actions workflow to run database migrations and test suites against a staging PostgreSQL instance. Skips 28 known failing tests and updates test helpers to unblock pipeline execution. Refactors policy engine risk reasons and review link formatting for missing history edge cases. Technical Highlights
Impact
|
| statuses: write | ||
|
|
||
| jobs: | ||
| livereview-tests: |
There was a problem hiding this comment.
Severity: warning
There is no concurrency group defined for this workflow. Consequently, parallel workflow runs can collide on the shared staging database.
Suggestions:
- Add concurrency group with cancel-in-progress: false to serialize runs against DATABASE_URL
- chat files and CI gate tests use a unique email per run - CI gate test cleans up child rows before the user and org - gemini test no longer sets the removed Temperature field LiveReview Pre-Commit Check: vouched (iter:1, coverage:0%)
Add Live CI Test Workflow and Stabilize Integration TestsOverviewThis change adds an on-demand GitHub Actions workflow to run the test suite against a live PostgreSQL database. It fixes test isolation, teardown sequencing, and shared database URL helpers across API integration tests. It also updates policy engine risk string formatting and skips known failing tests in the Makefile. Technical Highlights
Impact
|
|
|
||
| # The DB tests skip when the database is unreachable, so fail here instead of passing silently. | ||
| - name: Check staging database is reachable | ||
| run: psql "$DATABASE_URL" -c 'select 1' > /dev/null |
There was a problem hiding this comment.
Severity: warning
The psql client is not preinstalled on the ubuntu-24.04 runner, which causes step 24 to fail.
Suggestions:
- Install postgresql-client prior to running psql (
sudo apt-get install -y postgresql-client). - Alternatively, verify connectivity using a small Go script or dbmate.
| run: sudo npm install -g dbmate | ||
|
|
||
| - name: Run staging migrations | ||
| run: dbmate --url "$DATABASE_URL" up |
There was a problem hiding this comment.
Severity: warning
Running dbmate up and executing tests against a shared staging database creates a risk of schema corruption and test run collisions.
Suggestions:
- Use an isolated PostgreSQL service container in the GitHub Actions job (
services: postgres: ...). - If remote DB is required, create an ephemeral schema or dedicated test database per CI run.
- Postgres 18 service container per run, so migrations and tests never touch staging - Drop the psql reachability step; dbmate up fails the job if the DB is down - Skip schema dump in CI to avoid a pg_dump version mismatch LiveReview Pre-Commit Check: vouched (iter:1, coverage:0%)
Summary
Fixes two confusing parts of the auto-approve output found while testing, adds tests for policy edge cases, and adds a manual CI workflow for the Go test suite.
Risk stage message
Risk score 1.00 (P0) is above the threshold of 0.50 (P20). With no score history, the P0 is a placeholder and the 0.50 is a fixed fallback, not the P20 value, so it read as "P0 is above P20".Risk score 1.00 is above the cutoff of 0.50Risk score 0.90 (P90) is above the cutoff of 0.20 (P20)riskReasonfunction. Decision logic is unchanged.Policy PR comment
Tests
risk_reason_test.go: exact messages for no, minimal and full history, plus a check that a blocked review's P number is never below the policy's P (and a passing one never at or above it).daily_cap_test.go: no cap means unlimited; a failed count query skips the cap (pins the current fail-open behaviour).scenarios.jsoncases: bot passes at min level 0, required LLM confidence 0, security-sensitive with low confidence reports the confidence.CI
livereview-testsworkflow, run manually (workflow_dispatch). Each run gets its own throwaway Postgres 18 container, runsdbmate upon it, thenmake testall, and reports alivereview-testsstatus on the commit. It never touches staging, so unmerged migrations, parallel runs and leftover test rows can't affect it.make testallskips 28 tests that already fail on master and 2 packages that don't build (scripts,cmd/onboarding-pdf), listed inTESTALL_SKIP_TESTS/TESTALL_SKIP_PKGS. Remove a name once its test is fixed.internal/apiDB tests now useDATABASE_URL(viatestdb_test.go) instead of a hardcoded local connection, and the prorated charge test passes cents (6400) as the function expects. These 8 tests now pass and are no longer skipped.TestServeChatCSVandTestCIGateGeneratedScriptE2Euse a unique email per run, and the CI gate test cleans up child rows before the user and org, so rows left by an earlier run can't cause duplicate-key failures.Temperaturefield, which was removed fromgemini.TestableFields.Linked Issue
None. Found while testing auto-approve for the demo.
Validation
go test ./internal/policyengine/:TestRiskReason*,TestDailyCap*and allTestScenarioscases pass, including the 3 new ones.go test ./internal/api/ -run '…': the 8 fixed api tests pass against a local DB.make testallrun locally to collect the known failing tests for the skip list.gofmtandgo vetclean on changed packages.Checklist
SECURITY.mdand updated related documentation if needed.Notes For Reviewers
TestResolvePolicy*needs the default-policy migration (20261017100000); the workflow runsdbmate upfirst. Locally, rundbmate upbeforemake testall.license/paymenttests print Razorpay keys and create a real plan. They're in the skip list and untouched here.🔍 LiveReview
⚙️ Customize risk-based approval policy for this repository or your organization.