Skip to content

Retire EnvLock rather than restore its synchronisation unit tests #321

Description

@coderabbitai

Rescoped 2026-08-01

This issue originally asked to restore unit tests covering ensure_env_lock() idempotency and Drop-based CWD restoration, removed in #273. That work is no longer wanted: AGENTS.md now forbids in-process environment mutation in tests and explicitly disqualifies process-wide locks as a fallback. Adding coverage for EnvLock would entrench the mechanism being retired.

The original text is preserved below for the record.

Required work

Retire EnvLock rather than test it.

This issue now stands for the decision — that EnvLock is retired rather than hardened — and closes when #494 closes.

Why the synchronisation properties no longer need coverage

The two properties named in the original issue are properties of the lock, not of Netsuke. Once the lock has no callers, ensure_env_lock idempotency is vacuous and CWD restoration is handled by the scenarios that no longer change the working directory at all (#492).


Original issue text

Summary

PR #273 removed the #[cfg(test)] mod tests block from tests/bdd/fixtures/mod.rs that previously validated ensure_env_lock() and Drop CWD restoration behaviour. This leaves the EnvLock guard untested at the unit level, which is a risk given that BDD tests rely on it for process-wide environment isolation.

Context

The removed block validated:

  • ensure_env_lock() is idempotent when the lock is already held
  • The Drop implementation restores the original working directory

These are synchronisation correctness properties and should be covered by dedicated unit tests.

Proposed work

Backlinks

Activity

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

Metadata

Metadata

Assignees

Labels

concurrencyConcurrency, parallelism, and synchronization work, including races and deadlocks.mediumRoadmap items to schedule within the current quarter. Clear scope, normal review cycles.refactorBehaviour-preserving restructuring that improves code health.testingTest coverage, test infrastructure, and verification tooling work.

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions