Add Jira multi-account support, connection-aware sync/matching, and related fixes - #41
Open
batoolfatima05 wants to merge 1 commit into
Open
batoolfatima05 wants to merge 1 commit into
batoolfatima05 wants to merge 1 commit into
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements docs/JIRA_MULTI_ACCOUNT_PLAN.md end to end:
layer (create/list/get/delete/set-default, encrypted tokens, delete
blocked while referenced, default-switch atomicity).
through the backend so business rules live in one place.
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.
colliding-key case, without changing the default org-wide matching
behavior for every ordinary org.
(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:
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.
project pairing per team (never affects matching/sync/metrics).
"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.
cycle-time data -- a repo-less team with real ticket data was always
falling into "configure team repos" instead of showing it.
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.
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.
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