Skip to content

Commit 0200969

Browse files
alireza787bclaude
andcommitted
feat: schema system rewrite — ruamel.yaml, Pydantic validation, CI enforcement
Core improvements: - generate_schema.py: migrate comment extraction from hand-rolled 200-line regex scanner to ruamel.yaml (preserves comments natively via CommentToken) - extract_unit(): add = guard to reject parentheticals like (lower = less CPU) - config_validator.py (new): thin Pydantic validation for Safety.GlobalLimits and VideoSource at startup — non-blocking, logs WARNING only - parameters.py: call validate_safety_config() after config load - schemaAnalyzer.js: fix minimum/maximum → min/max naming drift bug (SmartValueEditor now shows bounds for nested object/array fields) CI & docs: - .pre-commit-config.yaml (new): schema-sync-check hook regenerates schema on config_default.yaml changes and blocks commit if out of sync - scripts/check_schema.sh (new): standalone CI sync-check script - scripts/SCHEMA_COMMENT_CONVENTIONS.md (new): structured comment patterns doc Tests: - test_generate_schema.py: +11 new tests for extract_unit(), parse_config_with_comments(), and validate_safety_config() — 25 tests total, all pass Results: 1558 passed, 49 skipped, 0 failed Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 905e1a5 commit 0200969

File tree

9 files changed

+1848
-644
lines changed

9 files changed

+1848
-644
lines changed

.pre-commit-config.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# .pre-commit-config.yaml
2+
# Pre-commit hooks for PixEagle
3+
#
4+
# Install: pip install pre-commit && pre-commit install
5+
# Run manually: pre-commit run --all-files
6+
#
7+
# Schema sync hook: runs generate_schema.py whenever config_default.yaml changes.
8+
# If the schema is out of date, the commit is blocked with an error message.
9+
10+
repos:
11+
- repo: local
12+
hooks:
13+
- id: schema-sync-check
14+
name: Config schema must be up-to-date
15+
language: python
16+
additional_dependencies: [pyyaml, ruamel.yaml]
17+
entry: python scripts/generate_schema.py
18+
pass_filenames: false
19+
files: '^configs/config_default\.yaml$'
20+
stages: [commit]
21+
22+
- repo: https://github.com/pre-commit/pre-commit-hooks
23+
rev: v4.5.0
24+
hooks:
25+
- id: trailing-whitespace
26+
exclude: '^docs/'
27+
- id: end-of-file-fixer
28+
exclude: '^docs/'
29+
- id: check-yaml
30+
args: [--unsafe] # Allow YAML with anchors/aliases
31+
- id: check-json
32+
- id: check-merge-conflict

0 commit comments

Comments
 (0)