FlexiRule Docs
Scheduled Agent Automation Workflow
Automated synchronization and product-update review workflow for scheduled agents.
Scheduled Agent Automation Workflow#
This document details the operational specifications, algorithm, data schemas, checkpoint semantics, data minimization rules, and failure handling procedures for automated scheduled agents that process application commit history and maintain product updates for FlexiRule.
1. Responsibilities & UI Separation#
To preserve absolute accuracy, privacy, and commit traceability, the system strictly separates public user-facing content from internal developer diagnostics:
content/en/product-updates/_index.md: Public-facing release notes written in clear, business-oriented language for Frappe/ERPNext users. Does not display raw commit SHAs, author email addresses, checkpoint badges, or automation diagnostics.content/en/developer-guide/commit-history.md: Technical developer view providing full git commit subjects, SHAs, PR links, and search controls.data/commit_history.json&static/data/commit_history.json: Canonical public commit history API. Author and committer email addresses are excluded to enforce data minimization.data/product_updates_checkpoint.json&static/data/product_updates_checkpoint.json: Machine-readable review checkpoint tracking the latest commit SHA evaluated for product-facing impact.data/commit_audit_map.json&static/data/commit_audit_map.json: Internal audit matrix mapping each commit SHA to its review classification (user_facing,internal,needs_review) and associated update ID.
2. Agent Execution Algorithm#
A scheduled agent must execute the following 11-step procedure during each execution cycle:
- Read Canonical Checkpoint: Read
data/product_updates_checkpoint.jsonto obtainlatest_reviewed_commit_sha. - Fetch Develop Head SHA: Query the GitHub REST API (
https://api.github.com/repos/Sendipad/flexirule/commits?sha=develop&per_page=1) or fetch local git HEAD to obtainhead_sha. - Compare SHAs:
- If
head_sha == latest_reviewed_commit_sha, log “No new commits require review” and exit safely with status0.
- If
- Synchronize Commit History: Run
python3 scripts/sync_commit_history.pyto updatedata/commit_history.jsonand verify that thestatic/data/static mirror is identical. - Identify Commit Range: Extract all commits in
data/commit_history.jsonbetweenlatest_reviewed_commit_shaandhead_shain chronological order (oldest to newest). - Analyze User Impact: For each unreviewed commit, inspect the commit subject, changed files, pull request details, and documentation.
- Filter & Group User Changes: Distinguish user-visible features, workflow changes, UI improvements, bug fixes, or breaking changes from internal maintenance (tests, refactors, CI updates). Group related commits into a single coherent update entry.
- Draft Product Update Entries: Append new entries to
content/en/product-updates/_index.mdunder standard categories (Features, Improvements, Fixes) with concise “What Changed”, “What You Can Do”, “Why It Matters”, and documentation cross-links. - Update Audit Map: Record review classifications and update mappings in
data/commit_audit_map.json. - Validate Site Integrity: Execute
hugo --gc --minify=falseto verify frontmatter, internal links, aliases, and static site build status. - Advance Review Checkpoint: Run
python3 scripts/sync_commit_history.py --advance-checkpoint <head_sha> --review-status assessedto atomically advancelatest_reviewed_commit_shatohead_sha.
3. Data Schemas & Privacy Rules#
Data Minimization Rule#
- Author and committer email addresses must never be written to public static JSON endpoints (
commit_history.json). Only display names (author_name,committer_name) are retained.
Checkpoint Schema (data/product_updates_checkpoint.json)#
{
"repository": "Sendipad/flexirule",
"tracked_branch": "develop",
"latest_reviewed_commit_sha": "1c32acc451ff13950c3d5125a114cf3b59dfa01b",
"commit_url": "https://github.com/Sendipad/flexirule/commit/1c32acc451ff13950c3d5125a114cf3b59dfa01b",
"checkpoint_timestamp": "2026-10-09T22:45:00Z",
"review_status": "assessed",
"latest_completed_review_timestamp": "2026-10-09T22:45:00Z",
"latest_synchronized_commit_sha": "1c32acc451ff13950c3d5125a114cf3b59dfa01b",
"latest_synchronized_timestamp": "2026-10-09T22:45:00Z"
}
4. Failure Handling & Resilience Rules#
- Mirror Consistency:
scripts/sync_commit_history.pyverifies thatdata/files andstatic/data/mirrors match identically. - Fetch Failures: If GitHub API or network errors occur, existing valid commit history and checkpoint files are preserved without modification.
- Unreachable Checkpoint SHA: If
latest_reviewed_commit_shais no longer reachable fromdevelop(e.g. force push or history rebase), fail fast and request manual reconciliation. Do not silently reset the checkpoint. - Partial Review Interruption: If an agent reviews only part of a batch, advance
--advance-checkpointto the last successfully reviewed commit SHA in the sequence.
Was this page helpful?