Skip to content

Build comment from fields of Koji build target - #3174

Open
jpodivin wants to merge 2 commits into
packit:mainfrom
jpodivin:more_context
Open

Build comment from fields of Koji build target#3174
jpodivin wants to merge 2 commits into
packit:mainfrom
jpodivin:more_context

Conversation

@jpodivin

Copy link
Copy Markdown
Contributor

RELEASE NOTES BEGIN

Packit will supply Log Detective with additional information about executed Koji build. Such as duration, version and architecture.

RELEASE NOTES END

@jpodivin
jpodivin requested a review from a team as a code owner August 26, 2026 15:24
@jpodivin
jpodivin requested review from mfocko and removed request for a team August 26, 2026 15:24
@fullsend-ai-review

fullsend-ai-review Bot commented Aug 26, 2026

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 3:26 PM UTC · Completed 3:39 PM UTC

Commit: efcb19d · View workflow run →

Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $4.97

@centosinfra-prod-github-app

Copy link
Copy Markdown
Contributor

@nforro nforro left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. Not sure what triggered the test failures though.

@fullsend-ai-review

fullsend-ai-review Bot commented Aug 26, 2026

Copy link
Copy Markdown

Review

Findings

Medium

  • [mocking library consistency] tests/unit/test_logdetective_koji_helper.py:7 — The PR introduces from unittest.mock import MagicMock to create mock objects that pass isinstance() checks. However, every other test file in the repository (64 files) uses flexmock exclusively and none import unittest.mock. Mixing two mocking libraries creates maintenance friction. flexmock can achieve isinstance() compatibility via flexmock(PullRequestModel()).
    Remediation: Replace MagicMock(spec=PullRequestModel) with a flexmock-based approach such as flexmock(PullRequestModel()). Apply the same change for GitBranchModel and ProjectReleaseModel. Remove the from unittest.mock import MagicMock import.

Low

  • [test adequacy] tests/integration/test_logdetective_koji.py:76 — The integration test sets nvr/scratch/sidetag/build_submission_stdout on the koji_build_pr_downstream fixture, but the fixture's db_project_object is a bare flexmock, not a PullRequestModel instance. Since _build_commentary uses isinstance(db_project_object, PullRequestModel), the PR-build branch will never be exercised in the integration test.

  • [edge case handling] packit_service/worker/helpers/logdetective.py:107build.build_submission_stdout is appended to the commentary string without truncation. If Koji build submission produced unusually large stdout, the Log Detective API request payload could become unexpectedly large. In practice Koji submission stdout is typically short, so the risk is low.

  • [naming-coherence] packit_service/worker/helpers/logdetective.py — The method name _build_commentary uses 'build' as a verb (meaning 'construct'), but in this codebase 'build' overwhelmingly refers to a Koji/Copr build noun. A name like _compose_commentary or _generate_commentary would avoid the collision with the domain term.

Previous run

Review

Findings

Low

  • [edge-case] packit_service/worker/helpers/logdetective.py:82_build_commentary accesses self.koji_event.build_model and immediately dereferences build.nvr without a None guard. If build_model were None, this would raise AttributeError. However, this mirrors the existing pattern in trigger_log_detective_analysis_for_arch (which also dereferences build_model without checking) and is not practically reachable — the handler's _run() method returns early if the build model is absent before this code path executes.

  • [test-inadequate] tests/integration/test_logdetective_koji.py:76 — The integration test sets new attributes (build_submission_stdout, nvr, scratch, sidetag) on koji_build_pr_downstream but the requests.post mock accepts any arguments, so the dynamic commentary payload is never validated end-to-end. Additionally, db_project_object resolves to a flexmock that will fail the isinstance(db_project_object, PullRequestModel) check (flexmock objects are not instances of the real model class), causing the PR-specific commentary line to be silently skipped. Consider adding a payload assertion or using flexmock(PullRequestModel) to ensure isinstance works correctly.

Previous run (2)

Review

Findings

Low

  • [test-inadequate] tests/unit/test_logdetective_koji_helper.py:55 — The test fixture only exercises one path through _build_commentary: db_project_object=None, scratch=False, sidetag=None, build_submission_stdout=None, and valid numeric timestamps. None of the new conditional branches are tested: PullRequestModel/GitBranchModel/ProjectReleaseModel project types, scratch builds, sidetag builds, non-None build_submission_stdout, or the error/edge-case paths in _format_duration (None timestamps, negative duration, non-numeric string timestamps). The method has six independent conditional branches; a single happy-path case leaves most of them unverified.

fullsend-ai-review[bot]

This comment was marked as outdated.

@fullsend-ai-review fullsend-ai-review Bot added the ready-for-merge All reviewers approved — ready to merge label Aug 26, 2026
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@fullsend-ai-review

fullsend-ai-review Bot commented Aug 27, 2026

Copy link
Copy Markdown

🤖 Review · ❌ Terminated · Started 7:54 AM UTC · Ended 8:11 AM UTC

Commit: 2e9d82f · View workflow run →

@centosinfra-prod-github-app

Copy link
Copy Markdown
Contributor

fullsend-ai-review[bot]

This comment was marked as outdated.

@fullsend-ai-review

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 7:54 AM UTC · Completed 8:11 AM UTC

Commit: 2e9d82f · View workflow run →

Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $5.46

Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
@fullsend-ai-review

fullsend-ai-review Bot commented Aug 27, 2026

Copy link
Copy Markdown

🤖 Review · ❌ Terminated · Started 10:08 AM UTC · Ended 10:24 AM UTC

Commit: 83d4b46 · View workflow run →

@centosinfra-prod-github-app

Copy link
Copy Markdown
Contributor

@fullsend-ai-review fullsend-ai-review Bot added requires-manual-review Review requires human judgment and removed ready-for-merge All reviewers approved — ready to merge labels Aug 27, 2026
@fullsend-ai-review

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 10:08 AM UTC · Completed 10:24 AM UTC

Commit: 83d4b46 · View workflow run →

Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $5.50

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

requires-manual-review Review requires human judgment

Projects

Development

Successfully merging this pull request may close these issues.

3 participants