MCPcopy Create free account
hub / github.com/github/gh-aw / ResolvePullRequest

Method ResolvePullRequest

pkg/intent/resolver.go:70–97  ·  view source on GitHub ↗
(pr PullRequestData)

Source from the content-addressed store, hash-verified

68}
69
70func (r Resolver) ResolvePullRequest(pr PullRequestData) IntentRecord {
71 resolverLog.Printf("ResolvePullRequest: nodeID=%s explicitIntent=%t closingIssues=%d labels=%d", pr.NodeID, pr.ExplicitIntent != nil, len(pr.ClosingIssues), len(pr.Labels))
72
73 if pr.ExplicitIntent != nil {
74 intent := *pr.ExplicitIntent
75 if intent.ResolverVersion == "" {
76 intent.ResolverVersion = r.ResolverVersion
77 }
78 resolverLog.Printf("ResolvePullRequest: using explicit metadata for %s", pr.NodeID)
79 return intent
80 }
81
82 switch len(pr.ClosingIssues) {
83 case 1:
84 resolverLog.Printf("ResolvePullRequest: attributing %s to single closing issue", pr.NodeID)
85 return r.fromRoot(pr.ClosingIssues[0], SourceClosingIssue, "single_closing_issue")
86 case 0:
87 if len(pr.Labels) > 0 {
88 resolverLog.Printf("ResolvePullRequest: no closing issue, falling back to %d PR label(s) for %s", len(pr.Labels), pr.NodeID)
89 return r.fromLabels(pr.NodeID, pr.URL, pr.Labels, SourceArtifactLabels, "pull_request_label_fallback")
90 }
91 resolverLog.Printf("ResolvePullRequest: no intent source for %s, marking unlinked", pr.NodeID)
92 return r.unlinked("no_supported_intent_source")
93 default:
94 resolverLog.Printf("ResolvePullRequest: %d closing issues for %s, marking ambiguous", len(pr.ClosingIssues), pr.NodeID)
95 return r.ambiguous(SourceClosingIssue, "multiple_closing_issues")
96 }
97}
98
99func (r Resolver) ResolveIssue(nodeID, url string, labels []string) IntentRecord {
100 resolverLog.Printf("ResolveIssue: nodeID=%s labels=%d", nodeID, len(labels))

Calls 5

fromRootMethod · 0.95
fromLabelsMethod · 0.95
unlinkedMethod · 0.95
ambiguousMethod · 0.95
PrintfMethod · 0.45