Skip to content

Fix mentorship issue collisions across repositories - #5751

Open
vianmangal wants to merge 3 commits into
OWASP:mainfrom
vianmangal:codex/fix-mentorship-issue-ids
Open

vianmangal wants to merge 3 commits into
OWASP:mainfrom
vianmangal:codex/fix-mentorship-issue-ids

Conversation

@vianmangal

@vianmangal vianmangal commented Oct 23, 2026 •

Copy link
Copy Markdown

Proposed change

Resolves #5747

Mentorship modules can contain issues from multiple repositories with overlapping GitHub numbers. Use the existing Nest issue ID in detail URLs, GraphQL queries, assignments, and deadline updates so each action targets the selected issue.

Key deadline and assignment-time caches by issue ID, and scope interested-user and mentee lookups to that issue. Update the shared issue table so mentee profiles also open the selected repository's issue. Multi-repository support and existing role checks are preserved.

Regenerate GraphQL types and add regression tests for overlapping numbers, distinct detail URLs, assignment isolation, invalid ID types and numeric ranges, and mutation refetches.

Validate numeric issue IDs against the database bigint range and return malformed IDs consistently as GraphQL errors. Collision tests cover assignment, unassignment, and setting or clearing deadlines.

Validation

make check-test passed locally with exit code 0:

  • All pre-commit hooks, Prettier, ESLint, and CSpell passed.
  • Backend: 3,876 tests passed with 99.06% coverage.
  • Frontend: 2,981 unit tests and 371 accessibility tests passed; all configured 95% coverage thresholds passed.
  • Application and test TypeScript checks passed.
  • End-to-end: 256 tests passed across desktop and mobile Chrome.

GraphQL code generation completed with the pinned dependencies. Also verified the collision scenario using the real GraphQL schema and PostgreSQL, including assignments, deadlines, interests, mentees, and module boundaries. Fixture writes were rolled back.

Local Docker setup used longer dependency-download timeouts, bounded/recycled Jest workers, and Git-recorded file modes for Docker Desktop permission checks. Test selection, assertions, timeouts, coverage thresholds, pinned dependencies, and image digests were unchanged.

Compatibility

Internal mentorship operations now accept issueId: ID!, and issueById replaces issueByNumber. Detail URLs contain an encoded Nest issue ID. Existing number-only bookmarks are not retained because they can identify multiple issues. No database migration is required.

Checklist

  • Required: I followed the contributing workflow
  • Required: I verified that my code works as intended and resolves the issue as described
  • Required: I ran all required checks and tests locally; all warnings addressed and failures resolved
  • I used AI for code, documentation, tests, or communication related to this PR

Signed-off-by: vian <viaanmangal@gmail.com>
@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: OWASP/Nest
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: 63b7d48
  • Layers: Repository YAML
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 4c18a735-1ab4-4ef4-a17c-1f96af335667
Commits

Reviewing files that changed from the base of the PR and between 63b7d48 and edff9d3.

Files ignored due to path filters: 2
  • frontend/src/types/__generated__/graphql.ts is excluded by !**/__generated__/**
  • frontend/src/types/__generated__/issueQueries.generated.ts is excluded by !**/*.generated.*, !**/__generated__/**
Files selected for processing: 20
  • backend/src/apps/github/api/internal/nodes/issue.py
  • backend/src/apps/mentorship/api/internal/mutations/module.py
  • backend/src/apps/mentorship/api/internal/nodes/module.py
  • backend/src/apps/mentorship/api/internal/utils.py
  • backend/tests/unit/apps/github/api/internal/nodes/issue_test.py
  • backend/tests/unit/apps/mentorship/api/internal/mutations/module_mutation_test.py
  • backend/tests/unit/apps/mentorship/api/internal/nodes/api_internal_module_test.py
  • backend/tests/unit/apps/mentorship/api/internal/utils_test.py
  • frontend/__tests__/a11y/pages/ModuleIssueDetailsPage.a11y.test.tsx
  • frontend/__tests__/unit/components/IssuesTable.test.tsx
  • frontend/__tests__/unit/components/cards/ModuleIssues.test.tsx
  • frontend/__tests__/unit/hooks/useIssueMutations.test.tsx
  • frontend/__tests__/unit/pages/MenteeProfilePage.test.tsx
  • frontend/__tests__/unit/pages/ModuleIssueDetailsPage.test.tsx
  • frontend/src/app/my/mentorship/programs/[programKey]/modules/[moduleKey]/issues/[issueId]/page.tsx
  • frontend/src/app/my/mentorship/programs/[programKey]/modules/[moduleKey]/mentees/[menteeKey]/page.tsx
  • frontend/src/components/IssuesTable.tsx
  • frontend/src/components/cards/ModuleIssues.tsx
  • frontend/src/hooks/useIssueMutations.ts
  • frontend/src/server/queries/issueQueries.ts

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

Summary by CodeRabbit

  • Improvements
    • Issues are now identified by unique IDs across issue details, navigation, assignment, and deadline management. This distinguishes issues that share the same GitHub issue number.
    • Issue-related queries and actions now use issue IDs instead of issue numbers.

Walkthrough

Mentorship issue lookups, management mutations, and frontend routes now use Nest issue IDs instead of GitHub issue numbers. Backend resolution and task lookups use issue primary keys. Tests cover selecting between issues that share a GitHub number.

Changes

Mentorship issue identification

Layer / File(s) Summary
Backend issue resolution
backend/src/apps/mentorship/api/internal/nodes/module.py, backend/src/apps/mentorship/api/internal/utils.py, backend/src/apps/github/api/internal/nodes/issue.py, backend/tests/unit/apps/mentorship/api/internal/nodes/*, backend/tests/unit/apps/mentorship/api/internal/utils_test.py, backend/tests/unit/apps/github/api/internal/nodes/issue_test.py
Resolvers accept GlobalID values and filter issues and task records by primary key. get_issue_pk validates issue IDs. Resolver tests cover issues with overlapping GitHub numbers.
Issue management mutations
backend/src/apps/mentorship/api/internal/mutations/module.py, backend/tests/unit/apps/mentorship/api/internal/mutations/module_mutation_test.py
Assignment, unassignment, and deadline mutations accept GlobalID values and look up issues by primary key. Tests cover selection among issues with the same GitHub number.
Frontend issue queries and navigation
frontend/src/server/queries/issueQueries.ts, frontend/src/app/my/mentorship/programs/.../issues/[issueId]/page.tsx, frontend/src/app/my/mentorship/programs/.../mentees/[menteeKey]/page.tsx, frontend/src/components/IssuesTable.tsx, frontend/src/components/cards/ModuleIssues.tsx, frontend/src/hooks/useIssueMutations.ts, frontend/__tests__/*
Issue queries and mutations pass issue IDs. Detail routes and click handlers use issue IDs, and tests verify distinct navigation for overlapping issue numbers.

Priority: Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: Minimal · up to edff9

Issue selection and actions now target the selected issue across repositories. No actionable merge-blocking risk was identified; this is ready for normal merge checks.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title "Fix mentorship issue collisions across repositories" matches the main change. The PR replaces number-only issue lookups with the Nest issue ID in mentorship detail URLs, GraphQL queries, as…
Description check Passed The description is related to the changeset. It explains that mentorship modules can contain issues from multiple repositories with overlapping GitHub numbers. It states that the PR uses the Nest issu…
Linked Issues check Passed Issue #5747 requires distinct issue links and correct actions when repositories share a GitHub issue number. The PR uses the Nest issue ID in detail routes, GraphQL queries, assignments, deadlines, in…
Out of Scope Changes check Passed The reviewed changes support issue #5747. The utility validates issue IDs, the cache keys use issue IDs, shared issue-table navigation uses selected issue IDs, GraphQL types and queries are updated, a…
Docstring Coverage Passed Docstring coverage is 86.75% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 83 functions across 20 files.
Full details: Title check

Explanation

The title "Fix mentorship issue collisions across repositories" matches the main change. The PR replaces number-only issue lookups with the Nest issue ID in mentorship detail URLs, GraphQL queries, assignments, and deadline updates, so issues that share a GitHub number across repositories no longer collide. The title is concise and specific.

Full details: Description check

Explanation

The description is related to the changeset. It explains that mentorship modules can contain issues from multiple repositories with overlapping GitHub numbers. It states that the PR uses the Nest issue ID in detail URLs, GraphQL queries, assignments, and deadline updates. It also covers the caches, the shared issue table, the regression tests, the validation steps, and the compatibility impact (issueByNumber replaced by issueById, and number-only bookmarks not retained).

Full details: Linked Issues check

Explanation

Issue #5747 requires distinct issue links and correct actions when repositories share a GitHub issue number. The PR uses the Nest issue ID in detail routes, GraphQL queries, assignments, deadlines, interested-user lookups, and mentee lookups. Backend resolvers and mutations filter by issue primary key within the module. Frontend tests cover distinct URLs and collision-safe assignment and deadline operations. The changes preserve multi-repository issue support.

Full details: Out of Scope Changes check

Explanation

The reviewed changes support issue #5747. The utility validates issue IDs, the cache keys use issue IDs, shared issue-table navigation uses selected issue IDs, GraphQL types and queries are updated, and regression tests cover the changed behavior. The issue-related test and compatibility changes have a direct connection to collision-safe issue selection. No unrelated change is established.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 22 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread backend/src/apps/mentorship/api/internal/utils.py Outdated
Signed-off-by: vian <viaanmangal@gmail.com>
cubic-dev-ai[bot]
cubic-dev-ai Bot previously approved these changes Oct 23, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 3 files (changes from recent commits).

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@vianmangal
vianmangal marked this pull request as ready for review October 23, 2026 22:12
@kasya

kasya commented Oct 24, 2026

Copy link
Copy Markdown
Collaborator

@vianmangal Hi! Please address SonarQube issues that were introduced in this PR:
Screenshot 2026-10-23 at 7 01 30 PM

@vianmangal
vianmangal marked this pull request as draft October 24, 2026 06:31
Signed-off-by: vian <viaanmangal@gmail.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 1 file (changes from recent commits).

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@sonarqubecloud

Copy link
Copy Markdown

@vianmangal
vianmangal marked this pull request as ready for review October 24, 2026 06:41

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mentorship issue links and actions collide when repositories share the same issue number

2 participants