Skip to content

chore: close test gaps and add release docs for v0.6.0 - #54

Merged
brucearctor merged 2 commits into
mainfrom
chore/pre-release-v0.6.0
Jul 27, 2026
Merged

chore: close test gaps and add release docs for v0.6.0#54
brucearctor merged 2 commits into
mainfrom
chore/pre-release-v0.6.0

Conversation

@brucearctor

@brucearctor brucearctor commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Pre-release hardening for v0.6.0. Addresses every E9-flagged gap.

Test Coverage: 73.8% → 77.0%

GitLab client (+14.6%)

Test Coverage Target
TestResolvePreviousReviews Resolve mode: filters by botMarker, resolves only bot discussions
TestResolveDiscussion_Success PUT with {"resolved":true}
TestListDiscussions_Pagination Link-header pagination across 2 pages
TestCreateDiscussion_MultiLine line_range with start/end refs
TestSubmitReview_MultiLineDraftNote Draft note line_range + suggestion:-N+0 offset
TestSubmitReview_SingleLineSuggestion Single-line suggestion:-0+0
TestGetDescription_Success GET MR description
TestSetDescription_Success PUT method + body verification
TestGetMRVersions_Success Version SHA mapping

GitHub client (+4.9%)

Test Coverage Target
TestGetDescription_Success GET PR body
TestSetDescription_Success PATCH method + body
TestSubmitReview_MultiLine start_line + line=EndLine contract
TestSubmitReview_SingleLine start_line omitted

Model (+3.7%)

Test Coverage Target
TestParseSummaryJSON Valid, fenced, malformed, prose-wrapped, missing fields, extra fields
TestValidateSummary Required field validation (title, classification, risk_level)

Config (+2.9%)

Test Coverage Target
TestLoadGitHubCIEnv Platform, project ID, MR IID from GITHUB_REF

Release Docs

  • CHANGELOG.md — Keep a Changelog format, v0.1 through v0.6.0
  • ROADMAP.md — Updated to v0.6.0, shipped features checked
  • .code-reviewer.example.yaml — Added missing config fields

Summary by CodeRabbit

  • Documentation

    • Added a structured changelog covering recent review, suggestion, cleanup, CLI, and security improvements.
    • Updated the roadmap to mark GitHub support and expanded review capabilities as complete.
    • Documented additional review-control defaults, including intent-focused reviews.
  • Quality Improvements

    • Expanded validation across GitHub and GitLab workflows, including descriptions, multiline comments, suggestions, draft notes, pagination, and discussion resolution.
    • Added coverage for GitHub Actions configuration and summary parsing.

Test coverage improvements (73.8% → 77.0%):
- GitLab: resolve mode (ResolvePreviousReviews, ListDiscussions,
  ResolveDiscussion), multi-line (line_range, suggestion offset),
  description update, MR versions, put() helper, pagination
- GitHub: multi-line (start_line), description update (PATCH),
  single-line suggestion contract
- Model: parseSummaryJSON (valid, malformed, fenced, prose-wrapped,
  missing fields), validateSummary edge cases
- Config: loadGitHubCIEnv (platform, project ID, MR IID from ref)

Release documentation:
- CHANGELOG.md (Keep a Changelog format, v0.1 through v0.6.0)
- ROADMAP.md updated to v0.6.0 with shipped features checked off
- .code-reviewer.example.yaml: added missing config fields
@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@brucearctor, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 14 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 73a24dfc-3c01-408a-acf9-0712269b9b28

📥 Commits

Reviewing files that changed from the base of the PR and between 1b6d053 and 6af4232.

📒 Files selected for processing (3)
  • internal/config/config_test.go
  • internal/github/client_test.go
  • internal/model/summarize_test.go
📝 Walkthrough

Walkthrough

The PR adds configuration and release documentation updates, GitHub CI and review-client tests, GitLab review-client coverage, and summary parsing and validation tests.

Changes

Review coverage and release documentation

Layer / File(s) Summary
Configuration and release documentation
.code-reviewer.example.yaml, CHANGELOG.md, ROADMAP.md
Documents review-control defaults, records released changes, and marks v0.6.0 roadmap items complete.
GitHub CI and review client tests
internal/config/config_test.go, internal/github/client_test.go
Tests GitHub Actions environment detection, description operations, and single-line or multi-line review comment serialization.
GitLab review client tests
internal/gitlab/client_test.go
Tests descriptions, MR versions, discussion resolution, pagination, multiline discussions, and draft-note suggestion formatting.
Summary parsing and validation tests
internal/model/summarize_test.go
Tests summary JSON parsing, required fields, malformed input, and validation errors.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is relevant but does not follow the required What/Why/How/Testing template or include the checklist items. Add the required What, Why, How, and Testing sections, and complete the checklist items for build, tests, lint, config fields, YAML, and README updates.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: closing test gaps and adding v0.6.0 release docs.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/pre-release-v0.6.0

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🧹 Nitpick comments (3)
internal/model/summarize_test.go (1)

9-13: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Assert the decoded values, not just validation side effects.

A successful parseSummaryJSON result already guarantees these fields are non-empty via validateSummary. A broken field mapping or fixed placeholder result would still pass. Add expected values per successful fixture and compare them.

Proposed test strengthening
 tests := []struct {
-    name    string
-    input   string
-    wantErr string
+    name               string
+    input              string
+    wantErr            string
+    wantTitle          string
+    wantClassification string
+    wantRiskLevel      string
 }{
     {
-        name:  "valid_json",
-        input: `...`,
+        name:               "valid_json",
+        input:              `...`,
+        wantTitle:          "Fix auth",
+        wantClassification: "fix",
+        wantRiskLevel:      "low",
     },
 }
 ...
- if res.Title == "" || res.Classification == "" || res.RiskLevel == "" {
-     t.Errorf("missing required fields in successful parse: %+v", res)
+ if res.Title != tt.wantTitle ||
+     res.Classification != tt.wantClassification ||
+     res.RiskLevel != tt.wantRiskLevel {
+     t.Errorf("unexpected result: %+v", res)
  }

Also applies to: 70-74

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/model/summarize_test.go` around lines 9 - 13, Strengthen the
successful parseSummaryJSON test cases by adding expected decoded field values
to each fixture and comparing the returned summary against them. Update the test
table and assertions in the parseSummaryJSON test so validation alone cannot
pass with incorrect field mappings or placeholder values; retain the existing
wantErr checks for failure cases.
internal/github/client_test.go (1)

850-854: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Assert request methods and paths in the HTTP handlers.

These handlers return successful responses without validating the endpoint. The tests could pass even if the client targets the wrong URL; add method and path assertions before decoding or responding.

Also applies to: 870-876, 897-903, 938-944

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/github/client_test.go` around lines 850 - 854, Update the HTTP
handlers in TestGetDescription_Success and the additionally affected test
handlers to assert the expected request method and URL path before writing or
decoding the response. Use each test’s intended endpoint, preserving the
existing response behavior after validation.
internal/gitlab/client_test.go (1)

1459-1552: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider collapsing these two near-duplicate draft-note tests into one table-driven test.

TestSubmitReview_MultiLineDraftNote and TestSubmitReview_SingleLineSuggestion share identical mock-server wiring (notes/draft_notes/bulk_publish handlers) and request shape; only the ReviewComment fields and the expected suggestion substring differ. As per path instructions, **/*_test.go files should "Prefer table-driven tests," and this pair is a natural candidate: a shared httptest handler factory plus a []struct{ comment vcs.ReviewComment; wantSubstrings []string } table would remove the duplicated switch-case boilerplate.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/gitlab/client_test.go` around lines 1459 - 1552, Collapse
TestSubmitReview_MultiLineDraftNote and TestSubmitReview_SingleLineSuggestion
into one table-driven test with shared httptest server setup and request
execution. Define cases containing the ReviewComment and expected suggestion
substring, reuse the common notes, draft_notes, and bulk_publish handler
behavior, and retain the existing line_range assertion for the multi-line case.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/config/config_test.go`:
- Around line 974-980: Update the test setup around Load() to clear the
competing CI_PROJECT_ID environment variable with t.Setenv("CI_PROJECT_ID", "")
before loading configuration, ensuring GitHub detection is selected regardless
of the runner environment. Keep the existing GitHub variables and assertions
unchanged, and preserve t.Setenv-based cleanup and race-safe test isolation.

In `@internal/github/client_test.go`:
- Line 858: Update the test function containing the GetDescription call and the
other client calls at the referenced locations to use a cancellable test context
instead of context.Background(). Create and manage the context with the test’s
cleanup lifecycle, then pass it to each client method so cancellation and
deadlines propagate through the HTTP requests.
- Around line 965-971: Add an assertion in the single-line comment test
alongside the existing Line and StartLine checks to verify that comment.Side
equals "RIGHT", preserving coverage of the expected single-line serialization
mapping.

In `@internal/model/summarize_test.go`:
- Line 8: Add Go doc comments immediately before TestParseSummaryJSON and
TestValidateSummary in internal/model/summarize_test.go, with each comment
beginning with its corresponding function name and briefly describing the test.
- Line 54: Update parseSummaryJSON to use the shared JSON extraction and parsing
strategy already used by parseReviewJSON instead of calling json.Unmarshal
directly, while preserving SummaryResult validation and the existing
clean/parse/validation sequence.

---

Nitpick comments:
In `@internal/github/client_test.go`:
- Around line 850-854: Update the HTTP handlers in TestGetDescription_Success
and the additionally affected test handlers to assert the expected request
method and URL path before writing or decoding the response. Use each test’s
intended endpoint, preserving the existing response behavior after validation.

In `@internal/gitlab/client_test.go`:
- Around line 1459-1552: Collapse TestSubmitReview_MultiLineDraftNote and
TestSubmitReview_SingleLineSuggestion into one table-driven test with shared
httptest server setup and request execution. Define cases containing the
ReviewComment and expected suggestion substring, reuse the common notes,
draft_notes, and bulk_publish handler behavior, and retain the existing
line_range assertion for the multi-line case.

In `@internal/model/summarize_test.go`:
- Around line 9-13: Strengthen the successful parseSummaryJSON test cases by
adding expected decoded field values to each fixture and comparing the returned
summary against them. Update the test table and assertions in the
parseSummaryJSON test so validation alone cannot pass with incorrect field
mappings or placeholder values; retain the existing wantErr checks for failure
cases.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: b7af2027-9782-43fd-870f-ff78076bc86f

📥 Commits

Reviewing files that changed from the base of the PR and between 8a8be00 and 1b6d053.

📒 Files selected for processing (7)
  • .code-reviewer.example.yaml
  • CHANGELOG.md
  • ROADMAP.md
  • internal/config/config_test.go
  • internal/github/client_test.go
  • internal/gitlab/client_test.go
  • internal/model/summarize_test.go

Comment thread internal/config/config_test.go
defer srv.Close()

client := NewClient(srv.URL, "token")
desc, err := client.GetDescription(context.Background(), "owner/repo", "1")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Use cancellable test contexts instead of context.Background().

All four client calls in this test function use a non-cancellable root context. Use a cancellable test context here so request cancellation and deadlines can propagate through the HTTP requests.

Also applies to: 883, 916, 957.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/github/client_test.go` at line 858, Update the test function
containing the GetDescription call and the other client calls at the referenced
locations to use a cancellable test context instead of context.Background().
Create and manage the context with the test’s cleanup lifecycle, then pass it to
each client method so cancellation and deadlines propagate through the HTTP
requests.

Comment thread internal/github/client_test.go
"testing"
)

func TestParseSummaryJSON(t *testing.T) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Add doc comments to exported test functions.

  • internal/model/summarize_test.go#L8-L8: add a TestParseSummaryJSON ... doc comment.
  • internal/model/summarize_test.go#L79-L79: add a TestValidateSummary ... doc comment.

As per coding guidelines, “All exported Go functions and types MUST have doc comments.”

📍 Affects 1 file
  • internal/model/summarize_test.go#L8-L8 (this comment)
  • internal/model/summarize_test.go#L79-L79
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/model/summarize_test.go` at line 8, Add Go doc comments immediately
before TestParseSummaryJSON and TestValidateSummary in
internal/model/summarize_test.go, with each comment beginning with its
corresponding function name and briefly describing the test.

Source: Coding guidelines


for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
res, err := parseSummaryJSON(tt.input)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Inspect the supported parser's signature and existing callers before migration.
ast-grep outline internal/model --items all --type function --match 'parseReviewJSON|parseSummaryJSON'
rg -n -C 4 '\bfunc\s+parseReviewJSON\b|\bparseReviewJSON\s*\(' internal/model

Repository: OpticDiff/code-reviewer

Length of output: 10984


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== files =="
git ls-files 'internal/model/*.go'

echo "== summarize.go relevant section =="
if [ -f internal/model/summarize.go ]; then
  nl -ba internal/model/summarize.go | sed -n '1,140p'
fi

echo "== provider.go parseReviewJSON implementation =="
nl -ba internal/model/provider.go | sed -n '145,215p'

echo "== direct json.Unmarshal calls in internal/model =="
rg -n -C 3 'json\.Unmarshal' internal/model || true

echo "== summary tests around parseSummaryJSON =="
nl -ba internal/model/summarize_test.go | sed -n '1,90p'

Repository: OpticDiff/code-reviewer

Length of output: 761


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== provider.go parseReviewJSON implementation =="
sed -n '145,215p' internal/model/provider.go

echo "== summarize.go summary parser implementation =="
sed -n '1,140p' internal/model/summarize.go

echo "== direct json.Unmarshal calls in internal/model =="
grep -Rn -C 3 'json\.Unmarshal' internal/model || true

echo "== summarize_test.go around parseSummaryJSON calls =="
sed -n '1,110p' internal/model/summarize_test.go

Repository: OpticDiff/code-reviewer

Length of output: 9155


Route summary model-output parsing through the shared JSON parser.

parseSummaryJSON() in internal/model/summarize.go:48-62 still uses raw json.Unmarshal() on model output. Move the JSON extraction/unmarshalling into a shared helper or reuse parseReviewJSON()’s strategy so SummaryResult parsing stays covered by the clean/parse/validation sequence.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/model/summarize_test.go` at line 54, Update parseSummaryJSON to use
the shared JSON extraction and parsing strategy already used by parseReviewJSON
instead of calling json.Unmarshal directly, while preserving SummaryResult
validation and the existing clean/parse/validation sequence.

Source: Coding guidelines

- Clear CI_PROJECT_ID in GitHub CI env test to prevent env leak
- Assert Side=RIGHT on single-line review comment test
- Strengthen parseSummaryJSON: assert decoded field values per fixture
@brucearctor
brucearctor merged commit e8680e2 into main Jul 27, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant