Skip to content

refactor: centralize tracked item projection#226

Draft
mariusvniekerk wants to merge 2 commits intomainfrom
architecture-item-projection
Draft

refactor: centralize tracked item projection#226
mariusvniekerk wants to merge 2 commits intomainfrom
architecture-item-projection

Conversation

@mariusvniekerk
Copy link
Copy Markdown
Collaborator

  • Move PR and issue response assembly into a tracked item projection module.
  • Keep repo decoration, UTC detail timestamps, detail-loaded flags, empty slices, worktree links, and workspace refs in one place.
  • This makes handlers simpler because they fetch rows and pass them through one projection seam instead of rebuilding response rules inline.
  • The new projection tests make API-shape invariants easier to verify without duplicating assertions across every route.

Validation:

  • go test ./internal/server -run 'TestProject|TestAPIGetPull|TestAPIListPulls|TestAPIGetIssue|TestAPIListIssues|TestAPISyncPR|TestAPISyncIssue' -shuffle=on\n- git diff --check

PR and issue handlers were each rebuilding the same response rules: repo decoration, detail-loaded flags, UTC detail timestamps, empty timeline slices, worktree links, and workspace refs. Moving those rules behind a tracked item projection module gives the API layer one place to preserve ADR 0001 timestamp behavior and makes handler call sites smaller and more uniform.

The result is a deeper module seam: handlers fetch domain rows and pass them to projection helpers, while tests can exercise response-shape invariants directly without walking every route path.

Verified with: go test ./internal/server -run 'TestProject|TestAPIGetPull|TestAPIListPulls|TestAPIGetIssue|TestAPIListIssues|TestAPISyncPR|TestAPISyncIssue' -shuffle=on; git diff --check

Co-authored-by: OpenAI Codex <noreply@openai.com>
@roborev-ci
Copy link
Copy Markdown

roborev-ci Bot commented May 1, 2026

roborev: Combined Review (6fb970f)

Medium-risk test gap in core API response coverage; no security findings.

Medium

  • internal/server/huma_routes.go:659 - Shared PR/issue API response projection is now used across list, detail, sync, and create paths, but coverage appears limited to projection-unit tests. Without full handler/API coverage over real SQLite reads and HTTP response shapes, regressions in maintainer-facing PR and issue views could ship even if helper tests pass.
    • Fix: Add full-stack API/e2e tests for representative PR and issue list/detail responses, including detail timestamps, empty event/link slices, repo decoration, and workspace/worktree link projection where applicable.

Synthesized from 3 reviews (agents: codex, gemini | types: default, security)

Roborev flagged that the projection helper was covered mostly at the unit boundary even though list/detail handlers now depend on it. Add generated-client API tests over the real SQLite test server for PR and issue response shapes, including repo decoration, UTC detail timestamps, empty event/link slices, worktree links, and workspace refs.

Validation: go test ./internal/server -run 'TestAPI(PullListAndDetailProjectSharedResponseShape|IssueListAndDetailProjectSharedResponseShape)$' -shuffle=on; git diff --check.

Co-authored-by: OpenAI Codex <noreply@openai.com>
@roborev-ci
Copy link
Copy Markdown

roborev-ci Bot commented May 1, 2026

roborev: Combined Review (1b00a07)

Clean review: no Medium, High, or Critical findings were reported by any reviewer.


Synthesized from 3 reviews (agents: codex, gemini | types: default, security)

@mariusvniekerk mariusvniekerk marked this pull request as draft May 1, 2026 23:51
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