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:
Steve Yegge
2025-11-04 17:48:33 -08:00
parent 6ab6f82c6e
commit cac9ae6647
9 changed files with 554 additions and 9 deletions

View File

@@ -537,3 +537,56 @@ func TestDatabaseHandshake(t *testing.T) {
t.Errorf("Create without ExpectedDB should succeed (backward compat): %v", err)
}
}
func TestCreate_DiscoveredFromInheritsSourceRepo(t *testing.T) {
_, client, cleanup := setupTestServer(t)
defer cleanup()
// Create a parent issue
parentArgs := &CreateArgs{
Title: "Parent issue",
IssueType: "task",
Priority: 1,
}
parentResp, err := client.Create(parentArgs)
if err != nil {
t.Fatalf("Failed to create parent: %v", err)
}
var parentIssue types.Issue
if err := json.Unmarshal(parentResp.Data, &parentIssue); err != nil {
t.Fatalf("Failed to unmarshal parent: %v", err)
}
// Create discovered issue with discovered-from dependency
// The logic in handleCreate should check for discovered-from dependencies
// and inherit the parent's source_repo
discoveredArgs := &CreateArgs{
Title: "Discovered bug",
IssueType: "bug",
Priority: 1,
Dependencies: []string{"discovered-from:" + parentIssue.ID},
}
discoveredResp, err := client.Create(discoveredArgs)
if err != nil {
t.Fatalf("Failed to create discovered issue: %v", err)
}
var discoveredIssue types.Issue
if err := json.Unmarshal(discoveredResp.Data, &discoveredIssue); err != nil {
t.Fatalf("Failed to unmarshal discovered issue: %v", err)
}
// Verify the issue was created successfully
if discoveredIssue.Title != "Discovered bug" {
t.Errorf("Expected title 'Discovered bug', got %s", discoveredIssue.Title)
}
// Note: To fully test source_repo inheritance, we'd need to:
// 1. Create a parent with custom source_repo (requires direct storage access)
// 2. Verify the discovered issue inherited it
// The logic is implemented in server_issues_epics.go handleCreate
// and tested via the cmd/bd test which has direct storage access
}