-
Notifications
You must be signed in to change notification settings - Fork 50
chore(SREP-4482, SREP-4486, SREP-4800: Boilerplate Update for Agentic SDLC Rollout) #724
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
charlesgong
wants to merge
7
commits into
openshift:main
Choose a base branch
from
charlesgong:SREP-4485
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
71f51ab
add: pre-commit hooks golden standard (SREP-4485)
charlesgong e98bef5
chore(SREP-4482, SREP-4486, SREP-4800): Boilerplate Update for Agenti…
charlesgong c4cb5cc
chore: boilerplate update and pre-commit fixes
charlesgong 04bb6f9
fix: lint and test issues
charlesgong fd8998e
chore: final boilerplate update
charlesgong 18f9df1
chore: remove .pre-commit-config.yaml to unblock CI
charlesgong 5a945e0
chore: rollback .pre-commit-config.yaml to original version
charlesgong File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| build_root_image: | ||
| name: boilerplate | ||
| namespace: openshift | ||
| tag: image-v8.3.4 | ||
| tag: image-v8.3.6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| Run pre-commit hooks on this repository following the agentic SDLC golden rules (SREP-4450). | ||
|
|
||
| ## Usage | ||
| - `/pre-commit` — run on staged files (default, fastest) | ||
| - `/pre-commit --all-files` — run on all files (first-time setup, CI equivalent) | ||
| - `/pre-commit <hook-id>` — run a single hook by ID (targeted debugging) | ||
|
|
||
| ## What you must do | ||
|
|
||
| ### Step 1 — Preflight checks | ||
|
|
||
| 1. Confirm `.pre-commit-config.yaml` exists in the repo root. If not, tell the user and stop. | ||
| 2. Confirm `pre-commit` is installed: run `which pre-commit`. If not found, run `pip install pre-commit` or `pip3 install pre-commit`. | ||
| 3. Confirm hooks are installed: check if `.git/hooks/pre-commit` exists. If not, run `pre-commit install`. | ||
|
|
||
| ### Step 2 — Run hooks | ||
|
|
||
| Determine the run mode from `$ARGUMENTS`: | ||
| - `--all-files` → run `pre-commit run --all-files` | ||
| - `<hook-id>` (a word that is not a flag) → run `pre-commit run <hook-id>` | ||
| - empty or default → run `pre-commit run` (staged files only) | ||
|
|
||
| Capture the full stdout and stderr output. | ||
|
|
||
| ### Step 3 — Parse and categorise results | ||
|
|
||
| For each hook in the output, classify it as one of: | ||
| - **Passed** — hook exited 0, no changes | ||
| - **Auto-fixed** — hook exited non-zero but modified files (trailing-whitespace, end-of-file-fixer) | ||
| - **Failed** — hook exited non-zero, no auto-fix | ||
|
|
||
| Extract for each failure: | ||
| - Hook ID and name | ||
| - Affected files and line numbers if present | ||
| - The error message | ||
| - Whether it is a security hook (gitleaks, rbac-wildcard-check) | ||
|
|
||
| ### Step 4 — Handle auto-fixes (idempotency loop, golden rule 9) | ||
|
|
||
| If any hooks auto-fixed files: | ||
| 1. Stage the modified files: `git add <auto-fixed files>` | ||
| 2. Re-run the hooks on staged files | ||
| 3. Report what was fixed | ||
|
|
||
| ### Step 5 — Retry on failure (golden rule 19, max 2 iterations) | ||
|
|
||
| Track `attempt_count` starting at 1. | ||
|
|
||
| For each non-security failure with an identifiable fix: | ||
| 1. Apply the fix (edit the file, run the suggested command) | ||
| 2. Stage the changes | ||
| 3. Re-run `pre-commit run` | ||
| 4. Increment `attempt_count` | ||
|
|
||
| **Stop retrying when:** | ||
| - All hooks pass → report success | ||
| - `attempt_count` reaches 3 → stop, escalate to human (see Step 6) | ||
| - A security hook fails → stop immediately, escalate to human (see Step 6) | ||
|
|
||
| ### Step 6 — Escalate to human when required | ||
|
|
||
| Escalate (do not retry further) when: | ||
| - A **security hook** fires (gitleaks, rbac-wildcard-check) — these require human judgment | ||
| - Hooks still fail after **2 fix-and-retry attempts** | ||
| - A hook **timed out** — this indicates a systemic issue, not a fixable code problem | ||
|
|
||
| When escalating, report: | ||
| - Which hook is failing | ||
| - The exact error output | ||
| - What was already attempted | ||
| - The recommended next action for the human | ||
|
|
||
| ### Step 7 — Final report | ||
|
|
||
| Always end with a structured summary: | ||
|
|
||
| ``` | ||
| PRE-COMMIT SUMMARY | ||
| ================== | ||
| Passed: <list of hook IDs> | ||
| Auto-fixed: <list of hook IDs> → files staged | ||
| Fixed: <list of hook IDs> → changes applied | ||
| Failed: <list of hook IDs> → escalated to human | ||
| Attempts: <N> of 2 maximum | ||
| ``` | ||
|
|
||
| ## Rules you must never break | ||
|
|
||
| - **Never run `git commit --no-verify`** — bypassing all hooks is not permitted | ||
| - **Never modify `.pre-commit-config.yaml`** to suppress a failing hook | ||
| - **Never retry more than twice** — escalate on the third failure | ||
| - **Never auto-fix a security hook failure** — always escalate to human | ||
| - **Always stage auto-fixed files** before re-running — do not leave unstaged modifications | ||
| - **Always report what changed** — the human must be able to review every fix you applied | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| image-v8.3.4 | ||
| image-v8.3.6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| 28f0d527a87f963961e218687f8e481acf62e47d | ||
| c2342f1bcec55d87fd028e5c1d7f105c745eb32e |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,39 +1,76 @@ | ||
| version: "2" | ||
| run: | ||
| concurrency: 10 | ||
|
|
||
| linters: | ||
| default: none | ||
| enable: | ||
| # Error Handling & Security | ||
| - errcheck | ||
| - gosec | ||
| - govet | ||
| - ineffassign | ||
| - misspell | ||
| - staticcheck | ||
| - gosec | ||
| - bodyclose | ||
| - sqlclosecheck | ||
| - contextcheck | ||
| - noctx | ||
|
|
||
| # Error Prevention | ||
| - errorlint | ||
| - nilerr | ||
| - nilnil | ||
| - revive | ||
|
|
||
| # Code Quality | ||
| - ineffassign | ||
| - unconvert | ||
| - unparam | ||
| - unused | ||
| - misspell | ||
|
|
||
| # Maintainability | ||
| - prealloc | ||
| - nolintlint | ||
| - gocyclo | ||
| - exhaustive | ||
| - makezero | ||
| - containedctx | ||
|
|
||
| settings: | ||
| revive: | ||
| rules: | ||
| - name: package-comments | ||
| disabled: true | ||
|
|
||
| errcheck: | ||
| check-type-assertions: true | ||
| check-blank: false | ||
|
|
||
| exclusions: | ||
| presets: | ||
| - std-error-handling | ||
|
|
||
| gocyclo: | ||
| min-complexity: 15 | ||
|
|
||
| errorlint: | ||
| errorf: true | ||
| asserts: true | ||
| comparison: true | ||
|
|
||
| misspell: | ||
| extra-words: | ||
| - typo: openshit | ||
| correction: OpenShift | ||
| exclusions: | ||
| generated: lax | ||
| presets: | ||
| - comments | ||
| - common-false-positives | ||
| - legacy | ||
| - std-error-handling | ||
| paths: | ||
| - third_party/ | ||
| - builtin/ | ||
| - examples/ | ||
|
|
||
| run: | ||
| timeout: 5m | ||
| # Incremental linting (new-from-rev) is passed via the Makefile's | ||
| # go-check target. In CI it uses PULL_BASE_SHA (guaranteed to exist | ||
| # even in shallow clones); locally it falls back to origin/HEAD. | ||
|
|
||
| formatters: | ||
| enable: | ||
| - gofmt | ||
| - goimports | ||
|
|
||
| issues: | ||
| max-issues-per-linter: 0 | ||
| max-same-issues: 0 | ||
| formatters: | ||
| exclusions: | ||
| generated: lax | ||
| paths: | ||
| - third_party/ | ||
| - builtin/ | ||
| - examples/ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add language specification to fenced code block.
The fenced code block lacks a language identifier. Add a language specification to satisfy markdown linting rules.
📝 Proposed fix
📝 Committable suggestion
🧰 Tools
🪛 markdownlint-cli2 (0.22.1)
[warning] 77-77: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🤖 Prompt for AI Agents