Drift Analyzer Tool Index
Mô tả công cụ: drift_analyzer.py
Script: /tools/review/drift_analyzer.py
Mục đích: Chạy nightly trên main branch để phát hiện tài liệu quá hạn review (review_by <= today), phân tích git history và incident correlation, đưa ra recommendation thay vì gửi thông báo blank.
Logic phân tích drift
Với mỗi tài liệu quá hạn:
- Git log check: Đếm commits trên file kể từ
timestampcuối cùng → nếu có commits mới = có thay đổi thực tế. - Incident correlation: Tìm incidents trong
/irp/incidents/cótagsoverlap với tags của document → nếu có = service đã từng gặp sự cố.
Kết quả:
drift_detected = True→ "Review required — code or operational changes detected"drift_detected = False→ "Auto-renew suggested — no system or document modifications detected"
Cách chạy
# Scan và in report dạng text
python tools/review/drift_analyzer.py --format text
# Scan và export JSON report
python tools/review/drift_analyzer.py --format json --output reports/drift-$(date +%Y%m%d).json
# CI gate mode: exit 1 nếu có expired docs
python tools/review/drift_analyzer.py --format text --check-only
CI mode (--check-only)
Khi chạy với --check-only trong nightly schedule job: exit code 1 nếu phát hiện expired docs — giúp CI pipeline cảnh báo team mà không block các pipelines khác.