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: Fix time_in_draft iterator exhaustion and misnamed event#610

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 4 commits intomainfromcopilot/fix-draft-pr-metrics-issue
Oct 4, 2025

Conversation

Copy link
Contributor

CopilotAI commentedOct 3, 2025
edited by zkoppert
Loading

This pull request updates the logic and tests for measuring the time a pull request spends in draft state. The main changes include standardizing the event name for draft conversions, improving compatibility with iterator-based event sources, updating test data types, and rounding the output for consistency.

Bug fixes and compatibility improvements:

  • Standardized the event name from"converted_to_draft" to"convert_to_draft" throughout both the implementation and all test cases, ensuring consistency with the real GitHub API event names.[1][2][3][4][5][6][7][8][9]

  • Modified themeasure_time_in_draft function to convert the events iterator to a list at the start, ensuring compatibility with the real GitHub API, which returns an iterator that can only be consumed once.

Test enhancements:

  • Added a new test (test_time_in_draft_with_iterator_events) to verify thatmeasure_time_in_draft works correctly when the events method returns an iterator, simulating real-world API behavior.

  • Updated test setup to usedatetime objects forcreated_at instead of ISO-formatted strings, aligning with the rest of the code and improving clarity.[1][2]

Accuracy improvements:

  • The result ofmeasure_time_in_draft is now rounded to the nearest second for improved accuracy and consistency.

  • Updated variable names in the implementation for clarity (e.g.,converted_to_draft_eventsconvert_to_draft_events).[1][2]

These changes improve reliability, maintainability, and correctness of the draft time measurement logic and its associated tests.fixes#608

Co-authored-by: zkoppert <6935431+zkoppert@users.noreply.github.com>
CopilotAI changed the title[WIP] Fix draft pull request metrics returning NoneFix time_in_draft iterator exhaustion causing None valuesOct 3, 2025
CopilotAI requested a review fromzkoppertOctober 3, 2025 18:15
Copilot finished work on behalf ofzkoppertOctober 3, 2025 18:15
@zkoppertzkoppert changed the titleFix time_in_draft iterator exhaustion causing None valuesfix: Fix time_in_draft iterator exhaustion causing None valuesOct 3, 2025
- Change event name from converted_to_draft to convert_to_draft to match actual GitHub timeline events- Remove problematic datetime parsing that was causing type errors- Update time calculation logic to properly handle draft state transitions- Make issue_metrics.py executable- Update corresponding test cases to use correct event namesThis fixes the draft PR metrics functionality to work with the actual GitHub API events.Signed-off-by: Zack Koppert <zkoppert@github.com>
@zkoppertzkoppert changed the titlefix: Fix time_in_draft iterator exhaustion causing None valuesfix: Fix time_in_draft iterator exhaustion and misnamed eventOct 4, 2025
@zkoppertzkoppert marked this pull request as ready for reviewOctober 4, 2025 05:06
@zkoppertzkoppert requested a review froma team as acode ownerOctober 4, 2025 05:06
CopilotAI review requested due to automatic review settingsOctober 4, 2025 05:06
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 pull request fixes bugs in the draft time measurement functionality by correcting the GitHub API event name and improving compatibility with iterator-based event sources. The changes ensure the code works correctly with the real GitHub API.

  • Standardized event name from "converted_to_draft" to "convert_to_draft" throughout code and tests
  • Fixed iterator exhaustion issue by converting events to a list upfront
  • Added test coverage for iterator-based events and improved test data consistency

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

FileDescription
time_in_draft.pyUpdated event name, fixed iterator handling, and added result rounding
test_time_in_draft.pyUpdated all test cases with correct event name and added iterator test

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>Signed-off-by: Zack Koppert <zkoppert@github.com>
@zkoppertzkoppert merged commit4860492 intomainOct 4, 2025
34 checks passed
@zkoppertzkoppert deleted the copilot/fix-draft-pr-metrics-issue branchOctober 4, 2025 15:29
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.

Time in draft for pull requests metrics is alwaysNone v2

3 participants

@jmeridth@zkoppert

[8]ページ先頭

©2009-2025 Movatter.jp