Skip to content

Commit 862c539

Browse files
test(compat): cross-version request-compatibility against supported server contracts (#407)
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent f59f26d commit 862c539

6 files changed

Lines changed: 13684 additions & 0 deletions

File tree

tests/compat/__init__.py

Whitespace-only changes.

tests/compat/refresh_specs.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
"""Re-vendor the server OpenAPI specs at the SHAs pinned in manifest.json.
2+
Usage: `python tests/compat/refresh_specs.py` (needs `gh` auth for the source repo)."""
3+
4+
from __future__ import annotations
5+
6+
import json
7+
import subprocess
8+
from pathlib import Path
9+
10+
_DIR = Path(__file__).parent / "server_specs"
11+
12+
13+
def main() -> None:
14+
manifest = json.loads((_DIR / "manifest.json").read_text())
15+
repo, path = manifest["source_repo"], manifest["source_path"]
16+
for entry in manifest["specs"]:
17+
content = subprocess.run(
18+
[
19+
"gh",
20+
"api",
21+
f"repos/{repo}/contents/{path}?ref={entry['sha']}",
22+
"-H",
23+
"Accept: application/vnd.github.raw",
24+
],
25+
check=True,
26+
capture_output=True,
27+
text=True,
28+
).stdout
29+
(_DIR / entry["file"]).write_text(content)
30+
print(f"wrote {entry['file']} from {repo}@{entry['sha'][:12]}")
31+
32+
33+
if __name__ == "__main__":
34+
main()

0 commit comments

Comments
 (0)