8000 Tests: hostile boundary conditions · Issue #49 · nixidae/nixidae · GitHub
[go: up one dir, main page]

Skip to content

Tests: hostile boundary conditions #49

Closed
Closed

Description

@Lillecarl

The empty string is already handled well, by _require_filesystem_path.
Extend the same treatment to the other bad inputs.

Scope

  • a store URI with an unknown scheme;
  • a URI parameter that the model rejects;
  • a NixSettings field with a value that Nix rejects;
  • a handle number that the worker never issued;
  • a ValueProxy used after its session closed, and after the worker died.

Depends on

#41 for the worker-death case.

Section 5, item 3.4 of CODE_IMPROVEMENT_PLAN.md.

Activity

  1. Lillecarl commented on Aug 2, 2026

    @Lillecarl
    ContributorAuthor

    Done in b281f185

    tests/nanopynix/test_hostile_inputs.py, 18 tests. The subject is the class
    and the wording, not the fact that a bad input fails — every input here
    already failed somehow. Three answers were wrong:

    1. stores.parse and StoreConfig.uri promise ValueError, and leaked
      UsageError.
      An unknown scheme and an unknown parameter already answered
      ValueError. A URI Nix itself cannot read answered Nix's own UsageError,
      a RuntimeError from the compiled bindings carrying terminal colour codes.
      Which half of the URI was at fault chose the exception class.
    2. The worker answered an evaluator handle it never issued with "no EvalState
      is open — call OpenEval before evaluating".
      One had been opened. Handle
      0 is the wire's "none" and keeps that message; any other number now names
      the handle and says what happened to it.
    3. A settings value Nix refuses left the whole worker behind.
      WorkerClient.open spawns the process, opens the channel and starts the log
      task before Nix is asked to take the settings. Nix refuses, open raises,
      and Python does not run __aexit__ for an __aenter__ that raised — so
      nothing closed any of the three. The worker stayed alive holding a Nix store
      connection nothing in this process remembered.

    The third one was not in the issue. It surfaced as an intermittent failure of
    the settings test: the abandoned channel raised StreamTerminatedError in a
    task nobody awaited, and whether the garbage collector noticed before the test
    ended decided which test the report landed on. That chase also found a second
    leak one layer down, in grpclib-transports: killing a worker left
    LogicalRpcPeer.aclose unable to reap its own reader task, because
    _receive_loop sets _closed in its finally and the guard at the top of
    aclose then made the one call that reaps it a no-op. Fixed upstream in
    84e5fcd6,
    and the flake input is bumped here. Measured: 5 of 5 leaks before, 0 of 5
    after.

    Two answers are recorded as they are rather than corrected, each with the
    reason in the test:

    • An unknown value handle still answers a bare KeyError. Changing it
      changes what crosses boundary B, and WIRE_CLASSES in
      test_exceptions_classify.py with it.
    • An unknown experimental feature still answers a bare RuntimeError.
      nix_util.cpp throws it before Nix is asked, so nothing translates it, and
      tests/nanopynix/bindings/test_util.py pins that as the binding's own
      contract.

    Both are written down where a caller meets them, so the asymmetry is visible
    rather than surprising.

  2. added
    source: nanopynix
    on Oct 19, 2026
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