Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,12 @@ export class FileSessionIndex extends Disposable implements ISessionIndex {
await this.ensureProjection();
}

/** Test hook: stop the background reconcile loop, so measurement windows
* contain only the operations under test. */
Comment on lines +249 to +250

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Remove the method-level test-hook comment

This new JSDoc sits beside a method in an implementation file. The scoped packages/agent-core-v2/AGENTS.md comment convention requires comments to live only in the top-of-file /** */ block and never beside functions or methods, so this note should be removed or folded into the file header if it is important.

AGENTS.md reference: packages/agent-core-v2/AGENTS.md:L17-L17

Useful? React with 👍 / 👎.

stopReconcileLoop(): void {
this.reconcileTimer.cancel();
}

private async tick(): Promise<void> {
if (!this.readModelEnabled()) return;
if (this.state === 'degraded') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -888,8 +888,11 @@ describe('FileSessionIndex (read model)', () => {
// every warm read must touch a bounded number of store rows and zero
// session directories, and that work must be identical at 1k, 10k, and 50k
// sessions — a linear regression changes the counts deterministically, on
// any runner. The single retry absorbs a background reconcile tick (60s
// interval) landing inside a counting window.
// any runner. The background reconcile loop is stopped right after
// prepare(): a tick's authoritative scan enumerates the session
// directories (60s interval), and on a runner slow enough for the test to
// cross that interval it would land inside a counting window and be
// attributed to the read under test. The retry absorbs runner hiccups.
const baseline = { retry: 1, timeout: 120_000 };

it('baseline: warm listRecent(limit=20) at 1k vs 10k vs 50k sessions', baseline, async () => {
Expand All @@ -907,6 +910,9 @@ describe('FileSessionIndex (read model)', () => {
// directly into the generation (the mirror path is covered elsewhere).
await seedSession('seed', { createdAt: 0, updatedAt: 0 });
await store.prepare();
// Freeze the background reconcile loop so the counting windows below
// contain only the read under test.
store.stopReconcileLoop();
const collection = sessionCollection(1);

const seedRows = async (from: number, to: number): Promise<void> => {
Expand Down
Loading