decode_tools / docs /guides /git-and-pr-rules.md
DecodeMarketing's picture
Claude Opus 4.7 (1M context)
[ai-standards][slice-1] orientation and deploy boundary (#7)
7a5c442 unverified
|
Raw History Blame Contribute Delete
4.8 kB
# Git and PR rules
## Default flow
1. Branch from `main`: `git checkout -b feature/<scope-kebab>`.
2. Commit on the feature branch. Stage files explicitly (`git add path/to/file`, never `git add -A` / `git add .`). The pre-commit gate runs ruff on staged Python; the commit-msg gate enforces the reviewer marker. Both are bypassable only via `[override-reviewer: <reason>]` (audit-logged).
3. Push the feature branch: `git push -u origin feature/<scope-kebab>`.
4. Open a PR against `main`. Fill in the PR template at `.github/pull_request_template.md`.
5. Wait for CI: `gate.yml` (ruff + override-audit), `repo_validate.yml` (py_compile sweep), `check-file-size.yml` (LFS warning).
6. Get review: the `feature-dev:code-reviewer` subagent locally (writes `.decode-reviewer-clean`), plus at least one human approver on the PR.
7. Merge to `main`. **Note: merging to `main` triggers an HF Space deploy.** See [`protected-boundary-policy.md`](protected-boundary-policy.md) for the deploy-continuity check expected after merge.
## Branch naming
- `feature/<scope-kebab>` β€” new feature or change.
- `debug/<scope-kebab>` β€” short-lived branch for investigation (do not merge β€” close with discussion in a comment).
- `hotfix/<scope-kebab>` β€” emergency fix going to `main`. Requires explicit owner sign-off per the protected-boundary policy.
Anything that does not fit one of these prefixes should be discussed before pushing.
## Commit message rules
From `CLAUDE.md` (base rules):
- **No AI attribution.** Conventional Commits format (`feat:`, `fix:`, `docs:`, `chore:`, `refactor:`, `test:`), human author.
- **No `Co-Authored-By` lines naming an AI model.**
- The override marker is the only AI-specific text permitted: `[override-reviewer: <reason>]` inline in the message.
The local agent harness applies these rules as well.
## PR target
`main` is the PR target for all routine work. There is no `develop` / `dev` PR target in active use today (see "Observed branches" below).
## Observed branches on origin (status: not yet defined in repo docs)
These branches exist on `origin` at the time of writing:
| Branch | Observed state | Documented role |
|---------------------------------------------------|-------------------------------------------------|-----------------|
| `main` | Default branch. Auto-deploys to HF Space. | Yes β€” this doc + `protected-boundary-policy.md`. |
| `dev` | Exists on origin. | **No.** Team should confirm intended role. |
| `staging` | Exists on origin. | **No.** Team should confirm intended role. |
| `hardening/decode-gates` | Source of the DECODE hardening commits merged into main 2026-05. | Historical; closed/archive candidate. |
| `sandbox` | Old, unused. | **No.** Likely archive/delete candidate. |
| `feature/refresh-codeowners-posture-2026-05-11` | Existing feature branch. | In-flight feature work (not this remediation). |
**Open team decision** β€” do `dev` and `staging` participate in a planned promotion model (e.g., `feature/* β†’ dev β†’ staging β†’ main`)? If yes, document it here and rewire `.github/workflows/main.yml` so the HF deploy trigger fires only at the right step. If no, archive them.
This doc records what is **observed**, not what is **prescribed**. Do not invent a promotion model in the absence of team confirmation.
## What pull request reviewers should look for
PR reviewer checklist (also in `.github/pull_request_template.md`):
1. Does this change touch any deploy-boundary file? (See `protected-boundary-policy.md`.)
2. Does this change add a new shared utility that should live in `helper.py`, not in a tab file? (See `docs/architecture/active-surface.md`.)
3. Does this change add a new doc that should also be linked from `docs/INDEX.md`?
4. Did `gate.yml`, `repo_validate.yml`, and `check-file-size.yml` all pass?
5. Is there a `[override-reviewer: ...]` line in the commit history of this PR? If yes, is the reason real?
## Merging strategy
Squash-merge is the recommended option for the in-repo flow. The HF deploy sees one commit per merged PR, which keeps the rebuild log clean.
## Force push and destructive ops
Blocked by `.claude/hooks/block-dangerous-git.sh` at the Claude Code tool layer. If you genuinely need one (e.g., to clean up a feature branch before PR review), ask the user to run the command manually in their own terminal. **Never force-push `main`** under any circumstance.