Skip to content

Commit 83aafa0

Browse files
committed
fix: wire 2560 surreal embedding column
1 parent 7e9a7f9 commit 83aafa0

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

CODEX_JOURNAL.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Codex Journal
2+
3+
## 2025-11-18
4+
- Added `surreal_embedding_column_supports_2560_dimension` test and wired `SurrealEmbeddingColumn` to accept the 2,560-d slot in `crates/codegraph-mcp/src/indexer.rs` so qwen3 embeddings no longer panic.
5+
- Verified with `cargo test -p codegraph-mcp --lib surreal_embedding_column_supports_2560_dimension`; still seeing external warnings from `server.rs`.

crates/codegraph-mcp/src/indexer.rs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// ABOUTME: Drives the indexing pipeline for the Codegraph MCP CLI.
2+
// ABOUTME: Coordinates parsing, embeddings, and persistence into SurrealDB.
13
#![allow(dead_code, unused_variables, unused_imports)]
24

35
use crate::estimation::{
@@ -10,8 +12,8 @@ use codegraph_core::{CodeNode, EdgeRelationship, NodeId, NodeType};
1012
use codegraph_graph::{
1113
edge::CodeEdge, FileMetadataRecord, NodeEmbeddingRecord, ProjectMetadataRecord,
1214
SurrealDbConfig, SurrealDbStorage, SymbolEmbeddingRecord, SURR_EMBEDDING_COLUMN_1024,
13-
SURR_EMBEDDING_COLUMN_2048, SURR_EMBEDDING_COLUMN_384, SURR_EMBEDDING_COLUMN_4096,
14-
SURR_EMBEDDING_COLUMN_768,
15+
SURR_EMBEDDING_COLUMN_2048, SURR_EMBEDDING_COLUMN_2560, SURR_EMBEDDING_COLUMN_384,
16+
SURR_EMBEDDING_COLUMN_4096, SURR_EMBEDDING_COLUMN_768,
1517
};
1618
use codegraph_parser::{get_ai_pattern_learner, TreeSitterParser};
1719
#[cfg(feature = "ai-enhanced")]
@@ -62,6 +64,7 @@ enum SurrealEmbeddingColumn {
6264
Embedding768,
6365
Embedding1024,
6466
Embedding2048,
67+
Embedding2560,
6568
Embedding4096,
6669
}
6770

@@ -72,6 +75,7 @@ impl SurrealEmbeddingColumn {
7275
SurrealEmbeddingColumn::Embedding768 => SURR_EMBEDDING_COLUMN_768,
7376
SurrealEmbeddingColumn::Embedding1024 => SURR_EMBEDDING_COLUMN_1024,
7477
SurrealEmbeddingColumn::Embedding2048 => SURR_EMBEDDING_COLUMN_2048,
78+
SurrealEmbeddingColumn::Embedding2560 => SURR_EMBEDDING_COLUMN_2560,
7579
SurrealEmbeddingColumn::Embedding4096 => SURR_EMBEDDING_COLUMN_4096,
7680
}
7781
}
@@ -82,6 +86,7 @@ impl SurrealEmbeddingColumn {
8286
SurrealEmbeddingColumn::Embedding768 => 768,
8387
SurrealEmbeddingColumn::Embedding1024 => 1024,
8488
SurrealEmbeddingColumn::Embedding2048 => 2048,
89+
SurrealEmbeddingColumn::Embedding2560 => 2560,
8590
SurrealEmbeddingColumn::Embedding4096 => 4096,
8691
}
8792
}
@@ -498,7 +503,7 @@ impl ProjectIndexer {
498503
let vector_dim = env_vector_dim.unwrap_or(embedder_dimension);
499504
let embedding_column = resolve_surreal_embedding_column(vector_dim).with_context(|| {
500505
format!(
501-
"Unsupported embedding dimension {}. Supported dimensions: 384, 768, 1024, 2048, 4096.",
506+
"Unsupported embedding dimension {}. Supported dimensions: 384, 768, 1024, 2048, 2560, 4096.",
502507
vector_dim
503508
)
504509
})?;
@@ -2825,9 +2830,10 @@ fn resolve_surreal_embedding_column(dim: usize) -> Result<SurrealEmbeddingColumn
28252830
768 => Ok(SurrealEmbeddingColumn::Embedding768),
28262831
1024 => Ok(SurrealEmbeddingColumn::Embedding1024),
28272832
2048 => Ok(SurrealEmbeddingColumn::Embedding2048),
2833+
2560 => Ok(SurrealEmbeddingColumn::Embedding2560),
28282834
4096 => Ok(SurrealEmbeddingColumn::Embedding4096),
28292835
other => Err(anyhow!(
2830-
"Unsupported embedding dimension {}. Supported: 384, 768, 1024, 2048, 4096",
2836+
"Unsupported embedding dimension {}. Supported: 384, 768, 1024, 2048, 2560, 4096",
28312837
other
28322838
)),
28332839
}
@@ -2854,6 +2860,14 @@ mod tests {
28542860
assert_eq!(symbol_embedding_db_batch_size(), 1);
28552861
std::env::remove_var("CODEGRAPH_SYMBOL_DB_BATCH_SIZE");
28562862
}
2863+
2864+
#[test]
2865+
fn surreal_embedding_column_supports_2560_dimension() {
2866+
let column = resolve_surreal_embedding_column(2560)
2867+
.expect("2560-d embeddings should be supported");
2868+
assert_eq!(column.column_name(), SURR_EMBEDDING_COLUMN_2560);
2869+
assert_eq!(column.dimension(), 2560);
2870+
}
28572871
}
28582872

28592873
pub fn prepare_node_text(node: &CodeNode) -> String {

0 commit comments

Comments
 (0)