Skip to content

feat: add --check-stale flag for CI gating (fixes #2) - #64

Open
Fuhua-GIF wants to merge 1 commit into
Saiaaax:mainfrom
Fuhua-GIF:feat/check-stale-ci-gate
Open

feat: add --check-stale flag for CI gating (fixes #2)#64
Fuhua-GIF wants to merge 1 commit into
Saiaaax:mainfrom
Fuhua-GIF:feat/check-stale-ci-gate

Conversation

@Fuhua-GIF

Copy link
Copy Markdown

Summary

Adds --check-stale flag to build.py for CI pipeline gating, as requested in #2.

Changes

  • Updated build.py:

    • Added --check-stale CLI flag: exits 1 if older (non-current-commit) diagnostic artifacts exist
    • Added --max-stale-bytes option (default: 0 = any stale is an error)
    • Added find_stale_artifacts() function: scans diagnostic/ for artifacts from other commits
    • Added check_stale_artifacts() function: compares artifact commit IDs to current HEAD
    • Added 5 self-tests (--self-test) covering empty dir, current artifacts, stale detection, byte thresholds, and chunked artifacts
    • The flag is read-only and does not delete any artifacts
  • Updated docs/OPERATIONS.md:

    • Added 'Build System' section documenting --check-stale
    • Documented options table, CI pipeline YAML example, and self-test instructions

Usage

# CI gate: fail if stale diagnostics exist
python3 build.py --check-stale

# Allow up to 1KB of stale artifacts
python3 build.py --check-stale --max-stale-bytes 1024

# Run self-tests
python3 build.py --self-test

Testing

All 5 self-tests pass:

  1. Empty diagnostic dir is clean
  2. Current commit artifacts are not stale
  3. Different commit artifact is stale
  4. max_stale_bytes threshold works
  5. Chunked stale artifacts are detected

Diagnostic Artifacts

Diagnostic JSON metadata: build-ec966bc5.json

Note: .logd file could not be generated on Windows (encryptly binary not available for this platform). JSON metadata is included.

Checklist

  • --check-stale flag added to build.py
  • --max-stale-bytes option works
  • 5 self-tests added and passing
  • Documentation updated in docs/OPERATIONS.md
  • Flag is read-only (does not delete artifacts)
  • Changes are scoped to the build system

Fixes #2

- Add --check-stale flag: exits 1 if stale diagnostic artifacts exist
- Add --max-stale-bytes option (default: 0 = any stale is error)
- Add find_stale_artifacts() and check_stale_artifacts() functions
- Add 5 self-tests (--self-test flag)
- Add documentation in docs/OPERATIONS.md
- Read-only: does not delete artifacts

All 5 self-tests pass.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[$10 BOUNTY] [Python] Add build.py --check-stale flag for CI gating

1 participant