Skip to content

Commit c9eed14

Browse files
committed
Make fixed mode's index list completely static
In fixed mode, refreshIndexList() is now a no-op. The index list is completely static and never changes, even if indexes are deleted from the store. This fixes the issue where: 1. Fixed mode starts with [-i pytorch -i react] 2. User deletes pytorch from the store 3. Agent calls list_indexes → triggers refreshIndexList() 4. Previously: indexNames would shrink to ["react"] 5. Now: indexNames remains ["pytorch", "react"] In discovery mode, refreshIndexList() still refreshes from the store to pick up new/deleted indexes. Changes: - src/clients/multi-index-runner.ts: Make refreshIndexList() a no-op in fixed mode - src/clients/multi-index-runner.test.ts: Update test to expect static list in fixed mode All tests pass, build succeeds. Agent-Id: agent-0ac871dd-5181-4ed9-84d1-446aa4b19c81
1 parent 2c37861 commit c9eed14

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

src/clients/multi-index-runner.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,10 @@ describe("MultiIndexRunner.refreshIndexList", () => {
203203
expect(runner.indexNames).toEqual(["pytorch", "react"]);
204204
});
205205

206-
it("in fixed mode, refreshIndexList handles missing indexes gracefully", async () => {
206+
it("in fixed mode, refreshIndexList is a no-op even when indexes are deleted", async () => {
207207
const store = createMockStoreWithIndexes(["pytorch", "react"]);
208208

209-
// Create runner in fixed mode with pytorch, react, and a missing index
209+
// Create runner in fixed mode with pytorch and react
210210
const runner = await MultiIndexRunner.create({
211211
store,
212212
indexNames: ["pytorch", "react"],
@@ -233,7 +233,7 @@ describe("MultiIndexRunner.refreshIndexList", () => {
233233

234234
await runner.refreshIndexList();
235235

236-
// Should only include react (pytorch is gone from store)
237-
expect(runner.indexNames).toEqual(["react"]);
236+
// In fixed mode, the list should remain unchanged even though pytorch was deleted
237+
expect(runner.indexNames).toEqual(["pytorch", "react"]);
238238
});
239239
});

src/clients/multi-index-runner.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -207,21 +207,24 @@ export class MultiIndexRunner {
207207
* Refresh the list of available indexes from the store.
208208
* Call after adding or removing indexes.
209209
*
210-
* In fixed mode (when originalIndexNames is set), only includes indexes
211-
* from the original allowlist, even if other indexes exist in the store.
210+
* In fixed mode (when originalIndexNames is set), this is a no-op.
211+
* The list is completely static and never changes.
212+
*
213+
* In discovery mode, refreshes from the store to pick up new/deleted indexes.
212214
*/
213215
async refreshIndexList(): Promise<void> {
214-
const allIndexNames = await this.store.list();
216+
// In fixed mode, the list is static - don't refresh
217+
if (this.originalIndexNames) {
218+
return;
219+
}
215220

216-
// In fixed mode, filter to only the original allowlist
217-
const indexNamesToLoad = this.originalIndexNames
218-
? allIndexNames.filter(name => this.originalIndexNames!.includes(name))
219-
: allIndexNames;
221+
// Discovery mode: refresh from store
222+
const allIndexNames = await this.store.list();
220223

221224
const newIndexes: IndexInfo[] = [];
222225
const newIndexNames: string[] = [];
223226

224-
for (const name of indexNamesToLoad) {
227+
for (const name of allIndexNames) {
225228
try {
226229
const state = await this.store.loadSearch(name);
227230
if (state) {

0 commit comments

Comments
 (0)