Skip to content

Commit 004a2a6

Browse files
authored
Merge pull request #258 from ToolboxAid/PR_26179_OWNER_013-project-branching-policy-document
PR_26179_OWNER_013-project-branching-policy-document
2 parents b8a09a1 + 141d713 commit 004a2a6

11 files changed

Lines changed: 698 additions & 167 deletions
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
# Project Branching Policy
2+
3+
Version: 2026.06.28.002
4+
Last Updated: 2026-06-28
5+
Owner: OWNER
6+
7+
## Purpose
8+
9+
Define the repository branching policy for Independent PRs and Stacked PRs.
10+
11+
This document owns PR branching model decisions. Other Project Instructions documents may point here, but must not duplicate the full policy.
12+
13+
## Independent PR
14+
15+
An Independent PR is a PR with no direct dependency on another open PR.
16+
17+
Rules:
18+
- Independent PRs start from synchronized `main`.
19+
- Independent PRs target `main`.
20+
- Independent PRs must not reuse another feature branch as their starting point.
21+
- Independent PR work must return to synchronized `main` before another unrelated Independent PR begins.
22+
23+
## Stacked PR
24+
25+
A Stacked PR is a PR with a direct dependency on a previous PR branch or active team workstream branch.
26+
27+
Rules:
28+
- Stacked PRs may start from the previous PR branch when there is a direct dependency.
29+
- Stacked PRs belong under the documented active workstream.
30+
- Stacked PRs must document dependency order before BUILD begins.
31+
- A later stacked PR must not merge before every prior dependency PR is merged.
32+
33+
## Owner Branching Rules
34+
35+
OWNER may create Independent PRs from synchronized `main` when the work has no direct dependency.
36+
37+
OWNER may also create Stacked PRs when dependency order, reviewability, or workstream continuity requires it.
38+
39+
OWNER stacked PRs must document the same dependency, review, and merge order required for all stacked work.
40+
41+
## Non-Owner Team Branching Rules
42+
43+
Non-Owner teams use Stacked PR workstreams by default.
44+
45+
Non-Owner teams include Alfa, Bravo, Charlie, Delta, Golf, and any future non-Owner canonical team.
46+
47+
Non-Owner team PRs must start from the active team workstream branch or the documented previous PR branch unless OWNER explicitly grants a standalone/no-dependency exception.
48+
49+
## Explicit Owner Exception Process For Team Independent PRs
50+
51+
A non-Owner team may create an Independent PR from `main` only when OWNER explicitly marks the task:
52+
53+
```text
54+
standalone/no-dependency
55+
```
56+
57+
The exception must be documented before branch creation and must name:
58+
- team
59+
- PR name
60+
- reason the PR has no dependency
61+
- confirmation that the branch starts from synchronized `main`
62+
- confirmation that the PR targets `main`
63+
64+
Without that explicit exception, Codex must treat the non-Owner team PR as Stacked.
65+
66+
## Dependency Documentation Requirements
67+
68+
Every Stacked PR report must name:
69+
- stack order
70+
- previous PR dependency
71+
- next PR dependency, if known
72+
- starting branch
73+
- intended merge order
74+
- base branch
75+
- source branch
76+
77+
## Review Order
78+
79+
Stacked PRs must be reviewed in dependency order.
80+
81+
A later stacked PR may be reviewed for context, but OWNER approval must respect dependency order unless OWNER explicitly grants an exception.
82+
83+
## Merge Order
84+
85+
Stacked PRs must be merged in dependency order.
86+
87+
A later stacked PR must not merge before all prior dependency PRs are merged and the stack base has been updated as required by GitHub.
88+
89+
## Hard-Stop Validation Rules
90+
91+
Codex must HARD STOP before changing files when:
92+
- the requested Independent PR does not start from `main`
93+
- a non-Owner team PR starts from `main` without OWNER `standalone/no-dependency` approval
94+
- the requested Stacked PR does not start from the documented previous PR branch or active workstream branch
95+
- the Stacked PR lacks dependency order documentation
96+
- the current branch changes unexpectedly
97+
- the requested branch model conflicts with OWNER instructions
98+
99+
The hard-stop report must include:
100+
- current branch
101+
- expected branch
102+
- requested PR model
103+
- missing dependency or exception details
104+
- worktree status
105+
106+
## Examples
107+
108+
### Owner Independent PR
109+
110+
```text
111+
PR: PR_26179_OWNER_020-doc-cleanup
112+
Model: Independent PR
113+
Start: main
114+
Base: main
115+
Reason: no direct dependency
116+
```
117+
118+
### Owner Stacked PR
119+
120+
```text
121+
PR #1: PR_26179_OWNER_021-policy-foundation
122+
Base: main
123+
124+
PR #2: PR_26179_OWNER_022-policy-followup
125+
Base: PR_26179_OWNER_021-policy-foundation
126+
Model: Stacked PR
127+
Merge order: #1, then #2
128+
```
129+
130+
### Non-Owner Team Stacked PR
131+
132+
```text
133+
PR #1: PR_26179_ALFA_030-tool-flow-foundation
134+
Base: main
135+
136+
PR #2: PR_26179_ALFA_031-tool-flow-validation
137+
Base: PR_26179_ALFA_030-tool-flow-foundation
138+
Model: Stacked PR
139+
Merge order: #1, then #2
140+
```
141+
142+
### Non-Owner Team Independent Exception
143+
144+
```text
145+
OWNER exception: standalone/no-dependency
146+
Team: Bravo
147+
PR: PR_26179_BRAVO_040-small-doc-fix
148+
Start: main
149+
Base: main
150+
Reason: isolated documentation fix with no branch dependency
151+
```

dev/build/ProjectInstructions/PROJECT_INSTRUCTIONS.md

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Before performing ANY task, Codex must:
99
- Never allow conversation memory to override repository instructions.
1010
- Load all referenced instruction documents required by this file and the task.
1111
- Validate canonical paths.
12-
- Validate branching model.
12+
- Load and validate `dev/build/ProjectInstructions/PROJECT_BRANCHING_POLICY.md`.
1313
- Validate ZIP and report locations.
1414

1515
Every Codex response must begin with:
@@ -30,10 +30,11 @@ Canonical paths
3030
Reports .......... dev/reports
3131
ZIPs ............. dev/workspace/zips
3232
33-
Branching model
34-
---------------
35-
Owner ............ Independent PRs allowed
36-
Teams ............ Stacked PRs by default
33+
Branching Policy
34+
----------------
35+
Source ............ PROJECT_BRANCHING_POLICY.md
36+
Version ........... <version>
37+
Status ............ PASS
3738
3839
Legacy path check
3940
-----------------
@@ -115,25 +116,27 @@ Rules:
115116

116117
## Current Version/Date
117118

118-
- Project Instructions Version: 2026.06.28.001
119+
- Project Instructions Version: 2026.06.28.002
119120
- Date: 2026-06-28
120121
- Owner: OWNER
121122

122123
## Required Read Order
123124

124125
1. Always read `dev/build/ProjectInstructions/PROJECT_INSTRUCTIONS_VERSION.md`.
125126
2. Always read `dev/build/ProjectInstructions/PROJECT_INSTRUCTIONS.md`.
126-
3. Always read `dev/build/ProjectInstructions/PROJECT_STATE.md`.
127-
4. Always read `dev/build/ProjectInstructions/repository/canonical_repository_structure.md`.
128-
5. For Codex workflow command interpretation, read `dev/build/ProjectInstructions/standards/CODEX_WORKFLOW_COMMANDS.md`.
129-
6. For Start of Day, read `dev/build/ProjectInstructions/bootstrap/codex_start_of_day_bootstrap.md`.
130-
7. Load team, backlog, database, runtime, theme, or other specialist documents only when the current task requires them.
127+
3. Always read `dev/build/ProjectInstructions/PROJECT_BRANCHING_POLICY.md`.
128+
4. Always read `dev/build/ProjectInstructions/PROJECT_STATE.md`.
129+
5. Always read `dev/build/ProjectInstructions/repository/canonical_repository_structure.md`.
130+
6. For Codex workflow command interpretation, read `dev/build/ProjectInstructions/standards/CODEX_WORKFLOW_COMMANDS.md`.
131+
7. For Start of Day, read `dev/build/ProjectInstructions/bootstrap/codex_start_of_day_bootstrap.md`.
132+
8. Load team, backlog, database, runtime, theme, or other specialist documents only when the current task requires them.
131133

132134
## Load Graph
133135

134136
```text
135137
PROJECT_INSTRUCTIONS.md
136138
|-- PROJECT_INSTRUCTIONS_VERSION.md
139+
|-- PROJECT_BRANCHING_POLICY.md
137140
|-- PROJECT_STATE.md
138141
|-- repository/canonical_repository_structure.md
139142
|-- standards/CODEX_WORKFLOW_COMMANDS.md
@@ -154,6 +157,7 @@ PROJECT_INSTRUCTIONS.md
154157

155158
- `PROJECT_INSTRUCTIONS_VERSION.md`: always.
156159
- `PROJECT_INSTRUCTIONS.md`: always.
160+
- `PROJECT_BRANCHING_POLICY.md`: always.
157161
- `PROJECT_STATE.md`: always.
158162
- `repository/canonical_repository_structure.md`: always.
159163
- `standards/CODEX_WORKFLOW_COMMANDS.md`: Start of Day, PLAN_PR, BUILD_PR, APPLY_PR, invalid command, or command interpretation tasks.
@@ -187,6 +191,7 @@ That file owns Start of Day, PLAN_PR, BUILD_PR, APPLY_PR, and invalid command be
187191
## Referenced Documents
188192

189193
- Project Instructions version: `dev/build/ProjectInstructions/PROJECT_INSTRUCTIONS_VERSION.md`
194+
- Project branching policy: `dev/build/ProjectInstructions/PROJECT_BRANCHING_POLICY.md`
190195
- Project state: `dev/build/ProjectInstructions/PROJECT_STATE.md`
191196
- Repository folder placement SSoT: `dev/build/ProjectInstructions/repository/canonical_repository_structure.md`
192197
- Codex workflow commands: `dev/build/ProjectInstructions/standards/CODEX_WORKFLOW_COMMANDS.md`
@@ -210,6 +215,7 @@ That file owns Start of Day, PLAN_PR, BUILD_PR, APPLY_PR, and invalid command be
210215

211216
- `PROJECT_INSTRUCTIONS_VERSION.md` owns the current Project Instructions version and startup version proof.
212217
- `PROJECT_INSTRUCTIONS.md` owns the manual entry point, startup contract, required read order, load graph, stop gates, execution modes, and pointers.
218+
- `PROJECT_BRANCHING_POLICY.md` owns Independent PR, Stacked PR, Owner branching, non-Owner team branching, exception, dependency, review, merge, and hard-stop rules.
213219
- `PROJECT_STATE.md` owns machine-friendly project state metadata.
214220
- `repository/canonical_repository_structure.md` owns all folder placement and file-placement rules.
215221
- `standards/CODEX_WORKFLOW_COMMANDS.md` owns Start of Day, PLAN_PR, BUILD_PR, APPLY_PR, and invalid command behavior.
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
# Project Instructions Version
22

3-
Current Project Instructions Version: 2026.06.28.001
3+
Current Project Instructions Version: 2026.06.28.002
44

55
Last Updated: 2026-06-28
66

77
## Breaking Changes Summary
88

99
- Codex startup validation is mandatory before every task outcome.
1010
- Project Instructions versions are repository-owned and increment independently of PR numbers.
11+
- Added dedicated branching policy document.
12+
- Startup validation now verifies the branching policy document was loaded instead of duplicating policy text.
1113
- Codex must read this version file and the latest repository copy of `PROJECT_INSTRUCTIONS.md` before performing work.
1214
- Codex must discard previously remembered Project Instructions and treat the repository copy as authoritative.
1315
- Codex must validate canonical report and ZIP paths, branching model, and legacy path avoidance before work proceeds.

dev/build/ProjectInstructions/addendums/pr_workflow.md

Lines changed: 4 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -39,63 +39,13 @@ This file owns PR lifecycle governance. It must not duplicate command phase rule
3939

4040
## PR Branching Models
4141

42-
Every PR must declare one branching model before branch creation or branch continuation.
42+
Canonical PR branching policy lives in:
4343

44-
### Ownership Defaults
44+
`dev/build/ProjectInstructions/PROJECT_BRANCHING_POLICY.md`
4545

46-
OWNER may create an Independent PR from synchronized `main` when the PR has no direct dependency.
46+
That document owns Independent PR, Stacked PR, Owner branching, non-Owner team branching, explicit Owner standalone/no-dependency exceptions, dependency documentation, review order, merge order, hard-stop validation rules, and examples.
4747

48-
Non-Owner team PRs use Stacked PR workstreams by default. A non-Owner team PR may start from `main` only when OWNER explicitly marks that PR as `standalone/no-dependency` before branch creation.
49-
50-
If a non-Owner team PR is not explicitly marked `standalone/no-dependency`, Codex must treat it as Stacked and verify the active team workstream branch or documented previous PR branch before changing files.
51-
52-
### Independent PR
53-
54-
Use an Independent PR when the change has no direct dependency on another open PR.
55-
56-
Rules:
57-
- Independent PRs must start from synchronized `main`.
58-
- Independent PRs must target `main`.
59-
- Independent PRs must not reuse another feature branch as their starting point.
60-
- OWNER PRs may use the Independent PR model when the PR has no direct dependency.
61-
- Non-Owner team PRs may use the Independent PR model only when OWNER explicitly marks the PR as `standalone/no-dependency`.
62-
- Codex must HARD STOP if the requested Independent PR starts from any branch other than `main`.
63-
- Codex must HARD STOP if a non-Owner team PR starts from `main` without an explicit OWNER `standalone/no-dependency` marker.
64-
- Codex must return to synchronized `main` before starting the next unrelated Independent PR.
65-
66-
### Stacked PR
67-
68-
Use a Stacked PR only when the PR has a direct dependency on the previous PR branch.
69-
70-
Rules:
71-
- Stacked PRs may start from the previous PR branch when there is a direct dependency.
72-
- Non-Owner team PRs should use Stacked PR workstreams by default.
73-
- A Stacked PR belongs under the active team workstream and must use the documented previous PR branch or active workstream branch as its starting point.
74-
- Stacked PRs must document the dependency order before BUILD begins.
75-
- Stacked PR reports must name:
76-
- the stack order
77-
- the previous PR dependency
78-
- the next PR dependency, if known
79-
- the starting branch
80-
- the intended merge order
81-
- Stacked PRs must be reviewed in dependency order.
82-
- Stacked PRs must be merged in dependency order.
83-
- A later stacked PR must not merge before every prior dependency PR is merged.
84-
- Codex must HARD STOP if the requested Stacked PR starts from a branch that is not the documented previous PR branch.
85-
- Codex must HARD STOP if a Stacked PR lacks a documented dependency order.
86-
87-
### Model Mismatch Hard Stop
88-
89-
Codex must verify the requested PR model before changing files.
90-
91-
HARD STOP when:
92-
- an Independent PR is requested but the current/start branch is not `main`
93-
- a non-Owner team PR starts from `main` without explicit OWNER `standalone/no-dependency` approval
94-
- a Stacked PR is requested but the current/start branch is not the documented previous PR branch
95-
- the request does not say whether the PR is Independent or Stacked and the start branch is not clearly valid
96-
- a PR is described as stacked but no direct dependency or merge order is documented
97-
98-
When the model is unclear, Codex must report the current branch, expected starting branch, and the missing model/dependency information before making changes.
48+
This PR workflow document must load and follow that policy, but it must not duplicate the full policy text.
9949

10050
All PR branching models remain subject to the Codex Completion Contract. Missing required ZIP output means the Codex run is incomplete.
10151

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# PR_26179_OWNER_013-project-branching-policy-document Branch Validation
2+
3+
## Result
4+
5+
PASS
6+
7+
## Checks
8+
9+
| Check | Result | Notes |
10+
| --- | --- | --- |
11+
| Stacked PR model identified | PASS | This PR depends on PR #257. |
12+
| Started from documented previous PR branch | PASS | Started from `PR_26179_OWNER_012-project-instructions-startup-validation`. |
13+
| Worktree clean before branch creation | PASS | Verified before branch creation. |
14+
| PR branch created | PASS | `PR_26179_OWNER_013-project-branching-policy-document`. |
15+
| Work stayed on PR branch | PASS | No direct commit to `main`. |
16+
| Documentation/governance scope | PASS | Only Project Instructions and reports changed. |
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# PR_26179_OWNER_013-project-branching-policy-document Manual Validation Notes
2+
3+
## Notes
4+
5+
- Confirmed `PROJECT_BRANCHING_POLICY.md` owns the full branching policy.
6+
- Confirmed startup validation now checks the branching policy source/version/status instead of duplicating Owner/team branch policy details.
7+
- Confirmed `pr_workflow.md` points to `PROJECT_BRANCHING_POLICY.md` and no longer carries the full policy text.
8+
- Confirmed Project Instructions version is `2026.06.28.002`.
9+
- Confirmed no runtime or product files were modified.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# PR_26179_OWNER_013-project-branching-policy-document Report
2+
3+
## Purpose
4+
5+
Separate branching policy from startup validation mechanics.
6+
7+
## Branching Model
8+
9+
- Model: Stacked PR
10+
- Previous PR dependency: `PR_26179_OWNER_012-project-instructions-startup-validation` / PR #257
11+
- Starting branch: `PR_26179_OWNER_012-project-instructions-startup-validation`
12+
- Merge order: PR #255, then PR #256, then PR #257, then this PR
13+
14+
## Governance Outcome
15+
16+
- Added `dev/build/ProjectInstructions/PROJECT_BRANCHING_POLICY.md`.
17+
- Moved full Independent PR and Stacked PR policy ownership into the dedicated branching policy document.
18+
- Updated startup validation to verify the branching policy document was loaded instead of duplicating branch policy details.
19+
- Incremented Project Instructions version to `2026.06.28.002`.
20+
- Updated `PROJECT_INSTRUCTIONS_VERSION.md` with change notes for the branching policy document and startup validation change.
21+
- Updated `pr_workflow.md` to point to the dedicated branching policy instead of duplicating full policy text.
22+
23+
## Runtime Impact
24+
25+
None. This PR changes documentation/governance only.
26+
27+
## ZIP
28+
29+
- `dev/workspace/zips/PR_26179_OWNER_013-project-branching-policy-document_delta.zip`
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# PR_26179_OWNER_013-project-branching-policy-document Requirement Checklist
2+
3+
| Requirement | Result | Notes |
4+
| --- | --- | --- |
5+
| Create `PROJECT_BRANCHING_POLICY.md` | PASS | Added under `dev/build/ProjectInstructions/`. |
6+
| Define purpose | PASS | Included in policy document. |
7+
| Define Independent PR | PASS | Included in policy document. |
8+
| Define Stacked PR | PASS | Included in policy document. |
9+
| Define Owner branching rules | PASS | Included in policy document. |
10+
| Define non-Owner team branching rules | PASS | Included in policy document. |
11+
| Define Owner exception process for team independent PRs | PASS | Included `standalone/no-dependency` process. |
12+
| Define dependency documentation requirements | PASS | Included required report fields. |
13+
| Define review order | PASS | Included dependency-order review rule. |
14+
| Define merge order | PASS | Included dependency-order merge rule. |
15+
| Define hard-stop validation rules | PASS | Included branch/model mismatch hard stops. |
16+
| Include examples | PASS | Added Owner independent, Owner stacked, team stacked, and team exception examples. |
17+
| Update startup validation to load branching policy | PASS | Startup block now includes Branching Policy source/version/status. |
18+
| Increment version to `2026.06.28.002` | PASS | Updated version file and `PROJECT_INSTRUCTIONS.md`. |
19+
| Preserve ZIP/report completion contract | PASS | Existing contract remains referenced and unchanged. |
20+
| Do not modify implementation code | PASS | Documentation/governance only. |

0 commit comments

Comments
 (0)