mirror of
https://github.com/rsyslog/rsyslog.git
synced 2026-06-17 10:42:41 +02:00
Why: Mandate the local container testing validation per AGENTS.md before push. To make it completely robust, we prevent empty or invalid marker commits from bypassing the check, expand the file types that trigger re-run (including Python, Dockerfile, YAML metadata, and tests), and handle git history changes gracefully without crashes. Impact: Developer/AI agents are blocked from pushing if they touch C, Python, Docker, YAML, or test files without running container validation first. Before/After: Before, container validation wasn't wired, or empty/invalid markers could be bypassed or cause shell crashes. Now, the hook is fully integrated, robust against invalid commit hashes, and covers all relevant file extensions. Technical Overview: 1. Wire pre_push_container_gate.sh into hooks.json under PreToolUse for Bash. 2. Use git rev-parse to verify the validation marker commit hash actually exists in the local repository before running diffs. 3. Expand file matching regex to include .py, Dockerfile, MODULE_METADATA.yaml, and any files under tests/. 4. Gitignore .codex/container_validated.marker to keep mutable local developer state out of commits. With the help of AI-Agents: Antigravity
Codex Repo Setup
This repository ships a repo-local Codex hook configuration for trusted projects.
What it does
- Enables Codex hooks for this repository via
.codex/config.toml - Runs
.codex/pre_commit_format_gate.shbefore Bash-basedgit commitcommands - Understands both direct
git commit ...invocations and shell-wrapped forms such asbash -lc 'git commit ...' - Runs the deterministic repo-policy focus checks first against the staged commit snapshot
- If those invariants fail, the hook exits early and prints the specific failures for the agent to fix
- The hook runs
./devtools/format-code.sh --git-changed - If
clang-format-18is not installed, the hook allows the commit without blocking - If no tracked
.cor.hfiles have changed, the hook skips formatting work - If formatting fails, the
git committool call is blocked and Codex is told to fix formatting first - If formatting updates
.cor.hfiles, the hook stages those tracked formatter updates automatically and then allows the commit - If partially staged
.cor.hfiles are present, the hook blocks because auto-restaging would not be safe
Requirements
- The repository must be trusted so Codex loads
.codex/config.toml - Codex hooks must be available in your Codex build
Scope
This affects Codex users working in this repository. It does not replace normal project review or CI checks, and it does not affect contributors who are not using Codex.