Skip to content

fix: saveToFile allocator (#405), PPR weighted threshold (#109), runChainStep timeouts, macOS zig-build#410

Open
yxlyx wants to merge 2 commits intomainfrom
fix/405-109-runchain-zigbuild
Open

fix: saveToFile allocator (#405), PPR weighted threshold (#109), runChainStep timeouts, macOS zig-build#410
yxlyx wants to merge 2 commits intomainfrom
fix/405-109-runchain-zigbuild

Conversation

@yxlyx
Copy link
Copy Markdown
Collaborator

@yxlyx yxlyx commented Apr 10, 2026

Summary

  • refactor: CodeGraph saveToFile should accept an allocator #405 saveToFile allocator: saveToFile now accepts a caller-provided std.mem.Allocator instead of using a hardcoded page_allocator. Includes a new round-trip test (saveToFileloadFromFile).
  • fix: PPR push threshold uses unweighted out-degree but transitions use weighted probabilities #109 PPR weighted threshold: The push threshold in pprPush now uses epsilon * W_out(u) (total outgoing edge weight) instead of epsilon * deg(u) (raw degree). This is consistent with the weighted residual distribution W(u,v) / W_out(u). Adds totalOutWeight helper.
  • runChainStep timeouts: All 4 call sites of runChainStep in tools.zig now correctly pass both timeout_ms: u64 and reported_timeout_seconds: u32.
  • macOS zig-build wrapper: scripts/zig-build.sh wraps zig build for macOS 26+ where Zig 0.15.x's bundled lld cannot link against the system SDK.

Test plan

  • zig test src/graph/storage.zig — 83/83 tests pass (includes new saveToFile and loadFromFile round-trip (#405) test)
  • zig test src/graph/ppr.zig — 81/81 tests pass
  • zig test src/graph/watcher.zig — 16/16 tests pass
  • zig test src/graph/ipc.zig — 17/17 tests pass
  • zig ast-check src/tools.zig — clean parse
  • Total: 197 tests passing

Closes #405, Closes #109

Made with Cursor

Lim Yu Xi added 2 commits April 10, 2026 10:12
…hainStep timeouts, macOS zig-build wrapper

- storage.zig: saveToFile now accepts a caller-provided allocator instead
  of using a hardcoded page_allocator. Adds round-trip test for saveToFile/loadFromFile.
- ppr.zig: PPR push threshold uses total outgoing edge weight (W_out)
  instead of raw degree, matching the weighted residual distribution formula.
  Adds totalOutWeight helper.
- tools.zig: fix runChainStep call sites to pass both timeout_ms (u64)
  and reported_timeout_seconds (u32) — previously only one value was passed.
- scripts/zig-build.sh: wrapper for zig build on macOS 26+ where
  Zig 0.15.x's bundled lld cannot link against the system SDK.

Made-with: Cursor
Removes scripts/zig-build.sh which contained macOS-specific linker
workarounds (-fno-lld, --sysroot). This should not be part of the PR.

Made-with: Cursor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant