Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

add more instructions and development protocol (#3438)

Edgar Riba39824895b42c
diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml
index 945618181..d8efa8ade 100644
--- a/.github/ISSUE_TEMPLATE/bug-report.yml
+++ b/.github/ISSUE_TEMPLATE/bug-report.yml
@@ -14,6 +14,18 @@ body:
- [ ] I have checked the [help wanted issues](https://github.com/kornia/kornia/issues?q=is%3Aissue%20state%3Aopen%20label%3A%22help%20wanted%22) list
- [ ] I have read the [Contributing Guide](https://github.com/kornia/kornia/blob/main/CONTRIBUTING.md)
+ ---
+
+ **⚠️ Important: Before submitting a PR**
+
+ If you plan to fix this bug yourself:
+
+ 1. **Wait for maintainer approval**: A maintainer must review and approve this issue first
+ 2. **Wait for assignment**: You must be assigned to this issue by a maintainer before submitting a PR
+ 3. **Do not start work until assigned**: PRs submitted without prior issue approval and assignment may be closed
+
+ This helps us ensure the issue aligns with project goals, avoid duplicate work, and coordinate contributions effectively. See the [Contributing Guide](https://github.com/kornia/kornia/blob/main/CONTRIBUTING.md#pull-request) for more details.
+
- type: textarea
id: describe-bug
attributes:
diff --git a/.github/ISSUE_TEMPLATE/feature-request.yml b/.github/ISSUE_TEMPLATE/feature-request.yml
index ff986fb34..2184ae3cd 100644
--- a/.github/ISSUE_TEMPLATE/feature-request.yml
+++ b/.github/ISSUE_TEMPLATE/feature-request.yml
@@ -15,6 +15,18 @@ body:
- [ ] I have read the [Contributing Guide](https://github.com/kornia/kornia/blob/main/CONTRIBUTING.md)
- [ ] This feature aligns with Kornia's focus on end-to-end vision models and SOTA Vision/Robotics models
+ ---
+
+ **⚠️ Important: Before submitting a PR**
+
+ If you plan to implement this feature yourself:
+
+ 1. **Wait for maintainer approval**: A maintainer must review and approve this issue first
+ 2. **Wait for assignment**: You must be assigned to this issue by a maintainer before submitting a PR
+ 3. **Do not start work until assigned**: PRs submitted without prior issue approval and assignment may be closed
+
+ This helps us ensure the issue aligns with project goals, avoid duplicate work, and coordinate contributions effectively. See the [Contributing Guide](https://github.com/kornia/kornia/blob/main/CONTRIBUTING.md#pull-request) for more details.
+
- type: textarea
id: feature-description
attributes:
diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md
index 8ab82115b..9713a463b 100644
--- a/.github/copilot-instructions.md
+++ b/.github/copilot-instructions.md
@@ -56,3 +56,27 @@ When reviewing code changes, verify:
- PR includes proof of local test execution (test logs)
- Code uses `kornia` utilities instead of reinventing existing functionality
- Comments are written in English and verified by a human with a good understanding of the code
+
+## PR-Issue Alignment Review
+
+When reviewing pull requests, ensure strict alignment with the linked issue:
+
+1. **Issue Link Verification**:
+ - Verify the PR description contains a valid issue reference (e.g., "Fixes #123" or "Closes #123")
+ - Confirm the linked issue exists and is open (or was open when the PR was created)
+
+2. **Assignment Verification**:
+ - Check that the PR author is assigned to the linked issue
+ - If not assigned, request that a maintainer assign the issue before proceeding with review
+
+3. **Scope Matching**:
+ - **Critical**: Verify that the PR implementation strictly matches what the issue describes
+ - The PR should not include changes beyond the scope of the linked issue
+ - If the PR includes additional features or changes not mentioned in the issue, request that those be split into separate issues/PRs
+ - Compare the PR description, code changes, and tests against the issue description to ensure alignment
+
+4. **Issue Approval Status**:
+ - Verify the linked issue has been reviewed and approved by a maintainer
+ - Issues with the `triage` label may not have been fully reviewed yet
+
+**Reviewer Action**: If the PR does not match the issue scope or requirements, clearly explain the mismatch and request that the PR be updated to strictly align with the issue, or that additional changes be moved to separate issues/PRs.
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
index fd2dc3360..0d9e77d83 100644
--- a/.github/pull_request_template.md
+++ b/.github/pull_request_template.md
@@ -1,6 +1,14 @@
## 📝 Description
+
+**⚠️ Issue Link Required**: This PR must be linked to an approved and assigned issue. See [Contributing Guide](https://github.com/kornia/kornia/blob/main/CONTRIBUTING.md#pull-request) for details.
+
**Fixes/Relates to:** # (issue number)
+**Important**:
+- Ensure you are assigned to the linked issue before submitting this PR
+- This PR should strictly implement what the linked issue describes
+- Do not include changes beyond the scope of the linked issue
+
---
## 🛠️ Changes Made
@@ -25,6 +33,8 @@
---
## 🚦 Checklist
+- [ ] I am assigned to the linked issue (required before PR submission)
+- [ ] The linked issue has been approved by a maintainer
- [ ] I have performed a **self-review** of my code (no "ghost" variables or hallucinations).
- [ ] My code follows the existing style guidelines of this project.
- [ ] I have commented my code, particularly in hard-to-understand areas.
diff --git a/.github/workflows/issue-triage.yml b/.github/workflows/issue-triage.yml
new file mode 100644
index 000000000..f69e15845
--- /dev/null
+++ b/.github/workflows/issue-triage.yml
@@ -0,0 +1,41 @@
+name: Issue Triage
+
+on:
+ issues:
+ types: [opened]
+
+permissions:
+ issues: write
+ contents: read
+
+jobs:
+ triage:
+ name: Triage New Issue
+ runs-on: ubuntu-latest
+ steps:
+ - name: Add triage label
+ uses: actions/github-script@v7
+ with:
+ script: |
+ await github.rest.issues.addLabels({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: context.issue.number,
+ labels: ['triage']
+ });
+
+ - name: Post welcome message
+ uses: actions/github-script@v7
+ with:
+ script: |
+ const welcomeMessage = '## ⚠️ Before Submitting a PR\n\n' +
+ 'Please wait for a maintainer to approve and assign this issue to you or someone else before submitting a PR. ' +
+ 'PRs submitted without prior approval and assignment may be closed. ' +
+ 'See our [Contributing Guide](https://github.com/kornia/kornia/blob/main/CONTRIBUTING.md) for details.';
+
+ await github.rest.issues.createComment({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: context.issue.number,
+ body: welcomeMessage
+ });
diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml
new file mode 100644
index 000000000..68e1dacca
--- /dev/null
+++ b/.github/workflows/pr-validation.yml
@@ -0,0 +1,129 @@
+name: PR Validation
+
+on:
+ pull_request:
+ types: [opened, synchronize]
+
+permissions:
+ pull-requests: write
+ issues: read
+ contents: read
+
+jobs:
+ validate:
+ name: Validate PR Requirements
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+
+ - name: Validate PR requirements
+ uses: actions/github-script@v7
+ with:
+ script: |
+ const pr = context.payload.pull_request;
+ const prBody = pr.body || '';
+ const prAuthor = pr.user.login;
+
+ // Extract issue numbers from PR description
+ // Matches patterns like: Fixes #123, Closes #456, Relates to #789, etc.
+ const issuePattern = /(?:fixes?|closes?|resolves?|relates?\s+to|see|refs?)\s+#(\d+)/gi;
+ const matches = [...prBody.matchAll(issuePattern)];
+ const issueNumbers = [...new Set(matches.map(m => parseInt(m[1])))];
+
+ const warnings = [];
+
+ if (issueNumbers.length === 0) {
+ warnings.push('❌ **No linked issue found**: This PR does not reference any issue. Please link to an issue using "Fixes #123" or "Closes #123" in the PR description.');
+ } else {
+ // Check each linked issue
+ for (const issueNumber of issueNumbers) {
+ try {
+ const issue = await github.rest.issues.get({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: issueNumber
+ });
+
+ if (issue.data.state === 'closed') {
+ warnings.push(`⚠️ **Issue #${issueNumber} is closed**: The linked issue #${issueNumber} is already closed. Please ensure you're linking to the correct issue.`);
+ }
+
+ // Check if PR author is assigned to the issue
+ const assignees = issue.data.assignees.map(a => a.login);
+ if (assignees.length === 0) {
+ warnings.push(`⚠️ **Issue #${issueNumber} has no assignee**: This issue has not been assigned to anyone. Please wait for a maintainer to assign it to you before submitting a PR.`);
+ } else if (!assignees.includes(prAuthor)) {
+ warnings.push(`⚠️ **Assignment mismatch**: You (@${prAuthor}) are not assigned to issue #${issueNumber}. The issue is assigned to: ${assignees.map(a => `@${a}`).join(', ')}. Please wait for a maintainer to assign the issue to you.`);
+ }
+
+ // Check if issue has triage label (indicating it might not be approved yet)
+ const labels = issue.data.labels.map(l => l.name);
+ if (labels.includes('triage')) {
+ warnings.push(`ℹ️ **Issue #${issueNumber} is still in triage**: This issue may not have been reviewed and approved by a maintainer yet. Please ensure the issue has been approved before submitting a PR.`);
+ }
+ } catch (error) {
+ if (error.status === 404) {
+ warnings.push(`❌ **Issue #${issueNumber} not found**: The linked issue #${issueNumber} does not exist. Please check the issue number.`);
+ } else {
+ warnings.push(`⚠️ **Error checking issue #${issueNumber}**: ${error.message}`);
+ }
+ }
+ }
+ }
+
+ // Post comment if there are warnings
+ if (warnings.length > 0) {
+ const commentBody = '## ⚠️ PR Validation Warnings\n\n' +
+ warnings.join('\n\n') + '\n\n' +
+ '---\n\n' +
+ '**Note**: This PR can remain open, but please address these issues to ensure a smooth review process. For more information, see our [Contributing Guide](https://github.com/kornia/kornia/blob/main/CONTRIBUTING.md).';
+
+ // Check if we already posted a comment
+ const comments = await github.rest.issues.listComments({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: pr.number
+ });
+
+ const botComment = comments.data.find(
+ c => c.user.type === 'Bot' && c.body.includes('PR Validation Warnings')
+ );
+
+ if (botComment) {
+ // Update existing comment
+ await github.rest.issues.updateComment({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ comment_id: botComment.id,
+ body: commentBody
+ });
+ } else {
+ // Create new comment
+ await github.rest.issues.createComment({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: pr.number,
+ body: commentBody
+ });
+ }
+ } else {
+ // Remove any existing warning comments if validation passes
+ const comments = await github.rest.issues.listComments({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: pr.number
+ });
+
+ const botComment = comments.data.find(
+ c => c.user.type === 'Bot' && c.body.includes('PR Validation Warnings')
+ );
+
+ if (botComment) {
+ await github.rest.issues.deleteComment({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ comment_id: botComment.id
+ });
+ }
+ }
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index a15c61462..521f7cbba 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -370,7 +370,25 @@ This section provides guidance for contributing to Kornia, with a focus on Pytho
# Pull Request
+## Issue Approval and Assignment Workflow
+
+**Before submitting a PR, you must:**
+
+1. **Open an issue first**: All PRs must be linked to an existing issue. If no issue exists for your work, create one using the appropriate template (bug report or feature request).
+
+2. **Wait for maintainer approval**: A maintainer must review and approve the issue before you start working on it. New issues are automatically labeled with `triage` and will receive a welcome message explaining this process.
+
+3. **Wait for assignment**: You must be assigned to the issue by a maintainer before submitting a PR. This ensures:
+ - The issue aligns with project goals
+ - No duplicate work is being done
+ - Proper coordination of contributions
+
+4. **Do not start work until assigned**: PRs submitted without prior issue approval and assignment may be closed or receive warnings during automated validation.
+
+This workflow helps maintain quality, avoid conflicts, and ensure contributions align with the project's direction. The automated PR validation workflow will check these requirements and post warnings if they're not met.
+
**Requirements:**
+- **Issue approval and assignment**: The linked issue must be approved by a maintainer and you must be assigned to it (see workflow above)
- Link PR to an issue (use "Closes #123" or "Fixes #123")
- Pass all local tests before submission
- Provide proof of local test execution in the PR description (this is especially important for first-time contributors)