Skip to content

chore(sonar): hoist constant array in reschedule test (CA1861) (#243)#402

Merged
thomasluizon merged 1 commit into
mainfrom
chore/api-ca1861-reschedule-test
Jul 14, 2026
Merged

chore(sonar): hoist constant array in reschedule test (CA1861) (#243)#402
thomasluizon merged 1 commit into
mainfrom
chore/api-ca1861-reschedule-test

Conversation

@thomasluizon

Copy link
Copy Markdown
Owner

Clears the last CA1861 code smell (introduced by #398's tests). Refs thomasluizon/orbit-ui-mobile#243

Clears the last CA1861 code smell (external_roslyn:CA1861, introduced by
#398's coverage tests): hoists the constant `{ "Monday", "Tuesday" }` array
literal passed as the reschedule payload's `days` argument into a
descriptively-named `private static readonly string[]` field, matching the
#387/#397 pattern. Behavior-preserving: same values, order, and element type;
full suite green.

Refs thomasluizon/orbit-ui-mobile#243

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@claude claude 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.

Code Review: PR #402

Scope: PR #402 in thomasluizon/orbit-api (chore(sonar): hoist constant array in reschedule test (CA1861) (#243))
Recommendation: APPROVE

Summary

Single-file, test-only chore: hoists the inline new[] { "Monday", "Tuesday" } array literal in AiRescheduleSuggestionServiceGenerationTests.GenerateAsync_ValidPayload_ReturnsClampedSuggestion into a private static readonly string[] SuggestedDayNames field, matching the existing UserId/Today static-field pattern already used in the same class. This clears a Sonar CA1861 ("prefer static readonly over inline array") smell with zero behavioral change — the serialized JSON payload and the test's assertions are unchanged.

Findings

Critical

None.

High

None.

Medium

None.

Low / Info

None — nothing worth surfacing under the rubric's signal gate for a mechanical, zero-behavior-change hoist.

Subagents

Agent Verdict
security-reviewer N/A — diff touches only tests/, no src/ code changed
contract-aligner N/A — no DTO, Controller route, or packages/shared surface touched

Validation

Check Result
Build (dotnet) N/A — skipped per CI adaptation; Build runs as a separate required check
Tests (dotnet) N/A — skipped per CI adaptation; Unit Tests runs as a separate required check

Deferred — N/A dimensions & files not verdicted

  • Dimension 8 (DESIGN.md/AI-slop) — N/A, no apps/* UI files in diff.
  • Dimension 9 (Parity) — N/A, frontend-only dimension; no apps/** files in diff.
  • Dimension 10 (i18n) — N/A, frontend-only dimension; no user-facing strings in diff.
  • Dimension 11 (Contract drift) — N/A, no DTO/schema files in diff; not verifiable in CI (sibling orbit-ui-mobile repo not checked out) but moot since nothing in that surface changed.
  • Dimension 14 (FEATURES.md parity) — N/A, pure test refactor with no user-facing behavior change.
  • All other dimensions (1-7, 12, 13) were checked against the one changed file, tests/Orbit.Infrastructure.Tests/Services/AiRescheduleSuggestionServiceGenerationTests.cs, and verdicted clean.
  • Every changed file in the diff (1 of 1) received a verdict — nothing deferred there.

What's good

  • Matches the existing static-readonly-field convention already used for UserId and Today in the same test class, rather than inventing a new pattern.
  • Minimal, single-purpose diff scoped exactly to the Sonar finding it's fixing — no scope creep.

Recommendation

Safe to merge as-is. No action required.

@sonarqubecloud

Copy link
Copy Markdown

@thomasluizon
thomasluizon merged commit d23c750 into main Jul 14, 2026
19 checks passed
@thomasluizon
thomasluizon deleted the chore/api-ca1861-reschedule-test branch July 14, 2026 15:25
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