Skip to content

[test-improver] Improve tests for server/difc_log - #9362

Merged
lpcox merged 3 commits into
mainfrom
test-improver/difc-log-coverage-074124ebe9a56545
Jul 15, 2026
Merged

[test-improver] Improve tests for server/difc_log#9362
lpcox merged 3 commits into
mainfrom
test-improver/difc-log-coverage-074124ebe9a56545

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Summary

Analyzed internal/server/difc_log_test.go and found two uncovered branches in buildDIFCFilteredNotice.

File Analyzed

internal/server/difc_log_test.go (corresponding impl: internal/server/difc_log.go)

Improvements Made

Added two new tests to cover previously-untested branches in buildDIFCFilteredNotice (lines 150–154):

  • TestBuildDIFCFilteredNotice_ItemWithDescOnly — exercises the else if desc != "" branch: an item that has a description but no reason should appear inline using only the description.
  • TestBuildDIFCFilteredNotice_ItemWithReasonOnly — exercises the else branch: an item that has a reason but no description should appear inline using only the reason.

Coverage

Function Before After
buildDIFCFilteredNotice 87.5% 100%
internal/server package 92.4% 92.6%

Test Output

--- PASS: TestBuildDIFCFilteredNotice_ItemWithDescOnly (0.00s)
--- PASS: TestBuildDIFCFilteredNotice_ItemWithReasonOnly (0.00s)
ok  github.com/github/gh-aw-mcpg/internal/server  5.326s  coverage: 92.6% of statements

Warning

Firewall blocked 2 domains

The following domains were blocked by the firewall during workflow execution:

  • awmgmcpg
  • index.crates.io

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "awmgmcpg"
    - "index.crates.io"

See Network Configuration for more information.

Generated by Test Improver · 145.6 AIC · ⊞ 5.5K ·

…anches

Add TestBuildDIFCFilteredNotice_ItemWithDescOnly and
TestBuildDIFCFilteredNotice_ItemWithReasonOnly to cover the two
previously-untested branches in buildDIFCFilteredNotice (lines 150–154):
- else if desc != : item has a description but no reason
- else: item has a reason but no description

buildDIFCFilteredNotice coverage: 87.5% → 100%
internal/server package coverage: 92.4% → 92.6%

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@lpcox
lpcox marked this pull request as ready for review July 15, 2026 14:38
Copilot AI review requested due to automatic review settings July 15, 2026 14:38

Copilot AI left a comment

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.

Pull request overview

This PR improves unit test coverage for internal/server’s DIFC notice rendering by adding targeted tests for previously uncovered branches in buildDIFCFilteredNotice, ensuring the notice formats items correctly when only a description or only a reason is present.

Changes:

  • Added TestBuildDIFCFilteredNotice_ItemWithDescOnly to cover the desc != "" && reason == "" formatting path.
  • Added TestBuildDIFCFilteredNotice_ItemWithReasonOnly to cover the desc == "" && reason != "" formatting path.
Show a summary per file
File Description
internal/server/difc_log_test.go Adds two new tests to exercise previously untested formatting branches in buildDIFCFilteredNotice.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 2
  • Review effort level: Low

Comment thread internal/server/difc_log_test.go Outdated
Comment thread internal/server/difc_log_test.go Outdated
lpcox and others added 2 commits July 15, 2026 08:51
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@lpcox
lpcox merged commit 01fb4fb into main Jul 15, 2026
27 checks passed
@lpcox
lpcox deleted the test-improver/difc-log-coverage-074124ebe9a56545 branch July 15, 2026 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants