Skip to content

fix(api): include view context in view responses - #637

Merged
pikann merged 1 commit into
Paca-AI:masterfrom
pujitha24:auto/issue-633
Oct 25, 2026
Merged

pikann merged 1 commit into
Paca-AI:masterfrom
pujitha24:auto/issue-633

Conversation

@pujitha24

Copy link
Copy Markdown
Contributor

Summary

ViewResponse did not include the view's context, so MCP get_view/list_views/update_view printed Context: undefined. This adds a context field (sprint/backlog/timeline) to the API response, populated from the stored view_context. update_view still 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

  • Other (bug fix)

Checklist

  • The change is focused and scoped.
  • Related documentation is updated. (No docs changed; the example JSON in http-design.md already omits other fields.)
  • New structure or direction is explained clearly.
  • I avoided unnecessary detail or premature abstraction.

Fixes #633

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)

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

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

  • ViewResponse gains a context field — Context sprintdom.ViewContext with json:"context", populated from v.ViewContext in ViewFromEntity, 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 asserting sprint, backlog, and timeline all map through. Verified locally: go test ./internal/transport/http/dto/, gofmt -l, and go vet are 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`?

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@pikann pikann left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you for the contribution! 🚀

@pikann
pikann merged commit 715c379 into Paca-AI:master Oct 25, 2026
6 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.

[Bug] view context is accepted but returned as undefined by get_view and list_views

2 participants