From bd704113374a890992e9161416f57dc6abc04a34 Mon Sep 17 00:00:00 2001 From: Timothy Wayne Gregg Date: Thu, 12 Nov 2026 21:46:34 -0500 Subject: [PATCH 1/2] Document exact pins versus floating dependencies List every exact pin and bounded range declared in pyproject.toml and the gateway example requirements, state that transitive packages are unpinned and unhashed, that CI resolves fresh on every run, and that no lock file exists. Link the section from the README and add a regression test that derives the expected list from pyproject.toml. Refresh the three touched MANIFEST entries. Refs #50 Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 3 +++ MANIFEST.sha256 | 6 ++--- README.md | 7 +++-- docs/INTEGRATIONS.md | 44 ++++++++++++++++++++++++++++++++ tests/test_packaging_metadata.py | 38 +++++++++++++++++++++++++++ 5 files changed, 93 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 32060bd..7cd7ddb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ (approved endpoint policy). A worker whose `.env.local` points routes 3-5 at any other host, port or path now fails at startup, before any credential is sent. Redirects are refused and errors never echo the configured URL (#88). +- Documented which dependencies are exact pins and which float (bounded ranges, unpinned + transitive packages, fresh CI resolution, no lock file) in `docs/INTEGRATIONS.md`, linked from + the README, with a regression test against `pyproject.toml` (#50). No lock was generated. - Frozen hierarchy artifacts are now checked for lexical scope on load: node origins must match their export chain, references, `after` edges, and finals may not cross subgraph scopes (except through the inputs an export passes down), and exports must have descendant nodes (#85). diff --git a/MANIFEST.sha256 b/MANIFEST.sha256 index e26ec3b..8bfe13b 100644 --- a/MANIFEST.sha256 +++ b/MANIFEST.sha256 @@ -4,7 +4,7 @@ b4a064c3a119736216efaca4188b17c9829ba8fef12312ea1c067d3fe638b0e4 .github/workfl 30a02d4b567c1cb152c54ec29668d31a69f069e1b7cfd4aad770e37f45024431 AGENTS.md 2e7d278cb4a2bad1de30725a7d02b20d44e88891396f51ac046711923ba51409 CLAUDE.md db67f4a91a30e84b4ce631a2ce4fdc4bf85496cadbe385f166744f51b3ff4a96 LICENSE -e0347533deea5611b88b486299c3985fa9c3c02682fce97abbee6a823796cf64 README.md +42811d5e0839f9ac12ea32b0f723cb729a00c36ca9a126a9517a5bd5e33d4b96 README.md 0c5aa6eeeb0e20ce2dbd26ee69176abcc36d00d91625f418f8a9e3ee8e349095 SETUP_PROMPT.md 243306f74235bd6dfd3cc137955604e526bf9ac0c93179574c27b4ddbf3d602f assets/banner.jpg 9083ffe0453986d4185e3af9592ad161c6ad33d802f154985d7aa4628efdc707 docs/ARCHITECTURE.md @@ -12,7 +12,7 @@ ede994551e3cc7a86aa7cf23a51a195bad3f14d8702fa304a4f9bec402041648 docs/BANKING77 9cce65e0f71299b5dfa8091c98be142e8144a3dae0db2859a494fadfca0ff5ab docs/BANKING77_VERIFICATION.md b66a6567a03354429a8adec2fbdc8fd273a7c00074d746b4116a8834d5889931 docs/BUILD_REPORT.md 4456edea5047efa737fd81b9fa5ba4d2437d5a06bf00406d2b901e6de7b1add6 docs/EXPERIMENTS.md -576b71c24ab77ccaa60b5489e684bbadcb6cb1c3e84df3d361ba2b9177ed4eee docs/INTEGRATIONS.md +4b53bac3d638c6fb826a920521b588b19a284c1fd4aa8890b21c70b97d9a2d9b docs/INTEGRATIONS.md 3edc2de2ce0406f7a900f2f690100bc89462065ba84e6942f9b797fbceece623 docs/RESEARCH_BENCHMARKS.md 28381a3b13778a9d077a88130db7ba560bd837122c1b3b8afa563c099530480c docs/RESEARCH_BENCHMARKS_VERIFICATION.md 1f08cae6a606cefdb53fc75df194cae15059f5abaf47d0af72c66db66a0dd55b docs/ROADMAP.md @@ -79,7 +79,7 @@ e40ffc5c7ab75bdc33cdc2e225e3cc9648b7a1c66fbdaeb2f1fd2c0b39205466 tests/test_ban be3fc236651af314a33cf3f42e439c59e4c6ead83da7afb2e914b17b11768c5f tests/test_metrics_compiler.py b89d27b911461abd1c734b0ce85eecae367d4ad1ac15a13652013531a6868037 tests/test_optimization_adapters.py 0af57a704a04ca473e892f387fa09d6917d05f3d97b1b55031124e4427008e56 tests/test_optional_integrations.py -0fa9ad363fdd99d3ade00ab7c5bd2dc26fe8f65f15a484b602516678fe8a13ad tests/test_packaging_metadata.py +2c9f6add6fa5f914825c499010f7b797d467f843530494ab1f1c93c54b58b36c tests/test_packaging_metadata.py 2768020caca9fb67bb02456f90d04d50f5edeab19a0cface5b7820dc585863b9 tests/test_research.py a41a84b814e9039202d921ce575825f9b902de4be1d34970fe58bfeb3c993008 tests/test_research_teacher.py c00e5859d7a50540e4dab72ee24b7a91c53d85f4bef5ef30aeb089c7fffcfb41 tests/test_runtime_backends.py diff --git a/README.md b/README.md index c11eaef..bb42d7e 100644 --- a/README.md +++ b/README.md @@ -145,9 +145,12 @@ typewright doctor --check-optional # checks installed interfaces; never calls ``` These pins are integration targets, **not a fully resolved dependency lock**. +Only `typesafe-sdk`, `gepa`, and DSPy in the `compile` and `all` extras are +exact pins; everything else, including the `optimize` DSPy range and all +transitive packages, floats. The full list is in +[Pinned and floating dependencies](docs/INTEGRATIONS.md#pinned-and-floating-dependencies). Generate a lock in your own verified environment before reproducible live -experiments. See [docs/INTEGRATIONS.md](docs/INTEGRATIONS.md) and -[docs/SOURCES.md](docs/SOURCES.md). +experiments. See also [docs/SOURCES.md](docs/SOURCES.md). ## Declare a use case diff --git a/docs/INTEGRATIONS.md b/docs/INTEGRATIONS.md index db4e19e..09dcf2f 100644 --- a/docs/INTEGRATIONS.md +++ b/docs/INTEGRATIONS.md @@ -17,6 +17,50 @@ may fail on a different Python/platform/provider combination. Verify against primary documentation and change pins with regression tests rather than silently installing an arbitrary newest version. +## Pinned and floating dependencies + +There is no lock file in this repository and none was fabricated. The declared +requirements in `pyproject.toml` and `examples/ai-gateway/requirements.txt` are +the whole story; nothing is hashed. + +Exact pins (`==`), resolved to that version only: + +| Requirement | Declared in | +|---|---| +| `typesafe-sdk==0.7.0` | `live`, `compile`, `all` extras | +| `dspy[typesafe]==3.4.0` | `compile` extra | +| `dspy[litellm,typesafe]==3.4.0` | `all` extra | +| `gepa==0.1.4` | `optimize`, `all` extras | + +Bounded ranges, which float to the newest release inside the range at install time: + +| Requirement | Declared in | +|---|---| +| `pydantic>=2.10,<3` | base dependencies | +| `PyYAML>=6.0,<7` | base dependencies | +| `dspy[litellm]>=3.3.1,<3.5` | `optimize` extra | +| `numpy>=1.26,<3` | `research` extra | +| `matplotlib>=3.8,<4` | `research` extra | +| `pytest>=8,<10` | `dev`, `all` extras | +| `pytest-cov>=5,<8` | `dev`, `all` extras | +| `ruff>=0.11,<1` | `dev` extra | +| `build>=1,<2` | `dev` extra | +| `httpx>=0.28,<1` | `examples/ai-gateway/requirements.txt` | +| `python-dotenv>=1.0,<2` | `examples/ai-gateway/requirements.txt` | + +The build backend requirements (`setuptools>=77`, `wheel`) have a lower bound or +no bound at all. + +Transitive dependencies are not pinned or hashed. Everything the SDKs, DSPy, and +GEPA pull in, such as `litellm` through `dspy[litellm]`, resolves to whatever the +installer picks on the day, subject only to those packages' own constraints. CI (`.github/workflows/ci.yml`) resolves fresh on every run: the +core job installs `.[dev]` plus the gateway requirements, and the optional job +installs `.[all,dev]` and then reinstalls `dspy[litellm]==` and +`gepa==0.1.4` for each end of the supported DSPy range. A passing run therefore +describes the versions resolved for that run, not a reproducible environment. +Generate and record your own lock in a verified environment before reproducible +live experiments. + ## DSPy 3.3.1 and 3.4.x (issue #90) The supported range is `>=3.3.1,<3.5`, with `gepa==0.1.4` pinned (DSPy 3.4.0 resolves diff --git a/tests/test_packaging_metadata.py b/tests/test_packaging_metadata.py index 45feb20..bcc4a6d 100644 --- a/tests/test_packaging_metadata.py +++ b/tests/test_packaging_metadata.py @@ -54,3 +54,41 @@ def test_checked_in_json_schemas_match_the_models(): for name, model in expected.items(): stored = json.loads((directory / name).read_text(encoding="utf-8")) assert stored == model.model_json_schema(), f"{name} is stale; run `typewright schema --out schemas`" + + +def _dependency_section(): + text = (ROOT / "docs" / "INTEGRATIONS.md").read_text(encoding="utf-8") + start = text.index("## Pinned and floating dependencies") + end = text.index("\n## ", start + 1) + return text[start:end] + + +def _declared_requirements(pyproject): + project = pyproject["project"] + declared = list(project["dependencies"]) + for requirements in project["optional-dependencies"].values(): + declared.extend(requirements) + gateway = (ROOT / "examples" / "ai-gateway" / "requirements.txt").read_text(encoding="utf-8") + declared.extend(line.strip() for line in gateway.splitlines() + if line.strip() and not line.strip().startswith("#")) + return set(declared) + + +def test_dependency_doc_lists_every_declared_exact_pin_and_range(pyproject): + # Expectations come from pyproject.toml and the gateway requirements, not from the doc (#50). + section = _dependency_section() + exact_heading = section.index("Exact pins") + range_heading = section.index("Bounded ranges") + exact_block, range_block = section[exact_heading:range_heading], section[range_heading:] + for requirement in _declared_requirements(pyproject): + if "==" in requirement: + assert f"`{requirement}`" in exact_block, f"{requirement} missing from documented exact pins" + else: + assert f"`{requirement}`" in range_block, f"{requirement} missing from documented ranges" + + +def test_dependency_doc_matches_absence_of_lock_file(): + lock_names = ("uv.lock", "poetry.lock", "Pipfile.lock", "pdm.lock", "pylock.toml", + "requirements.lock", "constraints.txt") + assert not [name for name in lock_names if (ROOT / name).exists()], "Lock file present; update #50 docs." + assert "no lock file" in _dependency_section().lower() From 701169d97d270be4bd129412a011563698238558 Mon Sep 17 00:00:00 2001 From: Timothy Wayne Gregg Date: Thu, 12 Nov 2026 21:54:33 -0500 Subject: [PATCH 2/2] Scope lock claims to the Python package and test every lock-like file The dependency section said the repository has no lock file, but it tracks the npm lock for the Node gateway smoke (ai pinned at 7.0.114, integrity hashes) and a stale Windows/CPython 3.13 pip freeze in reports/. Scope the claim to the Python package, name both files with their scope, and mark the freeze as historical and not authoritative. The lock test now walks the source tree (skipping ignored and local-only directories) for lock-like names and requires each to be named in the section. The table test also checks the Declared in column against pyproject extras, and a new test ties the build-system sentence to [build-system].requires and the npm pins to package.json. Refs #50 Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 10 ++- MANIFEST.sha256 | 6 +- README.md | 10 ++- docs/INTEGRATIONS.md | 29 ++++++-- tests/test_packaging_metadata.py | 112 +++++++++++++++++++++++++------ 5 files changed, 131 insertions(+), 36 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7cd7ddb..50a5e7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,9 +6,13 @@ (approved endpoint policy). A worker whose `.env.local` points routes 3-5 at any other host, port or path now fails at startup, before any credential is sent. Redirects are refused and errors never echo the configured URL (#88). -- Documented which dependencies are exact pins and which float (bounded ranges, unpinned - transitive packages, fresh CI resolution, no lock file) in `docs/INTEGRATIONS.md`, linked from - the README, with a regression test against `pyproject.toml` (#50). No lock was generated. +- Documented which Python dependencies are exact pins and which float (bounded ranges, unpinned + transitive packages, fresh CI resolution, no current resolved Python lock) in + `docs/INTEGRATIONS.md`, linked from the README. The section also names the two tracked lock-like + files and their scope: the npm lock for the Node gateway smoke (`ai` pinned at `7.0.114`) and the + stale, Windows/CPython 3.13-only historical freeze in `reports/`. Regression tests check the + tables against `pyproject.toml` and require every lock-like file in the tree to be named (#50). + No lock was generated. - Frozen hierarchy artifacts are now checked for lexical scope on load: node origins must match their export chain, references, `after` edges, and finals may not cross subgraph scopes (except through the inputs an export passes down), and exports must have descendant nodes (#85). diff --git a/MANIFEST.sha256 b/MANIFEST.sha256 index 8bfe13b..7ba7bf3 100644 --- a/MANIFEST.sha256 +++ b/MANIFEST.sha256 @@ -4,7 +4,7 @@ b4a064c3a119736216efaca4188b17c9829ba8fef12312ea1c067d3fe638b0e4 .github/workfl 30a02d4b567c1cb152c54ec29668d31a69f069e1b7cfd4aad770e37f45024431 AGENTS.md 2e7d278cb4a2bad1de30725a7d02b20d44e88891396f51ac046711923ba51409 CLAUDE.md db67f4a91a30e84b4ce631a2ce4fdc4bf85496cadbe385f166744f51b3ff4a96 LICENSE -42811d5e0839f9ac12ea32b0f723cb729a00c36ca9a126a9517a5bd5e33d4b96 README.md +e0640484241ee37d9d5b7d5077fb168b4a21d1ded0624509ad7f1dca11342590 README.md 0c5aa6eeeb0e20ce2dbd26ee69176abcc36d00d91625f418f8a9e3ee8e349095 SETUP_PROMPT.md 243306f74235bd6dfd3cc137955604e526bf9ac0c93179574c27b4ddbf3d602f assets/banner.jpg 9083ffe0453986d4185e3af9592ad161c6ad33d802f154985d7aa4628efdc707 docs/ARCHITECTURE.md @@ -12,7 +12,7 @@ ede994551e3cc7a86aa7cf23a51a195bad3f14d8702fa304a4f9bec402041648 docs/BANKING77 9cce65e0f71299b5dfa8091c98be142e8144a3dae0db2859a494fadfca0ff5ab docs/BANKING77_VERIFICATION.md b66a6567a03354429a8adec2fbdc8fd273a7c00074d746b4116a8834d5889931 docs/BUILD_REPORT.md 4456edea5047efa737fd81b9fa5ba4d2437d5a06bf00406d2b901e6de7b1add6 docs/EXPERIMENTS.md -4b53bac3d638c6fb826a920521b588b19a284c1fd4aa8890b21c70b97d9a2d9b docs/INTEGRATIONS.md +f4ac0ebce68926b95a8e68c691fe579362afbb2440856b1a077a0687bc4e3d4d docs/INTEGRATIONS.md 3edc2de2ce0406f7a900f2f690100bc89462065ba84e6942f9b797fbceece623 docs/RESEARCH_BENCHMARKS.md 28381a3b13778a9d077a88130db7ba560bd837122c1b3b8afa563c099530480c docs/RESEARCH_BENCHMARKS_VERIFICATION.md 1f08cae6a606cefdb53fc75df194cae15059f5abaf47d0af72c66db66a0dd55b docs/ROADMAP.md @@ -79,7 +79,7 @@ e40ffc5c7ab75bdc33cdc2e225e3cc9648b7a1c66fbdaeb2f1fd2c0b39205466 tests/test_ban be3fc236651af314a33cf3f42e439c59e4c6ead83da7afb2e914b17b11768c5f tests/test_metrics_compiler.py b89d27b911461abd1c734b0ce85eecae367d4ad1ac15a13652013531a6868037 tests/test_optimization_adapters.py 0af57a704a04ca473e892f387fa09d6917d05f3d97b1b55031124e4427008e56 tests/test_optional_integrations.py -2c9f6add6fa5f914825c499010f7b797d467f843530494ab1f1c93c54b58b36c tests/test_packaging_metadata.py +83b1c94f950bc8edb08f903d45d03739a9847da9561d7769e2590c7890a5173a tests/test_packaging_metadata.py 2768020caca9fb67bb02456f90d04d50f5edeab19a0cface5b7820dc585863b9 tests/test_research.py a41a84b814e9039202d921ce575825f9b902de4be1d34970fe58bfeb3c993008 tests/test_research_teacher.py c00e5859d7a50540e4dab72ee24b7a91c53d85f4bef5ef30aeb089c7fffcfb41 tests/test_runtime_backends.py diff --git a/README.md b/README.md index bb42d7e..3a182dd 100644 --- a/README.md +++ b/README.md @@ -145,9 +145,13 @@ typewright doctor --check-optional # checks installed interfaces; never calls ``` These pins are integration targets, **not a fully resolved dependency lock**. -Only `typesafe-sdk`, `gepa`, and DSPy in the `compile` and `all` extras are -exact pins; everything else, including the `optimize` DSPy range and all -transitive packages, floats. The full list is in +Among the Python requirements, only `typesafe-sdk`, `gepa`, and DSPy in the +`compile` and `all` extras are exact pins; everything else, including the +`optimize` DSPy range and all transitive packages, floats. The Python package +has no current resolved lock. The only tracked lock is the npm lock for the +optional Node gateway smoke (`ai` pinned at `7.0.114`), and +`reports/resolved-lock-windows-py313.txt` is a stale, Windows/CPython 3.13-only +historical freeze, not an authoritative lock. Details are in [Pinned and floating dependencies](docs/INTEGRATIONS.md#pinned-and-floating-dependencies). Generate a lock in your own verified environment before reproducible live experiments. See also [docs/SOURCES.md](docs/SOURCES.md). diff --git a/docs/INTEGRATIONS.md b/docs/INTEGRATIONS.md index 09dcf2f..6e8d019 100644 --- a/docs/INTEGRATIONS.md +++ b/docs/INTEGRATIONS.md @@ -19,9 +19,25 @@ installing an arbitrary newest version. ## Pinned and floating dependencies -There is no lock file in this repository and none was fabricated. The declared -requirements in `pyproject.toml` and `examples/ai-gateway/requirements.txt` are -the whole story; nothing is hashed. +The Python package has no current resolved lock, and none was fabricated. For +Python installs, the declared requirements in `pyproject.toml` and +`examples/ai-gateway/requirements.txt` are the whole story, and no Python +requirement is hashed. The tables below cover Python requirements only. + +Two tracked files are locks or lock-like. Neither is a current lock for the +Python package: + +- `examples/ai-gateway/package-lock.json` is a real npm lock (lockfileVersion 3) + for the optional Node AI Gateway smoke only. `examples/ai-gateway/package.json` + pins `ai` exactly at `7.0.114`, and the lock records a `resolved` URL and a + sha512 `integrity` hash for every package in that tree, so `npm ci` installs it + exactly. It does not affect the Python package. +- `reports/resolved-lock-windows-py313.txt` is a historical `pip freeze` from + 2026-09-19, scoped to CPython 3.13.13 on Windows 11 (win_amd64) with + `pip install -e ".[all,dev]"`. It is stale and not maintained: it predates the + rename (it names `systemone-compiler`) and records `dspy==3.3.1`, while the + `compile` and `all` extras now pin DSPy 3.4.0. Do not treat it as authoritative + for any current install. Exact pins (`==`), resolved to that version only: @@ -48,12 +64,13 @@ Bounded ranges, which float to the newest release inside the range at install ti | `httpx>=0.28,<1` | `examples/ai-gateway/requirements.txt` | | `python-dotenv>=1.0,<2` | `examples/ai-gateway/requirements.txt` | -The build backend requirements (`setuptools>=77`, `wheel`) have a lower bound or -no bound at all. +The build backend requirements in `[build-system]` (`setuptools>=77`, `wheel`) +have a lower bound or no bound at all. Transitive dependencies are not pinned or hashed. Everything the SDKs, DSPy, and GEPA pull in, such as `litellm` through `dspy[litellm]`, resolves to whatever the -installer picks on the day, subject only to those packages' own constraints. CI (`.github/workflows/ci.yml`) resolves fresh on every run: the +installer picks on the day, subject only to those packages' own constraints. +CI (`.github/workflows/ci.yml`) resolves fresh on every run: the core job installs `.[dev]` plus the gateway requirements, and the optional job installs `.[all,dev]` and then reinstalls `dspy[litellm]==` and `gepa==0.1.4` for each end of the supported DSPy range. A passing run therefore diff --git a/tests/test_packaging_metadata.py b/tests/test_packaging_metadata.py index bcc4a6d..7c45a97 100644 --- a/tests/test_packaging_metadata.py +++ b/tests/test_packaging_metadata.py @@ -1,5 +1,8 @@ """Packaging metadata regression tests. No build, network, or inference required.""" +import json +import re import tomllib +from fnmatch import fnmatch from pathlib import Path import pytest @@ -63,15 +66,39 @@ def _dependency_section(): return text[start:end] -def _declared_requirements(pyproject): +GATEWAY_REQUIREMENTS = "examples/ai-gateway/requirements.txt" + + +def _declared_locations(pyproject): + """Map each declared Python requirement to where it is declared (#50).""" project = pyproject["project"] - declared = list(project["dependencies"]) - for requirements in project["optional-dependencies"].values(): - declared.extend(requirements) - gateway = (ROOT / "examples" / "ai-gateway" / "requirements.txt").read_text(encoding="utf-8") - declared.extend(line.strip() for line in gateway.splitlines() - if line.strip() and not line.strip().startswith("#")) - return set(declared) + locations = {} + for requirement in project["dependencies"]: + locations.setdefault(requirement, set()).add("base dependencies") + for extra, requirements in project["optional-dependencies"].items(): + for requirement in requirements: + locations.setdefault(requirement, set()).add(extra) + gateway = (ROOT / GATEWAY_REQUIREMENTS).read_text(encoding="utf-8") + for line in gateway.splitlines(): + if line.strip() and not line.strip().startswith("#"): + locations.setdefault(line.strip(), set()).add(GATEWAY_REQUIREMENTS) + return locations + + +def _table_rows(block): + rows = {} + for line in block.splitlines(): + match = re.fullmatch(r"\| `([^`]+)` \| (.+) \|", line.strip()) + if match: + rows[match.group(1)] = match.group(2) + return rows + + +def _documented_locations(cell): + locations = set(re.findall(r"`([^`]+)`", cell)) + if "base dependencies" in cell: + locations.add("base dependencies") + return locations def test_dependency_doc_lists_every_declared_exact_pin_and_range(pyproject): @@ -79,16 +106,59 @@ def test_dependency_doc_lists_every_declared_exact_pin_and_range(pyproject): section = _dependency_section() exact_heading = section.index("Exact pins") range_heading = section.index("Bounded ranges") - exact_block, range_block = section[exact_heading:range_heading], section[range_heading:] - for requirement in _declared_requirements(pyproject): - if "==" in requirement: - assert f"`{requirement}`" in exact_block, f"{requirement} missing from documented exact pins" - else: - assert f"`{requirement}`" in range_block, f"{requirement} missing from documented ranges" - - -def test_dependency_doc_matches_absence_of_lock_file(): - lock_names = ("uv.lock", "poetry.lock", "Pipfile.lock", "pdm.lock", "pylock.toml", - "requirements.lock", "constraints.txt") - assert not [name for name in lock_names if (ROOT / name).exists()], "Lock file present; update #50 docs." - assert "no lock file" in _dependency_section().lower() + exact_rows = _table_rows(section[exact_heading:range_heading]) + range_rows = _table_rows(section[range_heading:]) + declared = _declared_locations(pyproject) + for requirement, locations in declared.items(): + table, rows = ("exact pins", exact_rows) if "==" in requirement else ("ranges", range_rows) + assert requirement in rows, f"{requirement} missing from the documented {table}" + assert _documented_locations(rows[requirement]) == locations, ( + f"'Declared in' for {requirement} is stale; it is declared in {sorted(locations)}") + assert set(exact_rows) | set(range_rows) == set(declared), "Doc lists a requirement that is not declared" + + +def test_dependency_doc_build_system_sentence_matches_pyproject(pyproject): + section = _dependency_section() + start = section.index("The build backend requirements") + sentence = section[start:section.index("\n\n", start)] + documented = set(re.findall(r"`([^`]+)`", sentence)) - {"[build-system]"} + assert documented == set(pyproject["build-system"]["requires"]) + + +def test_dependency_doc_covers_exact_npm_pins(): + package = json.loads((ROOT / "examples" / "ai-gateway" / "package.json").read_text(encoding="utf-8")) + section = _dependency_section() + for name, version in package["dependencies"].items(): + assert re.fullmatch(r"\d+\.\d+\.\d+", version), f"npm {name} is not an exact pin; update #50 docs" + assert f"`{name}`" in section and f"`{version}`" in section, f"npm pin {name}@{version} undocumented" + + +LOCK_NAMES = {"package-lock.json", "npm-shrinkwrap.json", "yarn.lock", "pnpm-lock.yaml", "bun.lock", + "bun.lockb", "poetry.lock", "uv.lock", "Pipfile.lock", "pdm.lock", "Cargo.lock", + "Gemfile.lock", "composer.lock"} +LOCK_PATTERNS = ("*.lock", "*lock*.txt", "*lock*.toml", "requirements*.lock", "constraints*.txt", + "*freeze*.txt") +# Ignored or local-only directories (see .gitignore); untracked local files there must not matter. +SKIP_DIRS = {".git", ".venv", "venv", "node_modules", "__pycache__", ".pytest_cache", ".ruff_cache", + ".mypy_cache", ".tox", "htmlcov", "build", "dist", "runs", ".s1", ".claude"} + + +def _lock_like_files(): + found = [] + for path in ROOT.rglob("*"): + relative = path.relative_to(ROOT) + if any(part in SKIP_DIRS or part.endswith(".egg-info") for part in relative.parts[:-1]): + continue + if path.is_file() and (path.name in LOCK_NAMES or any(fnmatch(path.name, p) for p in LOCK_PATTERNS)): + found.append(relative.as_posix()) + return sorted(found) + + +def test_dependency_doc_names_every_lock_like_file_in_the_tree(): + # Every lock-like file in the source tree must be named, with its scope, in the #50 section. + section = _dependency_section() + found = _lock_like_files() + assert "examples/ai-gateway/package-lock.json" in found, "lock scan is not reaching nested directories" + undocumented = [path for path in found if f"`{path}`" not in section] + assert not undocumented, f"Lock-like files not named in docs/INTEGRATIONS.md: {undocumented}" + assert "has no current resolved lock" in " ".join(section.split())