Skip to content

Commit 8915750

Browse files
viraatcclaude
andcommitted
chore: check-only pre-commit, CI template check, bump fuzz to 4000, doc regenerate script
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d6da029 commit 8915750

5 files changed

Lines changed: 20 additions & 26 deletions

File tree

.github/workflows/pre-commit.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,5 @@ jobs:
2525
pip install -e ".[dev]"
2626
2727
- name: Run pre-commit
28-
env:
29-
SKIP: regenerate-templates
3028
run: |
3129
pre-commit run --all-files --show-diff-on-failure

.github/workflows/test.yml

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -88,23 +88,7 @@ jobs:
8888
run: |
8989
pytest -xv -m schema_fuzz
9090
91-
- name: Validate YAML templates against schema
91+
- name: Check YAML templates are up to date
9292
if: steps.schema.outputs.changed == 'true'
9393
run: |
94-
python -c "
95-
import sys
96-
from pathlib import Path
97-
from inference_endpoint.config.schema import BenchmarkConfig
98-
templates = sorted(Path('src/inference_endpoint/config/templates').glob('*.yaml'))
99-
failed = False
100-
for t in templates:
101-
try:
102-
BenchmarkConfig.from_yaml_file(t)
103-
print(f' OK: {t.name}')
104-
except Exception as e:
105-
print(f' FAIL: {t.name}: {e}')
106-
failed = True
107-
if failed:
108-
sys.exit(1)
109-
print(f'All {len(templates)} templates valid.')
110-
"
94+
python scripts/regenerate_templates.py --check

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ repos:
4848
args: ["--tb=short", "--strict-markers"]
4949
stages: [manual]
5050

51-
- id: regenerate-templates
52-
name: Regenerate YAML templates from schema defaults
53-
entry: python scripts/regenerate_templates.py
51+
- id: check-templates
52+
name: Check YAML templates match schema defaults
53+
entry: python scripts/regenerate_templates.py --check
5454
language: system
5555
pass_filenames: false
5656
files: ^(src/inference_endpoint/config/schema\.py|scripts/regenerate_templates\.py)$

docs/DEVELOPMENT.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,18 @@ pytest -s -v
276276
python -m pdb -m pytest test_file.py
277277
```
278278

279+
## 📄 YAML Config Templates
280+
281+
Config templates in `src/inference_endpoint/config/templates/` are auto-generated from schema defaults. When you change `config/schema.py`, regenerate them:
282+
283+
```bash
284+
python scripts/regenerate_templates.py
285+
```
286+
287+
Pre-commit and CI will fail if committed templates are out of sync with the schema (`--check` mode).
288+
289+
The script applies overrides (model name, endpoint URL, dataset path) defined in `scripts/regenerate_templates.py` on top of `BenchmarkConfig.create_default_config()` defaults. To change a template override, edit `_COMMON` or `_TEMPLATES` in the script and re-run.
290+
279291
## 📦 Package Management
280292

281293
### Adding Dependencies

tests/integration/commands/test_cli.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def _build_tokens(
134134
draw: DrawFn, base: list[str], flags: list[tuple[str, list[str]]]
135135
) -> list[str]:
136136
"""Append 1-6 random flags (with valid values) to a base token list."""
137-
n = draw(st.integers(min_value=1, max_value=6))
137+
n = draw(st.integers(min_value=1, max_value=10))
138138
chosen = draw(
139139
st.lists(
140140
st.sampled_from(flags), min_size=n, max_size=n, unique_by=lambda x: x[0]
@@ -168,7 +168,7 @@ def online_tokens(draw: DrawFn) -> list[str]:
168168
@pytest.mark.integration
169169
@pytest.mark.schema_fuzz
170170
@pytest.mark.slow
171-
@hyp_settings(max_examples=500, deadline=5000)
171+
@hyp_settings(max_examples=2000, deadline=5000)
172172
@given(tokens=offline_tokens())
173173
def test_offline_cli_no_crash(tokens):
174174
"""Random offline flag combos must parse or reject cleanly — never crash."""
@@ -181,7 +181,7 @@ def test_offline_cli_no_crash(tokens):
181181
@pytest.mark.integration
182182
@pytest.mark.schema_fuzz
183183
@pytest.mark.slow
184-
@hyp_settings(max_examples=500, deadline=5000)
184+
@hyp_settings(max_examples=2000, deadline=5000)
185185
@given(tokens=online_tokens())
186186
def test_online_cli_no_crash(tokens):
187187
"""500 random online flag combos (poisson + concurrency) — no crashes."""

0 commit comments

Comments
 (0)