test: cover goal habit ID forwarding for ORB-252 - #475
Conversation
|
Approach:
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. |
There was a problem hiding this comment.
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_ReturnsCreateddoes not supply or assertHabitIds.
⚠️ 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.GPT Sol | 𝕏
There was a problem hiding this comment.
✅ 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
HabitIdsunchanged.
GPT Sol | 𝕏
|




Summary
Adds a focused controller regression test that supplies known habit IDs, captures the
CreateGoalCommandsent through MediatR, and asserts the forwarded IDs have the same values and order.Preserves the existing request-without-
HabitIdstest so the optional field path remains covered.Why
ORB-213 added
HabitIdsto 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 passeddotnet build Orbit.slnx --no-restore: succeeded with 0 errorsdotnet test: 5,730 passedTicket
ORB-252