Compare commits

...

2 Commits

Author SHA1 Message Date
infra-sre 6d055b5581 fix(queue): catch HTTP 405 from pre-receive hook and post UI-merge notice
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 21s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 29s
CI / Detect changes (pull_request) Successful in 46s
E2E API Smoke Test / detect-changes (pull_request) Successful in 44s
Lint curl status-code capture / Scan workflows for curl status-capture pollution (pull_request) Successful in 15s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 1m25s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 25s
lint-continue-on-error-tracking / lint-continue-on-error-tracking (pull_request) Successful in 2m23s
Runtime PR-Built Compatibility / detect-changes (pull_request) Successful in 1m12s
qa-review / approved (pull_request) Failing after 22s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 1m30s
security-review / approved (pull_request) Failing after 18s
gate-check-v3 / gate-check (pull_request) Successful in 31s
Lint pre-flip continue-on-error / Verify continue-on-error flips have run-log proof (pull_request) Successful in 2m15s
sop-tier-check / tier-check (pull_request) Successful in 24s
Lint workflow YAML (Gitea-1.22.6-hostile shapes) / Lint workflow YAML for Gitea-1.22.6-hostile shapes (pull_request) Successful in 1m57s
lint-mask-pr-atomicity / lint-mask-pr-atomicity (pull_request) Successful in 2m53s
Ops Scripts Tests / Ops scripts (unittest) (pull_request) Failing after 1m33s
lint-required-context-exists-in-bp / lint-required-context-exists-in-bp (pull_request) Successful in 2m40s
CI / Python Lint & Test (pull_request) Successful in 7m47s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 15s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 13s
Runtime PR-Built Compatibility / PR-built wheel + import smoke (pull_request) Successful in 20s
CI / Canvas (Next.js) (pull_request) Successful in 20m19s
CI / Platform (Go) (pull_request) Successful in 21m13s
CI / all-required (pull_request) Successful in 21m44s
CI / Canvas Deploy Reminder (pull_request) Successful in 14s
sop-checklist / all-items-acked (pull_request) [info tier:low] acked: 0/7 — missing: comprehensive-testing, local-postgres-e2e, staging-smoke, +4 — body-unfilled: comprehensive-testing, l
audit-force-merge / audit (pull_request) Waiting to run
Pre-receive hook blocks API merges with HTTP 405. Queue bot was silently
retrying indefinitely. Now detects 405 and posts a comment on the PR
directing humans to merge via UI.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 03:20:40 +00:00
infra-sre 686c08d9aa fix(ci): increase golangci-lint and job timeouts for Platform (Go)
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 28s
CI / Detect changes (pull_request) Successful in 1m38s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 55s
Lint curl status-code capture / Scan workflows for curl status-capture pollution (pull_request) Successful in 31s
E2E API Smoke Test / detect-changes (pull_request) Successful in 1m42s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 1m38s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 1m34s
lint-continue-on-error-tracking / lint-continue-on-error-tracking (pull_request) Successful in 2m45s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 23s
Runtime PR-Built Compatibility / detect-changes (pull_request) Successful in 39s
qa-review / approved (pull_request) Failing after 22s
security-review / approved (pull_request) Failing after 21s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 2m41s
Lint workflow YAML (Gitea-1.22.6-hostile shapes) / Lint workflow YAML for Gitea-1.22.6-hostile shapes (pull_request) Failing after 2m49s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 20s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 12s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 11s
lint-required-context-exists-in-bp / lint-required-context-exists-in-bp (pull_request) Failing after 3m39s
Lint pre-flip continue-on-error / Verify continue-on-error flips have run-log proof (pull_request) Failing after 3m46s
Runtime PR-Built Compatibility / PR-built wheel + import smoke (pull_request) Successful in 30s
CI / Python Lint & Test (pull_request) Successful in 8m7s
CI / Platform (Go) (pull_request) Successful in 14m3s
CI / Canvas (Next.js) (pull_request) Successful in 14m22s
CI / all-required (pull_request) Successful in 13m44s
CI / Canvas Deploy Reminder (pull_request) Successful in 11s
sop-tier-check / tier-check (pull_request) Successful in 30s
gate-check-v3 / gate-check (pull_request) Successful in 43s
lint-mask-pr-atomicity / lint-mask-pr-atomicity (pull_request) Successful in 2m9s
sop-checklist / all-items-acked (pull_request) [info tier:low] acked: 7/7
audit-force-merge / audit (pull_request) Has been skipped
The 3m golangci-lint timeout was too short, causing lint to fail and the
diagnostic step (continue-on-error) to run the full suite, exceeding the
15m job ceiling. Bumps:
- job timeout: 15m → 20m
- golangci-lint: 3m → 5m
- diagnostic test timeouts: 60s → 300s

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 02:46:23 +00:00
2 changed files with 68 additions and 7 deletions
+63 -2
View File
@@ -65,6 +65,21 @@ class ApiError(RuntimeError):
pass
class PreReceiveBlocked(ApiError):
"""Raised when the pre-receive hook blocks a merge (HTTP 405).
Distinguishes "retryable transient failure" (network, auth, rate-limit)
from "permanent block that requires human UI intervention".
"""
def __init__(self, path: str, status: int, body: str, pr_number: int):
self.status = status
self.body = body
self.pr_number = pr_number
super().__init__(f"{path} -> HTTP {status}: {body[:200]}")
@dataclasses.dataclass(frozen=True)
class MergeDecision:
ready: bool
@@ -338,7 +353,20 @@ def merge_pull(pr_number: int, *, dry_run: bool) -> None:
print(f"::notice::merging PR #{pr_number}")
if dry_run:
return
api("POST", f"/repos/{OWNER}/{NAME}/pulls/{pr_number}/merge", body=payload, expect_json=False)
path = f"/repos/{OWNER}/{NAME}/pulls/{pr_number}/merge"
try:
api("POST", path, body=payload, expect_json=False)
except ApiError as exc:
# Gitea pre-receive hook returns HTTP 405 with body like
# '{"message":"User not allowed to merge PR"}'. The hook blocks
# all API-originated merges regardless of token permissions.
# Detect: 405 + "not allowed" or "pre-receive" in the error body.
msg: str = str(exc)
body_snippet = msg.split("HTTP 405:")[1].strip() if "HTTP 405:" in msg else ""
if "405" in msg or "not allowed" in body_snippet.lower() or "pre-receive" in body_snippet.lower():
raise PreReceiveBlocked(path, 405, body_snippet, pr_number) from exc
# Other API errors (auth, rate-limit, server error) are retryable.
raise
def process_once(*, dry_run: bool = False) -> int:
@@ -407,7 +435,20 @@ def process_once(*, dry_run: bool = False) -> int:
"deferring to next tick"
)
return 0
merge_pull(pr_number, dry_run=dry_run)
try:
merge_pull(pr_number, dry_run=dry_run)
except PreReceiveBlocked as exc:
msg = (
"merge-queue: **blocked by pre-receive hook** — "
"the Gitea server-side hook is preventing API merges for this PR. "
"Please merge via the UI at the link above, or ask a repo admin "
"to temporarily disable the hook if an emergency merge is needed."
)
post_comment(exc.pr_number, msg, dry_run=dry_run)
sys.stderr.write(
f"::error::queue: PR #{exc.pr_number} blocked by pre-receive hook "
f"(HTTP {exc.status}); posted comment and skipping.\n"
)
return 0
return 0
@@ -426,6 +467,26 @@ def main() -> int:
# workflow run, blocking future ticks.
sys.stderr.write(f"::error::queue API error: {exc}\n")
return 0
except PreReceiveBlocked as exc:
# Pre-receive hook is blocking API merges. Post a comment so humans
# know the PR is in the queue but blocked, then skip it. We do NOT
# re-raise — exit 0 keeps the workflow green so the next tick can
# check again in case an admin clears the hook.
msg = (
"merge-queue: **blocked by pre-receive hook** — "
"the Gitea server-side hook is preventing API merges for this PR. "
"Please merge via the UI at the link above, or ask a repo admin "
"to temporarily disable the hook if an emergency merge is needed."
)
try:
post_comment(exc.pr_number, msg, dry_run=args.dry_run)
except Exception:
pass # Don't fail the tick if commenting also fails.
sys.stderr.write(
f"::error::queue: PR #{exc.pr_number} blocked by pre-receive hook "
f"(HTTP {exc.status}); posted comment and skipping.\n"
)
return 0
except urllib.error.URLError as exc:
sys.stderr.write(f"::error::queue network error: {exc}\n")
return 0
+5 -5
View File
@@ -148,7 +148,7 @@ jobs:
# Job-level ceiling. The go test step below runs with a per-step 10m timeout;
# this cap catches any step that leaks past that. Set well above 10m so
# the per-step timeout is the active constraint.
timeout-minutes: 15
timeout-minutes: 20
defaults:
run:
working-directory: workspace-server
@@ -174,14 +174,14 @@ jobs:
run: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.12.2
- if: always()
name: Run golangci-lint
run: $(go env GOPATH)/bin/golangci-lint run --timeout 3m ./...
run: $(go env GOPATH)/bin/golangci-lint run --timeout 5m ./...
- if: always()
name: Diagnostic — per-package verbose 60s
name: Diagnostic — per-package verbose 300s
run: |
set +e
go test -race -v -timeout 60s ./internal/handlers/... 2>&1 | tee /tmp/test-handlers.log
go test -race -v -timeout 300s ./internal/handlers/... 2>&1 | tee /tmp/test-handlers.log
handlers_exit=$?
go test -race -v -timeout 60s ./internal/pendinguploads/... 2>&1 | tee /tmp/test-pu.log
go test -race -v -timeout 300s ./internal/pendinguploads/... 2>&1 | tee /tmp/test-pu.log
pu_exit=$?
echo "::group::handlers exit=$handlers_exit (last 100 lines)"
tail -100 /tmp/test-handlers.log