mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-11-09 20:07:43 +08:00
refactor(docs): drop unused bail event graph support
This commit is contained in:
@@ -27,8 +27,7 @@ const FIXTURE: Record<string, string> = {
|
||||
},
|
||||
include: ['vendor/**/*.ts', 'packages/**/*.ts'],
|
||||
}),
|
||||
'vendor/cordis/src/context.ts':
|
||||
'export class Context { private brand!: void; bail(...args: unknown[]): unknown { return undefined } }\n',
|
||||
'vendor/cordis/src/context.ts': 'export class Context { private brand!: void }\n',
|
||||
'vendor/cordis/src/events.ts': [
|
||||
'export class EventsService {',
|
||||
' dispatch(type: string, args: unknown[]): unknown[] { return [type, args] }',
|
||||
@@ -64,12 +63,6 @@ const FIXTURE: Record<string, string> = {
|
||||
'packages/fix/pkgc/src/helper.ts':
|
||||
"function scriptFire(args: [string]): void { void gEvents.dispatch('emit', args) }\n",
|
||||
'packages/fix/pkgc/src/caller.ts': "scriptFire(['pkgc/script-event'])\n",
|
||||
'packages/fix/pkgd/src/index.ts': [
|
||||
"import { Context } from '../../../../vendor/cordis/src/context.ts'",
|
||||
'declare const ctx: Context',
|
||||
"ctx.bail(ctx, 'pkgd/message-name', {})",
|
||||
"const unrelated = { bail: (...args: unknown[]) => args }; unrelated.bail('pkgd/not-an-event')",
|
||||
].join('\n'),
|
||||
}
|
||||
|
||||
const root = mkdtempSync(join(tmpdir(), 'gen-doc-graphs-'))
|
||||
@@ -91,11 +84,6 @@ function dispatchersOf(pkgs: readonly string[], event: string): string[] {
|
||||
}
|
||||
|
||||
describe('event relation call-site indexing', () => {
|
||||
it('recognizes scoped Cordis bail calls without treating unrelated methods as events', () => {
|
||||
expect(dispatchersOf(['pkgd'], 'pkgd/message-name')).toEqual(['pkgd'])
|
||||
expect(dispatchersOf(['pkgd'], 'pkgd/not-an-event')).toEqual([])
|
||||
})
|
||||
|
||||
it('recovers a proven-local helper through the single-file fast path', () => {
|
||||
expect(dispatchersOf(['pkga', 'pkgb'], 'pkga/local-event')).toEqual(['pkga'])
|
||||
})
|
||||
|
||||
@@ -1127,7 +1127,7 @@ type CallSiteIndex = Map<ts.SignatureDeclaration | ts.JSDocSignature, ts.CallExp
|
||||
* must appear here — the prefilter drops non-members before any branch runs,
|
||||
* so a branch for an unlisted name is silently dead.
|
||||
*/
|
||||
const EVENT_API_METHODS = new Set(['on', 'once', 'emit', 'parallel', 'serial', 'waterfall', 'bail', 'dispatch'])
|
||||
const EVENT_API_METHODS = new Set(['on', 'once', 'emit', 'parallel', 'serial', 'waterfall', 'dispatch'])
|
||||
|
||||
/**
|
||||
* Collect event dispatch/listener relations from real cross-file receiver types.
|
||||
@@ -1285,7 +1285,7 @@ export class EventRelationCollector {
|
||||
const eventNames = this.eventNamesFromCall(node, receiverKind)
|
||||
if (method === 'on' || method === 'once') {
|
||||
for (const event of eventNames) this.ensure(event).listeners.add(source.pkg)
|
||||
} else if (method === 'emit' || method === 'parallel' || method === 'serial' || method === 'waterfall' || method === 'bail') {
|
||||
} else if (method === 'emit' || method === 'parallel' || method === 'serial' || method === 'waterfall') {
|
||||
for (const event of eventNames) this.addDispatcher(event, source.pkg, method)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user