Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: AttributeError when DRAFT_PR_TRACKING is enabled#570

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
zkoppert merged 3 commits intomainfromcopilot/fix-567
Aug 16, 2025

Conversation

Copy link
Contributor

CopilotAI commentedAug 15, 2025
edited
Loading

WhenDRAFT_PR_TRACKING is set totrue, themeasure_time_in_draft function throws anAttributeError: events because it attempts to callissue.events() directly on a search result object that doesn't have anevents() method.

The issue occurs because:

  • get_per_issue_metrics passes issue search result objects tomeasure_time_in_draft
  • These objects have a nested structure where events are accessed viaissue.issue.events()
  • The function was incorrectly callingissue.events() instead of following the established pattern

Before:

events=issue.events()# ❌ AttributeError: events

After:

events=issue.issue.events()# ✅ Works correctly

This change aligns with the pattern used throughout the codebase in functions likeget_label_events() andget_time_to_ready_for_review() which correctly useissue.issue.events().

The fix is minimal and surgical - only one line changed in the core function, with corresponding test updates to match the real-world usage pattern.

Fixes#567.


✨ Let Copilot coding agentset things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: zkoppert <6935431+zkoppert@users.noreply.github.com>
CopilotAI changed the title[WIP]DRAFT_PR_TRACKING is not working when set totrueFix AttributeError when DRAFT_PR_TRACKING is enabledAug 15, 2025
CopilotAI requested a review fromzkoppertAugust 15, 2025 17:56
Copilot finished work on behalf ofzkoppertAugust 15, 2025 17:56
@zkoppertzkoppert changed the titleFix AttributeError when DRAFT_PR_TRACKING is enabledfix: AttributeError when DRAFT_PR_TRACKING is enabledAug 15, 2025
@zkoppert
Copy link
Member

@copilot can you fix the failing github actions on this pull request?

Co-authored-by: zkoppert <6935431+zkoppert@users.noreply.github.com>
Copy link
ContributorAuthor

@copilot can you fix the failing github actions on this pull request?

I've fixed the failing GitHub Actions. The issues were:

  1. AttributeError fix: Changedissue.events() toissue.issue.events() intime_in_draft.py to properly access events through the nested issue structure
  2. Test coverage: Updated all tests to use the correct mock structure and added a specific test case that reproduces the original AttributeError scenario
  3. Linting fixes: Cleaned up trailing whitespace issues

All tests now pass (115/115) and linting is clean. The GitHub Actions should now pass successfully.

Commit:80d8649

Copilot finished work on behalf ofzkoppertAugust 15, 2025 22:10
@zkoppertzkoppert marked this pull request as ready for reviewAugust 15, 2025 22:15
@zkoppertzkoppert requested a review froma team as acode ownerAugust 15, 2025 22:15
CopilotAI review requested due to automatic review settingsAugust 15, 2025 22:15
Copy link
Contributor

CopilotAI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes an AttributeError that occurs when theDRAFT_PR_TRACKING feature is enabled, where themeasure_time_in_draft function was incorrectly callingissue.events() instead ofissue.issue.events() on search result objects.

  • Updates the function to use the correct nested attribute access pattern
  • Adds comprehensive test coverage for the bug scenario
  • Aligns with the established pattern used throughout the codebase

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

FileDescription
time_in_draft.pyFixed the AttributeError by changingissue.events() toissue.issue.events()
test_time_in_draft.pyUpdated all test mocks to use the correct nested structure and added a regression test

Tip: Customize your code reviews with copilot-instructions.md.Create the file orlearn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card.Take the survey.

@jmeridth
Copy link
Member

@zkoppert do we want to add release label on this one?

zkoppert reacted with thumbs up emoji

@zkoppertzkoppert merged commit2212538 intomainAug 16, 2025
32 checks passed
@zkoppertzkoppert deleted the copilot/fix-567 branchAugust 16, 2025 02:53
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

Copilot code reviewCopilotCopilot left review comments

@jmeridthjmeridthjmeridth approved these changes

+1 more reviewer

@zkoppertzkoppertzkoppert approved these changes

Reviewers whose approvals may not affect merge requirements

Labels

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

DRAFT_PR_TRACKING is not working when set totrue

3 participants

@zkoppert@jmeridth

[8]ページ先頭

©2009-2025 Movatter.jp