Skip to content

feat(#305): EventBridge v2.4 terminals and service-token job polling - #307

Merged
mottych merged 2 commits into
devfrom
feature/issue-305-eventbridge-terminals-service-auth
Apr 10, 2026
Merged

feat(#305): EventBridge v2.4 terminals and service-token job polling#307
mottych merged 2 commits into
devfrom
feature/issue-305-eventbridge-terminals-service-auth

Conversation

@mottych

@mottych mottych commented Apr 10, 2026

Copy link
Copy Markdown
Owner

Pull Request

Summary

Implements #305: pure EventBridge terminal completion for email insight jobs (spec v2.4) plus service-token alignment for API fallback polling.

  • Domain terminals: publish_email_insight_terminal_v24 publishes ai.job.completed / ai.job.failed to purposepath-domain-events-{STAGE} with flat v2.4 detail (requestId, kickoffEventId, executionMode, etc.). Legacy ai.job.* events on the default bus remain for non–email-insight / non–EventBridge-kickoff jobs.
  • Job model: persists request_id, topic_category, event_signal, kickoff_transport (eventbridge vs api) so terminals only fire for Api EventBridge kickoff + email_insight.
  • Auth: GET /ai/jobs/{jobId} accepts bearer tokens where tokenType/token_type = service_enrichment, role = service, and tenant_id is present; v2 POST /execute-async requires requestId and can use Authorization bearer if body token omitted.
  • Pulumi: ai.job.requested rule + target on shared domain bus; Lambda PutEvents IAM for default + domain bus.

Checklist

  • I reviewed ENGINEERING_GUIDE.md
  • API changes match docs/frontend-integration-guide.md (or I updated it)
  • Responses use ApiResponse[...] with snake_case keys
  • Tests added/updated and pass locally (pytest -q)
  • Updated/Created docs/frontend-alignment-plan.md if scope affects alignment

Testing

Unit tests updated for kickoff detail, async models, execute-async route, and EventBridge client. Ran:

cd c:\Projects\PurposePath\PurposePath_AI\coaching
uv run pytest tests/unit -q

Result: all unit tests pass except pre-existing failures in tests/unit/services/test_website_analysis_service.py (unchanged by this PR).

Mypy on touched files: uv run mypy ../coaching/src/api/auth.py ../coaching/src/services/async_execution_service.py ../coaching/src/api/routes/ai_execute_async.py ../shared/services/eventbridge_client.py --explicit-package-bases — clean.

Deploy note: Event bus purposepath-domain-events-{env} must exist in AWS before applying Pulumi changes.

Screenshots/Logs (optional)

N/A

mottych added 2 commits April 9, 2026 19:38
- Publish email-insight completion/failure to domain bus with flat v2.4 detail (requestId, kickoffEventId, executionMode)

- Persist requestId/topic context and kickoff_transport; domain terminals only for Api EventBridge kickoff

- GET /ai/jobs/{id}: accept service_enrichment + role=service bearer tokens

- Pulumi: ai.job.requested rule on purposepath-domain-events-{stack}; PutEvents IAM for domain bus

Made-with: Cursor
…llowlist, auth naming)

- pip-audit: ignore GHSA-926x-3r5x-gfhw (langchain-core) pending coordinated bump

- auth: use jwt_signing_key for get_tenant_for_async_job_access decode

- secrets baseline: allowlist auth.py keyword hits + restore analyze_slow_llm_calls; resync paths from local detect-secrets

Made-with: Cursor
@mottych
mottych marked this pull request as ready for review April 10, 2026 02:06
@mottych
mottych merged commit 6236c7f into dev Apr 10, 2026
1 check passed
@mottych
mottych deleted the feature/issue-305-eventbridge-terminals-service-auth branch April 15, 2026 17:56
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