Skip to content

Commit 7aa9ab3

Browse files
authored
Merge pull request #255 from ToolboxAid/PR_26179_OWNER_011-pr-branching-model-docs
PR_26179_OWNER_011-pr-branching-model-docs
2 parents d663278 + 32f6d67 commit 7aa9ab3

13 files changed

Lines changed: 471 additions & 113 deletions

dev/build/ProjectInstructions/TEAM_START_COMMANDS.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ Official Start of Day command format lives in:
88

99
The ready-to-copy team assignment commands below are OWNER assignment helpers, not Start of Day bootstrap commands.
1010

11-
No team creates a PR branch until all checks pass:
11+
For Independent PRs and for the first PR in a new stacked workstream, no team creates a PR branch until all checks pass:
1212

1313
- Current branch: `main`
1414
- Worktree: clean
1515
- `main...origin/main`: `0 0`
1616
- `HEAD` SHA matches the published EOD SHA
1717

18+
Dependent Stacked PRs may start from the documented previous PR branch only when `dev/build/ProjectInstructions/addendums/pr_workflow.md` defines the direct dependency and merge order.
19+
1820
Use `dev/build/ProjectInstructions/` as the only active Project Instructions source.
1921
Read `dev/build/ProjectInstructions/addendums/team_backlog_sod_eod_standard.md` before implementation.
2022

dev/build/ProjectInstructions/addendums/branch_context_governance.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ At the start of work, report or validate:
2323
- active team
2424
- active assignment
2525
- active PR number/name or explicit `PLAN_ONLY`
26+
- requested PR branching model: Independent PR or Stacked PR
27+
- expected starting branch for the requested PR branching model
2628
- previous PR Closed status unless this is an explicitly documented stacked PR chain
2729

2830
Session start must follow the canonical START phase in `dev/build/ProjectInstructions/addendums/project_instructions_single_source_eod_lock.md`.
@@ -32,12 +34,14 @@ Session start must follow the canonical START phase in `dev/build/ProjectInstruc
3234
Stop and report before changing files when:
3335

3436
- current branch does not match the expected branch
37+
- requested PR branching model does not match the current/start branch
3538
- local branch is behind or ahead unexpectedly
3639
- worktree has unrelated changes
3740
- active assignment is missing or unclear
3841
- active team does not match the branch or OWNER instruction
3942
- BUILD_PR work has no PR name and active branch/PR identity, unless explicitly marked `PLAN_ONLY`
4043
- the team's previous PR is not Closed and no stacked PR chain is documented
44+
- the request describes a Stacked PR but does not document the dependency order
4145
- the requested work would modify files outside the approved scope
4246

4347
## Continuation Rule

dev/build/ProjectInstructions/addendums/branch_lock_governance.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,12 @@ This file owns branch lock enforcement and OWNER override handling; it must not
2626

2727
## Branch Rules
2828

29-
- Start from current `main`.
30-
- Pull latest `origin/main` before creating a work branch.
31-
- Do not create a PR branch unless current branch is `main`, worktree is clean, `main...origin/main` is `0 0`, and `HEAD` SHA matches the published EOD SHA.
29+
- Identify the PR branching model before creating or continuing a PR branch.
30+
- Independent PRs and new stacked workstreams start from current `main`.
31+
- Dependent Stacked PRs may start from the documented previous PR branch only when a direct dependency and dependency order are documented in `dev/build/ProjectInstructions/addendums/pr_workflow.md`.
32+
- Pull latest `origin/main` before creating an Independent PR branch or the first branch in a new stack.
33+
- Do not create an Independent PR branch unless current branch is `main`, worktree is clean, `main...origin/main` is `0 0`, and `HEAD` SHA matches the published EOD SHA.
34+
- HARD STOP if the current branch does not match the requested PR branching model.
3235
- Follow the canonical START / WORK / END lifecycle in `dev/build/ProjectInstructions/addendums/project_instructions_single_source_eod_lock.md`.
3336
- Keep work on the active branch until the PR is merged, the branch is retired, EOD closeout begins, or OWNER says to return to `main`.
3437
- For OWNER-approved stacked/sequential workstreams, PR branches/commits stay on the active team branch/workstream during the day and do not return to `main` between PRs.

dev/build/ProjectInstructions/addendums/pr_workflow.md

Lines changed: 64 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,69 @@ This file owns PR lifecycle governance. It must not duplicate command phase rule
1919

2020
## Standard Flow
2121

22-
1. Start from main.
23-
2. Pull latest origin/main.
24-
3. Verify clean worktree.
25-
4. Create a PR branch and PR identity.
26-
5. Mark lifecycle state as PR Open.
27-
6. Plan on the same PR branch.
28-
7. Build on the same PR branch.
29-
8. Validate the change.
30-
9. Commit with a clear OWNER/team message.
31-
10. Push the branch.
32-
11. Open or update the draft PR.
33-
12. Review the PR.
34-
13. OWNER approves merge.
35-
14. Merge to main.
36-
15. Pull latest main before starting the next unrelated workstream, or before a new PR when the work is not an OWNER-approved stacked/sequential workstream.
37-
16. Verify Main Verified and Closed gates.
22+
1. Identify the PR branching model: Independent PR or Stacked PR.
23+
2. Start from the required branch for that model.
24+
3. Pull or confirm the required base branch is current.
25+
4. Verify clean worktree.
26+
5. Create a PR branch and PR identity.
27+
6. Mark lifecycle state as PR Open.
28+
7. Plan on the same PR branch.
29+
8. Build on the same PR branch.
30+
9. Validate the change.
31+
10. Commit with a clear OWNER/team message.
32+
11. Push the branch.
33+
12. Open or update the draft PR.
34+
13. Review the PR.
35+
14. OWNER approves merge.
36+
15. Merge to main in the valid order for the PR model.
37+
16. Pull latest main before starting the next unrelated workstream, or before a new PR when the work is not an OWNER-approved stacked/sequential workstream.
38+
17. Verify Main Verified and Closed gates.
39+
40+
## PR Branching Models
41+
42+
Every PR must declare one branching model before branch creation or branch continuation.
43+
44+
### Independent PR
45+
46+
Use an Independent PR when the change has no direct dependency on another open PR.
47+
48+
Rules:
49+
- Independent PRs must start from synchronized `main`.
50+
- Independent PRs must target `main`.
51+
- Independent PRs must not reuse another feature branch as their starting point.
52+
- Codex must HARD STOP if the requested Independent PR starts from any branch other than `main`.
53+
- Codex must return to synchronized `main` before starting the next unrelated Independent PR.
54+
55+
### Stacked PR
56+
57+
Use a Stacked PR only when the PR has a direct dependency on the previous PR branch.
58+
59+
Rules:
60+
- Stacked PRs may start from the previous PR branch when there is a direct dependency.
61+
- Stacked PRs must document the dependency order before BUILD begins.
62+
- Stacked PR reports must name:
63+
- the stack order
64+
- the previous PR dependency
65+
- the next PR dependency, if known
66+
- the starting branch
67+
- the intended merge order
68+
- Stacked PRs must be reviewed in dependency order.
69+
- Stacked PRs must be merged in dependency order.
70+
- A later stacked PR must not merge before every prior dependency PR is merged.
71+
- Codex must HARD STOP if the requested Stacked PR starts from a branch that is not the documented previous PR branch.
72+
- Codex must HARD STOP if a Stacked PR lacks a documented dependency order.
73+
74+
### Model Mismatch Hard Stop
75+
76+
Codex must verify the requested PR model before changing files.
77+
78+
HARD STOP when:
79+
- an Independent PR is requested but the current/start branch is not `main`
80+
- a Stacked PR is requested but the current/start branch is not the documented previous PR branch
81+
- the request does not say whether the PR is Independent or Stacked and the start branch is not clearly valid
82+
- a PR is described as stacked but no direct dependency or merge order is documented
83+
84+
When the model is unclear, Codex must report the current branch, expected starting branch, and the missing model/dependency information before making changes.
3885

3986
## Daily Branch Workflow
4087

@@ -109,7 +156,7 @@ Closed gates:
109156
- Plan, Build, validation, reports, ZIP packaging, and closeout must stay tied to the same PR identity and source branch.
110157
- Source branches are retained by default after merge and closeout.
111158
- Do not mix unrelated scopes.
112-
- Do not start dependent PRs until the required base PR is merged.
159+
- Do not start dependent PRs until the required base PR is merged unless the work is an explicitly documented Stacked PR with a direct dependency on the previous PR branch.
113160
- Return to `main` before starting an unrelated PR or new workstream.
114161
- Do not return to `main` between PRs in the same OWNER-approved stacked/sequential workstream unless OWNER approves an EOD or intermediate merge checkpoint.
115162
- A team must not begin another PR if its previous PR is not Closed.

dev/build/ProjectInstructions/addendums/project_instructions_single_source_eod_lock.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,15 @@ git rev-parse HEAD
4747

4848
## Team Branch Creation Gate
4949

50-
No team creates a PR branch until:
50+
For Independent PRs and for the first PR in a new stacked workstream, no team creates a PR branch until:
5151
- Current branch: `main`
5252
- Worktree: clean
5353
- `main...origin/main`: `0 0`
5454
- `HEAD` SHA matches published EOD SHA
5555

56-
If any check fails, stop before branch creation and restore main to the published EOD state or request OWNER direction.
56+
For dependent Stacked PRs, the start branch may be the documented previous PR branch only when `dev/build/ProjectInstructions/addendums/pr_workflow.md` identifies a direct dependency and dependency order.
57+
58+
If any required check fails, or if the current branch does not match the requested PR model, stop before branch creation and restore the expected branch state or request OWNER direction.
5759

5860
## Branch Lifecycle (Canonical)
5961

@@ -90,7 +92,7 @@ main...origin/main
9092
HEAD equals published EOD SHA
9193
```
9294

93-
Only after ALL four pass may a branch be created or the active team branch/workstream be updated.
95+
Only after ALL required checks for the requested PR branching model pass may a branch be created or the active team branch/workstream be updated.
9496

9597
Create the PR branch:
9698

dev/build/ProjectInstructions/standards/CODEX_WORKFLOW_COMMANDS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ PLAN_PR is planning only.
101101
Rules:
102102
- Do not change files unless the user explicitly requests a planning artifact update.
103103
- Identify the correct branch or start point.
104+
- Identify whether the PR is Independent or Stacked.
105+
- For Stacked PRs, identify the previous PR branch and dependency order.
104106
- Identify the intended PR name, purpose, and scope.
105107
- Identify required validation and reporting.
106108
- Identify the required ZIP outcome path from the Codex Completion Contract.
@@ -113,12 +115,14 @@ BUILD_PR is the implementation phase.
113115

114116
Rules:
115117
- Verify branch and worktree rules for the PR before changing files.
118+
- Verify the requested PR branching model before changing files.
116119
- Use the latest Project Instructions.
117120
- Stay inside the approved PR purpose.
118121
- Create required reports.
119122
- Create the required repo-structured ZIP artifact for the attempted PR according to the Codex Completion Contract.
120123
- Run scoped validation required by the PR and Project Instructions.
121124
- HARD STOP on wrong branch.
125+
- HARD STOP when the current/start branch does not match the requested Independent or Stacked PR model.
122126
- HARD STOP on dirty worktree when the PR requires a clean start.
123127
- HARD STOP on scope conflict.
124128
- HARD STOP on missing required Project Instructions.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# PR_26179_OWNER_011-pr-branching-model-docs Branch Validation
2+
3+
## Result
4+
5+
PASS
6+
7+
## Checks
8+
9+
| Check | Result | Notes |
10+
| --- | --- | --- |
11+
| Started from `main` | PASS | `main...origin/main` was `0 0`. |
12+
| Worktree clean before branch creation | PASS | Verified before branch creation. |
13+
| PR branch created | PASS | `PR_26179_OWNER_011-pr-branching-model-docs`. |
14+
| Work stayed on PR branch | PASS | No direct commit to `main`. |
15+
| Documentation/governance scope | PASS | Only Project Instructions and reports changed. |
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# PR_26179_OWNER_011-pr-branching-model-docs Manual Validation Notes
2+
3+
## Notes
4+
5+
- Reviewed active Project Instructions for existing stacked/sequential branch wording.
6+
- Added the canonical Independent PR vs Stacked PR model in `pr_workflow.md`.
7+
- Updated adjacent branch and command governance documents to point enforcement at the requested PR model.
8+
- Confirmed the old dependent-PR rule now allows the explicitly documented Stacked PR exception.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# PR_26179_OWNER_011-pr-branching-model-docs Report
2+
3+
## Purpose
4+
5+
Define Independent PRs and Stacked PRs in active Project Instructions.
6+
7+
## Scope
8+
9+
Documentation/governance only. No implementation code, runtime files, API files, database files, or product pages changed.
10+
11+
## Governance Outcome
12+
13+
- `pr_workflow.md` now owns the canonical Independent PR vs Stacked PR model.
14+
- Independent PRs must start from synchronized `main`.
15+
- Stacked PRs may start from the documented previous PR branch only when there is a direct dependency.
16+
- Stacked PRs must document stack order, previous dependency, next dependency when known, starting branch, and merge order.
17+
- Stacked PRs must be reviewed and merged in dependency order.
18+
- Codex must HARD STOP when the requested PR model does not match the current/start branch.
19+
20+
## Updated Documents
21+
22+
- `dev/build/ProjectInstructions/addendums/pr_workflow.md`
23+
- `dev/build/ProjectInstructions/addendums/project_instructions_single_source_eod_lock.md`
24+
- `dev/build/ProjectInstructions/addendums/branch_lock_governance.md`
25+
- `dev/build/ProjectInstructions/addendums/branch_context_governance.md`
26+
- `dev/build/ProjectInstructions/standards/CODEX_WORKFLOW_COMMANDS.md`
27+
- `dev/build/ProjectInstructions/TEAM_START_COMMANDS.md`
28+
29+
## ZIP
30+
31+
- `dev/workspace/zips/PR_26179_OWNER_011-pr-branching-model-docs_delta.zip`
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# PR_26179_OWNER_011-pr-branching-model-docs Requirement Checklist
2+
3+
| Requirement | Result | Notes |
4+
| --- | --- | --- |
5+
| Define Independent PRs vs Stacked PRs | PASS | Added canonical model in `pr_workflow.md`. |
6+
| Independent PRs must start from `main` | PASS | Documented in Independent PR rules. |
7+
| Stacked PRs may start from previous PR branch with direct dependency | PASS | Documented in Stacked PR rules and branch gates. |
8+
| Stacked PRs must document dependency order | PASS | Required before BUILD begins and in reports. |
9+
| Stacked PRs must be reviewed and merged in order | PASS | Required in Stacked PR rules. |
10+
| Codex hard-stops on starting branch/model mismatch | PASS | Added to PR workflow, branch context, branch lock, and command docs. |
11+
| Do not change implementation code | PASS | Documentation/governance only. |

0 commit comments

Comments
 (0)