Skip to content

Fix/GitHub deployment time calculation#8715

Open
Ke-vin-S wants to merge 4 commits intoapache:mainfrom
Ke-vin-S:fix/github-deployment-time-calculation
Open

Fix/GitHub deployment time calculation#8715
Ke-vin-S wants to merge 4 commits intoapache:mainfrom
Ke-vin-S:fix/github-deployment-time-calculation

Conversation

@Ke-vin-S
Copy link

Summary

What does this PR do?

Fix deployment finish time calculation in the GitHub GraphQL plugin.

Previously, DevLake used the latest deployment status timestamp (often inactive) as the deployment completion time. However, GitHub marks a deployment as inactive when it is superseded by a newer successful deployment, which may occur significantly later than the actual success event.

This PR introduces a new nullable field finished_date in GithubDeployment and implements success-priority logic:

Use the latest success status timestamp if present.

  • Otherwise, fall back to the latest terminal status timestamp.
  • Domain conversion now uses finished_date to populate TaskDatesInfo.FinishedDate and calculate duration.
  • This ensures deployment metrics (e.g., PR Deploy Time) reflect the actual completion time.

Does this close any open issues?

Closes #8654

Other Information

  • Adds a backward-compatible migration for finished_date.
  • Preserves existing fields (LatestStatusState, LatestUpdatedDate) without changing semantics.
  • No breaking changes.

Introduce FinishedDate field in GithubDeployment to represent
success-priority deployment completion timestamp.

This field allows distinguishing SUCCESS timestamp from
latest status update time while preserving backward compatibility.
Add logic to derive FinishedDate from deployment statuses.

Preference order:
1. Latest SUCCESS timestamp
2. Latest terminal timestamp (FAILURE/ERROR/INACTIVE/ACTIVE)

This improves deployment lifecycle accuracy without modifying
existing LatestStatus semantics.
Update ConvertDeployment to use tool-layer FinishedDate when
populating domain TaskDatesInfo.FinishedDate.

Duration is now calculated using resolved finished time
instead of UpdatedDate.
Add migration script to auto-migrate GithubDeployment
and create nullable finished_date column.
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. component/plugins This issue or PR relates to plugins pr-type/bug-fix This PR fixes a bug priority/medium This issue is medium important severity/p1 This bug affects functionality or significantly affect ux labels Feb 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/plugins This issue or PR relates to plugins pr-type/bug-fix This PR fixes a bug priority/medium This issue is medium important severity/p1 This bug affects functionality or significantly affect ux size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug][Github] PR Deploy Time Incorrectly Calculated Using 'inactive' Status Timestamp Instead of 'success' Timestamp

1 participant