Files
gcp_solution_architecture_a…/tests/test_vendored_skills.py
Jonathan Boniface 2976dfab21 feat: vendor upstream Skills and add the GCP provider bundle
Increment 2 of .scratch/solution-architect-agent/spec.md.

- Vendor google-cloud-solution-architecture and the six
  google-cloud-waf-* Skills from google/skills@81a31a6, unmodified,
  with LICENSE, SHA256SUMS and VENDOR.md; add
  scripts/sync-vendored-skills.sh to re-sync at a pinned sha.
- app/agent_skills.py: discover Skills and validate SKILL.md
  frontmatter against the Agent Skills specification.
- app/providers.py + providers/gcp.yaml: load and validate a Cloud
  provider bundle (Skills, output template, per-role models, tool
  tiers, remote MCP servers). MCP allowlists stay empty until the
  read-only review in increment 6.
- Settings CLOUD_PROVIDER and MCP_ENABLE_PREVIEW.
- 35 new tests; full suite 65 passed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-15 18:20:17 +01:00

54 lines
1.8 KiB
Python

"""Vendored upstream Skills stay byte-for-byte what VENDOR.md says they are."""
import hashlib
from pathlib import Path
from app.agent_skills import discover_skills
VENDOR_DIR = Path(__file__).parents[1] / "skills" / "vendor" / "google"
PINNED_COMMIT = "81a31a6e4300425598a69fd96c8e843c947ae308"
EXPECTED_SKILLS = {
"google-cloud-solution-architecture",
"google-cloud-waf-security",
"google-cloud-waf-reliability",
"google-cloud-waf-cost-optimization",
"google-cloud-waf-operational-excellence",
"google-cloud-waf-performance-optimization",
"google-cloud-waf-sustainability",
}
def read_checksums() -> dict[str, str]:
entries = {}
for line in (VENDOR_DIR / "SHA256SUMS").read_text(encoding="utf-8").splitlines():
digest, relative_path = line.split(maxsplit=1)
entries[relative_path] = digest
return entries
def test_vendor_record_names_pinned_commit_and_licence():
vendor_md = (VENDOR_DIR / "VENDOR.md").read_text(encoding="utf-8")
assert f"`{PINNED_COMMIT}`" in vendor_md
assert "Apache License" in (VENDOR_DIR / "LICENSE").read_text(encoding="utf-8")
def test_checksums_cover_every_vendored_file_and_match():
checksums = read_checksums()
on_disk = {
path.relative_to(VENDOR_DIR).as_posix()
for path in VENDOR_DIR.rglob("*")
if path.is_file() and path.name not in {"SHA256SUMS", "VENDOR.md"}
}
assert set(checksums) == on_disk
for relative_path, digest in checksums.items():
actual = hashlib.sha256((VENDOR_DIR / relative_path).read_bytes()).hexdigest()
assert actual == digest, f"{relative_path} differs from vendored upstream"
def test_expected_upstream_skills_are_present_and_valid():
skills = discover_skills([VENDOR_DIR])
assert set(skills) == EXPECTED_SKILLS