Repository navigation
feat: add POST /agent/refresh so an agent can make a new repository visible - #202
Conversation
…isible A repository created after the app started only appears after a refresh, which only the dashboard button could queue. The endpoint queues the same RefreshAll work under the same dedup key, so it folds with a pending button press, and records the queue origin as agent-api. A refresh already running does not fold the request, because it may have listed the organisation before the repository existed.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 11 |
| Duplication | 0 |
🟢 Coverage 31.58% diff coverage · -0.03% coverage variation
Metric Results Coverage variation ✅ -0.03% coverage variation (-1.00%) Diff coverage ✅ 31.58% diff coverage Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (15455f7) 22624 14382 63.57% Head commit (051487d) 22643 (+19) 14388 (+6) 63.54% (-0.03%) Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#202) 19 6 31.58% Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%
AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.
TIP This summary will be updated as you push new changes.
There was a problem hiding this comment.
Pull Request Overview
✅ No blocking issues noticed
No blocking security or logic findings were identified. The endpoint implementation remains insufficiently covered: the complex production service has low overall coverage, and route-level HTTP behavior and queue attribution are not exercised. One required endpoint test scenario is missing.
Test suggestions
- First refresh request queues RefreshAll with the expected descriptor and deduplication key.
- Second request while a refresh is pending is deduplicated.
- Request while a refresh is running queues a distinct follow-up refresh.
- HTTP endpoint attributes queued work to agent-api and returns the expected response.
- Verify the endpoint response for both newly queued and deduplicated requests.
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. HTTP endpoint attributes queued work to agent-api and returns the expected response.
2. Verify the endpoint response for both newly queued and deduplicated requests.
TIP Add a Jira or Linear ticket key to the branch or title so the reviewer can check the PR against it. Using another tracker? Tell us.
TIP How was this review? Give us feedback
| group.MapPost("/refresh", (WorkLaneService lanes) => | ||
| { | ||
| using var origin = Governance.QueueOrigin.Use("agent-api"); | ||
|
|
||
| var item = EnqueueRefresh(lanes); | ||
|
|
||
| return Results.Json(new | ||
| { | ||
| queued = item is null ? 0 : 1, | ||
| id = item?.Id, | ||
| note = item is null ? "A refresh is already waiting its turn and will pick up what exists now." : null | ||
| }); | ||
| }); |
There was a problem hiding this comment.
🟡 MEDIUM RISK
Suggestion: Add an endpoint-level test for POST /agent/refresh covering a first request that returns a queued work ID, a deduplicated pending request that returns the explanatory note, and verification that the queued work is attributed to agent-api.
TIP React 👍 if this review is right, or reply with what's wrong and how it could be better to help improve the reviewer.
A repository created after the app started only becomes visible through a refresh, and only the dashboard button could queue one. The agent API now has POST /agent/refresh.