Skip to content

Add Jira multi-account support, connection-aware sync/matching, and related fixes - #41

Open
batoolfatima05 wants to merge 1 commit into
mainfrom
jira/multi-account-support
Open

batoolfatima05 wants to merge 1 commit into
mainfrom
jira/multi-account-support

Conversation

@batoolfatima05

Copy link
Copy Markdown
Collaborator

Implements docs/JIRA_MULTI_ACCOUNT_PLAN.md end to end:

  • Task 1-2: JiraConnection + OrgProjectConnection schema and repo/service
    layer (create/list/get/delete/set-default, encrypted tokens, delete
    blocked while referenced, default-switch atomicity).
  • Task 3: Flask + Next.js API endpoints for managing connections, proxied
    through the backend so business rules live in one place.
  • Task 4: connection-aware sync -- JiraETLHandler loops JiraConnection
    rows (falling back to the legacy Integration row when none exist),
    scoped ticket idempotency keys, fixed get_org_providers so a
    connection-only org actually syncs.
  • Task 5: PR<->ticket matching scoped by connection for the rare
    colliding-key case, without changing the default org-wide matching
    behavior for every ordinary org.
  • Task 6: connections management UI folded into the existing Jira card
    (not a second card), site-URL normalization (a pasted
    "https://x.atlassian.net/" was being stored verbatim and building an
    unreachable URL at search/sync time), and a connection picker for
    per-team Jira project search/save (jira_project_search.ts,
    team_projects.ts), closing the OrgProjectConnection write-side gap
    from Task 4.

Also, found while verifying against a 15-scenario Jira<->PR<->deployment
spec:

  • PR<->ticket matching now scans only the PR title (previously also
    scanned branch name and description) -- the PR title is the sole
    authoritative source per that spec; branch/description/commit are
    never used as a fallback.
  • New TeamRepoProjectMapping: an explicit, informational repo<->Jira-
    project pairing per team (never affects matching/sync/metrics).
  • Team creation no longer hard-requires a Git repo -- an opt-in
    "Jira-only, no Git repo" checkbox lets an org with only Jira create a
    team, without changing the default repo-required flow for anyone who
    doesn't check it.
  • DoraMetricsBody's empty-state check no longer ignores Jira ticket-
    cycle-time data -- a repo-less team with real ticket data was always
    falling into "configure team repos" instead of showing it.
  • Fixed a real, live bug: teams/v2.ts's default code-provider list
    omitted Bitbucket in two places, undercounting a team's repos on the
    team list and leaving its edit-form repo picker empty even when a
    Bitbucket repo was genuinely linked and its metrics were computing
    correctly.
  • Fixed a frontend bug in the Repo <-> Project pairing UI: the project
    id was read from the wrong API field (org_project_id instead of id),
    which made every project compare equal to every other one in the
    picker -- selecting one project visibly selected a different one.
  • Fixed a backend 500 on saving repo/project pairings: TeamRepoProjectMapping's
    composite primary key was being built from a mix of uuid.UUID and plain
    str values across rows, which broke SQLAlchemy 2's insertmanyvalues
    sentinel matching on bulk insert.

Backend: 567 tests passing, flake8/black clean. Frontend: tsc --noEmit
clean; new/touched test files verified individually.

Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com

…elated fixes

Implements docs/JIRA_MULTI_ACCOUNT_PLAN.md end to end:

- Task 1-2: JiraConnection + OrgProjectConnection schema and repo/service
  layer (create/list/get/delete/set-default, encrypted tokens, delete
  blocked while referenced, default-switch atomicity).
- Task 3: Flask + Next.js API endpoints for managing connections, proxied
  through the backend so business rules live in one place.
- Task 4: connection-aware sync -- JiraETLHandler loops JiraConnection
  rows (falling back to the legacy Integration row when none exist),
  scoped ticket idempotency keys, fixed get_org_providers so a
  connection-only org actually syncs.
- Task 5: PR<->ticket matching scoped by connection for the rare
  colliding-key case, without changing the default org-wide matching
  behavior for every ordinary org.
- Task 6: connections management UI folded into the existing Jira card
  (not a second card), site-URL normalization (a pasted
  "https://x.atlassian.net/" was being stored verbatim and building an
  unreachable URL at search/sync time), and a connection picker for
  per-team Jira project search/save (jira_project_search.ts,
  team_projects.ts), closing the OrgProjectConnection write-side gap
  from Task 4.

Also, found while verifying against a 15-scenario Jira<->PR<->deployment
spec:

- PR<->ticket matching now scans only the PR title (previously also
  scanned branch name and description) -- the PR title is the sole
  authoritative source per that spec; branch/description/commit are
  never used as a fallback.
- New TeamRepoProjectMapping: an explicit, informational repo<->Jira-
  project pairing per team (never affects matching/sync/metrics).
- Team creation no longer hard-requires a Git repo -- an opt-in
  "Jira-only, no Git repo" checkbox lets an org with only Jira create a
  team, without changing the default repo-required flow for anyone who
  doesn't check it.
- DoraMetricsBody's empty-state check no longer ignores Jira ticket-
  cycle-time data -- a repo-less team with real ticket data was always
  falling into "configure team repos" instead of showing it.
- Fixed a real, live bug: teams/v2.ts's default code-provider list
  omitted Bitbucket in two places, undercounting a team's repos on the
  team list and leaving its edit-form repo picker empty even when a
  Bitbucket repo was genuinely linked and its metrics were computing
  correctly.

Backend: 567 tests passing, flake8/black clean. Frontend: tsc --noEmit
clean; new/touched test files verified individually (this environment's
memory constraints made a single combined jest run unreliable, noted in
the plan doc).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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