Skip to content

Workflow contract selector test exceeds Windows fast-unit budget #9729

Description

@tianmind-studio

Product impact

  • Primary loop layer: Docs-Tooling
  • Involves data loss, failed capture, or broken sync/trust

Describe the bug

backend/tests/unit/test_workflow_contracts.py::test_workflow_contract_sources_select_adjacent_tests repeatedly exceeds the local 0.12-second fast-unit CPU budget on Windows even though every assertion passes.

To reproduce

  1. On Windows, select tests/unit/test_workflow_contracts.py through backend/test.sh with the default local duration guard.
  2. Observe all 19 tests pass.
  3. Observe the session still exits 1 because test_workflow_contract_sources_select_adjacent_tests measures approximately 0.12-0.14 seconds of call-phase CPU.

Current behavior

The workflow-contract test file loads select_backend_unit_tests.py and scans the full discovered test inventory independently in seven test calls. The slow test then evaluates 19 source-path cases on top of that repeated setup. Windows filesystem/path processing pushes the call just over the strict local threshold, blocking unrelated pre-push runs.

Expected behavior

Shared selector loading and test discovery should run once as module-scoped test setup. Individual contract assertions should remain under the existing strict budget without adding a global allowlist exception or raising the threshold.

Environment

  • Windows 11
  • Python 3.11.15
  • pytest 8.4.1

Additional context

The duration guard intentionally measures only the call phase so shared setup is not misattributed as a per-test regression. Reusing a module-scoped fixture follows that contract and also reduces total file runtime.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions