8000 RPC: the worker does not enforce the construction-time settings guard · Issue #37 · nixidae/nixidae · GitHub
[go: up one dir, main page]

Skip to content

RPC: the worker does not enforce the construction-time settings guard #37

Closed

Description

@Lillecarl

The docstring of reject_construction_time_keys (settings.py:101) says:

Both engines check before they send, and the worker checks again, so nothing
can slip past by building a request by hand.

The worker does not check. The guarantee is false at the protocol level.

Evidence

NixCore.configure_eval_state (_core/_nix_core.py:154) is the function that
performs the worker-side check. It has no production caller. The module
docstring of tests/nanopynix/core/test_nix_core_unit.py says so: "nothing
currently calls configure_eval_state".

The worker handler calls the other method.
EvalServiceHandler.configure_eval (rpc/worker/_worker_eval.py:258) calls
CoreEvalState.configure (_core/_objects.py:493), which applies both maps
with no check at all.

Measured:

public configure(pure_eval=True):      refused (SettingNotLiveError)
hand-built ConfigureEval(pure-eval):   ACCEPTED by worker

The existing unit test does not close the gap. It passes {"a": "1"}, which is
not a Nix setting, so the test passes whether the guard runs or not.

Why it matters

The client guard gives a good message. The worker guard makes the property
true of the protocol rather than of one client. A second client, or a
caller that reaches session._manager.eval_stub directly, gets the old
silent-drop behaviour.

Scope

  • Delete NixCore.configure_eval_state.
  • Put the two reject_construction_time_keys calls at the top of
    CoreEvalState.configure, where the call already goes.
  • Delete the EvalSettingsTarget protocol and its static-assertion helper.

Files

_core/_objects.py, _core/_nix_core.py,
tests/nanopynix/core/test_nix_core_unit.py.

Risk

Low.

Acceptance criteria

A hand-built ConfigureEvalRequest that carries pure-eval is refused by the
worker.

Tests

Rewrite the unit test to use a real construction-time key. Add an rpc test that
builds the request directly and expects a refusal.

Compatibility

This breaks only a caller that bypasses the public API. configure() itself
does not change: it already refuses.

Finding F2 of CODE_IMPROVEMENT_PLAN.md.

Metadata

Metadata

Assignees

No one assigned

    Labels

    source: nanopynix

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0