provide-foundry 2026-03-21
Add pre-commit, memray stress tests, and optimize crossrepo-links regex
15 files · 367+ · 156-

Pre-compiled regex optimization for crossrepo-links plugin

1 file changed
  • crossrepo_links.py Extracted all regex patterns to module-level pre-compiled constants. Consolidated per-package loops (28 individual patterns) into single alternation regexes for markdown and HTML link transforms. Same treatment for nested path fixups (14 patterns to 1). Moved PACKAGES list and NESTED_MAPPINGS dict to module scope.
  • The crossrepo-links plugin now compiles regex patterns once at module load instead of on every page render, and uses single-pass alternation instead of O(n) per-package loops, significantly reducing allocation pressure during large doc builds. streamline architectural
    1 file
    • crossrepo_links.py

Memray allocation stress tests

7 files changed
  • memray_crossrepo_links_stress.py New stress script exercising the regex-heavy link transformation pipeline (200 cycles x 20 pages) with realistic cross-repo markdown.
  • memray_extract_stress.py New stress script for config extraction hot paths (50 cycles of extract_base_mkdocs into temp directories).
  • __init__.py Empty init for memray test package
  • baselines.json Allocation baselines for crossrepo_links and extract stress tests
  • conftest.py Import wrknv memray fixtures
  • test_crossrepo_links_allocations.py Memray allocation regression test for crossrepo-links transforms
  • test_extract_allocations.py Memray allocation regression test for config extraction
  • Memray stress tests guard against allocation regressions in the two hottest code paths: cross-repo link transformation and config extraction. Tests are excluded from default pytest runs via markers. qualify behavioral
    2 files
    • test_crossrepo_links_allocations.py
    • test_extract_allocations.py

Pre-commit config and SPDX lint fixes

3 files changed
  • .pre-commit-config.yaml New pre-commit config with ruff, mypy strict, and standard hooks (trailing-whitespace, end-of-file-fixer, check-yaml, etc.). Includes site/ exclusion for generated docs.
  • add_spdx_headers.py Canonical lint fixes: replace Tuple with tuple, normalize quotes, extract _check_existing_header helper, rename loop variable (E741).
  • validate_spdx_headers.py Normalize quotes, reorder imports, remove year from SPDX header
  • Pre-commit hooks with mypy strict mode enforces type safety on every commit, beyond what ruff catches alone. qualify internal
    1 file
    • .pre-commit-config.yaml

Dependency and config updates

4 files changed
  • pyproject.toml Exclude memray tests from default pytest run, add memray marker
  • uv.lock Upgrade provide-foundation from 0.3.21 to 0.3.21.post1
  • wrknv.toml Add memray task aliases for running stress tests
  • .gitignore Add memray-output/ to gitignore
  • Upgraded provide-foundation to 0.3.21.post1 for latest base utilities. baseline internal
    1 file
    • uv.lock