Skip to content

feat(api): issues endpoint, readiness probe, Jira webhook (Phase 4 — T4.1–T4.3) - #4

Open
canonical-muhammadbassiony wants to merge 1 commit into
feat/phase-3-api-foundationfrom
feat/phase-4-api-endpoints
Open

feat(api): issues endpoint, readiness probe, Jira webhook (Phase 4 — T4.1–T4.3)#4
canonical-muhammadbassiony wants to merge 1 commit into
feat/phase-3-api-foundationfrom
feat/phase-4-api-endpoints

Conversation

@canonical-muhammadbassiony

Copy link
Copy Markdown
Owner

Summary

Adds three new API endpoints completing Phase 4 of spec 001.

Tasks Implemented

  • T4.1 POST /api/v1/issues: Runs orchestrator in dry-run mode (extraction + prompt only, no Copilot), formats result as markdown issue body categorising suggestions, creates GitHub issue via REST API, returns { issue_url, issue_number }.
  • T4.2 GET /api/v1/health/ready: K8s readiness probe on public mux (no auth). Checks credentials file readable + GitHub token set + gh CLI in PATH. Returns 503 with missing map if any check fails.
  • T4.3 POST /api/v1/webhooks/jira: Validates shared secret with constant-time comparison (crypto/hmac.Equal), parses Jira payload, extracts doc ID from configurable custom field, fires full workflow in goroutine, responds 202 Accepted immediately.

Security

  • ✅ Jira webhook secret validated with constant-time comparison
  • ✅ Readiness probe on public mux (K8s probes cannot send tokens)
  • ✅ No secrets in request bodies

Files Changed

  • cmd/app/v1/issues.go — new: IssuesHandler, formatIssueBody
  • cmd/app/v1/api.goReadinessHandler
  • cmd/app/v1/jira.go — new: JiraWebhookHandler
  • cmd/app/v1/helpers.go — new: shared httpError, firstNonEmpty, firstNonZero
  • internal/github/issue.goCreateIssue now returns (string, int, error)
  • internal/jira/payload.go — new: WebhookPayload, ExtractDocID
  • cmd/app/main.go — route registration
  • .envBAUER_JIRA_WEBHOOK_SECRET, BAUER_JIRA_DOC_FIELD docs

How to Review

git diff feat/phase-3-api-foundation..feat/phase-4-api-endpoints -- .

Part of the Bauer v2 stacked PR series (Branch 10 of 12).

…ebhook

T4.1: POST /api/v1/issues runs orchestrator dry-run and creates GitHub issue
T4.1: IssueRequest accepts doc_id, github_repo, chunk_size, page_refresh, model, figma_url
T4.1: github.CreateIssue updated to also return issue number (string, int, error)
T4.2: GET /api/v1/health/ready checks credentials file, GitHub token, gh CLI
T4.2: returns 503 with missing map if anything is not ready
T4.3: POST /api/v1/webhooks/jira validates secret, extracts doc_id, fires workflow async
T4.3: internal/jira/payload.go WebhookPayload + ExtractDocID
T4.3: BAUER_JIRA_WEBHOOK_SECRET and BAUER_JIRA_DOC_FIELD env vars documented
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.

1 participant