Conversation
Co-authored-by: ecarreras <294235+ecarreras@users.noreply.github.com>
|
@giscebot recordaràs que quan es modifiqui l'estructura del policy també s'ha de modificar el validador? |
|
Sí. Ho tractaré com un contracte de manteniment: qualsevol canvi estructural de Matís important d’aquest PR: |
|
@giscebot no entenc què vols dir en aquest comentari #228 (comment) fes que sigui coherent |
pilipilisbot
left a comment
There was a problem hiding this comment.
Reviewed the schema/validator change and I do not see blockers.
What I checked:
policy.schema.jsonrejects unknown fields at the same structural levels thatPolicy.from_filecurrently consumes.validate-policyruns JSON Schema first and thenPolicy.from_file, so schema shape errors and runtime semantic checks both stay active.- Top-level keys used by
Policy.from_filematch the schema properties. - Local focused tests in a temporary venv:
PYTHONPATH=src /tmp/gab-pr228-venv/bin/python -m pytest -q tests/test_validate_policy.py tests/test_policy.py-> 23 passed. - Manual CLI checks: valid
policy.example.jsonpasses, and an unknownfeedbackLearning.surprisefield is rejected.
Clarification on the earlier comment: the intended contract is simple: when policy structure changes, update the runtime loader, the JSON Schema, the example/docs, and tests together. The CLI is a deployment/editor guard, while Policy.from_file remains the runtime loader; they must not drift.
Closes #198.
Summary
gab validate-policy --policy PATHwith dotted error locations and runtime semantic checksValidation
python3 -m pytest -q tests/test_validate_policy.py tests/test_policy.py(23 passed)PYTHONPATH=src python3 -m github_agent_bridge.cli validate-policy --policy policy.example.jsongithub_agent_bridge/policy.schema.jsonis packagedEnvironment note
The full suite could not be collected in the system Python because the test-only
fastapidependency is absent and this host Python has neitherpipnorensurepip; targeted policy tests pass.