Load pull workspaces through one authorized snapshot #1350

Closed
opened 2026-08-24 13:07:03 +00:00 by timmy · 0 comments
Owner

User problem

Opening an authored or assigned pull currently repeats identity and pull lookups before loading its conversation or review data. On a mobile connection this adds sequential upstream phases, consumes the bounded Gitea read pool, and increases transient 503 risk.

Scope

  • Resolve the current user and canonical pull once per workspace request.
  • Compute authored/assigned capabilities from that snapshot.
  • Reuse the authorized pull when assembling detail and review payloads.
  • Fetch no conversation, diff, checks, or reviews before authorization succeeds.
  • Preserve existing API response shapes and lazy feedback behavior.

Acceptance tests

  • Authored-unassigned and assigned detail each perform exactly one /user, one /pulls/{n}, and one comments request.
  • Unauthorized detail returns 404 after identity and pull lookup and never requests protected resources.
  • Existing authored and assigned workspace behavior remains unchanged.
  • Focused tests and the full suite pass.

Evidence / non-duplication

Current main performs an assigned lookup, falls back to another capability lookup for authored pulls, then refetches the pull in pull_completion_detail. Complete historical issue and PR title review found no single-pass authorization-snapshot work. This follows #1348 (workspace access) by improving the resulting real user flow rather than repeating it.

## User problem Opening an authored or assigned pull currently repeats identity and pull lookups before loading its conversation or review data. On a mobile connection this adds sequential upstream phases, consumes the bounded Gitea read pool, and increases transient 503 risk. ## Scope - Resolve the current user and canonical pull once per workspace request. - Compute authored/assigned capabilities from that snapshot. - Reuse the authorized pull when assembling detail and review payloads. - Fetch no conversation, diff, checks, or reviews before authorization succeeds. - Preserve existing API response shapes and lazy feedback behavior. ## Acceptance tests - Authored-unassigned and assigned detail each perform exactly one `/user`, one `/pulls/{n}`, and one comments request. - Unauthorized detail returns 404 after identity and pull lookup and never requests protected resources. - Existing authored and assigned workspace behavior remains unchanged. - Focused tests and the full suite pass. ## Evidence / non-duplication Current `main` performs an assigned lookup, falls back to another capability lookup for authored pulls, then refetches the pull in `pull_completion_detail`. Complete historical issue and PR title review found no single-pass authorization-snapshot work. This follows #1348 (workspace access) by improving the resulting real user flow rather than repeating it.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: stackchain/stackchain-dashboard#1350
No description provided.