Skip to content

fix(training): guard HF dataset snapshots with parent-commit CAS #590

fix(training): guard HF dataset snapshots with parent-commit CAS

fix(training): guard HF dataset snapshots with parent-commit CAS #590

# .github/workflows/hf-space-drift.yml
# =============================================================================
# HF Space drift gate
# =============================================================================
# Protects the intentional mirror between the canonical OCR service and the
# frozen HF Space application core.
#
# Layer 1: scripts/sync-hf-space.sh --verify checks auto-synced directories.
# Layer 2: scripts/check_hf_space_drift.py compares the OCR knobs that must
# remain parallel between hf-space/app_core.py and app/services/ocr_service.py.
#
# Failure policy: any unexpected drift fails the build.
# =============================================================================
name: HF Space Drift Gate
on:
pull_request:
push:
branches: [main]
schedule:
- cron: '30 6 * * *'
permissions:
contents: read
concurrency:
group: hf-space-drift-${{ github.ref }}
cancel-in-progress: true
jobs:
hf-space-drift:
name: Verify hf-space ↔ app/services mirror
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Make sync script executable
run: chmod +x scripts/sync-hf-space.sh
- name: Layer 1 — auto-synced paths verify
run: |
echo "=== Layer 1: scripts/sync-hf-space.sh --verify ==="
./scripts/sync-hf-space.sh --verify
- name: Layer 2 — manual mirror audit
run: |
echo "=== Layer 2: app_core ↔ canonical OCR service ==="
python3 scripts/check_hf_space_drift.py
- name: Summary
if: always()
run: |
echo "=== Drift gate summary ==="
echo "Layer 1: scripts/sync-hf-space.sh --verify"
echo "Layer 2: scripts/check_hf_space_drift.py"
echo " — PaddleOCR / ImagePreprocessor / Tesseract / OCR_CORRECTIONS"