Skip to content

feat: Add AdfBuilder for Jira tickets generation#54

Closed
Jez-A wants to merge 33 commits intomasterfrom
auto_escalation_adf_builder
Closed

feat: Add AdfBuilder for Jira tickets generation#54
Jez-A wants to merge 33 commits intomasterfrom
auto_escalation_adf_builder

Conversation

@Jez-A
Copy link
Contributor

@Jez-A Jez-A commented Mar 3, 2026

[Redacted]

@Jez-A Jez-A force-pushed the auto_escalation_adf_builder branch from 1217069 to 846cb0b Compare March 3, 2026 15:43
@Jez-A Jez-A changed the title feat: Add AdfBuilder for Jira ADF document generation feat: Add AdfBuilder for Jira tickets generation Mar 3, 2026
@Jez-A Jez-A force-pushed the auto_escalation_adf_builder branch from 846cb0b to 698e096 Compare March 3, 2026 17:07
Jez-A and others added 6 commits March 9, 2026 10:44
Adds OpenTelemetry observability URL helpers that mirror Opsbox::OpenTelemetry.
Provides Grafana Tempo trace URLs, local Jaeger URLs (dev/development), and
Kibana Discover log URLs — all returning nil gracefully when OTEL is unconfigured.

Adds opentelemetry_api ~> 1.4 and jason ~> 1.4 dependencies.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds two new utility modules required by the AutoEscalation feature:

- Zexbox.JiraClient: Req-based client for the Jira Cloud REST API v3.
  Supports search, create, transition, and add_comment operations.
  Authenticates via JIRA_USER_EMAIL_ADDRESS / JIRA_API_TOKEN env vars
  or :jira_email / :jira_api_token application config.

- Zexbox.OpenTelemetry: Reads the current process OTEL context (baggage
  and active span) to produce Datadog session, Grafana Tempo trace, and
  Kibana Discover URLs. Returns nil gracefully when OTEL is unconfigured.

Adds :req, :jason, and :opentelemetry_api dependencies to mix.exs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…uests

search_latest_issues was using GET with query params, which means the
response body was not guaranteed to be JSON-decoded by Req (Req only
auto-decodes based on the response Content-Type, not the request method).

Two changes:
- search_latest_issues now uses POST /rest/api/3/search/jql with a JSON
  body — the preferred Jira v3 approach. This also allows fields to be
  sent as a proper JSON array rather than a comma-separated string.
- build_client adds Accept: application/json to every request so the
  remaining GET (transitions fetch) also explicitly signals JSON intent
  and Req's decode_body step has a clear content-type to act on.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replaces keyword list opts (Keyword.fetch!/get) with typed positional
arguments throughout, consistent with the rest of the repo's style:

  search_latest_issues(jql, project_key \\ nil)
  create_issue(project_key, summary, description, issuetype, priority, custom_fields \\ %{})
  transition_issue(issue_key, status_name)
  add_comment(issue_key, comment)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Jez-A Jez-A force-pushed the auto_escalation_infra branch from f1ce788 to 6d6528f Compare March 9, 2026 10:50
Jez-A and others added 4 commits March 9, 2026 10:51
Adds Zexbox.AutoEscalation.AdfBuilder, which builds Atlassian Document
Format (ADF) maps for new Jira issue descriptions and occurrence comments.

Structure produced:
- Telemetry paragraph (Datadog | Tempo | Kibana links, or "(Missing)")
- Optional divider + custom description paragraphs
- User context and additional context bullet lists
- Error Details heading, exception class/message, expandable stack trace

Both build_description/4 and build_comment/5 accept keyword opts for the
optional custom_description and stacktrace arguments.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Jez-A Jez-A force-pushed the auto_escalation_adf_builder branch from 0c230ce to 4ec7726 Compare March 9, 2026 10:51
Jez-A and others added 12 commits March 9, 2026 14:28
Jaeger is not available locally. generate_trace_url/0 now returns nil for
non-production/sandbox environments instead of a localhost Jaeger URL.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds two new utility modules required by the AutoEscalation feature:

- Zexbox.JiraClient: Req-based client for the Jira Cloud REST API v3.
  Supports search, create, transition, and add_comment operations.
  Authenticates via JIRA_USER_EMAIL_ADDRESS / JIRA_API_TOKEN env vars
  or :jira_email / :jira_api_token application config.

- Zexbox.OpenTelemetry: Reads the current process OTEL context (baggage
  and active span) to produce Datadog session, Grafana Tempo trace, and
  Kibana Discover URLs. Returns nil gracefully when OTEL is unconfigured.

Adds :req, :jason, and :opentelemetry_api dependencies to mix.exs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…uests

search_latest_issues was using GET with query params, which means the
response body was not guaranteed to be JSON-decoded by Req (Req only
auto-decodes based on the response Content-Type, not the request method).

Two changes:
- search_latest_issues now uses POST /rest/api/3/search/jql with a JSON
  body — the preferred Jira v3 approach. This also allows fields to be
  sent as a proper JSON array rather than a comma-separated string.
- build_client adds Accept: application/json to every request so the
  remaining GET (transitions fetch) also explicitly signals JSON intent
  and Req's decode_body step has a clear content-type to act on.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replaces keyword list opts (Keyword.fetch!/get) with typed positional
arguments throughout, consistent with the rest of the repo's style:

  search_latest_issues(jql, project_key \\ nil)
  create_issue(project_key, summary, description, issuetype, priority, custom_fields \\ %{})
  transition_issue(issue_key, status_name)
  add_comment(issue_key, comment)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds Zexbox.AutoEscalation.AdfBuilder, which builds Atlassian Document
Format (ADF) maps for new Jira issue descriptions and occurrence comments.

Structure produced:
- Telemetry paragraph (Datadog | Tempo | Kibana links, or "(Missing)")
- Optional divider + custom description paragraphs
- User context and additional context bullet lists
- Error Details heading, exception class/message, expandable stack trace

Both build_description/4 and build_comment/5 accept keyword opts for the
optional custom_description and stacktrace arguments.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Jez-A and others added 3 commits March 9, 2026 14:31
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Jez-A Jez-A force-pushed the auto_escalation_infra branch from 49ed703 to 8d02399 Compare March 9, 2026 14:31
* feat: Add Zexbox.JiraClient to link error handling with support processes.
Base automatically changed from auto_escalation_infra to master March 9, 2026 15:59
Jez-A and others added 7 commits March 9, 2026 16:07
Replace opts keyword list with explicit stacktrace and custom_description
positional arguments in build_description/5 and build_comment/6. Simplify
internal list-building from Kernel.++ pipe chains to plain ++ expressions,
and consolidate add_if/has_content? helpers into optional_description_blocks
and single_context_blocks. Restore Zexbox.OpenTelemetry (from stacked PR)
so the module is available to compile and mock in tests. Fix duplicate
dependency entries in mix.exs. All 60 tests pass; credo and dialyzer clean.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace the ++ chain in build_description and build_comment with a shared
private build_body/6 pipeline. Each section is now appended via a dedicated
append_telemetry/1, append_description/2, append_context/3, and
append_error_details/3 function that takes and returns the accumulator list,
making the document structure readable as a left-to-right pipe and keeping
each optional section's emptiness logic self-contained.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Jez-A Jez-A closed this Mar 10, 2026
@Jez-A Jez-A deleted the auto_escalation_adf_builder branch March 10, 2026 12:36
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