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
4 changes: 2 additions & 2 deletions .github/workflows/build-graph-node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,9 @@ jobs:
@ruvector/graph-node-linux-arm64-gnu @ruvector/graph-node-darwin-x64 \
@ruvector/graph-node-darwin-arm64 @ruvector/graph-node-win32-x64-msvc; do
ok=0
for i in $(seq 1 18); do
for i in $(seq 1 72); do
if npm view "${pkg}@${VERSION}" version >/dev/null 2>&1; then ok=1; break; fi
echo "waiting for ${pkg}@${VERSION} to propagate (attempt ${i}/18)..."
echo "waiting for ${pkg}@${VERSION} to propagate (attempt ${i}/72)..."
sleep 10
done
if [ "$ok" != 1 ]; then
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build-kge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -202,17 +202,17 @@ jobs:
local url="https://registry.npmjs.org/${enc}"
local tmp="$RUNNER_TEMP/reg.json"
local i
for i in $(seq 1 18); do
for i in $(seq 1 72); do
if curl -sfL "$url" -o "$tmp"; then
if REG_JSON="$tmp" REG_VER="$ver" node -e 'const d=require(process.env.REG_JSON); process.exit(d.versions && d.versions[process.env.REG_VER] ? 0 : 1)'; then
echo "verified ${pkg}@${ver} on the npm registry"
return 0
fi
fi
echo "waiting for ${pkg}@${ver} to propagate (attempt ${i}/18)..."
echo "waiting for ${pkg}@${ver} to propagate (attempt ${i}/72)..."
sleep 10
done
echo "::error::${pkg}@${ver} did not appear on the npm registry within ~3 minutes of publish"
echo "::error::${pkg}@${ver} did not appear on the npm registry within ~12 minutes of publish"
return 1
}
VERIFY
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/build-router.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,17 +170,17 @@ jobs:
local url="https://registry.npmjs.org/${enc}"
local tmp="$RUNNER_TEMP/reg.json"
local i
for i in $(seq 1 18); do
for i in $(seq 1 72); do
if curl -sfL "$url" -o "$tmp"; then
if REG_JSON="$tmp" REG_VER="$ver" node -e 'const d=require(process.env.REG_JSON); process.exit(d.versions && d.versions[process.env.REG_VER] ? 0 : 1)'; then
echo "verified ${pkg}@${ver} on the npm registry"
return 0
fi
fi
echo "waiting for ${pkg}@${ver} to propagate (attempt ${i}/18)..."
echo "waiting for ${pkg}@${ver} to propagate (attempt ${i}/72)..."
sleep 10
done
echo "::error::${pkg}@${ver} did not appear on the npm registry within ~3 minutes of publish"
echo "::error::${pkg}@${ver} did not appear on the npm registry within ~12 minutes of publish"
return 1
}

Expand Down Expand Up @@ -284,17 +284,17 @@ jobs:
local url="https://registry.npmjs.org/${enc}"
local tmp="$RUNNER_TEMP/reg.json"
local i
for i in $(seq 1 18); do
for i in $(seq 1 72); do
if curl -sfL "$url" -o "$tmp"; then
if REG_JSON="$tmp" REG_VER="$ver" node -e 'const d=require(process.env.REG_JSON); process.exit(d.versions && d.versions[process.env.REG_VER] ? 0 : 1)'; then
echo "verified ${pkg}@${ver} on the npm registry"
return 0
fi
fi
echo "waiting for ${pkg}@${ver} to propagate (attempt ${i}/18)..."
echo "waiting for ${pkg}@${ver} to propagate (attempt ${i}/72)..."
sleep 10
done
echo "::error::${pkg}@${ver} did not appear on the npm registry within ~3 minutes of publish"
echo "::error::${pkg}@${ver} did not appear on the npm registry within ~12 minutes of publish"
return 1
}
if npm publish --access public; then
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build-typesafe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -220,17 +220,17 @@ jobs:
local url="https://registry.npmjs.org/${enc}"
local tmp="$RUNNER_TEMP/reg.json"
local i
for i in $(seq 1 18); do
for i in $(seq 1 72); do
if curl -sfL "$url" -o "$tmp"; then
if REG_JSON="$tmp" REG_VER="$ver" node -e 'const d=require(process.env.REG_JSON); process.exit(d.versions && d.versions[process.env.REG_VER] ? 0 : 1)'; then
echo "verified ${pkg}@${ver} on the npm registry"
return 0
fi
fi
echo "waiting for ${pkg}@${ver} to propagate (attempt ${i}/18)..."
echo "waiting for ${pkg}@${ver} to propagate (attempt ${i}/72)..."
sleep 10
done
echo "::error::${pkg}@${ver} did not appear on the npm registry within ~3 minutes of publish"
echo "::error::${pkg}@${ver} did not appear on the npm registry within ~12 minutes of publish"
return 1
}
VERIFY
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ruvector-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ jobs:
run: |
# #1007: the job's conclusion must mean "it is on the registry".
VERSION=$(node -p "require('./package.json').version")
for i in $(seq 1 18); do
for i in $(seq 1 72); do
if npm view "ruvector@${VERSION}" version >/dev/null 2>&1; then
echo "verified ruvector@${VERSION}"; exit 0
fi
echo "waiting for ruvector@${VERSION} to propagate (attempt ${i}/18)..."
echo "waiting for ruvector@${VERSION} to propagate (attempt ${i}/72)..."
sleep 10
done
echo "::error::ruvector@${VERSION} is not resolvable on npm"
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

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

4 changes: 3 additions & 1 deletion crates/neural-trader-strategies/src/coherence_bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
//!
//! This module provides a thin wrapper so the full actuation path is:
//!
//! Strategy → Intent → CoherenceChecker.check → RiskGate → Order
//! ```text
//! Strategy → Intent → CoherenceChecker.check → RiskGate → Order
//! ```
//!
//! The wrapper is lightweight by design: operators may want to skip the
//! coherence gate in paper-only flows (which they can, by not
Expand Down
6 changes: 4 additions & 2 deletions crates/neural-trader-strategies/src/ev_kelly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
//! and a current market price `m` in cents (0..=100), the canonical
//! fractional Kelly sizing for a YES bet is:
//!
//! edge = p - m / 100
//! kelly = edge / (1 - m / 100)
//! ```text
//! edge = p - m / 100
//! kelly = edge / (1 - m / 100)
//! ```
//!
//! The strategy multiplies `kelly` by a conservative `kelly_fraction`
//! (default 0.25) and by `intent.confidence`, then converts the resulting
Expand Down
18 changes: 16 additions & 2 deletions crates/ruvector-diskann/tests/search_allocations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use rand::rngs::StdRng;
use rand::{Rng, SeedableRng};
use ruvector_diskann::{DiskAnnConfig, DiskAnnIndex};
use std::alloc::{GlobalAlloc, Layout, System};
use std::cell::Cell;
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};

struct CountingAllocator;
Expand All @@ -11,9 +12,20 @@ static LARGE_ALLOCATION_THRESHOLD: AtomicUsize = AtomicUsize::new(usize::MAX);
static LARGE_ALLOCATED_BYTES: AtomicUsize = AtomicUsize::new(0);
static TOTAL_ALLOCATED_BYTES: AtomicUsize = AtomicUsize::new(0);

thread_local! {
// Search is single-threaded; count only the searching thread. Idle rayon
// workers left over from build() could otherwise add unrelated bytes and
// make the total budget flaky (386 700 vs 300 000 in run 35908988894).
static ON_SEARCH_THREAD: Cell<bool> = const { Cell::new(false) };
}

fn tracking() -> bool {
TRACKING.load(Ordering::Relaxed) && ON_SEARCH_THREAD.try_with(Cell::get).unwrap_or(false)
}

unsafe impl GlobalAlloc for CountingAllocator {
unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
if TRACKING.load(Ordering::Relaxed) {
if tracking() {
TOTAL_ALLOCATED_BYTES.fetch_add(layout.size(), Ordering::Relaxed);
if layout.size() >= LARGE_ALLOCATION_THRESHOLD.load(Ordering::Relaxed) {
LARGE_ALLOCATED_BYTES.fetch_add(layout.size(), Ordering::Relaxed);
Expand All @@ -27,7 +39,7 @@ unsafe impl GlobalAlloc for CountingAllocator {
}

unsafe fn realloc(&self, ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8 {
if TRACKING.load(Ordering::Relaxed) {
if tracking() {
TOTAL_ALLOCATED_BYTES.fetch_add(new_size, Ordering::Relaxed);
if new_size >= LARGE_ALLOCATION_THRESHOLD.load(Ordering::Relaxed) {
LARGE_ALLOCATED_BYTES.fetch_add(new_size, Ordering::Relaxed);
Expand Down Expand Up @@ -72,11 +84,13 @@ fn pooled_search_does_not_allocate_visited_set_storage() {
LARGE_ALLOCATION_THRESHOLD.store(visited_generation_bytes, Ordering::Relaxed);
LARGE_ALLOCATED_BYTES.store(0, Ordering::Relaxed);
TOTAL_ALLOCATED_BYTES.store(0, Ordering::Relaxed);
ON_SEARCH_THREAD.with(|t| t.set(true));
TRACKING.store(true, Ordering::Relaxed);
for _ in 0..SEARCHES {
std::hint::black_box(index.search(&query, 10).unwrap());
}
TRACKING.store(false, Ordering::Relaxed);
ON_SEARCH_THREAD.with(|t| t.set(false));

let allocated = LARGE_ALLOCATED_BYTES.load(Ordering::Relaxed);
let total_allocated = TOTAL_ALLOCATED_BYTES.load(Ordering::Relaxed);
Expand Down
Loading
Loading