Skip to content

Commit 4dc270e

Browse files
committed
test(contracts): verify published registry drift
1 parent 4f6c1cb commit 4dc270e

8 files changed

Lines changed: 59 additions & 18 deletions
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Contract registry live drift
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "17 5 * * 1"
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
verify-v1-1:
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 10
15+
steps:
16+
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
17+
- name: Compare published v1.1.0 release with vendored contracts
18+
env:
19+
REGISTRY_BASE: https://coding-autopilot-system.github.io/cas-contracts/registry
20+
PINNED_VERSION: 1.1.0
21+
VENDORED_ROOT: tests/contracts/cas-contracts/v1.1.0
22+
shell: python
23+
run: |
24+
import hashlib, json, os, pathlib, urllib.request
25+
base = os.environ["REGISTRY_BASE"]
26+
version = os.environ["PINNED_VERSION"]
27+
root = pathlib.Path(os.environ["VENDORED_ROOT"])
28+
with urllib.request.urlopen(f"{base}/index.json", timeout=20) as response:
29+
index = json.load(response)
30+
if version not in index.get("releases", []):
31+
raise SystemExit(f"published registry is missing release {version}")
32+
with urllib.request.urlopen(f"{base}/releases/v{version}/manifest.json", timeout=20) as response:
33+
manifest = json.load(response)
34+
for entry in manifest["schemas"]:
35+
local = (root / entry["path"]).read_bytes()
36+
if hashlib.sha256(local).hexdigest() != entry["sha256"]:
37+
raise SystemExit(f"vendored digest drift: {entry['path']}")
38+
with urllib.request.urlopen(f"{base}/releases/v{version}/{entry['path']}", timeout=20) as response:
39+
published = response.read()
40+
if published != local:
41+
raise SystemExit(f"published content drift: {entry['path']}")

tests/contracts/cas-contracts/v1.1.0/common.schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://json-schema.org/draft/2020-12/schema",
3-
"$id": "https://schemas.coding-autopilot.dev/v1.1/common.schema.json",
3+
"$id": "https://coding-autopilot-system.github.io/cas-contracts/registry/v1.1/common.schema.json",
44
"title": "CAS Common Definitions v1.1",
55
"$defs": {
66
"actor": {

tests/contracts/cas-contracts/v1.1.0/manifest.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,34 @@
22
"version": "1.1.0",
33
"schemas": [
44
{
5-
"id": "https://schemas.coding-autopilot.dev/v1.1/common.schema.json",
5+
"id": "https://coding-autopilot-system.github.io/cas-contracts/registry/v1.1/common.schema.json",
66
"path": "common.schema.json",
7-
"sha256": "078026d60c219658fe0fc5cf7c4f786acdcf0c492121f7d688d5078b33ca25af"
7+
"sha256": "111ea168b873aa99a5f2d731f1295320c83c8424156546be9dbdc5624c597562"
88
},
99
{
10-
"id": "https://schemas.coding-autopilot.dev/v1.1/phase-execution-request.schema.json",
10+
"id": "https://coding-autopilot-system.github.io/cas-contracts/registry/v1.1/phase-execution-request.schema.json",
1111
"path": "phase-execution-request.schema.json",
12-
"sha256": "927ffda5ba809e58627ba25b3275355644b510b0ae1c76f446aa7b7f291f08fd"
12+
"sha256": "a9dd60ade628f98cdc97fec9900f4b429f81e0fe07413a2ff21cd42188f85fb6"
1313
},
1414
{
15-
"id": "https://schemas.coding-autopilot.dev/v1.1/phase-execution-result.schema.json",
15+
"id": "https://coding-autopilot-system.github.io/cas-contracts/registry/v1.1/phase-execution-result.schema.json",
1616
"path": "phase-execution-result.schema.json",
17-
"sha256": "1d353e20cf6338c2de4a9bec0bad83ca0dec6c9feb5434c5e6264fdc075e7c25"
17+
"sha256": "7c56cc51aa0f8ae878a4f8219a4b1bedc20697f57d557797a0907a7163df1f7e"
1818
},
1919
{
20-
"id": "https://schemas.coding-autopilot.dev/v1.1/phase-verification-result.schema.json",
20+
"id": "https://coding-autopilot-system.github.io/cas-contracts/registry/v1.1/phase-verification-result.schema.json",
2121
"path": "phase-verification-result.schema.json",
22-
"sha256": "ec5b97a2bf75892530442f666d23a8b6dbb8f13bda0efe49553d3f64cd41b995"
22+
"sha256": "800cfceecd61a16883a5be67f0da9ff9fa8865450c62e92676a878189c12b6cc"
2323
},
2424
{
25-
"id": "https://schemas.coding-autopilot.dev/v1.1/sdlc-lifecycle-event.schema.json",
25+
"id": "https://coding-autopilot-system.github.io/cas-contracts/registry/v1.1/sdlc-lifecycle-event.schema.json",
2626
"path": "sdlc-lifecycle-event.schema.json",
27-
"sha256": "bd955637761679d3b6e8ee09fb7b693b1d0362615b0865204c5ae3bacb3809dc"
27+
"sha256": "f746915fc3687496be216d0b8bcfec0398a8c5eebb765ff8c63e7c9ee88b174f"
2828
},
2929
{
30-
"id": "https://schemas.coding-autopilot.dev/v1.1/sdlc-profile.schema.json",
30+
"id": "https://coding-autopilot-system.github.io/cas-contracts/registry/v1.1/sdlc-profile.schema.json",
3131
"path": "sdlc-profile.schema.json",
32-
"sha256": "f4974e911e7cb88191c1a331470c8cd7a79d1c7311c963dd70cd9c8f524ebe45"
32+
"sha256": "80e75549b7ef49182aba640576228db6bed674f15847b154bbf83d7953e23334"
3333
}
3434
]
3535
}

tests/contracts/cas-contracts/v1.1.0/phase-execution-request.schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://json-schema.org/draft/2020-12/schema",
3-
"$id": "https://schemas.coding-autopilot.dev/v1.1/phase-execution-request.schema.json",
3+
"$id": "https://coding-autopilot-system.github.io/cas-contracts/registry/v1.1/phase-execution-request.schema.json",
44
"title": "PhaseExecutionRequest",
55
"type": "object",
66
"allOf": [

tests/contracts/cas-contracts/v1.1.0/phase-execution-result.schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://json-schema.org/draft/2020-12/schema",
3-
"$id": "https://schemas.coding-autopilot.dev/v1.1/phase-execution-result.schema.json",
3+
"$id": "https://coding-autopilot-system.github.io/cas-contracts/registry/v1.1/phase-execution-result.schema.json",
44
"title": "PhaseExecutionResult",
55
"type": "object",
66
"allOf": [

tests/contracts/cas-contracts/v1.1.0/phase-verification-result.schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://json-schema.org/draft/2020-12/schema",
3-
"$id": "https://schemas.coding-autopilot.dev/v1.1/phase-verification-result.schema.json",
3+
"$id": "https://coding-autopilot-system.github.io/cas-contracts/registry/v1.1/phase-verification-result.schema.json",
44
"title": "PhaseVerificationResult",
55
"type": "object",
66
"allOf": [

tests/contracts/cas-contracts/v1.1.0/sdlc-lifecycle-event.schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://json-schema.org/draft/2020-12/schema",
3-
"$id": "https://schemas.coding-autopilot.dev/v1.1/sdlc-lifecycle-event.schema.json",
3+
"$id": "https://coding-autopilot-system.github.io/cas-contracts/registry/v1.1/sdlc-lifecycle-event.schema.json",
44
"title": "SdlcLifecycleEvent",
55
"type": "object",
66
"allOf": [

tests/contracts/cas-contracts/v1.1.0/sdlc-profile.schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://json-schema.org/draft/2020-12/schema",
3-
"$id": "https://schemas.coding-autopilot.dev/v1.1/sdlc-profile.schema.json",
3+
"$id": "https://coding-autopilot-system.github.io/cas-contracts/registry/v1.1/sdlc-profile.schema.json",
44
"title": "SdlcProfile",
55
"type": "object",
66
"allOf": [

0 commit comments

Comments
 (0)