Skip to content

GHA-349 Dedup shared Jira helpers into shared/jira_common.py + Golden Architecture - #168

Merged
nils-werner-sonarsource merged 5 commits into
masterfrom
worktree-nw+dedup-shared-golden-arch
Jun 26, 2026
Merged

nils-werner-sonarsource merged 5 commits into
masterfrom
worktree-nw+dedup-shared-golden-arch

Conversation

@nils-werner-sonarsource

Copy link
Copy Markdown
Contributor

Summary

  • shared/jira_common.py: single source of truth for eprint, get_jira_instance, and CUSTOM_FIELDS — previously copy-pasted across 7 scripts
  • 7 Jira scripts migrated to import from shared/ via sys.path.insert (no install step needed — @v1 checks out the whole repo so ../shared is on disk at runtime)
  • Per-action auth tests removed — now covered by shared/test_jira_common.py; 98 business-logic tests remain green
  • JIRA_URL standardized to one canonical expression in all action.yml files (was 3 different spellings across 7 files)
  • CLAUDE.md Golden Architecture section added: documents the shared-code pattern, canonical JIRA_URL, and the four categories of load-bearing duplication that must stay per-action (vault blocks, injection guards, fan-outs, setup-python preamble) — so future contributors don't "fix" them into regressions

Net change: -548 lines / +193 lines

What was NOT changed

Vault credential blocks, inputs.x || env.X guards, orchestrator fan-outs, and setup-python preamble are all intentionally left per-action — see the Golden Architecture section in CLAUDE.md for why each is load-bearing.

Test plan

  • python3 -m pytest shared/test_jira_common.py — 5 tests (new shared helpers)
  • python3 -m pytest create-jira-version/test_create_jira_version.py — 13 tests
  • python3 -m pytest create-jira-release-ticket/test_create_release_ticket.py — passes
  • python3 -m pytest release-jira-version/test_release_jira_version.py — passes
  • python3 -m pytest get-jira-release-notes/test_get_jira_release_notes.py — passes
  • python3 -m pytest create-integration-ticket/test_create_integration_ticket.py — passes
  • python3 -m pytest update-release-ticket-status/test_update_release_ticket.py — passes
  • python3 -m pytest resolve-ktlo-epic/test_resolve_ktlo_epic.py — passes
  • All 98 tests pass in a single run

🤖 Generated with Claude Code

@hashicorp-vault-sonar-prod hashicorp-vault-sonar-prod Bot changed the title Dedup shared Jira helpers into shared/jira_common.py + Golden Architecture GHA-349 Dedup shared Jira helpers into shared/jira_common.py + Golden Architecture Jun 25, 2026
@hashicorp-vault-sonar-prod

hashicorp-vault-sonar-prod Bot commented Jun 25, 2026 •

Copy link
Copy Markdown

GHA-349

nils-werner-sonarsource and others added 2 commits June 25, 2026 16:46
…cture

- Add shared/jira_common.py with eprint, get_jira_instance, CUSTOM_FIELDS
- Add shared/test_jira_common.py (5 tests covering all shared helpers)
- Migrate all 7 Jira scripts to import from shared/ via sys.path.insert
- Remove per-action copies of eprint/get_jira_instance/CUSTOM_FIELDS
- Remove per-action auth tests now covered by shared/test_jira_common.py
- Standardize JIRA_URL ternary to one canonical expression in all action.yml
- Update CLAUDE.md: point CUSTOM_FIELDS at shared/, add Golden Architecture section
  documenting load-bearing constraints (vault blocks, injection guards, fan-outs)
  that must stay per-action, plus conventions for new actions

All 98 tests pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
All action.yml files previously embedded the full URL ternary:
  JIRA_URL: "https://sonarsource${{ ... }}.atlassian.net/"

Now they pass --use-sandbox="$USE_SANDBOX" and let shared/jira_common.py
resolve the URL via get_jira_url() / get_jira_instance(use_sandbox).
JIRA_URL_PROD and JIRA_URL_SANDBOX constants are the single source of truth.
A domain change is now one edit in shared/jira_common.py, not seven.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@nils-werner-sonarsource
nils-werner-sonarsource force-pushed the worktree-nw+dedup-shared-golden-arch branch from 98e2952 to 1b3fb22 Compare June 25, 2026 14:46
Comment thread test-fixtures/jira/jira_client.py Resolved
nils-werner-sonarsource and others added 2 commits June 25, 2026 16:59
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>
@nils-werner-sonarsource
nils-werner-sonarsource merged commit 5c39ec8 into master Jun 26, 2026
25 checks passed
@nils-werner-sonarsource
nils-werner-sonarsource deleted the worktree-nw+dedup-shared-golden-arch branch June 26, 2026 09:28
@sonarqubecloud

Copy link
Copy Markdown

@gitar-bot

gitar-bot Bot commented Jun 26, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 1 resolved / 1 findings

Consolidates Jira helpers into shared/jira_common.py and standardizes JIRA_URL constants across all actions, resolving duplication in jira_client.py. No issues found.

✅ 1 resolved
✅ Quality: JIRA URL constants duplicated in test-fixtures/jira/jira_client.py

📄 test-fixtures/jira/jira_client.py:19-31
This PR's stated goal and the new CLAUDE.md "Golden Architecture" section establish shared/jira_common.py as the single source of truth for the Jira URLs (JIRA_URL_PROD / JIRA_URL_SANDBOX) and the sandbox-toggle logic. However, test-fixtures/jira/jira_client.py:19-31 newly re-introduces its own copies of those exact constants and the isinstance(use_sandbox, str) / .lower() == 'true' resolution logic rather than importing from shared/. This means a future change to the prod or sandbox domain now requires editing two files, and the two implementations can silently drift. Consider importing the constants/helper from shared/jira_common.py (the repo is checked out whole at runtime, so ../../shared is reachable via the same sys.path.insert pattern already used by the action scripts), or at minimum add a comment noting that these values must be kept in sync with shared/jira_common.py.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

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.

2 participants