Skip to content

Commit 58f4762

Browse files
committed
Do not exclude entry point method from generated span count
1 parent eb72080 commit 58f4762

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

src/backend/generation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ export function generateFakeTrace(apps: Array<FakeApp>, params: TraceGenerationP
526526
}, []);
527527
const visitedClasses: Set<FakeClass> = new Set([entryPoint]);
528528
let previousClass: FakeClass = entryPoint;
529-
let generatedSpanCount: number = 0;
529+
let generatedSpanCount: number = 1; // Count entrySpan as first generated span
530530

531531
// Collect all methods for visitAllMethods feature
532532
interface MethodReference {

tests/backend/integration/trace-generation.test.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ describe('Trace Generation Integration', () => {
3838
}
3939

4040
const totalSpans = countSpans(trace);
41-
expect(totalSpans).toBe(11); // 1 root + 10 calls
41+
expect(totalSpans).toBe(10);
4242
});
4343

4444
it('should generate deterministic span names with seed 12345', () => {
@@ -121,7 +121,7 @@ describe('Trace Generation Integration', () => {
121121
return spans.length + spans.reduce((sum, span) => sum + countSpans(span.children), 0);
122122
}
123123

124-
expect(countSpans(trace)).toBe(9); // 1 root + 8 calls
124+
expect(countSpans(trace)).toBe(8);
125125
});
126126

127127
it('should generate exact trace structure for TRUE_RANDOM with seed 22222', () => {
@@ -141,7 +141,7 @@ describe('Trace Generation Integration', () => {
141141
return spans.length + spans.reduce((sum, span) => sum + countSpans(span.children), 0);
142142
}
143143

144-
expect(countSpans(trace)).toBe(9); // 1 root + 8 calls
144+
expect(countSpans(trace)).toBe(8);
145145
});
146146

147147
it('should generate exact trace structure for RANDOM_EXIT with seed 33333', () => {
@@ -161,7 +161,7 @@ describe('Trace Generation Integration', () => {
161161
return spans.length + spans.reduce((sum, span) => sum + countSpans(span.children), 0);
162162
}
163163

164-
expect(countSpans(trace)).toBe(9); // 1 root + 8 calls
164+
expect(countSpans(trace)).toBe(8);
165165
});
166166
});
167167

@@ -238,7 +238,7 @@ describe('Trace Generation Integration', () => {
238238
return spans.length + spans.reduce((sum, span) => sum + countSpans(span.children), 0);
239239
}
240240

241-
expect(countSpans(trace)).toBe(11);
241+
expect(countSpans(trace)).toBe(10);
242242
});
243243

244244
it('should generate exact structure without cyclic calls, seed 77777', () => {
@@ -258,7 +258,7 @@ describe('Trace Generation Integration', () => {
258258
return spans.length + spans.reduce((sum, span) => sum + countSpans(span.children), 0);
259259
}
260260

261-
expect(countSpans(trace)).toBe(11);
261+
expect(countSpans(trace)).toBe(10);
262262
});
263263
});
264264

@@ -353,7 +353,7 @@ describe('Trace Generation Integration', () => {
353353
return spans.length + spans.reduce((sum, span) => sum + countSpans(span.children), 0);
354354
}
355355

356-
expect(countSpans(trace)).toBe(2); // root + 1 call
356+
expect(countSpans(trace)).toBe(1);
357357
});
358358

359359
it('should handle large call count with seed 30001', () => {
@@ -373,7 +373,7 @@ describe('Trace Generation Integration', () => {
373373
return spans.length + spans.reduce((sum, span) => sum + countSpans(span.children), 0);
374374
}
375375

376-
expect(countSpans(trace)).toBe(101); // root + 100 calls
376+
expect(countSpans(trace)).toBe(100);
377377
});
378378

379379
it('should handle max depth=1 with seed 40001', () => {
@@ -574,7 +574,7 @@ describe('Trace Generation Integration', () => {
574574
}
575575

576576
// With cyclic calls enabled, should generate the requested number of spans
577-
expect(countSpans(trace)).toBe(6); // 1 root + 5 calls
577+
expect(countSpans(trace)).toBe(5);
578578
});
579579
});
580580
});

0 commit comments

Comments
 (0)