Skip to content

fix(tests): the composition perf test scans its own tree, not pytest's shared temp root - #691

Merged
fas89 merged 1 commit into
mainfrom
fix/composition-perf-test-owns-its-tree
Oct 3, 2026
Merged

fas89 merged 1 commit into
mainfrom
fix/composition-perf-test-owns-its-tree

Conversation

@fas89

@fas89 fas89 commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator

Why

test_for_contract_perf_bound_shallow_path failed the Coverage & Audit run on main after the 0.18.0 PRs merged. The composition scan took 10.50 s against a 10 s bound.

The test placed its workspace directly in tmp_path, which is a shallow path with no boundary marker. The ancestor walk therefore took tmp_path's parents as scan roots. Those are pytest's per-worker and per-session temp roots, which hold every *.fluid.yaml written by every earlier test. The scan time grew with the suite, and #687, #688 and #689 added many contract-writing tests. The product code is unchanged: the scan parses with load_yaml_safe only, and product_types.py was not touched by those PRs.

What

The workspace now sits _MAX_ANCESTOR_LEVELS below tmp_path. The capped walk still crosses marker-less ancestors up to the cap, which is what the test is for, but it ends at tmp_path. The test asserts this through _resolve_scan_roots.

Tested

  • tests/test_composition_workspace_scan.py: 22 passed. The perf test takes about 1 s.
  • Negative control: with the old placement, the new assertion fails, and the scan takes 19 s locally on a well-used temp tree.
  • ruff passes, and black==24.10.0 --check passes.

Documentation

  • No docs needed: test-only change.

…s shared temp root

test_for_contract_perf_bound_shallow_path put the workspace directly in
tmp_path. Its marker-less ancestor walk then took tmp_path's parents as
scan roots: pytest's per-worker and per-session temp roots, which hold
every contract written by every test that ran before it. The scan time
therefore grew with the suite and failed the 10 s bound on main's
Coverage & Audit run (10.50 s) after the 0.18.0 PRs added many
contract-writing tests; locally the old placement takes 19 s.

The workspace now sits _MAX_ANCESTOR_LEVELS below tmp_path, so the
capped walk still crosses marker-less ancestors but ends at tmp_path, and
the test asserts that. It runs in about 1 s; reverting the placement fails
the new assertion.
@github-actions github-actions Bot added tests Test coverage or test infrastructure changes needs-docs Pull request needs a linked docs update or justification labels Oct 3, 2026
@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown

📄 Documentation Reminder

This PR appears to be missing a documentation reference. Our docs live in a separate repo.

Please update the PR description with one of:

  • Link a docs PR — check the "Docs PR linked" box and paste the URL
  • Mark as no docs needed — check "No docs needed" with a justification
  • Acknowledge docs TODO — check "Docs TODO" and create the docs PR before merge

See the Contributing Guide for details.

@fas89
fas89 merged commit a8bbf6b into main Oct 3, 2026
32 checks passed
@fas89
fas89 deleted the fix/composition-perf-test-owns-its-tree branch October 3, 2026 00:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-docs Pull request needs a linked docs update or justification tests Test coverage or test infrastructure changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant