Skip to content

Commit b822151

Browse files
authored
Merge pull request #2 from Coding-Autopilot-System/gsd/phase-2-compatibility-distribution
feat: automate compatibility and schema distribution
2 parents caf4d8f + 2b9d57e commit b822151

26 files changed

Lines changed: 1058 additions & 13 deletions
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Compatibility
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "schemas/**"
7+
- "scripts/compatibility.mjs"
8+
- "scripts/lib.mjs"
9+
- "tests/compatibility.test.mjs"
10+
- ".github/workflows/compatibility.yml"
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
classify:
17+
name: Classify schema compatibility
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 10
20+
steps:
21+
- name: Check out proposed contracts
22+
uses: actions/checkout@v4
23+
with:
24+
path: candidate
25+
fetch-depth: 0
26+
- uses: actions/setup-node@v4
27+
with:
28+
node-version: 22
29+
cache: npm
30+
cache-dependency-path: candidate/package-lock.json
31+
- run: npm ci
32+
working-directory: candidate
33+
- name: Extract latest released contracts
34+
shell: bash
35+
working-directory: candidate
36+
run: |
37+
set -euo pipefail
38+
latest="$(git tag --list "v[0-9]*.[0-9]*.[0-9]*" --sort=-version:refname | head -n 1)"
39+
test -n "$latest"
40+
mkdir -p ../baseline
41+
git archive "$latest" schemas | tar -x -C ../baseline
42+
- name: Classify changes
43+
id: classify
44+
shell: bash
45+
run: |
46+
set +e
47+
node candidate/scripts/compatibility.mjs \
48+
--base baseline/schemas \
49+
--head candidate/schemas \
50+
--output candidate/compatibility-report.json
51+
code=$?
52+
{
53+
echo "## Compatibility against latest release"
54+
echo '```json'
55+
cat candidate/compatibility-report.json
56+
echo '```'
57+
} >> "$GITHUB_STEP_SUMMARY"
58+
exit "$code"
59+
- name: Upload compatibility report
60+
if: always()
61+
uses: actions/upload-artifact@v4
62+
with:
63+
name: compatibility-report
64+
path: candidate/compatibility-report.json
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Publish schema registry
2+
3+
on:
4+
push:
5+
tags:
6+
- "v[0-9]+.[0-9]+.[0-9]+"
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: pages
16+
cancel-in-progress: false
17+
18+
jobs:
19+
build:
20+
name: Build registry
21+
runs-on: ubuntu-latest
22+
timeout-minutes: 15
23+
steps:
24+
- uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
- uses: actions/setup-node@v4
28+
with:
29+
node-version: 22
30+
cache: npm
31+
- run: npm ci
32+
- run: npm test
33+
- name: Build every released schema version
34+
shell: bash
35+
run: |
36+
set -euo pipefail
37+
rm -rf registry release-source
38+
while IFS= read -r tag; do
39+
version="${tag#v}"
40+
line="v${version%.*}"
41+
mkdir -p "release-source/$version"
42+
git archive "$tag" "schemas/$line" | tar -x -C "release-source/$version"
43+
node scripts/build-registry.mjs \
44+
--version "$version" \
45+
--source "release-source/$version/schemas/$line" \
46+
--output registry \
47+
--append
48+
done < <(git tag --list "v[0-9]*.[0-9]*.[0-9]*" --sort=version:refname)
49+
- run: npm run validate:registry -- --registry registry
50+
- uses: actions/configure-pages@v5
51+
- uses: actions/upload-pages-artifact@v3
52+
with:
53+
path: registry
54+
55+
deploy:
56+
name: Deploy registry
57+
needs: build
58+
runs-on: ubuntu-latest
59+
timeout-minutes: 10
60+
environment:
61+
name: github-pages
62+
url: ${{ steps.deployment.outputs.page_url }}
63+
steps:
64+
- name: Deploy to GitHub Pages
65+
id: deployment
66+
uses: actions/deploy-pages@v4

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
node_modules/
22
coverage/
3+
registry/
4+
release-source/
5+
.tmp/
36
*.log
47
.DS_Store

‎.planning/PROJECT.md‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Every CAS component can exchange trustworthy lifecycle data without guessing str
1313
### Validated
1414

1515
- v0.1 lifecycle schemas, examples, tests, CI, and governance - Phase 1
16+
- Automated compatibility classification and stable versioned schema distribution - Phase 2
1617

1718
### Active
1819

@@ -48,6 +49,8 @@ CAS currently has multiple repositories that need a shared language for prompts,
4849
| Use one common lifecycle metadata definition | Prevent traceability drift across contracts | Pending |
4950
| Keep contracts implementation-neutral | Allow all CAS runtimes to adopt them | Pending |
5051
| Publish examples as executable fixtures | Documentation and validation stay synchronized | Pending |
52+
| Fail unknown schema semantics as review-required | Prevent false compatibility claims | Implemented in Phase 2 |
53+
| Rebuild all release tags for registry publication | Preserve immutable release URLs while stable lines advance | Implemented in Phase 2 |
5154

5255
## Evolution
5356

@@ -58,4 +61,4 @@ This document evolves at phase transitions and milestone boundaries.
5861
3. Reconfirm that contract interoperability remains the core value.
5962

6063
---
61-
*Last updated: 2026-06-11 after Phase 1 verification*
64+
*Last updated: 2026-06-11 after Phase 2 verification*

‎.planning/REQUIREMENTS.md‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
## vNext Requirements
2727

2828
- **SDK-01**: Consumers can install generated typed SDKs for supported languages.
29-
- **REG-01**: Consumers can resolve published schemas from a stable registry endpoint.
30-
- **COMP-01**: CI automatically compares proposed schemas against the latest release for compatibility.
29+
- [x] **REG-01**: Consumers can resolve published schemas from a stable registry endpoint.
30+
- [x] **COMP-01**: CI automatically compares proposed schemas against the latest release for compatibility.
3131

3232
## Out of Scope
3333

@@ -50,8 +50,10 @@
5050
| GOV-01 | Phase 1 | Complete |
5151
| GOV-02 | Phase 1 | Complete |
5252
| GOV-03 | Phase 1 | Complete |
53+
| COMP-01 | Phase 2 | Complete |
54+
| REG-01 | Phase 2 | Complete |
5355

54-
**Coverage:** 9 v0.1 requirements, 9 mapped, 0 unmapped.
56+
**Coverage:** 12 requirements, 12 mapped, 0 unmapped.
5557

5658
---
57-
*Last updated: 2026-06-11 after Phase 1 verification*
59+
*Last updated: 2026-06-11 after Phase 2 verification*

‎.planning/ROADMAP.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@
1818

1919
**Requirements:** COMP-01, REG-01
2020

21+
**Status:** Complete (2026-06-11)
22+
23+
**Plans:** 2/2 plans complete
24+
25+
**Wave 1**
26+
- [x] 02-01: Automated compatibility classification and PR enforcement
27+
28+
**Wave 2** *(blocked on Wave 1 completion)*
29+
- [x] 02-02: Deterministic versioned registry and release distribution
30+
2131
**Success criteria:**
2232
1. Pull requests receive automated breaking-change classification.
2333
2. Released schemas are resolvable from stable versioned URLs.

‎.planning/STATE.md‎

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,38 @@
1+
---
2+
gsd_state_version: 1.0
3+
milestone: v0.1
4+
milestone_name: Foundation
5+
status: ready_to_plan
6+
last_updated: 2026-06-11T11:07:16.086Z
7+
progress:
8+
total_phases: 3
9+
completed_phases: 2
10+
total_plans: 2
11+
completed_plans: 2
12+
percent: 67
13+
stopped_at: Phase 2 complete (2/2) - ready to discuss Phase 3
14+
---
15+
116
# Project State
217

318
## Project Reference
419

520
See: `.planning/PROJECT.md` (updated 2026-06-11)
621

7-
**Core value:** Every CAS component can exchange trustworthy lifecycle data without guessing structure, identity, traceability, or compatibility.
8-
**Current focus:** Phase 2 - Compatibility Automation and Distribution
22+
**Core value:** Every CAS component can exchange trustworthy lifecycle data without guessing structure, identity, traceability, or compatibility.
23+
**Current focus:** Phase 3 - Typed SDKs and Adoption
924

1025
## Status
1126

12-
- Phase: 1 of 3 complete; Phase 2 pending
27+
- Phase: 2 of 3 complete; Phase 3 pending
1328
- Milestone: v0.1
1429
- Mode: YOLO, quality, parallel
15-
- Next action: Integrate v0.1 contracts into CAS producers and consumers, then automate compatibility checks.
30+
- Next action: Plan Phase 3 typed SDKs and adoption.
1631

1732
## Decisions
1833

1934
- JSON Schema Draft 2020-12 is authoritative.
2035
- Shared lifecycle metadata is mandatory.
2136
- Examples are executable fixtures.
37+
- Unknown schema semantic changes require review rather than a compatibility claim.
38+
- Registry publication preserves immutable releases and advances stable version lines.

‎.planning/config.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
"verifier": true,
1111
"nyquist_validation": true,
1212
"auto_advance": true,
13-
"_auto_chain_active": true
13+
"_auto_chain_active": false
1414
}
1515
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
phase: 02-compatibility-automation-and-distribution
3+
plan: "01"
4+
type: execute
5+
wave: 1
6+
depends_on: []
7+
files_modified:
8+
- package.json
9+
- scripts/compatibility.mjs
10+
- scripts/lib.mjs
11+
- tests/compatibility.test.mjs
12+
- tests/fixtures/compatibility/
13+
- .github/workflows/compatibility.yml
14+
- docs/VERSIONING.md
15+
- CONTRIBUTING.md
16+
autonomous: true
17+
requirements: [COMP-01]
18+
must_haves:
19+
truths:
20+
- Pull requests automatically classify schema changes against their merge base.
21+
- Breaking and review-required changes cannot be silently reported as compatible.
22+
- Compatibility results are available as machine-readable JSON and a CI summary.
23+
---
24+
25+
<objective>
26+
Implement conservative automated JSON Schema breaking-change classification and enforce it in pull-request CI.
27+
</objective>
28+
29+
<tasks>
30+
<task type="auto">
31+
<name>Implement classifier and CLI</name>
32+
<read_first>scripts/lib.mjs, docs/VERSIONING.md, schemas/v0.1/common.schema.json</read_first>
33+
<action>Add a dependency-free directional schema-tree comparator. Report unchanged, compatible, breaking, and review_required outcomes with JSON details. Exit nonzero for breaking changes and support explicit base/head directories.</action>
34+
<acceptance_criteria>`node scripts/compatibility.mjs --help` exits successfully and documents CLI inputs and exit behavior.</acceptance_criteria>
35+
</task>
36+
<task type="auto">
37+
<name>Add compatibility fixtures and tests</name>
38+
<read_first>tests/contracts.test.mjs, scripts/compatibility.mjs</read_first>
39+
<action>Add tests for additions, removals, required properties, type and enum narrowing, extensibility tightening, constraints, schema removal, and unknown changed keywords.</action>
40+
<acceptance_criteria>`npm.cmd test` passes and exercises all four classifications.</acceptance_criteria>
41+
</task>
42+
<task type="auto">
43+
<name>Integrate PR compatibility CI and governance docs</name>
44+
<read_first>.github/workflows/ci.yml, CONTRIBUTING.md, docs/VERSIONING.md</read_first>
45+
<action>Add a least-privilege pull-request workflow that compares against the merge base, writes a job summary, uploads the JSON report, and fails on breaking changes. Document local classification and review-required semantics.</action>
46+
<acceptance_criteria>Workflow uses full-history checkout, runs the classifier, uploads its report, and has read-only contents permission.</acceptance_criteria>
47+
</task>
48+
</tasks>
49+
50+
<verification>
51+
- `npm.cmd test`
52+
- `npm.cmd run validate`
53+
- Run the CLI against identical schema trees and a known breaking fixture.
54+
</verification>
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
phase: 02-compatibility-automation-and-distribution
3+
plan: "01"
4+
subsystem: compatibility
5+
tags: [json-schema, ci, semver]
6+
requires: [01-useful-v0.1-foundation]
7+
provides: [compatibility-classifier, compatibility-pr-check]
8+
affects: [distribution, governance]
9+
tech-stack:
10+
added: []
11+
patterns: [conservative-directional-classification, machine-readable-ci-report]
12+
key-files:
13+
created:
14+
- scripts/compatibility.mjs
15+
- tests/compatibility.test.mjs
16+
- .github/workflows/compatibility.yml
17+
modified:
18+
- scripts/lib.mjs
19+
- docs/VERSIONING.md
20+
- CONTRIBUTING.md
21+
key-decisions:
22+
- Unknown semantic keyword changes are review_required and fail CI rather than being falsely classified compatible.
23+
requirements-completed: [COMP-01]
24+
completed: 2026-06-11
25+
---
26+
27+
# Phase 2 Plan 1: Compatibility Automation Summary
28+
29+
Implemented a dependency-free directional JSON Schema classifier with pull-request enforcement and machine-readable reports.
30+
31+
## Results
32+
33+
- Classifies unchanged, compatible, breaking, and review-required schema tree changes.
34+
- Detects property, required-field, type, enum, constraint, extensibility, definition, and schema-file compatibility changes.
35+
- Compares pull requests with the latest semantic release and fails CI for breaking and review-required changes.
36+
- Documents local use and governance semantics.
37+
38+
## Verification
39+
40+
- `npm.cmd test`: 8/8 passed
41+
- `npm.cmd run validate`: 7 lifecycle examples validated
42+
- Identical live schema tree classified as `unchanged`
43+
- CLI help and exit behavior verified
44+
45+
## Deviations from Plan
46+
47+
Compatibility tests generate isolated fixtures at runtime instead of storing static fixture directories. This keeps each case explicit and avoids fixture drift.
48+
49+
## Self-Check: PASSED

0 commit comments

Comments
 (0)