Skip to content

fix: various bug fixes - #575

Open
MartinuzziFrancesco wants to merge 5 commits into
masterfrom
fm/audit-2026-11-fixes
Open

MartinuzziFrancesco wants to merge 5 commits into
masterfrom
fm/audit-2026-11-fixes

Conversation

@MartinuzziFrancesco

Copy link
Copy Markdown
Collaborator

Checklist

  • Appropriate tests were added
  • Any code changes were done in a way that does not break public API
  • All documentation related to code changes were updated
  • The new code follows the
    contributor guidelines, in particular the SciML Style Guide and
    COLPRAC.
  • Any new documentation only uses public API

Additional context

Add any other context about the problem here.

MartinuzziFrancesco and others added 5 commits November 18, 2026 21:14
DelayLayer with stride > 1 updated its buffer only when clock % stride == 0,
so delayed copies did not sit at a fixed lag. The layer now shifts on every
call and returns h(t), h(t - s), ..., h(t - D*s), matching the NG-RC linear
features (Gauthier 2021, Eq. 5) and the delay ESN equations. stride = 1 is
unchanged. A history of the wrong size now throws a DimensionMismatch.

Also: collectstates docstring is attached to the public method, the chain
collectstates allocates its output with the element type of the first column
(integer input data works), and the stride descriptions in the delay models
and NGRC docstrings describe the new spacing.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
__state_modifier_output_dims for Extend assumed the wrapped op kept the state
width, so a readout built after an Extend of a layer with a different output
size had the wrong in_dims. The width now comes from the op applied to the
state features, including nested Extend.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
reverse_simple_cycle! wrote weight[idx] where simple_cycle! uses weight[idx - 1]
for the same edge convention, so the reverse cycle was shifted by one entry.
true_doublecycle, permutation_init and diagonal_init now convert weights with
T.(...) instead of passing the caller's vector to self_loop! and simple_cycle!,
which overwrote it.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
…nputs

ContinuousESN and SciMLProblemReservoir now throw when a solve or an
autoregressive step does not return a successful retcode, instead of
continuing with a bad state. Autoregressive predict copies initialdata into a
float array of the same kind, so integer inputs work. use_bias and
use_jac_prototype accept Static booleans. Calling ContinuousESN or LSM with
three integers and no tspan or solver now says what arguments are missing
instead of reporting that the extension is not loaded.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
loadpatterns rewrites reservoir_matrix, but EuSNCell does not apply that matrix
directly (it uses reservoir_matrix - reservoir_matrix' - gamma * I), so loaded
patterns would be wrong. It now throws an ArgumentError for EuSNCell.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member

🤖 Automated comment from an AI agent running as @ChrisRackauckas — not written or reviewed by Chris.

PR: #575

Reviewed head: 6f17bf2
Raw SHA-256: 60b80eb797dbd7b972f8c34b31388e163833cd07f0246faa554076729c76618e
Source SHA-256: 6a1265c498bcf1e721764231ee358fab4a868a8e1ea1f0ff7aa57dae4d5671b2
Source: standard-review-v1 (harness-log)
Reviewer session: 01a1ffa9-84a6-7163-b26c-d3dff4436013
Slot: 1
Confidence: unknown
Own risk fixed before author rating/discussion: yes
Redaction: ran (substitutions=0)

Risk assessment

  • Risk: high (H1)
  • Verdict: CHANGES
  • Reviewed head: 6f17bf2

Review report

VERDICT: CHANGES
Round: 1
Head: 6f17bf2
Slot: 1
CI: formatter or lint is not green
Session: 01a1ffa9-84a6-7163-b26c-d3dff4436013
Reviewer: codex-cli 0.170.0; model: gpt-6.2-sol

Risk

high (H1: DelayLayer changes documented output for stride > 1 and rejects saved state in the documented shape)

Blocking findings

  • Blocking priorities: P1, P1, P1, P2, P2
  • [P1] src/layers/basic.jl:305 sizes the result's element type from the first feature column. With ReservoirChain(x -> isinteger(x[1]) ? Int.(x) : x, Collect()) and [1.0 1.25], the base returns [1.0 1.25] and the head throws InexactError: Int64(1.25). With Float32.(x) in the same branch and input [1.0 1.0000000000000002], the head silently stores the second value as 1.0f0. Use storage that can represent subsequent columns and add a mixed-element-type regression alongside the integer-input test.
  • [P1] ext/RCODEReservoirExt.jl:132 converts views to floating point while preserving the element type of dense vectors. In a one-window SciMLProblemReservoir probe with zero initial state and unit readout, the RHS returned derivative 1.0 exactly when the input equaled 9007199254740993. The base predicted 0.9999999999999998 for both [9007199254740993] and a view of it. The head predicted 0.0 for the view. A one-step view of Any[1.0] also passed on the base and now throws MethodError from float(Any). Preserve the seed values when materializing input and choose the feedback representation independently of the seed container. Test both forms against the same analytic prediction.
  • [P1] src/layers/basic.jl:429 and src/layers/basic.jl:449 break the documented DelayLayer contract while Project.toml:4 stays at 0.12.47. For stride=2, num_delays=2 and inputs 1, 2, 3, the third output changes from [3, 2, 0] to [3, 1, 0]. A saved 1×2 state that returned [5, 4, 2] on the base throws DimensionMismatch on the head. This changes the features consumed by existing NGRC and delay ESN readouts. Preserve the current stride mode for a compatible release, or isolate fixed-lag behavior for a 0.13 release with explicit state and retraining requirements.
  • [P2] The signed examples at src/inits/inits_components.jl:622 and src/inits/inits_reservoir.jl:1358 fail as doctests. The documented reverse-edge signs in both are [-1, 1, -1, 1, 1], which the base produced. The head produced [1, -1, 1, -1, 1]. Specify the intended weight-to-edge convention, derive the signed examples from that convention, and rerun the doctests.
  • [P2] src/inits/inits_reservoir.jl:2423 converts weights before applying signs. diagonal_init(Xoshiro(1), UInt8, 4, 4; weight=[1,-2,3,-4], signs=RegularSigns()) produced diagonal [1, 2, 3, 4] on the base and throws InexactError: trunc(UInt8, -2) on the head. Apply signs to a writable copy in the source weight type and convert the signed values on assignment. Cover the ordering in a test and check the same conversion in permutation_init and true_doublecycle.

Non-blocking findings

  • test/inits_tests.jl:465 passes on a completely zero matrix. I evaluated the assertion's predicate with zeros(Float32, 4, 4) and got true. Supply an explicit permutation and compare the complete expected matrix, or assert the expected count of nonzero entries as well as their values.
  • src/conceptors.jl:729 lists the documented ArgumentError cases for loadpatterns. The new EuSN rejection test passed in the Models group. Add the supported reservoir constraint and the EuSN error to the docstring.

What I ran

  • Julia 1.12.4 with the package's resolved test environment and the supplied layered depot. GROUP=All julia --startup-file=no --project -e 'using Pkg; Pkg.test()' finished with Testing ReservoirComputing tests passed. The summaries total 4,071 passing assertions across 37 files. The directly edited test files reported basic 235/235, initializers 940/940, ContinuousESN 82/82, LSM 108/108, SciML ODE reservoir 40/40, conceptors 95/95, and state modifiers 75/75.
  • GROUP=QA julia --startup-file=no --project -e 'using Pkg; Pkg.test()' finished with QA/qa.jl | 41 41 and exit 0.
  • Documenter.doctest(ReservoirComputing; manual=false) with the setup from docs/make.jl passed 2/2 checks at the merge base and reported 1 pass and 1 fail at the head. The failed check reported both signed-example mismatches.
  • Ran matching public API probes with the same dependencies at the merge base and head. I checked mixed-type feature columns, stride=2 output and state reuse, signed initializer weights, and autoregressive predictions with dense, view, and range seeds. The positive Float64 view probe returned [0.4999999999999999 0.7499999999999998] on the head for the analytic response [0.5 0.75].
  • Julia Runic 1.10.0 with --check --diff, typos over the changed files, and git diff --check origin/master...HEAD each exited 0. uv run --locked python --version printed Python 3.13.13 and reported that --locked has no effect outside a project.
  • Separate Core and Models reruns reused the full run's temporary dependency environment. Both stopped with Package SafeTestsets not found in current path after the full run exited and cleaned up that environment. The complete GROUP=All run covered both groups.

What I did not verify

  • CUDA execution, the full HTML docs build, and Julia versions other than 1.12.4. The build host had no CUDA device.
  • Remote CI and author-reported verification were outside the blind review. The CI header records the supplied state.

AUTHOR_GRADE: {"task":"bugfix","score":2,"difficulty":3,"rounds":1,"author_harness":"unknown","author_model":"unknown","note":"The CPU suite and QA pass, but targeted probes found silent numerical changes and API regressions, and two signed examples fail their doctests."}

Head link: 6f17bf2


🤖 Posted by an AI agent — harness: codex-cli 0.170.0 · model: gpt-6.2-sol
Conversation: local session 01a1ffa9-84a6-7163-b26c-d3dff4436013 (no session URL)

This branch has not been deployed

No deployments
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.

2 participants