You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
NixEvaluatorSettings is not accepted where its docstring says it is #56
Both engines render the object with to_worker_settings() and send the whole
result as the eval settings map (inproc/_impl.py:969, rpc/client/_session.py:955). A NixEvaluatorSettings inherits NixFetchSettings too, so the map carries fetch keys, and Nix does not know
them as eval settings.
The same applies to configure() on both engines, and to the fetch_settings
parameter in the other direction.
Scope
Split the object by scope where it is rendered, rather than trusting the
declared parameter type. NixConfigModel.for_scope is the tool: render NixEvalSettings.for_scope(spec) into the eval map and NixFetchSettings.for_scope(spec) into the fetch map, so a caller may pass
either scope or both in one object.
The alternative is to delete the paragraph and reject a NixEvaluatorSettings
at the parameter, but the class exists precisely to be the one object an
evaluator is configured with.
session.eval(store, eval_settings=NixEvaluatorSettings(<one eval field>, <one fetch field>)) opens on both engines, and both settings take effect. configure() with the same object applies both.
Note
Found while working on #35. It is not caused by that change and is not fixed by
it -- the merge there preserves the object type, so the rendering stays as it
is today.
Two findings from the implementation, both widening this slightly beyond the
eval and fetch doors the issue names.
The same defect exists at two more doors
Every narrow settings parameter renders the whole object into one scope's map,
so the defect is not specific to eval_settings/fetch_settings:
door
site (inproc / rpc)
eval_settings
_impl.py:1065, 1110 / _session.py:964, 1033
fetch_settings
_impl.py:1067, 1111 / _session.py:971, 1034
flake_settings
_impl.py:1243, 1268 / _session.py:1144, 1239
set_settings
_impl.py:617 / session.py:361
NixSettings is a subclass of each narrow scope class, so each parameter
accepts one. The fix covers all four, because one shared helper is less code
than four separate corrections.
A field that no door on the call owns
Narrowing alone would drop such a field in silence, which is what SettingNotLiveError and #37 exist to prevent. There is now a SettingOutOfScopeError, a sibling of SettingNotLiveError under ObjectMisuseError: that one means the wrong moment, this one means the
wrong door.
It also replaces a misleading message. Measured before the change:
Nix named experimental-features, which the caller never set, because NixSettings gives that field a default. The check reads model_fields_set,
so a default alone never trips it, and it runs before the merge with the
session defaults -- fill_unset_fields uses model_copy(update=...), and that
marks a filled default as set.
set_settings narrows the rendered map, not the model
NixConfigModel.for_scope re-validates, and that promotes a default to an
explicitly-set field. Measured:
set_settings renders with explicit_only=True precisely so that writing one
field does not reset the feature list. Narrowing that door by model would undo
it, so that door filters the rendered mapping instead.
Side effect: set_settings(NixSettings(max_jobs=3)) now works, where it used
to fail with unknown setting: pure-eval.
Verification
All twelve new test cases fail with the fix removed, and none of them passes.
The four root causes are exactly the defect in its four shapes:
6x RuntimeError: unknown eval setting: allow-dirty # fetch half at the eval door
2x RuntimeError: unknown fetch setting: pure-eval # eval half at the fetch door
2x Failed: DID NOT RAISE SettingOutOfScopeError # the refusal
2x RuntimeError: unknown setting: pure-eval # the global door
Activity
Lillecarl commentedon Aug 1, 2026
Two findings from the implementation, both widening this slightly beyond the
eval and fetch doors the issue names.
The same defect exists at two more doors
Every narrow settings parameter renders the whole object into one scope's map,
so the defect is not specific to
eval_settings/fetch_settings:eval_settings_impl.py:1065,1110/_session.py:964,1033fetch_settings_impl.py:1067,1111/_session.py:971,1034flake_settings_impl.py:1243,1268/_session.py:1144,1239set_settings_impl.py:617/session.py:361NixSettingsis a subclass of each narrow scope class, so each parameteraccepts one. The fix covers all four, because one shared helper is less code
than four separate corrections.
A field that no door on the call owns
Narrowing alone would drop such a field in silence, which is what
SettingNotLiveErrorand #37 exist to prevent. There is now aSettingOutOfScopeError, a sibling ofSettingNotLiveErrorunderObjectMisuseError: that one means the wrong moment, this one means thewrong door.
It also replaces a misleading message. Measured before the change:
Nix named
experimental-features, which the caller never set, becauseNixSettingsgives that field a default. The check readsmodel_fields_set,so a default alone never trips it, and it runs before the merge with the
session defaults --
fill_unset_fieldsusesmodel_copy(update=...), and thatmarks a filled default as set.
set_settingsnarrows the rendered map, not the modelNixConfigModel.for_scopere-validates, and that promotes a default to anexplicitly-set field. Measured:
set_settingsrenders withexplicit_only=Trueprecisely so that writing onefield does not reset the feature list. Narrowing that door by model would undo
it, so that door filters the rendered mapping instead.
Side effect:
set_settings(NixSettings(max_jobs=3))now works, where it usedto fail with
unknown setting: pure-eval.Verification
All twelve new test cases fail with the fix removed, and none of them passes.
The four root causes are exactly the defect in its four shapes:
fix(settings): route each scope to the door that owns it