Skip to content

Commit 7a0a1d3

Browse files
docs: centralize lifecycle decisions in plan
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 87ba2aa commit 7a0a1d3

2 files changed

Lines changed: 54 additions & 24 deletions

File tree

docs/content/reference/process-workflow-lifecycle-design.md

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,32 +19,42 @@ The current code detects an existing published version, resumes GitHub Release c
1919

2020
## Candidate event routing
2121

22-
The planner classifies the caller event before build and publication work begins. Each route produces one of three mutation classes: validation only, prerelease mutation, or stable-release mutation. Pull-request events may cancel their predecessors, so every pull-request route must converge to the latest pull-request state.
22+
Plan resolves the caller event into one release classification before build and publication work begins. The classification is stable release, prerelease, recovery or resume, cleanup-only, or no-op. Pull-request events may cancel their predecessors, so every pull-request route must converge to the latest pull-request state.
2323

24-
| Event | Candidate route | Mutation class | Cancellation | Required result |
24+
| Event | Candidate Plan classification | Desired release action | Cancellation | Required result |
2525
| --- | --- | --- | --- | --- |
26-
| `workflow_dispatch` on the default branch | Recovery release | Stable release or explicit no-op | Never cancel | Rebuild and validate the selected commit; reconstruct the unreleased release notes. |
27-
| `schedule` | Published-artifact validation | Validation only | Never cancel | Validate the latest published stable artifact and its documentation. |
28-
| Pull request `opened`, `reopened`, `synchronize` | Pull-request CI | Validation only | Cancels a superseded pull-request run; the later run converges state | Report configured validation on the pull request. |
29-
| Pull request `labeled`, `unlabeled` | Prerelease evaluation | Prerelease or validation only | Cancels a superseded pull-request run; the later run converges state | Re-evaluate the full label set and publish only an eligible prerelease. |
30-
| Merged pull request `closed` | Post-merge close | Validation only | Cancels a superseded pull-request run; the later run converges state | Do not clean up; the successful main-push release owns promotion cleanup. |
31-
| Abandoned pull request `closed` | Pull-request cleanup | Prerelease cleanup only | Cancels a superseded pull-request run; the later run converges state | Remove only prereleases owned by the abandoned pull request. |
26+
| `workflow_dispatch` on the default branch | Recovery or resume | Stable release or no-op | Never cancel | Rebuild and validate the selected commit; reconstruct the unreleased release notes. |
27+
| `schedule` | Published-artifact validation | No-op after validation | Never cancel | Validate the latest published stable artifact and its documentation. |
28+
| Pull request `opened`, `reopened`, `synchronize` | Pull-request classification | Prerelease or no-op | Cancels a superseded pull-request run; the later run converges state | Report configured validation and execute the planned release action. |
29+
| Pull request `labeled`, `unlabeled` | Pull-request classification refresh | Prerelease, cleanup-only, or no-op | Cancels a superseded pull-request run; the later run converges state | Resolve the complete current classification and execute its action. |
30+
| Merged pull request `closed` | Post-merge close | No-op | Cancels a superseded pull-request run; the later run converges state | Do not clean up; the successful main-push release owns promotion cleanup. |
31+
| Abandoned pull request `closed` | Abandoned-close classification | Cleanup-only | Cancels a superseded pull-request run; the later run converges state | Reconcile only prereleases owned by the abandoned pull request. |
3232
| Push to the default branch | Stable release | Stable release | Never cancel | Resolve merged-pull-request intent when applicable, then publish and perform promotion cleanup after required gates. |
3333

34-
The classifier records the route, mutable resource scope, commit identity, and release decision in the plan result. Downstream jobs consume that record rather than infer the event again.
34+
Plan records its classification and release decision in enriched Settings. Downstream jobs consume that Settings object and do not infer policy from events, labels, or repository settings again.
3535

3636
## Candidate artifact and version boundary
3737

38-
Version resolution is the boundary between planning and release-capable work. The candidate carries one immutable release record through build, test, and publication:
38+
Version resolution is the boundary between planning and release-capable work. The candidate carries one immutable release record in enriched Settings through build, test, and release execution:
3939

4040
| Record field | Purpose |
4141
| --- | --- |
42-
| Commit identity | Binds validation, artifact, and release to one source revision. |
43-
| Resolved stable version and prerelease identity | Defines the only version permitted in the built artifact. |
44-
| Event route and mutation class | Restricts each downstream stage to its authorized behavior. |
45-
| Release-note range | Identifies the merged pull requests eligible for a recovery release note. |
46-
47-
The build stage stamps the resolved version into the module artifact. Before any package, tag, or release becomes visible, the publication stage verifies that the artifact version and prerelease identity equal the immutable release record. A mismatch stops publication; it is not corrected by retagging or by recalculating a version after the artifact is built.
42+
| Event and run type | Identifies the GitHub event and its candidate lifecycle classification. |
43+
| Event action | Preserves the relevant pull-request activity or non-pull-request action. |
44+
| Pull-request identity, state, and merged status | Distinguishes active, merged, and abandoned pull-request outcomes. |
45+
| Labels and repository settings result | Captures the input policy state used only by Plan. |
46+
| Version bump and base version | Explains the selected version transition. |
47+
| Manifest version, prerelease identifier, and full version or tag | Defines the only version and tag permitted in the built artifact and release. |
48+
| Target commit | Binds validation, artifact, and release to one source revision. |
49+
| Desired release action and create or publish flags | Selects stable release, prerelease, recovery or resume, cleanup-only, or no-op. |
50+
| Cleanup intent and artifact identity | Defines the exact artifacts that release execution may reconcile. |
51+
| Release-note source and boundary | Identifies the merged pull requests eligible for a recovery release note. |
52+
53+
The build stage stamps exactly the planned manifest version and prerelease identifier into the module artifact. Before any package, tag, or release becomes visible, release execution verifies that the artifact equals the immutable Settings record. A mismatch stops execution; it is not corrected by retagging or by recalculating a version after the artifact is built.
54+
55+
## Candidate general release execution
56+
57+
One general module release action or reusable workflow consumes enriched Settings after validation. It handles stable release, prerelease, recovery or resume, cleanup-only, and no-op actions according to the planned desired release action and flags. It verifies the artifact when an artifact is required and reconciles only the requested state. It does not recompute versioning, labels, event routing, or cleanup policy.
4858

4959
## Candidate manual recovery
5060

docs/content/reference/process-workflow-lifecycle-specification.md

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,23 +78,23 @@ Scenario: Validate a synchronized pull request
7878
And it does not publish a stable version
7979
```
8080

81-
### FR4 — Label changes MUST re-evaluate prerelease eligibility {#fr4}
81+
### FR4 — Label changes MUST refresh the planned release classification {#fr4}
8282

83-
A `labeled` or `unlabeled` pull-request event targeting the default branch MUST re-evaluate prerelease eligibility from the complete current label set. A prerelease publication MUST occur only when the pull request is eligible and every required validation succeeds.
83+
A `labeled` or `unlabeled` pull-request event targeting the default branch MUST refresh the complete planned release classification from the current label set and repository settings. A prerelease publication MUST occur only when the planned classification is prerelease and every required validation succeeds.
8484

8585
#### Behavioral scenarios {#fr4-scenarios}
8686

8787
```gherkin
8888
Scenario: Add prerelease eligibility
8989
Given a validated pull request has no prerelease eligibility
9090
When a prerelease label is added
91-
Then the workflow re-evaluates the pull request
91+
Then the plan resolves the pull request as prerelease eligible
9292
And it publishes at most one eligible prerelease version
9393
9494
Scenario: Remove prerelease eligibility
9595
Given a pull request has prerelease eligibility
9696
When its prerelease label is removed
97-
Then the workflow re-evaluates the pull request as ineligible
97+
Then the plan resolves the pull request as prerelease ineligible
9898
And it does not create a new prerelease version
9999
```
100100

@@ -134,15 +134,15 @@ Scenario: Publish a merged pull request
134134
And the successful release performs promotion cleanup
135135
```
136136

137-
### FR7 — Published artifacts MUST match the resolved version {#fr7}
137+
### FR7 — Published artifacts MUST match the planned version {#fr7}
138138

139-
Every prerelease or stable publication MUST contain the version and prerelease identity resolved for its workflow run. A version mismatch MUST fail publication before the release is made visible.
139+
Every prerelease or stable publication MUST contain the version and prerelease identity in the planned release decision. A version mismatch MUST fail publication before the release is made visible.
140140

141141
#### Behavioral scenarios {#fr7-scenarios}
142142

143143
```gherkin
144144
Scenario: Reject an incorrectly stamped artifact
145-
Given a workflow resolves a release version
145+
Given the plan resolves a release version
146146
And the built artifact reports a different version
147147
When publication is attempted
148148
Then publication fails
@@ -168,6 +168,26 @@ Scenario: Publish prereleases for distinct pull requests
168168
Then each pull request resolves a distinct prerelease identity
169169
```
170170

171+
### FR9 — Lifecycle policy MUST be resolved once before downstream work {#fr9}
172+
173+
The plan MUST resolve the lifecycle policy before build, test, or release execution begins. Downstream work MUST consume that planned policy and MUST NOT reinterpret event data, labels, or repository settings.
174+
175+
#### Behavioral scenarios {#fr9-scenarios}
176+
177+
```gherkin
178+
Scenario: Execute a planned prerelease action
179+
Given the plan resolves a pull request as an eligible prerelease publication
180+
When downstream work executes
181+
Then it consumes the planned release action and version
182+
And it does not re-evaluate pull-request labels or event data
183+
184+
Scenario: Execute a planned cleanup-only action
185+
Given the plan resolves an abandoned pull-request close as cleanup only
186+
When release execution runs
187+
Then it reconciles only the planned cleanup state
188+
And it does not create or publish an artifact
189+
```
190+
171191
## Non-functional requirements
172192

173193
### NFR1 — Lifecycle mutations MUST be idempotent {#nfr1}
@@ -288,7 +308,7 @@ Scenario: Recover release notes after a missed main-push publication
288308
And a retry creates no duplicate publication
289309
```
290310

291-
### AC2 — Verifies: [FR2](#fr2), [FR4](#fr4), [FR5](#fr5), [FR6](#fr6), [FR8](#fr8), [NFR2](#nfr2), [NFR3](#nfr3), [NFR4](#nfr4), [NFR5](#nfr5), [NFR6](#nfr6)
311+
### AC2 — Verifies: [FR2](#fr2), [FR4](#fr4), [FR5](#fr5), [FR6](#fr6), [FR8](#fr8), [FR9](#fr9), [NFR2](#nfr2), [NFR3](#nfr3), [NFR4](#nfr4), [NFR5](#nfr5), [NFR6](#nfr6)
292312

293313
```gherkin
294314
Scenario: Lifecycle runs preserve release ownership after cancellation

0 commit comments

Comments
 (0)