Skip to content

Use pipeline datetime rather than job submission time to get newer job runs#3123

Merged
centosinfra-prod-github-app[bot] merged 2 commits into
packit:mainfrom
nforro:race
May 13, 2026
Merged

Use pipeline datetime rather than job submission time to get newer job runs#3123
centosinfra-prod-github-app[bot] merged 2 commits into
packit:mainfrom
nforro:race

Conversation

@nforro
Copy link
Copy Markdown
Member

@nforro nforro commented May 13, 2026

No description provided.

@nforro nforro requested a review from a team as a code owner May 13, 2026 09:43
@nforro nforro requested review from majamassarini and removed request for a team May 13, 2026 09:43
@nforro nforro moved this from New to In review in Packit pull requests May 13, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the has_newer_run logic across several models (CoprBuildTargetModel, KojiBuildTargetModel, and TFTTestRunTargetModel) to utilize the pipeline's datetime instead of the build's submission time. Corresponding updates were made to the test suite, including mocking the new logic and setting up environment variables. The review feedback correctly identifies that accessing runs[0] is non-deterministic in SQLAlchemy and recommends using the maximum datetime from all associated runs. Additionally, it suggests using datetime.utcnow() in tests to avoid issues with naive local datetimes.

Comment thread packit_service/models.py Outdated
Comment thread packit_service/models.py Outdated
Comment thread packit_service/models.py Outdated
Comment thread tests/conftest.py Outdated
@centosinfra-prod-github-app
Copy link
Copy Markdown
Contributor

…b runs

Signed-off-by: Nikola Forró <nforro@redhat.com>
Assisted-by: Claude Opus 4.6 via Claude Code
@nforro
Copy link
Copy Markdown
Member Author

nforro commented May 13, 2026

/gemini review

@centosinfra-prod-github-app
Copy link
Copy Markdown
Contributor

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the has_newer_run logic across CoprBuildTargetModel, KojiBuildTargetModel, and TFTTestRunTargetModel to use a calculated pipeline_datetime instead of submitted_time. It also includes necessary test updates, such as adding datetime to the koji_build_pr_downstream mock and updating integration tests to mock has_newer_run. I have kept the feedback regarding the duplication of the pipeline_datetime calculation and the suggestion to use monkeypatch for modifying urls.DASHBOARD_URL in tests, as these provide actionable improvements for maintainability and test stability.

Comment thread packit_service/models.py
Comment on lines +2386 to +2387
runs = run.group_of_targets.runs if run.group_of_targets else []
pipeline_datetime = max((r.datetime for r in runs if r.datetime), default=None)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

This logic to calculate pipeline_datetime is duplicated in KojiBuildTargetModel.has_newer_run (line 3056) and TFTTestRunTargetModel.has_newer_run (line 3926). To improve maintainability and avoid future inconsistencies, consider extracting this logic into a common helper method in a follow-up change.

Comment thread tests/unit/test_testing_farm.py Outdated
Copy link
Copy Markdown
Member

@majamassarini majamassarini left a comment

Choose a reason for hiding this comment

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

🙏🏻

Signed-off-by: Nikola Forró <nforro@redhat.com>
Assisted-by: Claude Opus 4.6 via Claude Code
@centosinfra-prod-github-app
Copy link
Copy Markdown
Contributor

@nforro nforro added the mergeit Merge via Zuul label May 13, 2026
@centosinfra-prod-github-app
Copy link
Copy Markdown
Contributor

@centosinfra-prod-github-app centosinfra-prod-github-app Bot merged commit 737a31d into packit:main May 13, 2026
6 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in Packit pull requests May 13, 2026
@nforro nforro deleted the race branch May 13, 2026 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mergeit Merge via Zuul

Projects

Development

Successfully merging this pull request may close these issues.

3 participants