Skip to content

Commit e6b44bf

Browse files
Copilotdevlux76
andcommitted
fix(#92): finalize semantic neighbor naming — remove remaining Metroid references from neighbor graph code
Closes #92 Co-authored-by: devlux76 <[email protected]>
1 parent e4813bf commit e6b44bf

File tree

10 files changed

+23
-28
lines changed

10 files changed

+23
-28
lines changed

lib/daydreamer/ClusterStability.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export interface LabelPropagationResult {
5252
/**
5353
* Run one pass of label propagation over all pages.
5454
*
55-
* Each node adopts the most frequent label among its Metroid neighbors.
55+
* Each node adopts the most frequent label among its semantic neighbors.
5656
* Ties are broken deterministically by choosing the lexicographically
5757
* smallest label (consistent across runs and nodes).
5858
*
@@ -107,7 +107,7 @@ async function propagationPass(
107107

108108
/**
109109
* Assign community labels to all pages via label propagation on the
110-
* Metroid (semantic) neighbor graph.
110+
* Semantic neighbor graph.
111111
*
112112
* Initial labels: each page is its own community (pageId as initial label).
113113
* Each iteration: every node adopts the most frequent label among neighbors.

lib/daydreamer/FullNeighborRecalc.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export interface FullNeighborRecalcOptions {
3131
metadataStore: MetadataStore;
3232
vectorStore: VectorStore;
3333
policy?: HotpathPolicy;
34-
/** Maximum Metroid neighbors stored per page. Default: 16. */
34+
/** Maximum semantic neighbors stored per page. Default: 16. */
3535
maxNeighbors?: number;
3636
/** Current timestamp (ms since epoch). Defaults to Date.now(). */
3737
now?: number;
@@ -71,7 +71,7 @@ function cosineSimilarity(a: Float32Array, b: Float32Array): number {
7171
*
7272
* Finds all volumes flagged as dirty (via `needsNeighborRecalc`), loads
7373
* their pages, computes pairwise cosine similarities, and updates the
74-
* Metroid neighbor index. Processing is bounded by the Williams-Bound-derived
74+
* semantic neighbor index. Processing is bounded by the Williams-Bound-derived
7575
* maintenance budget to avoid blocking the idle loop.
7676
*
7777
* After recalculation, salience is recomputed for affected pages and a

lib/sharing/SubgraphExporter.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ async function expandSeeds(
8383
for (const pageId of frontier) {
8484
if (collectedPages.length >= maxNodes) break;
8585

86-
// Expand via Metroid (semantic) neighbors
87-
const metroidNeighbors: SemanticNeighbor[] = await metadataStore.getSemanticNeighbors(pageId);
88-
for (const n of metroidNeighbors) {
86+
// Expand via semantic neighbors
87+
const semanticNeighbors: SemanticNeighbor[] = await metadataStore.getSemanticNeighbors(pageId);
88+
for (const n of semanticNeighbors) {
8989
if (!visited.has(n.neighborPageId) && collectedPages.length < maxNodes) {
9090
visited.add(n.neighborPageId);
9191
nextFrontier.push(n.neighborPageId);

lib/storage/IndexedDbMetadataStore.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ function applyUpgrade(db: IDBDatabase): void {
9696
db.createObjectStore(STORE.pageActivity, { keyPath: "pageId" });
9797
}
9898

99-
// v3 stores — neighbor_graph (replaces the old metroid_neighbors name)
99+
// v3 stores — neighbor_graph (semantic neighbor proximity index)
100100
if (!db.objectStoreNames.contains(STORE.neighborGraph)) {
101101
db.createObjectStore(STORE.neighborGraph, { keyPath: "pageId" });
102102
}

tests/SalienceEngine.test.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,7 @@ class MockMetadataStore implements MetadataStore {
118118
async getBooksByPage(): Promise<never[]> { return []; }
119119
async getVolumesByBook(): Promise<never[]> { return []; }
120120
async getShelvesByVolume(): Promise<never[]> { return []; }
121-
async putMetroidNeighbors(): Promise<void> { /* stub */ }
122-
async getMetroidNeighbors(): Promise<never[]> { return []; }
123-
async getInducedMetroidSubgraph() { return { nodes: [], edges: [] }; }
124-
async needsMetroidRecalc(): Promise<boolean> { return false; }
125-
async flagVolumeForMetroidRecalc(): Promise<void> { /* stub */ }
126-
async clearMetroidRecalcFlag(): Promise<void> { /* stub */ }
121+
127122
async deleteEdge(): Promise<void> { /* stub */ }
128123
async putSemanticNeighbors(): Promise<void> { /* stub */ }
129124
async getSemanticNeighbors(): Promise<never[]> { return []; }

tests/daydreamer/ClusterStability.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ class MockMetadataStore implements MetadataStore {
350350
return [...this.shelves.values()].filter((s) => s.volumeIds.includes(volumeId));
351351
}
352352

353-
// Metroid / Semantic neighbor stubs
353+
// Semantic neighbor stubs
354354
async putSemanticNeighbors(): Promise<void> { /* stub */ }
355355
async getSemanticNeighbors(): Promise<SemanticNeighbor[]> { return []; }
356356
async getInducedNeighborSubgraph(): Promise<SemanticNeighborSubgraph> { return { nodes: [], edges: [] }; }

tests/daydreamer/FullNeighborRecalc.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class FullMockMetadataStore implements MetadataStore {
7171
private edgeMap = new Map<string, Edge>();
7272
private activities = new Map<Hash, PageActivity>();
7373
private hotpath = new Map<Hash, HotpathEntry>();
74-
private metroidNeighbors = new Map<Hash, SemanticNeighbor[]>();
74+
private semanticNeighbors = new Map<Hash, SemanticNeighbor[]>();
7575
private dirtyFlags = new Map<Hash, boolean>();
7676

7777
async putPage(page: Page) { this.pages.set(page.pageId, page); }
@@ -103,10 +103,10 @@ class FullMockMetadataStore implements MetadataStore {
103103
async getShelvesByVolume() { return []; }
104104

105105
async putSemanticNeighbors(pageId: Hash, neighbors: SemanticNeighbor[]) {
106-
this.metroidNeighbors.set(pageId, [...neighbors]);
106+
this.semanticNeighbors.set(pageId, [...neighbors]);
107107
}
108108
async getSemanticNeighbors(pageId: Hash) {
109-
return this.metroidNeighbors.get(pageId) ?? [];
109+
return this.semanticNeighbors.get(pageId) ?? [];
110110
}
111111
async getInducedNeighborSubgraph(): Promise<SemanticNeighborSubgraph> { return { nodes: [], edges: [] }; }
112112

@@ -132,7 +132,7 @@ class FullMockMetadataStore implements MetadataStore {
132132
async getPageActivity(id: Hash) { return this.activities.get(id); }
133133

134134
isDirty(volumeId: Hash): boolean { return this.dirtyFlags.get(volumeId) === true; }
135-
getSemanticNeighborsSync(pageId: Hash) { return this.metroidNeighbors.get(pageId) ?? []; }
135+
getSemanticNeighborsSync(pageId: Hash) { return this.semanticNeighbors.get(pageId) ?? []; }
136136
}
137137

138138
// ---------------------------------------------------------------------------

tests/daydreamer/HebbianUpdater.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class FullMockMetadataStore implements MetadataStore {
5858
private edgeMap = new Map<string, Edge>();
5959
private activities = new Map<Hash, PageActivity>();
6060
private hotpath = new Map<Hash, HotpathEntry>();
61-
private metroidNeighbors = new Map<Hash, SemanticNeighbor[]>();
61+
private semanticNeighbors = new Map<Hash, SemanticNeighbor[]>();
6262
private dirtyFlags = new Map<Hash, boolean>();
6363

6464
async putPage(page: Page) { this.pages.set(page.pageId, page); }
@@ -94,10 +94,10 @@ class FullMockMetadataStore implements MetadataStore {
9494
async getShelvesByVolume() { return []; }
9595

9696
async putSemanticNeighbors(pageId: Hash, neighbors: SemanticNeighbor[]) {
97-
this.metroidNeighbors.set(pageId, neighbors);
97+
this.semanticNeighbors.set(pageId, neighbors);
9898
}
9999
async getSemanticNeighbors(pageId: Hash) {
100-
return this.metroidNeighbors.get(pageId) ?? [];
100+
return this.semanticNeighbors.get(pageId) ?? [];
101101
}
102102
async getInducedNeighborSubgraph(): Promise<SemanticNeighborSubgraph> { return { nodes: [], edges: [] }; }
103103

tests/daydreamer/PrototypeRecomputer.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class FullMockMetadataStore implements MetadataStore {
7272
private edgeMap = new Map<string, Edge>();
7373
private activities = new Map<Hash, PageActivity>();
7474
private hotpath = new Map<Hash, HotpathEntry>();
75-
private metroidNeighbors = new Map<Hash, SemanticNeighbor[]>();
75+
private semanticNeighbors = new Map<Hash, SemanticNeighbor[]>();
7676
private dirtyFlags = new Map<Hash, boolean>();
7777

7878
async putPage(page: Page) { this.pages.set(page.pageId, page); }
@@ -111,9 +111,9 @@ class FullMockMetadataStore implements MetadataStore {
111111
async getShelvesByVolume() { return []; }
112112

113113
async putSemanticNeighbors(pageId: Hash, neighbors: SemanticNeighbor[]) {
114-
this.metroidNeighbors.set(pageId, neighbors);
114+
this.semanticNeighbors.set(pageId, neighbors);
115115
}
116-
async getSemanticNeighbors(pageId: Hash) { return this.metroidNeighbors.get(pageId) ?? []; }
116+
async getSemanticNeighbors(pageId: Hash) { return this.semanticNeighbors.get(pageId) ?? []; }
117117
async getInducedNeighborSubgraph(): Promise<SemanticNeighborSubgraph> { return { nodes: [], edges: [] }; }
118118

119119
async needsNeighborRecalc(id: Hash) { return this.dirtyFlags.get(id) === true; }

tests/sharing/SubgraphExchange.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class FullMockMetadataStore implements MetadataStore {
6666
private edgeMap = new Map<string, Edge>();
6767
private activities = new Map<Hash, PageActivity>();
6868
private hotpath = new Map<Hash, HotpathEntry>();
69-
private metroidNeighbors = new Map<Hash, SemanticNeighbor[]>();
69+
private semanticNeighbors = new Map<Hash, SemanticNeighbor[]>();
7070
private dirtyFlags = new Map<Hash, boolean>();
7171

7272
async putPage(page: Page) { this.pages.set(page.pageId, page); }
@@ -96,9 +96,9 @@ class FullMockMetadataStore implements MetadataStore {
9696
async getShelvesByVolume() { return []; }
9797

9898
async putSemanticNeighbors(pageId: Hash, neighbors: SemanticNeighbor[]) {
99-
this.metroidNeighbors.set(pageId, neighbors);
99+
this.semanticNeighbors.set(pageId, neighbors);
100100
}
101-
async getSemanticNeighbors(pageId: Hash) { return this.metroidNeighbors.get(pageId) ?? []; }
101+
async getSemanticNeighbors(pageId: Hash) { return this.semanticNeighbors.get(pageId) ?? []; }
102102
async getInducedNeighborSubgraph(): Promise<SemanticNeighborSubgraph> { return { nodes: [], edges: [] }; }
103103

104104
async needsNeighborRecalc(id: Hash) { return this.dirtyFlags.get(id) === true; }

0 commit comments

Comments
 (0)