Skip to content

Fix audit findings L3, L5: LIBSTATS_PORTABLE, cache doc accuracy, remove CachedProperty#64

Merged
OldCrow merged 1 commit into
mainfrom
fix/windows-portable-and-sync-docs
Jul 5, 2026
Merged

Fix audit findings L3, L5: LIBSTATS_PORTABLE, cache doc accuracy, remove CachedProperty#64
OldCrow merged 1 commit into
mainfrom
fix/windows-portable-and-sync-docs

Conversation

@OldCrow

@OldCrow OldCrow commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Addresses findings L3 and L5 from the 2026-07-04 audit. 46/46 tests pass. No API changes.

L3 — Windows global /arch: scoping

Adds LIBSTATS_PORTABLE=OFF option. When ON, wraps the add_compile_options(/arch:AVX512|AVX2) block (MSVC/Clang-cl x64) so those flags are not applied globally. Per-file ISA flags from cmake/SIMDDetection.cmake:apply_simd_source_flags() remain active on the SIMD kernel TUs, preserving kernel performance. Default OFF (native build). Recommend ON for pylibstats Windows wheel builds.

L5 — Sync complexity documentation

  • Fix 'lock-free fast path' inaccuracy: getCachedValue() checks cacheValidAtomic_ without a lock (avoiding the exclusive/write lock on the fast path), but still acquires shared_lock to read cached values. Correctly described as 'contention-reduced' not 'lock-free'.
  • Document torn-pair hazard: per-parameter atomics (atomicMean_, etc.) are individually consistent, but reading two across separate calls does not form an atomic pair under concurrent setParameters(). Added one-sentence note for callers needing a consistent pair.
  • Remove vestigial CachedProperty<T>: defined in distribution_cache.h, zero usages anywhere in src/ or include/. Removed (net −36 lines).

…cy; remove CachedProperty

L3: LIBSTATS_PORTABLE=OFF option wraps the global /arch: block on Windows.
L5: Fix lock-free doc claim; add torn-pair note; remove CachedProperty<T>.
46/46 tests pass.

Co-Authored-By: Oz <oz-agent@warp.dev>
@OldCrow OldCrow merged commit 9a81633 into main Jul 5, 2026
20 checks passed
@OldCrow OldCrow deleted the fix/windows-portable-and-sync-docs branch July 5, 2026 04:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant