chore(scripts): probe-fft-platform.py — root-cause aid for #560#607
Merged
Conversation
…for #560 The verify.py "platform-independent for IEEE 754 compliant systems" docstring at archive/v1/data/proof/verify.py:172 is incorrect — scipy's pocketfft uses SIMD vector kernels (AVX2/AVX-512 on x86_64, NEON on Apple Silicon) that reorder FP operations differently across builds, so the SHA-256 of the production pipeline diverges at ULP precision per platform. That divergence is what bug report #560 caught on macOS arm64. This script reproduces verify.py's hash-relevant scipy.fft.fft + Hamming- window calls in isolation on a deterministic synthetic input, without dragging in src.app / pydantic Settings. Run on each platform and diff the JSON output: python3 scripts/probe-fft-platform.py - If two machines print the same first8_doppler_bytes_hex and the same first4_psd_floats but different sha256, the divergence is in later FFT bins (SIMD reordering). - If even the first values differ, it's true ULP-level divergence at every bin (NEON vs x86_64, or different scipy pocketfft builds). Captured empirical evidence across Windows (Intel AVX-512), Linux x86_64 (ruvultra), and Apple Silicon (ruv-mac-mini) — Win + Linux agree on first PSD values but produce different SHA-256s; Mac arm64 differs at the first bins at ~1 ULP precision (~2e-14 on a value of ~94). This commit ships only the diagnostic. The architectural fix for #560 (quantize-before-hash in features_to_bytes(), then regenerate expected_features.sha256 on a canonical CI platform) is left as a separate maintainer decision because it changes a published trust-anchor artifact and merits a deliberate call. Supersedes the probe portion of PR #577 (the verify path fix from #577 already shipped via PR #590). Co-Authored-By: claude-flow <ruv@ruv.net>
Closed
4 tasks
This was referenced May 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
scripts/probe-fft-platform.py, a single-file diagnostic that reproducesverify.py's hash-relevant FFT steps in isolation on a deterministic synthetic input, without pulling insrc.app/ pydanticSettings. Used to empirically locate the source of the platform-specific hash divergence reported in #560.The script:
scipy.fft.fft+scipy.signal.windows.hammingcalls thatverify.pyhashesuname,python,numpy/scipyversions, SHA-256 of the output buffer, the first 8 Doppler bytes, the first 4 PSD floats, and the SciPy BLAS backend metadataWhy
The docstring at
archive/v1/data/proof/verify.py:172("platform-independent for IEEE 754 compliant systems") is incorrect. SciPy's pocketfft uses SIMD vector kernels — AVX2/AVX-512 on x86_64, NEON on Apple Silicon — that reorder FP operations differently across builds. IEEE 754 guarantees per-operation determinism, not associativity under reordering. The SHA-256 of the production pipeline diverges at ULP precision per platform, which is what bug report #560 caught on macOS arm64.Empirical evidence (across three machines via Tailscale)
..., 94.40426770856882, ..., 51.67749692464247678b3fb…..., 94.40426770856882, ..., 51.67749692464247641dc56…..., 94.4042677085688, ..., 51.677496924642469b5e19…What this PR does NOT do
The architectural fix for #560 is quantize-before-hash in
features_to_bytes()— round float64 to a fixed precision well above SIMD-ULP (e.g. 1e-9) before packing — then regenerateexpected_features.sha256on a canonical CI platform. That changes a published trust-anchor artifact (the witness chain) and merits a deliberate maintainer call. This PR ships only the diagnostic, so the empirical evidence is in-repo when that decision happens.Relation to #577
PR #577 bundled the verify path fix for #559 + this probe script for #560. The verify path fix already shipped via PR #590 (merged earlier this session), so #577's diff against current
mainis now mostly empty for theverifyportion. This PR extracts only the still-useful probe script; #577 can be closed.Test plan
python3 scripts/probe-fft-platform.pyruns cleanly on Windows (verified locally onruvzen— output matches the Windows row of the table above)features_to_bytes()quantization actually collapses the per-platform hash to a single value🤖 Generated with claude-flow