Skip to content

Conversation

@water-sucks
Copy link
Collaborator

@water-sucks water-sucks commented Nov 26, 2025

There were some sporadic failures in GitHub Actions when testing some completion code due to frequent iteration over maps that resulted in an undefined order for the resulting completion candidate slices.

This sorts the completion candidate output and modifies the affected test cases to guarantee testing stability in this regard.

Summary by CodeRabbit

  • Tests
    • Improved consistency of completion test validations by standardizing comparison logic.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Nov 26, 2025

Walkthrough

Test file updated to import the slices package and reorder expected completion results. Actual completions are now sorted before comparison to align with new ordering expectations.

Changes

Cohort / File(s) Summary
Test completion expectations
internal/settings/completion_test.go
Added slices package import; reordered expected completion lists for "option.", "apply.use_", and "color=" test cases; introduced sorting of actual completions via slices.Sort before comparison

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Verify the new completion order expectations are correct
  • Confirm the slices.Sort call is applied consistently across all relevant test assertions

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(completion): sort test cases' directly and clearly describes the main change: fixing completion by sorting test cases to address non-deterministic test failures from map iteration order.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between efc9493 and 932137e.

📒 Files selected for processing (1)
  • internal/settings/completion_test.go (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build/Test
🔇 Additional comments (3)
internal/settings/completion_test.go (3)

33-33: LGTM! Expected test values are correctly sorted.

The expected completion arrays have been properly updated to alphabetical order, matching the sorted actual results. This ensures deterministic test comparisons.

Also applies to: 35-35, 42-42


56-57: LGTM! Sorting logic correctly addresses non-deterministic ordering.

The addition of slices.Sort(actual) properly normalizes the completion results before comparison, effectively resolving the sporadic test failures caused by undefined map iteration order.


4-4: Verify Go version compatibility with the slices package.

The slices package was introduced in Go 1.21. Please ensure that the project's go.mod specifies Go 1.21 or later to avoid compatibility issues when this code is built.


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 and usage tips.

@water-sucks water-sucks merged commit a49b9aa into nix-community:main Nov 26, 2025
2 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