Skip to content

[Feature] Add regression tests for _classify_worker_death() and probe_capabilities() Windows platform guards #97

Description

@Harshitmishra001

Describe the bug

There is no existing test coverage for _classify_worker_death() in src/nooa/runtime/sandbox/executor.py or for the platform-guard behaviour of probe_capabilities() / apply_rlimits() in src/nooa/runtime/sandbox/guards.py.

Both functions were patched in #92 to guard against missing POSIX-only constants (signal.SIGXCPU, signal.SIGKILL) and the missing resource module on Windows. Without regression tests, any future refactor could silently revert those guards and the bugs would return undetected — CI would not catch it because the suite runs only on Linux today (see #95).

What's missing

  • No test calls _classify_worker_death() with a simulated Windows environment (i.e. signal.SIGXCPU / signal.SIGKILL absent).
  • No test calls probe_capabilities() with resource absent and asserts rlimit=False is returned instead of a crash.
  • No test calls apply_rlimits() with resource absent and asserts it returns early rather than raising ModuleNotFoundError.

Confirmed by searching tests/ — zero hits for _classify_worker_death, SIGXCPU, SIGKILL, or WorkerDiedError in a death-classification context.

Expected behavior

Regression tests that:

  1. Use monkeypatch.delattr to simulate a Windows signal module (remove SIGXCPU and SIGKILL) and assert _classify_worker_death() falls through cleanly without raising AttributeError.
  2. Use monkeypatch to make import resource raise ImportError and assert probe_capabilities() returns Capabilities(..., rlimit=False) without crashing.
  3. Same for apply_rlimits() — assert it returns early when resource is unavailable.

Environment

  • Not platform-specific — these tests should run on Linux CI using monkeypatch to simulate the missing platform attributes.

Additional context

This is a follow-up to #92. The fixes and these regression tests will be submitted together in a single PR so the guards and their verification land atomically.

No code change is needed in the production files — only new test cases in tests/test_sandbox.py or a new tests/runtime/sandbox/test_guards_windows.py.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions