copy check: assets/contracts/ files equal their contracts source
/ crosscheck (push) Successful in 1s
/ crosscheck (push) Successful in 1s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DDwfd6Ki8UfG4hK6W5YpJz
This commit is contained in:
@@ -17,6 +17,7 @@ no network: plain Python over the tracked files.
|
|||||||
| `docref` | the repos' own trees | ``<repo> `FILE.md` `` naming a file that does not exist; relative markdown links that do not resolve |
|
| `docref` | the repos' own trees | ``<repo> `FILE.md` `` naming a file that does not exist; relative markdown links that do not resolve |
|
||||||
| `binaries` | each repo's `Cargo.toml` and `deploy/*.service` | project-yukart `REPOS.md` missing a deployed binary; `ORIN-RUNTIME.md` missing a deployed service |
|
| `binaries` | each repo's `Cargo.toml` and `deploy/*.service` | project-yukart `REPOS.md` missing a deployed binary; `ORIN-RUNTIME.md` missing a deployed service |
|
||||||
| `frontmatter` | the docs convention | a `docs/**/*.md` without front matter, or with an unknown `type` |
|
| `frontmatter` | the docs convention | a `docs/**/*.md` without front matter, or with an unknown `type` |
|
||||||
|
| `copy` | contracts | a file under `assets/contracts/<path>` that is not byte-identical to contracts' `<path>` (or has no source there) |
|
||||||
|
|
||||||
## Run it
|
## Run it
|
||||||
|
|
||||||
|
|||||||
+18
-1
@@ -19,6 +19,8 @@ Exit status 1 when anything is found. Checks, and the source each one trusts:
|
|||||||
binaries REPOS.md's row for a repo names every deployed [[bin]] in its Cargo.toml;
|
binaries REPOS.md's row for a repo names every deployed [[bin]] in its Cargo.toml;
|
||||||
ORIN-RUNTIME.md names every service a repo deploys
|
ORIN-RUNTIME.md names every service a repo deploys
|
||||||
frontmatter every docs/**/*.md starts with front matter whose type is known
|
frontmatter every docs/**/*.md starts with front matter whose type is known
|
||||||
|
copy a file under assets/contracts/<path> in any repo is byte-identical to
|
||||||
|
contracts' <path> (bundled copies, e.g. the app's checklists)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
@@ -246,6 +248,21 @@ def check_frontmatter(ws: Workspace) -> None:
|
|||||||
find(f"{repo}/{rel}", 1, "frontmatter", f"type '{t.group(1)}' is not one of {sorted(DOC_TYPES)}")
|
find(f"{repo}/{rel}", 1, "frontmatter", f"type '{t.group(1)}' is not one of {sorted(DOC_TYPES)}")
|
||||||
|
|
||||||
|
|
||||||
|
# ── bundled copies of contracts files ────────────────────────────────────────
|
||||||
|
|
||||||
|
|
||||||
|
def check_copies(ws: Workspace) -> None:
|
||||||
|
for repo in ws.repos:
|
||||||
|
for rel in ws.files[repo]:
|
||||||
|
if not rel.startswith("assets/contracts/"):
|
||||||
|
continue
|
||||||
|
src = rel.removeprefix("assets/contracts/")
|
||||||
|
if src not in ws.files["contracts"]:
|
||||||
|
find(f"{repo}/{rel}", 1, "copy", f"contracts has no {src} to copy")
|
||||||
|
elif (ws.root / repo / rel).read_bytes() != (ws.root / "contracts" / src).read_bytes():
|
||||||
|
find(f"{repo}/{rel}", 1, "copy", f"differs from contracts {src}; run tool/sync-contracts.sh")
|
||||||
|
|
||||||
|
|
||||||
def main() -> int:
|
def main() -> int:
|
||||||
root = Path(sys.argv[1] if len(sys.argv) > 1 else ".").resolve()
|
root = Path(sys.argv[1] if len(sys.argv) > 1 else ".").resolve()
|
||||||
ws = Workspace(root)
|
ws = Workspace(root)
|
||||||
@@ -253,7 +270,7 @@ def main() -> int:
|
|||||||
if missing:
|
if missing:
|
||||||
print(f"crosscheck: {root} lacks {', '.join(sorted(missing))}; nothing to check against", file=sys.stderr)
|
print(f"crosscheck: {root} lacks {', '.join(sorted(missing))}; nothing to check against", file=sys.stderr)
|
||||||
return 2
|
return 2
|
||||||
for check in (check_decisions, check_topics, check_docrefs, check_binaries, check_frontmatter):
|
for check in (check_decisions, check_topics, check_docrefs, check_binaries, check_frontmatter, check_copies):
|
||||||
check(ws)
|
check(ws)
|
||||||
for f in findings:
|
for f in findings:
|
||||||
print(f)
|
print(f)
|
||||||
|
|||||||
Reference in New Issue
Block a user