@@ -45,7 +45,13 @@ import {
4545import type { ChaContext } from '../cha.js' ;
4646import { buildChaContext , resolveChaTargets , resolveThisDispatch } from '../cha.js' ;
4747import type { PipelineContext } from '../context.js' ;
48- import { BUILTIN_RECEIVERS , batchInsertEdges , runChaPostPass } from '../helpers.js' ;
48+ import {
49+ BUILTIN_RECEIVERS ,
50+ batchInsertEdges ,
51+ CHA_DISPATCH_PENALTY ,
52+ CHA_TYPED_DISPATCH_CONFIDENCE ,
53+ runChaPostPass ,
54+ } from '../helpers.js' ;
4955import { getResolved , isBarrelFile , resolveBarrelExportCached } from './resolve-imports.js' ;
5056
5157// ── Local types ──────────────────────────────────────────────────────────
@@ -101,9 +107,6 @@ interface NativeEdge {
101107 dynamic : number ;
102108}
103109
104- /** Phase 8.5: confidence penalty applied to CHA-dispatch edges. */
105- export const CHA_DISPATCH_PENALTY = 0.1 ;
106-
107110// ── Node lookup setup ───────────────────────────────────────────────────
108111
109112function makeGetNodeIdStmt ( db : BetterSqlite3Database ) : NodeIdStmt {
@@ -735,13 +738,12 @@ function buildChaPostPass(
735738 for ( const t of chaTargets ) {
736739 const edgeKey = `${ caller . id } |${ t . id } ` ;
737740 if ( t . id !== caller . id && ! seenByPair . has ( edgeKey ) ) {
738- // Typed-receiver (interface/CHA) dispatch: use the same hardcoded 0.8 that
739- // runChaPostPass (helpers.ts) and runPostNativeCha (native-orchestrator.ts)
740- // use — file proximity is not meaningful for virtual dispatch confidence.
741+ // Typed-receiver (interface/CHA) dispatch: use CHA_TYPED_DISPATCH_CONFIDENCE
742+ // — file proximity is not meaningful for virtual dispatch confidence.
741743 // this/super dispatch keeps computeConfidence-based proximity scoring to
742744 // match runPostNativeThisDispatch (native-orchestrator.ts).
743745 const conf = isTypedReceiverDispatch
744- ? 0.8
746+ ? CHA_TYPED_DISPATCH_CONFIDENCE
745747 : computeConfidence ( relPath , t . file , null ) - CHA_DISPATCH_PENALTY ;
746748 if ( conf > 0 ) {
747749 seenByPair . add ( edgeKey ) ;
@@ -1327,13 +1329,12 @@ function buildFileCallEdges(
13271329 for ( const t of chaTargets ) {
13281330 const edgeKey = `${ caller . id } |${ t . id } ` ;
13291331 if ( t . id !== caller . id && ! seenCallEdges . has ( edgeKey ) && ! ptsEdgeRows . has ( edgeKey ) ) {
1330- // Typed-receiver (interface/CHA) dispatch: use the same hardcoded 0.8 that
1331- // runChaPostPass (helpers.ts) and runPostNativeCha (native-orchestrator.ts)
1332- // use — file proximity is not meaningful for virtual dispatch confidence.
1332+ // Typed-receiver (interface/CHA) dispatch: use CHA_TYPED_DISPATCH_CONFIDENCE
1333+ // — file proximity is not meaningful for virtual dispatch confidence.
13331334 // this/super dispatch keeps computeConfidence-based proximity scoring to
1334- // match runPostNativeThisDispatch (native-orchestrator.ts line 906 ).
1335+ // match runPostNativeThisDispatch (native-orchestrator.ts).
13351336 const conf = isTypedReceiverDispatch
1336- ? 0.8
1337+ ? CHA_TYPED_DISPATCH_CONFIDENCE
13371338 : computeConfidence ( relPath , t . file , null ) - CHA_DISPATCH_PENALTY ;
13381339 if ( conf > 0 ) {
13391340 seenCallEdges . add ( edgeKey ) ;
0 commit comments