Compare commits

...
Sign in to create a new pull request.

3 commits

Author SHA1 Message Date
bf7ea1a9e6 Merge pull request 'fix: Remove the Approved From and Approved to search field' (#137) from claude/issue-136 into master
All checks were successful
Refresh staging / refresh (push) Successful in 7s
Reviewed-on: #137
2026-06-25 22:25:09 +00:00
90a831790d Merge pull request 'fix(automation): issue watcher must not open PRs without tests' (#138) from fix/watcher-test-gate into master
All checks were successful
Refresh staging / refresh (push) Successful in 7s
Reviewed-on: #138
2026-06-25 22:24:54 +00:00
a5248e5c23 fix(automation): issue watcher must not open PRs without tests
All checks were successful
PR checks / checks (pull_request) Successful in 48s
PR checks / integration (pull_request) Successful in 30s
PR #137 shipped a code change under App/app with no test — the test-presence
gate in pr-checks.yml would reject it, but the watcher opened the PR anyway.

Add the same gate to the watcher's fix phase: before pushing/opening a PR, run
the pr-checks.yml test-presence check against the branch diff. If code under
App/(app|lib|components|hooks) changed with no accompanying test, the watcher
does NOT open a PR — it marks the issue claude-failed and comments, so the
queue can retry. Never raises a PR the CI would immediately fail.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-26 03:47:59 +05:30
2 changed files with 21 additions and 0 deletions

View file

@ -60,6 +60,11 @@ requires an interactive ESLint migration (a follow-up). Integration tests are
type-checked here but executed against the `pelagia_test` DB by the autofix / locally type-checked here but executed against the `pelagia_test` DB by the autofix / locally
(not in this shared CI, to avoid prod-mirror schema drift). (not in this shared CI, to avoid prod-mirror schema drift).
The **issue watcher pre-applies gate 1 (test-presence) locally** before opening a PR:
if Claude's fix changes code under `App/app|lib|components|hooks` but adds no test, the
watcher does **not** open a PR — it marks the issue `claude-failed` and comments — so it
never raises a PR that this CI would immediately reject. Re-queue (`claude-queue`) to retry.
A [`PULL_REQUEST_TEMPLATE.md`](../.forgejo/PULL_REQUEST_TEMPLATE.md) carries the checklist. A [`PULL_REQUEST_TEMPLATE.md`](../.forgejo/PULL_REQUEST_TEMPLATE.md) carries the checklist.
## Components ## Components

View file

@ -339,6 +339,22 @@ while [ "$f" -lt "$n_fix" ]; do
commits=$(git -C "$WORKDIR" rev-list "origin/$BASE_BRANCH..HEAD" --count) commits=$(git -C "$WORKDIR" rev-list "origin/$BASE_BRANCH..HEAD" --count)
if [ "$commits" -gt 0 ]; then if [ "$commits" -gt 0 ]; then
# Test-presence gate -- mirror .forgejo/workflows/pr-checks.yml so the watcher
# never opens a PR the CI will immediately reject. "Code" = app source under
# App/(app|lib|components|hooks); tests, prisma, config, docs are exempt.
changed=$(git -C "$WORKDIR" diff --name-only "origin/$BASE_BRANCH...HEAD")
code_changed=$(printf '%s\n' "$changed" | grep -E '^App/(app|lib|components|hooks)/' | grep -vE '(\.test\.|\.spec\.|/tests/)' || true)
test_changed=$(printf '%s\n' "$changed" | grep -E '(\.test\.|\.spec\.|/tests/)' || true)
if [ -n "$code_changed" ] && [ -z "$test_changed" ]; then
log "Test-presence gate FAILED for #$num: code changed with no test; not opening a PR"
set_labels "$num" "claude-working" "claude-failed"
add_comment "$num" "$BOT_MARKER
[Claude] Implemented a change but added **no test**, so no PR was opened. The contribution policy (\`pr-checks.yml\`) requires a test for any change under \`App/app|lib|components|hooks\`, and would reject this. Re-add \`claude-queue\` to retry, or pick it up interactively.
Code files that needed an accompanying test:
$code_changed"
continue
fi
log "Claude made $commits commit(s); pushing $branch" log "Claude made $commits commit(s); pushing $branch"
if ! git -C "$WORKDIR" push -f -u origin "$branch" -q 2>>"$LOG_FILE"; then if ! git -C "$WORKDIR" push -f -u origin "$branch" -q 2>>"$LOG_FILE"; then
log "push failed for #$num"; set_labels "$num" "claude-working" "claude-failed"; continue log "push failed for #$num"; set_labels "$num" "claude-working" "claude-failed"; continue