Skip to content

test: improve render coverage from 78.5% to 84.4%#64

Open
JordanCoin wants to merge 1 commit intomainfrom
automation/test-coverage-render-20260331
Open

test: improve render coverage from 78.5% to 84.4%#64
JordanCoin wants to merge 1 commit intomainfrom
automation/test-coverage-render-20260331

Conversation

@JordanCoin
Copy link
Copy Markdown
Owner

Summary

  • add targeted render/depgraph tests for fanout, hub, and summary rendering paths using temp-dir fixtures
  • keep changes limited to tests plus CI coverage floor update
  • raise CI coverage floor in .github/workflows/ci.yml from 45.0 to 50.0

Coverage

Scope Before After
render 78.5% 84.4%
total 72.2% 73.1%

Validation

  • go test -race -coverprofile=coverage.out ./...
  • go vet ./...
  • gofmt -l .

Copilot AI review requested due to automatic review settings March 31, 2026 13:53
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5cc3d17f09

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +134 to +135
if !scanner.NewAstGrepAnalyzer().Available() {
t.Skip("ast-grep not available")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Make ast-grep availability check robust before running test

This guard can pass even when ast-grep is not actually installed (for example on many Linux systems where /usr/bin/sg exists but is the unrelated setgroups tool). In that case the test does not skip, Depgraph cannot build internal dependencies, and the assertion fails with 0 deps (reproducible via go test ./render -run TestDepgraphRendersChainsFanoutAndHubs). Please tighten the precondition so the test skips unless a real ast-grep scanner can parse the fixture.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

Copilot AI left a comment

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 increases test coverage for the depgraph renderer by adding a targeted fixture-based test that exercises fanout, hub detection, and summary rendering, and then raises the CI-enforced overall coverage floor accordingly.

Changes:

  • Add a temp-dir Go module fixture and a new depgraph rendering test that validates fanout + hubs output.
  • Raise the CI coverage floor from 45.0% to 50.0% on the Ubuntu Go 1.23 job.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
render/depgraph_test.go Adds a reusable on-disk fixture writer and a new depgraph rendering test covering fanout/hubs/summary paths.
.github/workflows/ci.yml Updates the enforced total coverage minimum to 50.0%.

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

Comment on lines +165 to +166
"main ──┬──▶ core/extra1/extra1",
"└──▶ core/root/root",
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

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

TestDepgraphRendersChainsFanoutAndHubs asserts a specific fanout ordering (expecting the first branch to be core/extra1/extra1 and the last to be core/root/root). The dependency list comes from ast-grep scan results and is not explicitly sorted before rendering, so the import/target order can vary across ast-grep versions/platforms, making this test potentially flaky. Consider making the assertions order-insensitive (e.g., assert that the fanout form is used and that all expected targets appear somewhere under main), or sort targets in the renderer if deterministic ordering is required.

Suggested change
"main ──┬──▶ core/extra1/extra1",
"└──▶ core/root/root",
"main ──┬──▶",
"core/extra1/extra1",
"core/root/root",

Copilot uses AI. Check for mistakes.
Comment on lines 51 to 55
total=$(go tool cover -func=coverage.out | awk '/^total:/ {gsub("%","",$3); print $3}')
# Current enforced coverage floor. Codex PRs raise this incrementally toward 90%.
min=45.0
min=50.0
awk -v t="$total" -v m="$min" 'BEGIN {
if (t+0 < m+0) {
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

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

CI coverage floor is raised to 50.0 here, but the coverage badge configuration later in this workflow still uses minColorRange: 45. If the intent is for the badge color scale to reflect the enforced floor, consider updating minColorRange to 50 to keep the workflow consistent.

Copilot uses AI. Check for mistakes.
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