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
14 changes: 7 additions & 7 deletions codebase_rag/tests/test_rust_extension_packaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
# What maturin names each wheel rust-wheels.yml builds, plus the sdist a
# release could also carry.
PUBLISHED_FILES = [
"cgr_graph_rs-0.1.3-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"cgr_graph_rs-0.1.3-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"cgr_graph_rs-0.1.3-cp312-abi3-musllinux_1_2_x86_64.whl",
"cgr_graph_rs-0.1.3-cp312-abi3-musllinux_1_2_aarch64.whl",
"cgr_graph_rs-0.1.3-cp312-abi3-macosx_10_13_x86_64.macosx_11_0_arm64.macosx_10_13_universal2.whl",
"cgr_graph_rs-0.1.3-cp312-abi3-win_amd64.whl",
"cgr_graph_rs-0.1.3.tar.gz",
"cgr_graph_rs-0.1.4-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"cgr_graph_rs-0.1.4-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"cgr_graph_rs-0.1.4-cp312-abi3-musllinux_1_2_x86_64.whl",
"cgr_graph_rs-0.1.4-cp312-abi3-musllinux_1_2_aarch64.whl",
"cgr_graph_rs-0.1.4-cp312-abi3-macosx_10_13_x86_64.macosx_11_0_arm64.macosx_10_13_universal2.whl",
"cgr_graph_rs-0.1.4-cp312-abi3-win_amd64.whl",
"cgr_graph_rs-0.1.4.tar.gz",
]

# What a Python on each wheel's platform reports to environment markers.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ dependencies = [
# abi3 wheels for exactly these platforms; elsewhere the engine runs its
# Python twin of every part. The floor is the crate version this code
# was written against, raised with each crate release.
"cgr-graph-rs>=0.1.3,<0.2; platform_python_implementation == 'CPython' and ((sys_platform == 'linux' and (platform_machine == 'x86_64' or platform_machine == 'aarch64')) or sys_platform == 'darwin' or (sys_platform == 'win32' and platform_machine == 'AMD64'))",
"cgr-graph-rs>=0.1.4,<0.2; platform_python_implementation == 'CPython' and ((sys_platform == 'linux' and (platform_machine == 'x86_64' or platform_machine == 'aarch64')) or sys_platform == 'darwin' or (sys_platform == 'win32' and platform_machine == 'AMD64'))",
]

[project.scripts]
Expand Down
2 changes: 1 addition & 1 deletion rust/cgr_graph_rs/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rust/cgr_graph_rs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cgr_graph_rs"
version = "0.1.3"
version = "0.1.4"
edition = "2021"
description = "Native acceleration for code-graph-rag: its embedded graph, and its indexer's tree walks"
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion rust/cgr_graph_rs/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "maturin"

[project]
name = "cgr-graph-rs"
version = "0.1.3"
version = "0.1.4"
description = "Native acceleration for code-graph-rag's embedded graph"
readme = "README.md"
requires-python = ">=3.12"
Expand Down
4 changes: 2 additions & 2 deletions rust/cgr_graph_rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub mod snapshot;
pub mod trees;
pub mod walk;

const DEFAULT_ITERATIONS: u32 = 100;
const DEFAULT_ITERATIONS: u64 = 100;
const DEFAULT_DAMPING: f64 = 0.85;
const DEFAULT_EPSILON: f64 = 1e-5;

Expand Down Expand Up @@ -148,7 +148,7 @@ pub fn pagerank_until(
args: &[Arg],
deadline: &Deadline,
) -> Result<Vec<Record>, TimedOut> {
let iterations = int_arg(args, 0).map_or(DEFAULT_ITERATIONS, |v| v.max(0) as u32);
let iterations = int_arg(args, 0).map_or(DEFAULT_ITERATIONS, |v| v.max(0) as u64);
let damping = float_arg(args, 1).unwrap_or(DEFAULT_DAMPING);
let epsilon = float_arg(args, 2).unwrap_or(DEFAULT_EPSILON);
let n = g.ids.len();
Expand Down
18 changes: 18 additions & 0 deletions rust/cgr_graph_rs/tests/algorithms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,24 @@ fn pagerank_is_a_distribution() {
assert!((total - 1.0).abs() < 1e-9);
}

/// Python's `for _ in range(iterations)` runs any count until the ranks
/// converge; a count past u32::MAX is no different.
#[test]
fn pagerank_runs_an_iteration_count_past_u32_max() {
let tight = |iterations: i64| {
let args = [Arg::Int(iterations), Arg::Float(0.85), Arg::Float(1e-12)];
run(&sample(), "pagerank.get", &args).expect("implemented")
};
assert_eq!(tight((1 << 32) + 1), tight(1000));
}

/// `range()` of a negative count is empty: the ranks stay uniform.
#[test]
fn pagerank_runs_no_iteration_for_a_negative_count() {
let records = run(&sample(), "pagerank.get", &[Arg::Int(-5)]).expect("implemented");
assert_eq!(column(&records, "rank"), vec![Value::Float(0.25); 4]);
}

#[test]
fn procedures_left_to_python_are_declined() {
assert!(run(&sample(), "nxalg.simple_cycles", &[]).is_none());
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading