Comp for js pb#3
Open
caumond wants to merge 28 commits into
Open
Conversation
caumond
force-pushed
the
comp-for-js-pb
branch
from
November 17, 2025 20:07
c1ffde7 to
12dc1ad
Compare
caumond
force-pushed
the
comp-for-js-pb
branch
3 times, most recently
from
December 17, 2025 14:28
0b30576 to
1ae3166
Compare
caumond
force-pushed
the
comp-for-js-pb
branch
3 times, most recently
from
December 17, 2025 15:10
f603242 to
ddd59ef
Compare
caumond
force-pushed
the
comp-for-js-pb
branch
3 times, most recently
from
December 17, 2025 15:39
61981a7 to
0331d94
Compare
caumond
force-pushed
the
comp-for-js-pb
branch
4 times, most recently
from
December 17, 2025 21:00
c7614c4 to
68c63fe
Compare
caumond
force-pushed
the
comp-for-js-pb
branch
from
December 17, 2025 21:00
68c63fe to
e8335d5
Compare
caumond
force-pushed
the
comp-for-js-pb
branch
from
December 22, 2025 13:53
e94b3cf to
35999ac
Compare
caumond
force-pushed
the
comp-for-js-pb
branch
4 times, most recently
from
December 22, 2025 21:00
e28a684 to
af750de
Compare
caumond
force-pushed
the
comp-for-js-pb
branch
2 times, most recently
from
December 22, 2025 23:17
7a43d76 to
14e4632
Compare
caumond
force-pushed
the
comp-for-js-pb
branch
from
December 25, 2025 10:27
14e4632 to
5f7846b
Compare
caumond
force-pushed
the
comp-for-js-pb
branch
from
December 28, 2025 17:21
1351130 to
33237a8
Compare
caumond
force-pushed
the
comp-for-js-pb
branch
2 times, most recently
from
December 30, 2025 17:14
4702ecf to
4939150
Compare
caumond
force-pushed
the
comp-for-js-pb
branch
from
December 30, 2025 17:51
4939150 to
4cec749
Compare
caumond
force-pushed
the
comp-for-js-pb
branch
from
December 30, 2025 19:45
a67fb5e to
ff1ba6f
Compare
Resolve the namespace collision where src/clj and src/cljc both defined auto-opti.prng.impl.xoroshiro128, which silently shadowed the portable implementation on the JVM and broke bb clj-test / CI. The registry now exposes platform-explicit variants: - :xoroshiro128 portable, identical values on JVM and JS (cljc) - :xoroshiro128-jvm fast JVM (primitive longs, mutable long-array) - :xoroshiro256-jvm fast JVM, larger xoshiro256+ state - :xoroshiro128-js fast JS (64-bit math emulated on 32-bit lanes) Only the entries matching the host platform are registered. The JVM-fast and JS-fast cores match the canonical C reference bit for bit (reference and JS-core tests). Fast variants implement the full PRNG protocol (including jump) and are documented as not thread-safe; xoro-common now holds the shared bit ops and the generic next-*-fn factories. Build: the clj test runner discovers test/clj (excluding :benchmark- tagged tests), the cljs build picks up src/cljs + test/cljs. bb bp green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Generate canonical xoshiro256+ values from a C reference (state [1,2,3,4]) and assert the JVM implementation reproduces them exactly, as the xoroshiro128+ variant already does. Adds test/c/xoro256_test.cpp and run256; also tracks the pre-existing xoro_test.cpp / run that back the 128-bit reference test. Compiled binaries stay gitignored. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
PRNG cluster: - xoshiro256: non-zero-state guard checks all four words; :meta uses the unambiguous :state-bits (128 too); :next-raw shape unified (task 4). - Tests: xoro-advanced-test drops the redundant outer `is`; test-state-independence forces its lazy seq with dorun (task 7). - xoro-common gains direct mix / long->unit-float:alt tests; the protocol lifecycle assertions are factored into a shared test-suites/run-prng-protocol-tests used by the 128-jvm, 256-jvm and js test namespaces (task 8). - stateful/PRNG docstring made honest about per-impl thread-safety; prng warns it is not cryptographically secure and flags the fixed default seed; ->uuid validates the seed and throws a clear error on malformed input (tasks 11, 12). Coverage + fixes (task 9): - New tests for eval, tb-var protocol/storage-strategy/var-aggregated, plus crit-comp/routings edge cases. Fixed a real eval/registry-schema bug: bare (invalid) malli :function and unqualified keys -> fn? + ::opti-qualified, so the registry validates against its own schema. iterative.descent quarantined as experimental: stochastic throws "not implemented yet", the unfinished loop kept as a documented sketch, with a test pinning the contract (task 10). Runnable docs (tasks 13, 14): docs/examples/ with a runnable .clj per feature (+ end-to-end) mirrored by .org, and a `bb examples` task that runs them all and fails on any throw. bb bp (format/lint/clj/cljs) and bb examples are green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Rename the JVM-only common helpers (and their test) to *_jvm to mark them platform-specific, and remove the now-unnecessary (:refer-clojure :exclude [next]) from the cljc built-in and xoroshiro128 impls. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
gamma now guards the non-positive integers (0, -1, -2, ...) where Γ is undefined and returns ##NaN there, matching the Apache Commons Math reference, rather than throwing an ArithmeticException. Fix the inv-gamma-1pm1 / log-gamma-1p docstrings ([-0.5;1.5]) and add a gamma-is-nan-at-poles test (green on clj and cljs). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
New auto-opti.rep namespace: a registry mapping a rep-type keyword (e.g. :seed) to a Malli schema, with valid-rep to validate a representation against its type. eval registry entries now use ::opti/rep-type and ::opti/eval-fn (was ::rep/::eval), and eval/eval-map validates the model and builds the evaluation. montecarlo/eval guards a non-numeric model. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Delete the duplicate per-example .clj files. bb examples now extracts the #+begin_src clojure block(s) from each docs/examples/*.org, runs all of a file's blocks in one JVM (shared session, like org-babel against one REPL), and checks each block's stdout against the #+RESULTS: that follows it (lines containing ... are wildcards). Supports multiple blocks per file. Update README to match. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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
Brings branch comp-for-js-pb to a steady state. The headline work is a rework of the PRNG subsystem into a portable + fast-per-platform design, plus a sweep of the tasks.org checklist (comprehensive tests, security docs, runnable examples). The branch also carries earlier refactoring commits that diverge from main (e.g. the time_based → tb_var rename, routings, eval).
PRNG: portable + fast-per-platform variants
registered.
reference-implementation-test).
next-*-fn factories live in xoro-common.
Steady-state checklist (tasks.org)
realized; xoro-common mix/long->unit-float:alt tests; protocol lifecycle assertions factored into one shared suite.
bug (bare invalid Malli :function + unqualified keys → fn? + ::opti-qualified, so the registry validates against its own schema).
made honest; seed input validated (->uuid throws a clear error instead of a downstream NPE).
by a test).
Build/CI wiring
:paths includes src/clj; :test-clj discovers test/clj (excluding ^:benchmark); :cljs-deps carries src/cljs + test/cljs; bb lint covers all source roots.
Test plan
Notes / follow-ups