Skip to content

feat: publish versioned JSON Schema for AWF config file#2375

Merged
lpcox merged 4 commits intomainfrom
copilot/publish-versioned-json-schema
May 1, 2026
Merged

feat: publish versioned JSON Schema for AWF config file#2375
lpcox merged 4 commits intomainfrom
copilot/publish-versioned-json-schema

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 1, 2026

AwfFileConfig had no published JSON Schema, leaving consumers (IDE validators, gh-aw compiler) without a machine-readable contract and no way to reference a stable, versioned URL.

Changes

  • scripts/generate-schema.mjs — generator script that builds the complete JSON Schema for AwfFileConfig

    • --version v0.X.Y embeds a version-specific $id for release assets
    • --print writes to stdout (used in release pipeline)
    • Default output: docs/awf-config.schema.json
  • docs/awf-config.schema.json — updated existing schema:

    • Added missing fields: apiProxy.anthropicAutoCache, apiProxy.anthropicCacheTailTtl, apiProxy.models
    • Added description on every property for IDE autocomplete
    • copilot target correctly uses a host-only $defs ref (no basePath)
  • src/schema.test.ts — 16 tests using ajv/dist/2020 (already transitive) covering valid configs, enum constraints, additionalProperties rejection, and type mismatches

  • package.jsongenerate:schema script

  • .github/workflows/release.yml — generates versioned schema and uploads awf-config.schema.json as a release asset

  • README.md / docs/awf-config-spec.md — documents the versioned release asset URL

IDE integration

Users can reference the schema for autocomplete in .awf.yml / .awf.json:

$schema: "https://github.com/github/gh-aw-firewall/releases/download/v0.23.1/awf-config.schema.json"
network:
  allowDomains:
    - github.com
apiProxy:
  enabled: true
  anthropicAutoCache: true

The live schema at docs/awf-config.schema.json is reachable via raw.githubusercontent.com; each release additionally uploads a pinned copy so downstream tools can reference a specific AWF version.

Copilot AI linked an issue May 1, 2026 that may be closed by this pull request
@lpcox lpcox marked this pull request as ready for review May 1, 2026 21:49
@lpcox lpcox requested a review from Mossaka as a code owner May 1, 2026 21:49
Copilot AI review requested due to automatic review settings May 1, 2026 21:49
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 1, 2026

Documentation Preview

Documentation build failed for this PR. View logs.

Built from commit 9df6004

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 1, 2026

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 85.90% 85.98% 📈 +0.08%
Statements 85.88% 85.96% 📈 +0.08%
Functions 88.00% 88.00% ➡️ +0.00%
Branches 80.06% 80.10% 📈 +0.04%
📁 Per-file Coverage Changes (1 files)
File Lines (Before → After) Statements (Before → After)
src/docker-manager.ts 87.4% → 87.7% (+0.29%) 87.0% → 87.3% (+0.27%)

Coverage comparison generated by scripts/ci/compare-coverage.ts

Copilot AI changed the title [WIP] Add versioned JSON Schema for AWF config file feat: publish versioned JSON Schema for AWF config file May 1, 2026
Copilot AI requested a review from lpcox May 1, 2026 21:52
Copilot finished work on behalf of lpcox May 1, 2026 21:52
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a generated, versioned JSON Schema for the AWF config file, along with tests and release automation to publish the schema as a release asset for IDE validation/autocomplete.

Changes:

  • Introduces scripts/generate-schema.mjs to generate docs/awf-config.schema.json (optionally embedding a versioned $id).
  • Adds Jest tests (src/schema.test.ts) to compile and validate the schema with Ajv 2020-12.
  • Updates docs and the release workflow to publish the versioned schema as a release asset.
Show a summary per file
File Description
src/schema.test.ts New unit tests that compile and validate the JSON Schema with Ajv.
scripts/generate-schema.mjs New generator script to produce the JSON Schema (supports --version and --print).
package.json Adds an npm script to run the schema generator.
docs/awf-config.schema.json Expands schema coverage and adds descriptions for IDE autocomplete.
docs/awf-config-spec.md Documents live vs versioned schema locations.
README.md Links to schema and notes the versioned release asset URL.
.github/workflows/release.yml Generates a versioned schema during releases and uploads it as an asset.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 7/7 changed files
  • Comments generated: 4

Comment thread scripts/generate-schema.mjs Outdated
Comment on lines +11 to +12
* The schema mirrors the AwfFileConfig TypeScript interface in src/config-file.ts.
* When the interface changes, update this script to match.
Comment thread scripts/generate-schema.mjs Outdated
enum: ['5m', '1h'],
description:
'TTL for Anthropic cache tail optimization. ' +
'Requires anthropicAutoCache to be enabled. Allowed values: "5m" or "1h".',
Comment thread src/schema.test.ts
Comment on lines +1 to +3
import * as fs from 'fs';
import * as path from 'path';
import Ajv2020 from 'ajv/dist/2020';
Comment on lines +25 to +28
const versionIdx = args.indexOf('--version');
const version = versionIdx !== -1 ? args[versionIdx + 1] : null;
const printOnly = args.includes('--print');

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@lpcox
Copy link
Copy Markdown
Collaborator

lpcox commented May 1, 2026

@copilot address the review feedback

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 1, 2026

@copilot address the review feedback

Addressed all four review items in c42ce40:

  1. Header comment (generate-schema.mjs:11-12): Updated to say the schema reflects the validated config surface from validateAwfFileConfig, not just the TypeScript interface.
  2. anthropicCacheTailTtl description (generate-schema.mjs:106): Changed "Requires anthropicAutoCache to be enabled" → "Only applies when anthropicAutoCache is enabled" to avoid implying enforcement.
  3. ajv devDependency (src/schema.test.ts:1-3): Added ajv@^8.18.0 as an explicit devDependency in package.json (with updated lockfile).
  4. --version argument validation (generate-schema.mjs:25-28): Added validation that exits non-zero with usage text when --version is missing its value, --version is followed by another flag, or an unknown flag is passed.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 1, 2026

🔥 Smoke Test: Copilot BYOK — PASS

Test Result
GitHub MCP (list PRs) ✅ PR #2360 retrieved successfully
GitHub.com connectivity ✅ (pre-step validated)
File write/read ⚠️ Pre-step vars not interpolated (template placeholders unexpanded)
BYOK inference (this response)

Running in BYOK offline mode (COPILOT_OFFLINE=true) via api-proxy → api.githubcopilot.com

Overall: PASS · PR by @Copilot · Assignees: @lpcox, @Copilot

🔑 BYOK report filed by Smoke Copilot BYOK

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 1, 2026

Smoke Test Results

Overall: PASS

💥 [THE END] — Illustrated by Smoke Claude

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 1, 2026

🔬 Smoke Test Results

Test Status
GitHub MCP connectivity
GitHub.com HTTP connectivity ⚠️ pre-step data unavailable
File write/read ⚠️ pre-step data unavailable

PR: feat: publish versioned JSON Schema for AWF config file — author @Copilot, assignees: @lpcox @Copilot

Overall: PARTIAL — MCP works; connectivity/file tests skipped due to unresolved template variables in workflow step data.

📰 BREAKING: Report filed by Smoke Copilot

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 1, 2026

PR titles: unavailable
GitHub merged PR review: ❌
Safeinputs PR query: ❌
Playwright title check: ✅
Tavily search: ❌
File write/readback: ✅
Build (npm ci && npm run build): ✅
Discussion oracle comment: ❌
Overall status: FAIL

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • registry.npmjs.org

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "registry.npmjs.org"

See Network Configuration for more information.

🔮 The oracle has spoken through Smoke Codex

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 1, 2026

Chroot Smoke Test Results

Runtime Host Version Chroot Version Match?
Python Python 3.12.13 Python 3.12.3 ❌ NO
Node.js v24.14.1 v20.20.2 ❌ NO
Go go1.22.12 go1.22.12 ✅ YES

Overall: FAILED — Python and Node.js versions differ between host and chroot environment.

Tested by Smoke Chroot

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 1, 2026

🏗️ Build Test Suite Results

Ecosystem Project Build/Install Tests Status
Bun elysia 1/1 passed ✅ PASS
Bun hono 1/1 passed ✅ PASS
C++ fmt N/A ✅ PASS
C++ json N/A ✅ PASS
Deno oak N/A 1/1 passed ✅ PASS
Deno std N/A 1/1 passed ✅ PASS
.NET hello-world N/A ✅ PASS
.NET json-parse N/A ✅ PASS
Go color passed ✅ PASS
Go env passed ✅ PASS
Go uuid passed ✅ PASS
Java gson 1/1 passed ✅ PASS
Java caffeine 1/1 passed ✅ PASS
Node.js clsx passed ✅ PASS
Node.js execa passed ✅ PASS
Node.js p-limit passed ✅ PASS
Rust fd 1/1 passed ✅ PASS
Rust zoxide 1/1 passed ✅ PASS

Overall: 8/8 ecosystems passed — ✅ PASS

Note: Java Maven required a custom local repository path (-Dmaven.repo.local) because the default ~/.m2/repository directory was owned by root and could not be created without elevated permissions in this environment.

Generated by Build Test Suite for issue #2375 · ● 567.7K ·

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 1, 2026

Smoke Test Results

  • Redis PING: ❌ (host.docker.internal:6379 — timeout/no response)
  • PostgreSQL pg_isready: ❌ (host.docker.internal:5432 — no response)
  • PostgreSQL SELECT 1: ❌ (skipped, pg_isready failed)

Overall: FAIL — Service containers unreachable from this environment.

🔌 Service connectivity validated by Smoke Services

@lpcox lpcox merged commit 34b4e73 into main May 1, 2026
66 of 70 checks passed
@lpcox lpcox deleted the copilot/publish-versioned-json-schema branch May 1, 2026 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: publish versioned JSON Schema for AWF config file

3 participants