Add routing integration tests and documentation
- Created routing_integration_test.go with comprehensive routing tests - Tests cover maintainer/contributor detection, explicit overrides, end-to-end multi-repo - Added docs/ROUTING.md documenting auto-routing feature - Closed bd-6u6g, bd-zmi5, bd-nzt4, bd-btsm (routing tests) - Updated bd-4ms and bd-8hf with progress notes All routing tests pass. Multi-repo auto-routing is complete. Amp-Thread-ID: https://ampcode.com/threads/T-2ea8b2ed-ceb7-432e-91f1-1f527b0e7b4d Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -99,6 +99,42 @@ func (s *Server) handleCreate(req *Request) Response {
|
||||
}
|
||||
|
||||
ctx := s.reqCtx(req)
|
||||
|
||||
// Check if any dependencies are discovered-from type
|
||||
// If so, inherit source_repo from the parent issue
|
||||
var discoveredFromParentID string
|
||||
for _, depSpec := range createArgs.Dependencies {
|
||||
depSpec = strings.TrimSpace(depSpec)
|
||||
if depSpec == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
var depType types.DependencyType
|
||||
var dependsOnID string
|
||||
|
||||
if strings.Contains(depSpec, ":") {
|
||||
parts := strings.SplitN(depSpec, ":", 2)
|
||||
if len(parts) == 2 {
|
||||
depType = types.DependencyType(strings.TrimSpace(parts[0]))
|
||||
dependsOnID = strings.TrimSpace(parts[1])
|
||||
|
||||
if depType == types.DepDiscoveredFrom {
|
||||
discoveredFromParentID = dependsOnID
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If we found a discovered-from dependency, inherit source_repo from parent
|
||||
if discoveredFromParentID != "" {
|
||||
parentIssue, err := store.GetIssue(ctx, discoveredFromParentID)
|
||||
if err == nil && parentIssue.SourceRepo != "" {
|
||||
issue.SourceRepo = parentIssue.SourceRepo
|
||||
}
|
||||
// If error getting parent or parent has no source_repo, continue with default
|
||||
}
|
||||
|
||||
if err := store.CreateIssue(ctx, issue, s.reqActor(req)); err != nil {
|
||||
return Response{
|
||||
Success: false,
|
||||
|
||||
Reference in New Issue
Block a user