8000 Settings: merge session-level eval, fetch and flake defaults · Issue #36 · nixidae/nixidae · GitHub
[go: up one dir, main page]

Skip to content

Settings: merge session-level eval, fetch and flake defaults #36

Closed

Description

@Lillecarl

Session-scoped defaults exist for stores and for nothing else.

Evidence

resolve_store_spec (nanopynix/src/nanopynix/stores.py:529) merges
NixStoreDefaults under a store model, and both engines call it. There is no
equivalent for the evaluator, fetcher or flake settings.
EvalSession.open on both engines reads the per-evaluator argument only.

A caller who wants every evaluator in a session to be pure must repeat
eval_settings= at every session.eval(...) call. There is no way to state
it once.

Scope

Write one merge helper, and use it four times:

def merge_defaults[M: NixConfigModel](spec: M | None, defaults: M | None) -> M | None:
    """Fill the fields ``spec`` did not set from ``defaults``. A set field wins."""

resolve_store_spec becomes its store-shaped caller. Session.eval,
Session.repl, EvalSession.lock_flake and EvalSession.eval_flake become
the other three.

Files

settings.py, stores.py, inproc/_impl.py, rpc/client/session.py,
rpc/client/_session.py.

Depends on

#35

Risk

Low. A field set on the call always wins, so nothing that works today changes.

Acceptance criteria

A session opened with pure_eval=True produces a pure evaluator from a bare
session.eval(store). A per-call
eval_settings=NixEvalSettings(pure_eval=False) overrides the default.

Tests

Two cases for each scope, on both engines: the default applies, and the
override wins.

Finding F8 of CODE_IMPROVEMENT_PLAN.md.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    source: nanopynix

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0