Skip to content

test: cover goal habit ID forwarding for ORB-252 - #475

Merged
thomasluizon merged 3 commits into
mainfrom
feature/orb-252-goals-habitids-test
Aug 13, 2026
Merged

test: cover goal habit ID forwarding for ORB-252#475
thomasluizon merged 3 commits into
mainfrom
feature/orb-252-goals-habitids-test

Conversation

@thomasluizon

@thomasluizon thomasluizon commented Aug 13, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a focused controller regression test that supplies known habit IDs, captures the CreateGoalCommand sent through MediatR, and asserts the forwarded IDs have the same values and order.

Preserves the existing request-without-HabitIds test so the optional field path remains covered.

Why

ORB-213 added HabitIds to the request and command mapping, but the controller suite only checked the created response. That left the boundary vulnerable to silently dropping the field while all existing tests remained green.

The test is placed at the controller boundary because that is where the mapping can regress. Handler coverage would not isolate a dropped request field, and no production change is needed.

Interpretation

The ticket asks for the exact IDs to be forwarded. This change treats exact as the same values in the same order, rather than set equality.

Impact

Test coverage only. Production behavior and contracts are unchanged.

Validation

  • dotnet test tests/Orbit.Infrastructure.Tests --filter "FullyQualifiedName~Orbit.Infrastructure.Tests.Controllers.GoalsControllerTests": 35 passed
  • dotnet build Orbit.slnx --no-restore: succeeded with 0 errors
  • dotnet test: 5,730 passed

Ticket

ORB-252

@thomasluizon

Copy link
Copy Markdown
Owner Author

Approach:

  1. Extend tests/Orbit.Infrastructure.Tests/Controllers/GoalsControllerTests.cs with a focused CreateGoal case that supplies known habit IDs.
  2. Capture the CreateGoalCommand sent through MediatR and assert the IDs exactly, including order and values.
  3. Preserve the existing absent-field regression, then run the focused controller tests, commit immediately, run the repository build and full test suite, and push.

This belongs at the controller boundary because the defect risk is the request-to-command mapping. A handler or integration test would exercise later layers without isolating a dropped controller field, while production changes are outside ORB-252.

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

Important

This pull request has no file changes, so it does not add the ORB-252 regression coverage described in its title and body.

Reviewed changes Reviewed the sole commit and the current controller regression coverage.

  • Empty scaffold The only commit has zero changed files.
  • Existing coverage CreateGoal_Success_ReturnsCreated does not supply or assert HabitIds.

⚠️ Regression coverage is absent

The PR can be merged without adding any test, leaving the forwarding path unprotected. Its current state cannot catch removal or corruption of request.HabitIds when constructing CreateGoalCommand.

Technical details
# Add the stated goal habit ID forwarding regression test

## Affected sites
- `tests/Orbit.Infrastructure.Tests/Controllers/GoalsControllerTests.cs:95` Existing coverage accepts any `CreateGoalCommand`, sends no habit IDs, and only checks the HTTP result.
- `src/Orbit.Api/Controllers/GoalsController.cs:60` This forwarding seam is the behavior the absent test is intended to pin.

## Required outcome
- Add a controller unit test that supplies distinct habit IDs and verifies that the exact sequence reaches the dispatched `CreateGoalCommand`.
- Ensure the assertion fails if `HabitIds` is omitted, replaced, or reordered.

Pullfrog  | Fix it ➔View workflow run | Using GPT Sol𝕏

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

✅ No new issues found.

Reviewed changes Reviewed the controller regression coverage added since the prior Pullfrog review.

  • Added exact forwarding coverage Supplied two distinct habit IDs, captured the dispatched CreateGoalCommand, and asserted value and order preservation.
  • Preserved optional-field coverage Kept the existing successful request without HabitIds unchanged.

Pullfrog  | View workflow run | Using GPT Sol𝕏

@thomasluizon
thomasluizon merged commit ca59b27 into main Aug 13, 2026
19 checks passed
@thomasluizon
thomasluizon deleted the feature/orb-252-goals-habitids-test branch August 13, 2026 21:28
@sonarqubecloud

Copy link
Copy Markdown

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