Skip to content

Require temporary_id for draft issue creation (breaking change)#14321

Closed
Copilot wants to merge 4 commits intomainfrom
copilot/update-project-for-draft-items
Closed

Require temporary_id for draft issue creation (breaking change)#14321
Copilot wants to merge 4 commits intomainfrom
copilot/update-project-for-draft-items

Conversation

Copy link
Contributor

Copilot AI commented Feb 7, 2026

Refactoring Implementation

Addressed all PR review feedback to improve code quality and efficiency.

Changes Made

1. Removed unused import

  • Removed generateTemporaryId from imports (was never used)

2. Optimized findExistingDraftByItemId()

  • Changed from O(N) pagination through all items to direct node query
  • Now queries item by ID directly: node(id: $draftItemId)
  • Verifies item belongs to correct project
  • Added error handling for non-existent items
  • Performance: Single GraphQL call instead of potentially many paginated calls

3. Added # prefix handling

  • draft_issue_id now strips optional leading # prefix
  • temporary_id now strips optional leading # prefix
  • Consistent with how content_number and project handle # prefix
  • Added tests for both scenarios

4. Structured temporary ID mapping

  • Draft mappings now use structured object: { draftItemId: "..." }
  • Distinguishes draft mappings from issue mappings { repo, number }
  • Prevents type confusion in shared temporaryIdMap
  • Updated resolution logic to handle both string (legacy) and structured formats

5. Improved schema documentation

  • Clarified that temporary_id requirement is runtime-enforced, not schema-enforced
  • More accurate description of validation behavior

6. Added comprehensive tests

  • Test for # prefix handling in draft_issue_id
  • Test for # prefix handling in temporary_id
  • Verified structured mapping format
  • All 51 tests passing ✅

Backward Compatibility

✅ Resolution logic handles both formats:

  • String format (legacy): temporaryIdMap.set("aw_...", "itemId")
  • Structured format (new): temporaryIdMap.set("aw_...", { draftItemId: "itemId" })

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…_project

Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copilot AI changed the title [WIP] Update project for draft items to prevent new creation Add draft_issue_id and temporary_id support to prevent duplicate draft items Feb 7, 2026
Copilot AI requested a review from mnkiefer February 7, 2026 10:32
@mnkiefer
Copy link
Contributor

mnkiefer commented Feb 7, 2026

@copilot Recompile workflows

Copy link
Contributor Author

Copilot AI commented Feb 7, 2026

@copilot Recompile workflows

Workflows recompiled successfully. All 147 workflows compiled with no changes needed - the lock files were already up-to-date.

Copilot AI requested a review from mnkiefer February 7, 2026 10:51
@mnkiefer
Copy link
Contributor

mnkiefer commented Feb 7, 2026

@copilot No longer support draft_title only. The behavior should be just like in issues and PRs and yield and error. When done, recompile workflows

Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 7, 2026

@copilot No longer support draft_title only. The behavior should be just like in issues and PRs and yield and error. When done, recompile workflows

Changes implemented in commit 2025ddb:

Breaking change: Draft issues now require temporary_id for creation, matching the behavior of issues/PRs that require content_number.

  • Creating drafts without temporary_id now throws an error
  • Updating existing drafts via draft_issue_id continues to work
  • All 49 tests passing
  • Workflows recompiled successfully (no changes needed)

The behavior now enforces explicit ID management to prevent duplicate drafts, just like issues and PRs.

Copilot AI changed the title Add draft_issue_id and temporary_id support to prevent duplicate draft items Require temporary_id for draft issue creation (breaking change) Feb 7, 2026
@mnkiefer
Copy link
Contributor

mnkiefer commented Feb 7, 2026

@pelikhan I think this is a required change. There should be no reason to treat draft issue items (in GitHub Projects) any different than issues or pull requests. Not requiring any identifier and matching by titles or hash of titles+body is not something I want to support going forward, it leads to all sorts of troubles.

Current behavior is that often draft items get duplicated instead of updated with update-project. This will prevent that but will also require a dedicated id, hence the breaking change. What do you think?

@mnkiefer mnkiefer marked this pull request as ready for review February 7, 2026 11:06
Copilot AI review requested due to automatic review settings February 7, 2026 11:06

This comment was marked as outdated.

@mnkiefer
Copy link
Contributor

mnkiefer commented Feb 7, 2026

@copilot Refactor implementation

… mapping

Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 7, 2026

@copilot Refactor implementation

Implementation refactored in commit 860b484:

Key improvements:

  • Removed unused generateTemporaryId import
  • Optimized findExistingDraftByItemId(): direct node query instead of O(N) pagination
  • Added # prefix support for both draft_issue_id and temporary_id
  • Used structured mapping { draftItemId } to distinguish draft mappings from issue mappings
  • Updated schema description to clarify runtime enforcement
  • Added 2 new tests for # prefix handling

All 51 tests passing. Backward compatible with legacy string mapping format.

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.

3 participants