kScenarios documents ising as taking a nested params object, but run_scenario rejects that shape

Open
#352 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
cpp, rust
Domain
api, backend

Research direction

Start with the ising entry in kScenarios, then trace how the scenario catalog is generated from the Rust request type and how flattened parameters are represented. Compare it with ising_wolff and the schrodinger entry to identify the intended parameter shapes. Done means the catalog exposes the fields accepted by Session::run_scenario; verify with the documented repro and the existing scenario tests.

Written by the indexing model from the issue text.

Description

area/simulation good first issue help wanted kind/doc-mismatch severity/4-minor

The kScenarios entry for ising says the request reads a nested params object plus seed, but Session::run_scenario("ising", ...) rejects that shape and only accepts the flat width/height/temperature/mc_steps/seed object — so the catalog's parameter list is unusable for the one scenario that needs it.

// repro.cpp
#include <cstdio>
#include "rssn/client.hpp"
#include "rssn/scenarios.hpp"
using namespace rssn::client;
static void run(const char *label, const char *params) {
  try { std::printf("%-18s OK  %s\n", label, Session::run_scenario("ising", params).substr(0,30).c_str()); }
  catch (const Error &e) { std::printf("%-18s %s: %s\n", label, status_name(e.status()), e.what()); }
}
int main() {
  std::printf("params = \"%s\"\n", lookup_scenario("ising")->params);
  run("documented", R"({"params":{"width":8,"height":8,"temperature":2.0,"mc_steps":10},"seed":3})");
  run("flat",       R"({"width":8,"height":8,"temperature":2.0,"mc_steps":10,"seed":3})");
}

Actual output (twice, identical):

params = "params:ising_statistical::IsingParameters; seed:int|null"
documented         simulation: invalid parameters: missing field `width` at line 1 column 74
flat               OK  {"magnetization":0.84375,"spi

Why it is wrong: ScenarioDef::params is documented as "the parameters its request type reads, as field:type[=default] separated by ;", and run_scenario "takes the name and a JSON object of those parameters" (scenarios.hpp:11-19). Following the ising entry produces a request the engine rejects; the flat object is what works, and it is the only place width, height, temperature and mc_steps are discoverable (the README example passes them, the catalog does not mention them). For comparison, schrodinger genuinely does read a nested params ({"params":{...}} gets past that field and fails later on ny), so ising is the odd one out rather than a deliberate convention.

Mechanism: the entry is generated from the Rust request type, where IsingParameters is a flattened/#[serde(flatten)]-style member, so the generator emitted the type name instead of the fields it contributes — the same reason ising_wolff (which lists width:int; height:int; ... explicitly) is correct while ising is not.

rssn 0.3.0, C++ client (header-only) over the release C library, Windows x86_64.

Dominant language
Rust
Stars
36
Forks
3
Avg merge
14h 51m
Merged PRs (30d)
29

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Apich-Organization/rssn

All issues in Apich-Organization/rssn

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.