fix(group): tidy thrift source-scan identifiers

This commit is contained in:
liyipeng06 2026-04-30 19:34:47 +08:00
parent 476af9b152
commit e81546db29
4 changed files with 10 additions and 3 deletions

View file

@ -228,7 +228,10 @@ export class ManifestExtractor {
} else if (link.type === 'grpc' || link.type === 'thrift') {
// Contract is "Service/Method" or just "Service" (or package.Service
// variants). Prefer matching by method name when present, otherwise
// by service name. NO IDL path fallback — that's guaranteed to
// by service name. Thrift generated Java classes often use
// package.Service in manifests while graph Class/Interface names are
// stored as bare Service, so strip the package prefix for thrift
// service-name lookups. NO IDL path fallback — that's guaranteed to
// return a wrong symbol in any repo with more than one IDL file.
// Label filters scope lookups: methods → Function|Method, services
// → Class|Interface (no label match = no silent wrong hits on

View file

@ -184,7 +184,10 @@ function thriftSourceScanSymbolUid(
filePath: string,
symbolName: string,
): string {
return ['source-scan::thrift', role, contractId, normalizeThriftPath(filePath), symbolName].join(
const contractKey = contractId.startsWith('thrift::')
? contractId.slice('thrift::'.length)
: contractId;
return ['source-scan::thrift', role, contractKey, normalizeThriftPath(filePath), symbolName].join(
'::',
);
}

View file

@ -448,7 +448,7 @@ class IfaceOrderHandler implements OrderService.Iface {
symbolUid: [
'source-scan::thrift',
'consumer',
'thrift::OrderService/PlaceOrder',
'OrderService/PlaceOrder',
'src/BillingWorkflow.java',
'orderService.PlaceOrder',
].join('::'),

View file

@ -488,6 +488,7 @@ class IfaceOrderHandler implements OrderService.Iface {
expect(providers.map((c) => c.symbolUid)).toEqual(repeatedProviders.map((c) => c.symbolUid));
expect(providers.every((c) => c.symbolUid.length > 0)).toBe(true);
expect(new Set(providers.map((c) => c.symbolUid)).size).toBe(2);
expect(providers.every((c) => !c.symbolUid.includes('::thrift::billing.v1'))).toBe(true);
});
it('test_extract_java_thrift_providers_from_fully_qualified_generated_iface', async () => {