Skip to content

fix: metadata["boundary"] documents trial 0 on all code paths - #316

Merged
AlexanderFengler merged 4 commits into
mainfrom
315-boundary-metadata-trial0
Aug 3, 2026
Merged

fix: metadata["boundary"] documents trial 0 on all code paths#316
AlexanderFengler merged 4 commits into
mainfrom
315-boundary-metadata-trial0

Conversation

@AlexanderFengler

@AlexanderFengler AlexanderFengler commented Aug 2, 2026

Copy link
Copy Markdown
Member

Closes #315

What was wrong

  • With multi-row θ, the sequential flexbound kernels returned the scratch boundary buffer in full-return metadata — i.e. the last trial's boundary — while metadata["trajectory"] (and the per-trial arrays t, z, ...) described trial 0.
  • 4 parallel dispatcher kernels already returned boundaries_all_np[0], so metadata["boundary"] silently depended on the code path (n_threads) taken.

The fix

  • Every flexbound kernel now recomputes the trial-0 boundary into the existing scratch buffer immediately before metadata assembly (19 sites across ddm_models, sequential_models, race_models, levy_models, ornstein_models, parallel_models).
  • No signature or shape changes; a no-op for single-trial calls; the already-correct dispatcher sites and addm are untouched.

Tests

  • New tests/test_metadata_boundary_trial0.py: one model per touched kernel family (angle, weibull_cdf, ddm_seq2_angle_no_bias, race_no_bias_angle_4, levy_angle, ornstein_angle, ddm_par2_angle_no_bias), asserting (1) multi-trial boundary == single-row trial-0 boundary, (2) reversed row order flips the result (contract is "first row", not coincidence), (3) n_threads=1 vs n_threads=4 give identical boundary metadata. 17/21 of these fail on current main.

Docs

  • simulator() docstring now states the contract: with full metadata, boundary and trajectory describe trial 0 (first row of θ); per-trial parameter arrays remain full-length. Previously last-trial on sequential paths.

Downstream

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Corrected full-output metadata so boundary and trajectory information consistently describe the first trial.
    • Ensured sequential and parallel simulations report matching boundary metadata.
    • Prevented boundary metadata errors when simulations contain no trials.
  • Documentation

    • Clarified that full-output boundary and trajectory fields refer to trial 0, while per-trial parameters remain unchanged.
  • Tests

    • Added regression coverage across simulator types, including multi-trial results and reordered parameter sets.

AlexanderFengler and others added 3 commits August 2, 2026 16:19
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…path (#315)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@AlexanderFengler, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 1 minute

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ba717a9c-a82e-4b9c-9938-59ed8d77a6bd

📥 Commits

Reviewing files that changed from the base of the PR and between 913ba05 and 43391b8.

📒 Files selected for processing (1)
  • pyproject.toml
📝 Walkthrough

Walkthrough

The simulator kernels now recompute full-result metadata boundaries from trial 0 parameters when trials exist. The simulator documentation defines trial 0 scope for boundary and trajectory metadata. Regression tests cover multiple kernel families and execution modes.

Changes

Metadata boundary alignment

Layer / File(s) Summary
Kernel metadata boundary reconciliation
src/cssm/ddm_models.pyx, src/cssm/levy_models.pyx, src/cssm/ornstein_models.pyx, src/cssm/parallel_models.pyx, src/cssm/race_models.pyx, src/cssm/sequential_models.pyx
Full metadata paths recompute boundary from trial 0 parameters when n_trials > 0.
Metadata contract and regression validation
ssms/basic_simulators/simulator.py, tests/test_metadata_boundary_trial0.py
The documentation defines trial 0 metadata scope. Tests verify trial ordering, model-specific boundaries, and sequential versus parallel consistency.

Estimated code review effort: 2 (Simple) | ~15 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the primary change: metadata boundary now consistently documents trial 0 across all code paths.
Linked Issues check ✅ Passed The changes satisfy issue #315 by aligning boundary metadata with trial 0 across kernels, documenting the contract, and adding regression tests.
Out of Scope Changes check ✅ Passed All code, documentation, and test changes directly support the trial-0 metadata consistency objective in issue #315.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 315-boundary-metadata-trial0

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

ruff 0.16 expands the default lint rules and formats markdown code
fences: ~300 findings appear in files this PR never touches, and any
fresh PR fails 'Check styling'/'Linting' regardless of content (main
last passed run_tests on July 16, before the 0.16 release). Pin to the
0.15 series that main actually passes; the 0.16 migration is filed
separately.
@codecov

codecov Bot commented Aug 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
unittests 94.08% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
ssms/basic_simulators/simulator.py 89.53% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@AlexanderFengler
AlexanderFengler merged commit e5b87eb into main Aug 3, 2026
14 checks passed
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.

Simulator metadata mixes trials: boundary is the last trial's scratch buffer, trajectory is trial 0's

1 participant