Repository navigation
fix(api): include view context in view responses - #637
Merged
Merged
Conversation
Motivation: ViewResponse never serialized the view's context, although it is stored in sprint_views.view_context and loaded by the repository. API clients such as the MCP get_view/list_views/update_view tools read `context` from the response and therefore print "Context: undefined" for every view. Approach: add a `context` field (sprint, backlog or timeline) to ViewResponse and populate it from SprintView.ViewContext in ViewFromEntity. No MCP change is needed since its View type already declares `context`. Not changed: UpdateViewRequest has no context field, so update_view still cannot change a view's context; this fix only makes the stored context visible on read-back. Validation: - go test ./internal/transport/http/... (services/api): passed - go build ./... and golangci-lint run on the dto package: clean - New TestViewFromEntity_Context fails to compile without the fix (ViewResponse has no Context field) and passes with it. - Not run: a live API + MCP end-to-end read-back. Report: #633 Signed-off-by: Pujitha Paladugu <[email protected]> Assisted-by: claude-sonnet-5-5 (via Claude Code)
Contributor
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
ViewResponsegains acontextfield —Context sprintdom.ViewContextwithjson:"context", populated fromv.ViewContextinViewFromEntity, so list/get/create/update/reorder responses all carry the interaction. Since every handler routes through that single constructor, the fix covers all read paths.TestViewFromEntity_Context— new test assertingsprint,backlog, andtimelineall map through. Verified locally:go test ./internal/transport/http/dto/,gofmt -l, andgo vetare all clean.
ℹ️ update_view still cannot change context, so #633 remains partially open
The change correctly fixes the read-back half of #633, but the issue's acceptance criterion 2 ("update_view persists the submitted context") is still unmet: MCP updateView sends context in the PATCH body, yet neither dto.UpdateViewRequest nor sprintdom.UpdateViewInput has a context field, so it is silently ignored and the call still reports success. Merging this will auto-close #633 while that expectation is unresolved — consider linking it as "Part of #633" or filing a follow-up rather than "Fixes".
Technical details
# update_view silently drops context
## Affected sites
- `apps/mcp/src/tools/view-tools.ts` — `update_view` schema advertises `context`, and `handleViewTool` passes it in `UpdateViewInput`; `apps/mcp/src/api/views-client.ts:159` PATCHes it in the body.
- `services/api/internal/transport/http/dto/view_dto.go:22` — `UpdateViewRequest` has no `Context` field.
- `services/api/internal/domain/sprint/service.go:137` — `UpdateViewInput` has no context field, so the service cannot apply one even if the DTO carried it.
## Required outcome
Either `update_view` persists a submitted `context` (plumb it through `UpdateViewRequest` → `UpdateViewInput` → `UpdateViewAtomic`, validating against `ValidViewContexts`), or the MCP tool stops advertising a field the API ignores. Whichever way, the read-back this PR adds then reliably reflects the stored value.
## Open questions for the human
- Is changing a view's context in place a supported operation (it can imply a sprint ↔ backlog/timeline move), or should the field be dropped from `update_view`?deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
pikann
approved these changes
Oct 25, 2026
pikann
left a comment
Contributor
There was a problem hiding this comment.
LGTM! Thank you for the contribution! 🚀
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
ViewResponsedid not include the view's context, so MCPget_view/list_views/update_viewprintedContext: undefined. This adds acontextfield (sprint/backlog/timeline) to the API response, populated from the storedview_context.update_viewstill cannot change the context (the API update request has no such field); this only fixes read-back. A unit test covers all three contexts; it fails to compile without the fix and passes with it. A live API + MCP end-to-end run was not done.Type of Change
Checklist
Fixes #633