You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: validate config files against published JSON Schema at runtime (#2384)
* feat: validate config files against published JSON Schema at runtime
Replace the hand-written validateAwfFileConfig() implementation with
ajv-based validation against the published awf-config.schema.json.
This makes the JSON Schema the single source of truth for:
1. Runtime validation inside awf (this change)
2. External consumers like the gh-aw compiler (schema is downloadable
as a release asset and from docs/awf-config.schema.json)
3. IDE autocomplete via $schema field
Changes:
- Move ajv from devDependencies to dependencies (runtime use)
- Add src/schema-validator.ts: compiles schema once, formats ajv errors
into human-readable messages matching the previous validator style
- Add src/awf-config-schema.json: bundleable copy of the schema (imported
at compile time, works with esbuild single-file bundle)
- Update generate-schema.mjs to write both docs/ and src/ copies
- Add sync test ensuring src/ and docs/ schemas stay aligned
- Update one test assertion for new enum formatting
The error messages are backward-compatible with the previous hand-written
validator (all 113 config/schema tests pass unchanged except one enum
format improvement: '"5m" or "1h"' → 'one of: 5m, 1h').
Closes#2374
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* feat: version the awf-config JSON Schema as v1
Agent-Logs-Url: https://github.com/github/gh-aw-firewall/sessions/b9f23f04-41af-4ebf-ba7f-52aa520cad1d
* feat: version the awf-config JSON Schema as v1
Agent-Logs-Url: https://github.com/github/gh-aw-firewall/sessions/b9f23f04-41af-4ebf-ba7f-52aa520cad1d
* docs: document JSON Schema versioning and release tag pinning in releasing.md
Agent-Logs-Url: https://github.com/github/gh-aw-firewall/sessions/72cdaa37-37d8-4564-937b-e5f2ee8eafc1
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
* test: add schema-validator tests and simplify unreachable branches
- Add 18 unit tests covering all error formatting paths
- Remove dead code: hasMinimumOne() and determineArticle() functions
(all integer fields have minimum:1; no vowel-starting types reach
the article logic after prior case handling)
- Simplify isArrayOfStringsField() to a single boolean expression
- Branch coverage for schema-validator.ts: 97.77%
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix(docker): make apt mirror selection resilient to DNS failures
- Conditionally switch to azure.archive.ubuntu.com only if DNS resolves it
- Falls back to default archive.ubuntu.com when BuildKit DNS can't
reach the Azure mirror (common in Docker-in-Docker scenarios)
- Improve apt_update_retry() to detect silent failures (apt returns 0
with 'Failed to fetch' warnings) and fall back to archive.ubuntu.com
- Fixes persistent CI failures where BuildKit couldn't resolve
azure.archive.ubuntu.com during container image builds
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
0 commit comments