chore(canonicals): sync contract-drift-check-v1 → template 2659a17

Single-pin sync of the drift-check meta-tooling to the corviduo-project-
template canonical (23271287 → 2659a17a). Consumer copy is byte-exact;
pin hash + pinned_at bumped. No runtime effect (meta-tooling, not product
code) → no version bump per SemVer skip-rule. The two tolerate_drift
worldtree prose pins (conversation-api-spec, affect-egress-consumer-
reference) are deliberately left STALE — their re-vendor is coordinated
with the R34/R35 eval's diff-review, not a blind sync.
This commit is contained in:
2026-07-12 01:41:41 -07:00
parent 62a16d2d92
commit 7bca76e7b6
2 changed files with 32 additions and 5 deletions
+2 -2
View File
@@ -87,8 +87,8 @@ id = "contract-drift-check-v1"
canonical_source = "corviduo-project-template"
canonical_path = "scripts/contract_drift_check.py"
consumer_path = "scripts/contract_drift_check.py"
pinned_sha256_16 = "23271287ac488da4"
pinned_at = "2026-05-17T05:30:00+00:00"
pinned_sha256_16 = "2659a17a65704b66"
pinned_at = "2026-07-12T08:39:35+00:00"
# ---------------------------------------------------------------------------
# Worldtree Conversation-API surface (vendored from ~/development/Worldtree).
+30 -3
View File
@@ -13,7 +13,8 @@ Usage:
python scripts/contract_drift_check.py --contract docs/contracts/issues/138.contract.md
python scripts/contract_drift_check.py --json
Requires GITEA_TOKEN in environment (and GITEA_URL/OWNER/REPO if not in env.sh).
Requires GITEA_TOKEN in environment. Owner/repo are derived from the `origin` git remote by
default (override with GITEA_OWNER / GITEA_REPO; GITEA_URL defaults to the Gitea host).
"""
from __future__ import annotations
@@ -21,6 +22,8 @@ import argparse
import hashlib
import json
import os
import re
import subprocess
import sys
from pathlib import Path
from typing import Any
@@ -32,6 +35,22 @@ PROJECT_ROOT = Path(__file__).parent.parent
CONTRACTS_GLOB = "docs/contracts/**/*.contract.md"
def _owner_repo_from_git_remote() -> tuple[str, str] | None:
"""Derive (owner, repo) from the `origin` git remote so the drift check targets THIS repo
by default — instead of a hardcoded repo name that silently checks the WRONG repo for every
other consumer. Supports ssh (git@host:owner/repo.git) and https (https://host/owner/repo.git)
Gitea remotes; returns None if it can't resolve."""
try:
url = subprocess.run(
["git", "-C", str(PROJECT_ROOT), "remote", "get-url", "origin"],
capture_output=True, text=True, check=True,
).stdout.strip()
except (OSError, subprocess.SubprocessError):
return None
m = re.search(r"[:/]([^/:]+)/([^/]+?)(?:\.git)?/?$", url)
return (m.group(1), m.group(2)) if m else None
def sha16(s: str) -> str:
return hashlib.sha256(s.encode("utf-8")).hexdigest()[:16]
@@ -70,11 +89,19 @@ def main() -> int:
token = os.environ.get("GITEA_TOKEN", "")
base_url = os.environ.get("GITEA_URL", "https://gitea.phasefinal.com")
owner = os.environ.get("GITEA_OWNER", "vh")
repo = os.environ.get("GITEA_REPO", "Worldtree")
# Owner/repo default to the `origin` remote so the check targets THIS repo; GITEA_OWNER /
# GITEA_REPO override when set. (Previously repo defaulted to a hardcoded "Worldtree", which
# silently checked the WRONG repo for every other consumer unless GITEA_REPO was set in env —
# a false-drift footgun. Derive it, and fail loud rather than guess.)
git_remote = _owner_repo_from_git_remote()
owner = os.environ.get("GITEA_OWNER") or (git_remote[0] if git_remote else None)
repo = os.environ.get("GITEA_REPO") or (git_remote[1] if git_remote else None)
if not token:
print("error: GITEA_TOKEN not set", file=sys.stderr)
return 2
if not owner or not repo:
print("error: could not resolve owner/repo — set GITEA_OWNER/GITEA_REPO or run inside a repo with an 'origin' remote", file=sys.stderr)
return 2
if args.contract:
files = [Path(args.contract).resolve()]