Files
msime-windows/scripts/check-dictionary-contract.py
T
Evan Hu 6bb0c1e10e fix(ci): check out the engine submodule in the product inputs job
check-dictionary-contract.py compares scripts/dictionary_product.py against the engine's own copy, so the job needs the submodule's contents and not just its gitlink. The reusable workflow this job replaced checked out submodules; the rewrite dropped that.

The script reported a missing file as "differs from the pinned Engine contract", which describes a drift that had not happened and sends the reader looking for a content change. It now says the file is missing and how to get it.
2026-09-06 02:51:08 +09:00

13 lines
793 B
Python

#!/usr/bin/env python3
"""Reject a vendored validator that differs from the reviewed Engine gitlink."""
from pathlib import Path
root = Path(__file__).resolve().parents[1]
source = root / 'vendor/MetasequoiaImeEngine/contracts/dictionary/product.py'
# An engine submodule that was never checked out is not a validator that drifted. Reporting both as
# "differs" sends whoever reads it looking for a content change that is not there.
if not source.is_file():
raise SystemExit(f'{source.relative_to(root)} is missing; run git submodule update --init')
if source.read_bytes() != (root / 'scripts/dictionary_product.py').read_bytes():
raise SystemExit('Dictionary validator differs from the pinned Engine contract')
print('Dictionary product validator matches the pinned Engine contract')