fix(github): recheck in-progress workflow runs using low-water-mark lookback (#9125) - #9162
Open
Thundercloud12 wants to merge 1 commit into
Open
Thundercloud12 wants to merge 1 commit into
Thundercloud12 wants to merge 1 commit into
Conversation
…ookback
Persist in-progress and queued workflow runs instead of skipping them,
and query the oldest unfinished run during incremental syncs to pull
windowStart back dynamically (capped by a 14-day max lookback) while
preserving the shared high-water mark.
Contributor
Author
|
@klesh hope this helps! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Problem
In
cicd_run_collector.go, the collector explicitly skipped workflow runs that were not completed:When runs were skipped while
in_progress,CollectorStateManager.Close()still advancedLatestSuccessStarttountil.Because GitHub's
/actions/runsAPI only filters by created date (created=<from>..<to>) and does not support filtering byupdated, subsequent incremental syncs queried:Any long-running workflow that was created before
LatestSuccessStartbut completed later was therefore permanently missed.Solution: Low-Water-Mark Lookback
Persist unfinished runs
Removed the
run.Status != "completed"skip inResponseParserso non-terminal runs (in_progress,queued,waiting, etc.) are written to_raw_github_api_runsand extracted into_tool_github_runs.Dynamic query start adjustment
In
CollectRuns, before bisecting leaf windows during incremental syncs, query_tool_github_runsfor the oldest unfinished run:If an unfinished run is found and its
github_created_atpredateswindowStart,windowStartis moved back to re-include it in the GitHub API query range.Preserve high-water mark
CollectorStateManager.Close()continues to advanceLatestSuccessStart = until.The shared database watermark therefore moves forward normally, and as soon as all unfinished runs complete,
windowStartautomatically snaps back toLatestSuccessStart + 1s.Zombie run guardrail
Added:
This ensures abandoned or killed runs cannot hold the collection window back indefinitely.
Downstream compatibility
Downstream tasks (
cicd_run_extractor,cicd_run_convertor, andcicd_job_collector) already support primary-key upserts andgithub_updated_at >= since.Therefore, completed runs and their jobs are converted and extracted automatically once the workflow status becomes
completed.Does this close any open issues?
Closes #9125
Screenshots
N/A (Backend collector logic fix)
Other Information
Unit tests added in
cicd_run_collector_test.go:TestCicdRunLoadOldestUnfinishedRunCreatedAt_ReturnsOldestTimestampTestCicdRunLoadOldestUnfinishedRunCreatedAt_NotFoundReturnsNilTestCicdRunLoadOldestUnfinishedRunCreatedAt_PropagatesErrorAll unit tests in
plugins/github/taskspass.Note for existing deployments: Workflows that were skipped in previous DevLake versions were dropped before reaching
_tool_github_runs. A one-time backfill withTimeAftercovering the affected window will be needed to capture those older runs. After that, the low-water-mark mechanism will track everything automatically.