@metasession.co/devaudit-cli 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -11
- package/dist/index.js +21 -5
- package/dist/index.js.map +1 -1
- package/package.json +9 -5
- package/scripts/upload-evidence.sh +225 -0
- package/sdlc/.claude/settings.local.json +11 -0
- package/sdlc/CLAUDE.md +73 -0
- package/sdlc/HOST_ADAPTER.md +127 -0
- package/sdlc/SKILLS.md +137 -0
- package/sdlc/STACK_ADAPTER.md +130 -0
- package/sdlc/ai-rules/INSTRUCTIONS-SDLC.md +172 -0
- package/sdlc/ai-rules/README.md +103 -0
- package/sdlc/ai-rules/SDLC_RULES.md +584 -0
- package/sdlc/ai-rules/claude/CLAUDE.md +192 -0
- package/sdlc/ai-rules/cursor/.cursorrules +167 -0
- package/sdlc/ai-rules/windsurf/.windsurfrules +167 -0
- package/sdlc/article.md +219 -0
- package/sdlc/files/_common/0-project-setup.md +410 -0
- package/sdlc/files/_common/1-plan-requirement.md +381 -0
- package/sdlc/files/_common/2-implement-and-test.md +276 -0
- package/sdlc/files/_common/3-compile-evidence.md +603 -0
- package/sdlc/files/_common/4-submit-for-review.md +362 -0
- package/sdlc/files/_common/5-deploy-main.md +251 -0
- package/sdlc/files/_common/Periodic_Security_Review_Schedule.md +169 -0
- package/sdlc/files/_common/README_TEMPLATE.md +441 -0
- package/sdlc/files/_common/Test_Architecture.md +461 -0
- package/sdlc/files/_common/Test_Plan_TEMPLATE.md +311 -0
- package/sdlc/files/_common/Test_Policy.md +277 -0
- package/sdlc/files/_common/Test_Strategy.md +359 -0
- package/sdlc/files/_common/github/ISSUE_TEMPLATE/bug.yml +75 -0
- package/sdlc/files/_common/github/ISSUE_TEMPLATE/config.yml +11 -0
- package/sdlc/files/_common/github/ISSUE_TEMPLATE/requirement.yml +75 -0
- package/sdlc/files/_common/github/ISSUE_TEMPLATE/task.yml +48 -0
- package/sdlc/files/_common/github/pull_request_template.md +69 -0
- package/sdlc/files/_common/implementing-an-sdlc-issue.md +413 -0
- package/sdlc/files/_common/scripts/derive-release-version.sh +40 -0
- package/sdlc/files/_common/scripts/derive-release-version.test.sh +98 -0
- package/sdlc/files/_common/scripts/submit-for-uat-review.sh +162 -0
- package/sdlc/files/_common/scripts/validate-commits.sh +83 -0
- package/sdlc/files/_common/scripts/validate-compliance-artifacts.sh +202 -0
- package/sdlc/files/_common/scripts/validate-compliance-artifacts.test.sh +202 -0
- package/sdlc/files/_common/skills/_schema/skill.schema.json +36 -0
- package/sdlc/files/_common/skills/e2e-test-engineer/SKILL.md +254 -0
- package/sdlc/files/_common/skills/e2e-test-engineer/references/bootstrap.md +244 -0
- package/sdlc/files/_common/skills/e2e-test-engineer/references/evidence.ts +40 -0
- package/sdlc/files/_common/skills/sdlc-implementer/SKILL.md +189 -0
- package/sdlc/files/_common/skills/sdlc-implementer/references/call-graph.md +64 -0
- package/sdlc/files/_common/skills/sdlc-implementer/references/change-request-loop.md +192 -0
- package/sdlc/files/_common/skills/sdlc-implementer/references/compliance-constraints.md +81 -0
- package/sdlc/files/ci/check-release-approval.yml.template +201 -0
- package/sdlc/files/ci/ci-status-fallback.yml.template +41 -0
- package/sdlc/files/ci/ci.yml.template +390 -0
- package/sdlc/files/ci/compliance-evidence.yml.template +161 -0
- package/sdlc/files/ci/compliance-validation.yml.template +34 -0
- package/sdlc/files/ci/post-deploy-prod.yml.template +159 -0
- package/sdlc/files/ci/python/ci.yml.template +335 -0
- package/sdlc/files/hosts/_schema/adapter.schema.json +103 -0
- package/sdlc/files/hosts/railway/adapter.json +32 -0
- package/sdlc/files/sdlc-config.example.json +74 -0
- package/sdlc/files/stacks/_schema/adapter.schema.json +151 -0
- package/sdlc/files/stacks/node/adapter.json +54 -0
- package/sdlc/files/stacks/node/hooks/.prettierrc.json +9 -0
- package/sdlc/files/stacks/node/hooks/commit-msg +7 -0
- package/sdlc/files/stacks/node/hooks/commitlint.config.mjs +64 -0
- package/sdlc/files/stacks/node/hooks/lint-staged.config.mjs +16 -0
- package/sdlc/files/stacks/node/hooks/pre-commit +13 -0
- package/sdlc/files/stacks/node/hooks/pre-push +15 -0
- package/sdlc/files/stacks/node/scripts/check-requirement-jsdoc.sh +54 -0
- package/sdlc/files/stacks/python/adapter.json +36 -0
- package/sdlc/files/stacks/python/hooks/.pre-commit-config.yaml +51 -0
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Create a PR from develop to main — triggers CI independent verification and human review
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Submit for Review
|
|
6
|
+
|
|
7
|
+
**Pipeline Stage:** 4 of 5
|
|
8
|
+
**Previous:** `3-compile-evidence.md` (tracked) or `2-implement-and-test.md` (untracked)
|
|
9
|
+
**Next:** `5-deploy-main.md` (after PR approved)
|
|
10
|
+
**References:** Test Policy (`sdlc/files/Test_Policy.md` in DevAudit) (approval gate, AI governance), Test Strategy (reviewer requirements)
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## IMPORTANT: Do NOT Create the PR Until Ready to Merge
|
|
15
|
+
|
|
16
|
+
**Do NOT create the PR prematurely.** Every push to `develop` while a PR is open triggers additional CI runs on the PR (quality gates + Release Approval Gate), creating unnecessary duplicate runs. Only create the PR when:
|
|
17
|
+
- All development and iteration is complete
|
|
18
|
+
- CI on `develop` is green
|
|
19
|
+
- UAT-environment verification has passed (only if Stage 3 Step 10 applied — opt-in by risk class)
|
|
20
|
+
- Evidence is compiled, committed, and uploaded
|
|
21
|
+
- **Release is approved in DevAudit** (status: `uat_approved` — backend enum kept as-is in v1.22.x for backwards-compat; renamed to `release_approved` in v1.23.0)
|
|
22
|
+
|
|
23
|
+
The PR is the **merge request**, not the development workspace. Develop on `develop`, iterate until ready, then create the PR as the final step before merge.
|
|
24
|
+
|
|
25
|
+
## What Happens at This Stage
|
|
26
|
+
|
|
27
|
+
When you create the PR, CI runs automatically — GitHub Actions re-executes the verification gates (TypeScript, SAST, dependency audit, E2E) independently. The `Release Approval Gate` workflow (renamed from `UAT Approval Gate` in sdlc-v1.22.0) also runs, verifying the release has been approved in DevAudit. This produces tamper-resistant evidence verified by GitHub's infrastructure.
|
|
28
|
+
|
|
29
|
+
> **Note:** The Release Approval Gate check will fail initially if the release hasn't been approved in DevAudit yet. This is expected. After approving the release in DevAudit (Stage 3 Step 11), re-run the `Release Approval Gate` workflow from GitHub Actions (or use `workflow_dispatch`) to update the check status. The PR cannot be merged until this check passes — it is a required status check.
|
|
30
|
+
|
|
31
|
+
What happens next depends on the risk level of the requirements in the PR:
|
|
32
|
+
|
|
33
|
+
- **LOW risk:** CI provides independent verification. After CI passes, the developer may self-merge.
|
|
34
|
+
- **MEDIUM/HIGH risk:** A second human reviewer is notified. They review the code, CI results, and compliance evidence. They cannot approve until CI passes. The developer may NOT self-merge.
|
|
35
|
+
|
|
36
|
+
If a PR contains requirements at multiple risk levels, the highest risk level determines the review requirement.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Prerequisites
|
|
41
|
+
|
|
42
|
+
- All changes committed and pushed on `develop`
|
|
43
|
+
- All local gates passing
|
|
44
|
+
- **UAT-environment verification passed** (only if Stage 3 Step 10 applied to this requirement) — health check, smoke test, feature verification recorded in evidence
|
|
45
|
+
- **Release approved in DevAudit** — release status is `uat_approved` in DevAudit (required for the Release Approval Gate check to pass on the PR)
|
|
46
|
+
- For tracked requirements: RTM updated, release ticket created, evidence saved
|
|
47
|
+
- **Know the risk level** of the requirement(s) — this determines whether a second reviewer is required
|
|
48
|
+
|
|
49
|
+
## Steps
|
|
50
|
+
|
|
51
|
+
### Step 0: Pre-Flight Verification
|
|
52
|
+
|
|
53
|
+
Before creating a PR, verify all prerequisites are met. **Do NOT skip this checklist.**
|
|
54
|
+
|
|
55
|
+
**Pipeline state:**
|
|
56
|
+
- [ ] Latest CI run on `develop` is green: `gh run list --branch develop --limit 1`
|
|
57
|
+
- [ ] CI is not stale (ran against the latest commit): compare CI commit SHA with `git rev-parse develop`
|
|
58
|
+
- [ ] Working tree is clean: `git status`
|
|
59
|
+
- [ ] UAT-environment verification passed (only if Stage 3 Step 10 applied to this requirement)
|
|
60
|
+
- [ ] Release approved in DevAudit (Stage 3 Step 11)
|
|
61
|
+
|
|
62
|
+
**For tracked requirements (REQ-XXX):**
|
|
63
|
+
- [ ] `compliance/evidence/REQ-XXX/test-scope.md` exists and all items addressed
|
|
64
|
+
- [ ] `compliance/evidence/REQ-XXX/implementation-plan.md` exists (MEDIUM/HIGH risk)
|
|
65
|
+
- [ ] `compliance/evidence/REQ-XXX/ai-prompts.md` exists (if AI was used on MEDIUM/HIGH risk)
|
|
66
|
+
- [ ] RTM status is `TESTED - PENDING SIGN-OFF`: `grep 'REQ-XXX' compliance/RTM.md`
|
|
67
|
+
- [ ] Release ticket exists: `ls compliance/pending-releases/RELEASE-TICKET-REQ-XXX.md`
|
|
68
|
+
- [ ] Evidence uploaded to DevAudit (or saved locally if git-based)
|
|
69
|
+
|
|
70
|
+
**Risk-tier reminder:**
|
|
71
|
+
- LOW risk → self-merge permitted after CI passes
|
|
72
|
+
- MEDIUM/HIGH risk → second human reviewer required, self-merge NOT permitted
|
|
73
|
+
|
|
74
|
+
If any item fails, resolve it before proceeding. Do NOT create a PR with incomplete prerequisites.
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
### Step 1: Verify Develop Is Ready
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
git status # Clean working tree
|
|
82
|
+
git branch --show-current # develop
|
|
83
|
+
git pull origin develop # Up to date
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Step 2: Review PR Contents
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
git log origin/main..develop --oneline
|
|
90
|
+
git diff origin/main..develop --stat
|
|
91
|
+
git diff origin/main..develop -- package.json | grep '^\+'
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Step 3: Create the PR
|
|
95
|
+
|
|
96
|
+
**For tracked requirements:**
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
gh pr create --base main --head develop --title "type: description" --body "$(cat <<'EOF'
|
|
100
|
+
## Summary
|
|
101
|
+
[1-3 bullet points]
|
|
102
|
+
|
|
103
|
+
## Requirement Reference
|
|
104
|
+
- **REQ-XXX:** [description]
|
|
105
|
+
- **Risk Level:** [LOW / MEDIUM / HIGH]
|
|
106
|
+
|
|
107
|
+
## Test Results (Local — Comprehensive)
|
|
108
|
+
|
|
109
|
+
| Gate | Result | Details |
|
|
110
|
+
|------|--------|---------|
|
|
111
|
+
| E2E Tests | [N]/[N] passed | Spec files: [list spec files that ran] |
|
|
112
|
+
| TypeScript | 0 errors | `npx tsc --noEmit` |
|
|
113
|
+
| SAST | 0 high/critical | [N] rules scanned, [N] files |
|
|
114
|
+
| Dependency Audit | 0 unaccepted | [note any accepted risks] |
|
|
115
|
+
|
|
116
|
+
**E2E spec files executed:**
|
|
117
|
+
- `e2e/[spec-file].spec.ts` — [N] tests ([brief description])
|
|
118
|
+
- [list all spec files that ran]
|
|
119
|
+
|
|
120
|
+
**Evidence location:** `compliance/evidence/REQ-XXX/`
|
|
121
|
+
|
|
122
|
+
## UAT Verification
|
|
123
|
+
- UAT Health check: PASS
|
|
124
|
+
- UAT Smoke test: PASS
|
|
125
|
+
- UAT Feature verification: PASS — [what was verified]
|
|
126
|
+
- UAT URL: [UAT_URL]
|
|
127
|
+
|
|
128
|
+
## CI Results (Independent Verification)
|
|
129
|
+
CI runs automatically on this PR. The following gates must pass before merge:
|
|
130
|
+
- [ ] TypeScript check (CI)
|
|
131
|
+
- [ ] SAST scan (CI)
|
|
132
|
+
- [ ] Dependency audit (CI)
|
|
133
|
+
- [ ] E2E tests — unauthenticated subset (CI)
|
|
134
|
+
|
|
135
|
+
### Where to Find Test Results
|
|
136
|
+
| Source | Location | What It Shows |
|
|
137
|
+
|--------|----------|---------------|
|
|
138
|
+
| **CI status** | Green/red icons on PR commits | Pass/fail for each gate (independent, tamper-resistant) |
|
|
139
|
+
| **CI E2E comment** | PR comments (automated) | E2E pass/fail with commit SHA |
|
|
140
|
+
| **DevAudit evidence** | [View evidence on DevAudit](https://[DevAudit-URL]/projects/[PROJECT_SLUG]/requirements/REQ-XXX) | Playwright report, SAST results, dependency audit |
|
|
141
|
+
| **Security summary** | `compliance/evidence/REQ-XXX/security-summary.md` (in PR files) | Developer's local gate results + UAT verification |
|
|
142
|
+
| **Test scope** | `compliance/evidence/REQ-XXX/test-scope.md` (in PR files) | What was planned to be tested (cross-reference with results) |
|
|
143
|
+
| **Test changes** | PR description ("Test Changes" section) + PR files | Which test files were added/modified and what they cover |
|
|
144
|
+
|
|
145
|
+
## AI Involvement
|
|
146
|
+
- **AI Tool:** [tool / none]
|
|
147
|
+
- **AI-Generated Code:** [list files, or "none"]
|
|
148
|
+
- **Components Regenerated:** [none / list]
|
|
149
|
+
- **AI Prompts Retained:** [yes / N/A]
|
|
150
|
+
|
|
151
|
+
## Test Changes
|
|
152
|
+
- **Tests added:** [list new test files or "none"]
|
|
153
|
+
- **Tests updated:** [list modified test files or "none"]
|
|
154
|
+
- **Test locations:** [e.g. `e2e/requirements-verification.spec.ts`, `__tests__/...`]
|
|
155
|
+
- **What's covered:** [brief description of what the new/updated tests verify]
|
|
156
|
+
- **What's NOT covered and why:** [any gaps and justification, or "Full coverage"]
|
|
157
|
+
|
|
158
|
+
## Dependency Changes
|
|
159
|
+
- [package@version — purpose, or "No new dependencies"]
|
|
160
|
+
|
|
161
|
+
## Compliance Artifacts
|
|
162
|
+
- [ ] RTM updated with risk level
|
|
163
|
+
- [ ] Test scope addressed (all items in test-scope.md completed)
|
|
164
|
+
- [ ] Implementation plan present and matches implementation (MEDIUM/HIGH risk)
|
|
165
|
+
- [ ] Release ticket created
|
|
166
|
+
- [ ] Test evidence saved
|
|
167
|
+
- [ ] Security evidence saved
|
|
168
|
+
- [ ] AI use documented
|
|
169
|
+
|
|
170
|
+
## Reviewer Checklist
|
|
171
|
+
|
|
172
|
+
**Code Quality**
|
|
173
|
+
- [ ] Changes correct and complete
|
|
174
|
+
- [ ] No sensitive data committed
|
|
175
|
+
- [ ] No regressions
|
|
176
|
+
|
|
177
|
+
**Test Scope Verification**
|
|
178
|
+
- [ ] Test scope document exists (`compliance/evidence/REQ-XXX/test-scope.md`)
|
|
179
|
+
- [ ] Risk classification is appropriate (not under-classified)
|
|
180
|
+
- [ ] Testing depth matches risk level
|
|
181
|
+
- [ ] All items in test scope addressed
|
|
182
|
+
- [ ] New/updated test files listed in PR description ("Test Changes" section)
|
|
183
|
+
- [ ] Review the test files — verify tests actually exercise the new functionality (not just passing on unchanged code)
|
|
184
|
+
- [ ] New routes/pages have route protection tests
|
|
185
|
+
- [ ] New API endpoints have auth enforcement tests
|
|
186
|
+
|
|
187
|
+
**Security**
|
|
188
|
+
- [ ] SAST: 0 unresolved high/critical (verify CI result)
|
|
189
|
+
- [ ] Dependencies verified (real, current, no CVEs)
|
|
190
|
+
- [ ] Access control changes tested (if applicable)
|
|
191
|
+
|
|
192
|
+
**AI Review** (if AI code present)
|
|
193
|
+
- [ ] AI code reviewed for correctness
|
|
194
|
+
- [ ] No insecure defaults or injection vulnerabilities
|
|
195
|
+
- [ ] No hardcoded credentials or test data
|
|
196
|
+
- [ ] Regenerated components fully retested
|
|
197
|
+
|
|
198
|
+
**UAT** (if UAT configured)
|
|
199
|
+
- [ ] UAT verification results recorded in evidence
|
|
200
|
+
- [ ] Feature works correctly on UAT environment
|
|
201
|
+
|
|
202
|
+
**Compliance**
|
|
203
|
+
- [ ] RTM status: TESTED - PENDING SIGN-OFF
|
|
204
|
+
- [ ] Release ticket accurate
|
|
205
|
+
- [ ] Security evidence present and clean
|
|
206
|
+
|
|
207
|
+
> **Audit Note:** AI-assisted PR. Verified locally (comprehensive) and by CI (independent). See Test Plan for evidence model.
|
|
208
|
+
EOF
|
|
209
|
+
)"
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
**For untracked changes:**
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
gh pr create --base main --head develop --title "type: description" --body "$(cat <<'EOF'
|
|
216
|
+
## Summary
|
|
217
|
+
[1-3 bullet points]
|
|
218
|
+
|
|
219
|
+
## Test Results (Local)
|
|
220
|
+
- E2E: [N]/[N] passed, TypeScript: 0 errors, SAST: clean, Dependencies: clean
|
|
221
|
+
- Spec files: [list spec files that ran]
|
|
222
|
+
|
|
223
|
+
## Test Changes
|
|
224
|
+
- **Tests added/updated:** [list or "none"]
|
|
225
|
+
- **What's covered:** [brief description]
|
|
226
|
+
|
|
227
|
+
## UAT Verification
|
|
228
|
+
- UAT Health check: PASS
|
|
229
|
+
- UAT Smoke test: PASS
|
|
230
|
+
- UAT Feature verification: PASS — [what was verified]
|
|
231
|
+
|
|
232
|
+
## CI Verification
|
|
233
|
+
- [ ] TypeScript (CI)
|
|
234
|
+
- [ ] SAST (CI)
|
|
235
|
+
- [ ] Dependency audit (CI)
|
|
236
|
+
- [ ] E2E tests (CI)
|
|
237
|
+
|
|
238
|
+
CI pass/fail visible on PR commit status icons. Full test evidence available on [DevAudit](https://[DevAudit-URL]/projects/[PROJECT_SLUG]).
|
|
239
|
+
|
|
240
|
+
## Reviewer Checklist
|
|
241
|
+
- [ ] Code correct, no sensitive data, no regressions
|
|
242
|
+
- [ ] SAST clean, no hallucinated dependencies
|
|
243
|
+
- [ ] AI code reviewed (if applicable)
|
|
244
|
+
- [ ] Tests reviewed — verify they cover the changes (not just passing on unchanged code)
|
|
245
|
+
- [ ] Testing depth appropriate for the change
|
|
246
|
+
EOF
|
|
247
|
+
)"
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### Step 4: Wait for CI and Report Honest Status (MANDATORY)
|
|
251
|
+
|
|
252
|
+
After creating the PR, **do not hand off to the reviewer yet**. Required checks include `Compliance Validation` and `Release Approval Gate` (the latter is named `DevAudit Release Approval` in the job-level UI) — both take time to run and can fail for reasons the local gates did not catch (e.g. a missing `RELEASE-TICKET-REQ-XXX.md` that only the PR-side validator sees).
|
|
253
|
+
|
|
254
|
+
1. Wait ≥60 seconds for required checks to register.
|
|
255
|
+
2. Verify status:
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
gh pr checks <PR-NUMBER>
|
|
259
|
+
gh pr view <PR-NUMBER> --json mergeable,mergeStateStatus
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
3. If ANY required check is `fail` or `pending`, DO NOT describe the PR as "awaiting review" or "awaiting approvers." Instead:
|
|
263
|
+
- Name each failing check and surface its error (e.g. `gh run view <RUN-ID> --log-failed`)
|
|
264
|
+
- Fix the underlying issue
|
|
265
|
+
- Re-push and re-check
|
|
266
|
+
|
|
267
|
+
4. Only when every required check is `pass` **and** `mergeStateStatus` is `CLEAN` (or `BLOCKED` purely by required-reviewer approval) may you describe the PR as ready for review.
|
|
268
|
+
|
|
269
|
+
**Why this matters:** A status like "awaiting UAT + 2 reviewers" is read by the developer as "nothing for me to do but approve." If a required check is red, that summary is a lie by omission — the PR cannot merge regardless of what the reviewer does. Honest status reporting at this step is the single cheapest defence against wasted review time.
|
|
270
|
+
|
|
271
|
+
**If CI fails:**
|
|
272
|
+
|
|
273
|
+
```bash
|
|
274
|
+
# Check which job failed
|
|
275
|
+
gh pr checks <PR-NUMBER>
|
|
276
|
+
|
|
277
|
+
# Fix the issue locally
|
|
278
|
+
git add <fixed-files>
|
|
279
|
+
git commit -m "fix: resolve CI failure - [description]"
|
|
280
|
+
|
|
281
|
+
# Re-run local gates to confirm
|
|
282
|
+
npx tsc --noEmit && semgrep scan --config auto [SOURCE_DIR]/ --severity ERROR --severity WARNING && npm audit --audit-level=high && npx playwright test
|
|
283
|
+
|
|
284
|
+
# Push — CI re-runs automatically
|
|
285
|
+
git push origin develop
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### Step 5: Link PR to Release Ticket (Tracked Only)
|
|
289
|
+
|
|
290
|
+
```bash
|
|
291
|
+
gh pr list --head develop --json number --jq '.[0].number'
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
Add to release ticket and push:
|
|
295
|
+
```bash
|
|
296
|
+
# Edit RELEASE-TICKET-REQ-XXX.md to add PR link
|
|
297
|
+
git add compliance/pending-releases/RELEASE-TICKET-REQ-XXX.md
|
|
298
|
+
git commit -m "compliance: [REQ-XXX] link PR #[number]"
|
|
299
|
+
git push origin develop
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
### Step 6: Wait for CI and Review
|
|
303
|
+
|
|
304
|
+
**For LOW risk (self-merge permitted):**
|
|
305
|
+
|
|
306
|
+
```bash
|
|
307
|
+
# Watch CI status
|
|
308
|
+
gh pr checks
|
|
309
|
+
# Once all checks pass, merge
|
|
310
|
+
gh pr merge [PR-NUMBER] --merge --delete-branch=false
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
**For MEDIUM/HIGH risk (second reviewer required):**
|
|
314
|
+
|
|
315
|
+
The reviewer sees:
|
|
316
|
+
1. **CI results** — independent pass/fail from GitHub (green checks)
|
|
317
|
+
2. **Code changes** — in the Files changed tab
|
|
318
|
+
3. **Test changes** — in the PR description ("Test Changes" section) and in the Files changed tab (look for `e2e/`, `__tests__/`, `*.spec.ts`, `*.test.ts` files)
|
|
319
|
+
4. **Compliance evidence** — in the compliance/ directory
|
|
320
|
+
5. **Test scope** — in compliance/evidence/REQ-XXX/test-scope.md
|
|
321
|
+
6. **Implementation plan** — in compliance/evidence/REQ-XXX/implementation-plan.md (MEDIUM/HIGH risk)
|
|
322
|
+
|
|
323
|
+
They cannot approve until CI is green. They then verify the comprehensive local evidence and compliance artifacts. The developer may NOT merge until the reviewer approves.
|
|
324
|
+
|
|
325
|
+
### Step 7: Handle Feedback (MEDIUM/HIGH risk only)
|
|
326
|
+
|
|
327
|
+
```bash
|
|
328
|
+
git add <changed-files>
|
|
329
|
+
git commit -m "fix: address review feedback - [description]"
|
|
330
|
+
|
|
331
|
+
# Re-run local gates
|
|
332
|
+
# Push — CI re-runs automatically
|
|
333
|
+
git push origin develop
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
## What Approval Means
|
|
337
|
+
|
|
338
|
+
The verification model is risk-tiered to satisfy separation of duties (ISO 27001 A.5.3, SOC 2 CC6.1/CC8.1) where it matters:
|
|
339
|
+
|
|
340
|
+
**LOW risk — CI-verified self-merge:**
|
|
341
|
+
1. **CI** — GitHub confirms gates passed (tamper-resistant, independent)
|
|
342
|
+
2. **Developer** — Confirms code quality and compliance (author verification)
|
|
343
|
+
|
|
344
|
+
CI provides the independent verification source. The developer's self-merge is acceptable because the risk classification is LOW and the automated gates provide objective verification.
|
|
345
|
+
|
|
346
|
+
**MEDIUM/HIGH risk — second human reviewer required:**
|
|
347
|
+
1. **CI** — GitHub confirms gates passed (tamper-resistant, independent)
|
|
348
|
+
2. **Human reviewer** — Confirms code quality, security, compliance, test scope (judgment-based, independent)
|
|
349
|
+
|
|
350
|
+
Both are recorded immutably in GitHub. The second reviewer satisfies separation of duties for changes that affect security, PII, payments, RBAC, or user-facing features.
|
|
351
|
+
|
|
352
|
+
## Output
|
|
353
|
+
|
|
354
|
+
- PR created: `develop` → `main`
|
|
355
|
+
- CI independent verification running (or passed)
|
|
356
|
+
- Compliance checklist in PR description
|
|
357
|
+
- For MEDIUM/HIGH: second reviewer approval recorded
|
|
358
|
+
- Immutable audit trail
|
|
359
|
+
|
|
360
|
+
## Next Step
|
|
361
|
+
|
|
362
|
+
After CI passes (and reviewer approves for MEDIUM/HIGH risk), proceed to `5-deploy-main.md`.
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Merge approved PR, verify deployment including security checks, sync branches, finalize compliance
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Deploy to Production
|
|
6
|
+
|
|
7
|
+
**Pipeline Stage:** 5 of 5
|
|
8
|
+
**Previous:** `4-submit-for-review.md` (after PR approved and CI passed)
|
|
9
|
+
**References:** Test Plan (post-deploy verification, DR targets), Test Strategy (`sdlc/files/Test_Strategy.md` in DevAudit)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Prerequisites
|
|
14
|
+
|
|
15
|
+
- All CI checks passed (enforced by branch protection)
|
|
16
|
+
- **LOW risk:** Self-merged after CI passed
|
|
17
|
+
- **MEDIUM/HIGH risk:** PR approved by a second human reviewer, no unresolved review comments
|
|
18
|
+
- UAT-environment verification passed (only if Stage 3 Step 10 applied — opt-in by risk class)
|
|
19
|
+
- **Release approved in DevAudit** (Stage 3 Step 11, verified by Release Approval Gate on the PR)
|
|
20
|
+
|
|
21
|
+
## Steps
|
|
22
|
+
|
|
23
|
+
### Step 1: Merge the PR
|
|
24
|
+
|
|
25
|
+
**Option A: GitHub CLI (Preferred)**
|
|
26
|
+
```bash
|
|
27
|
+
gh pr list --head develop --json number --jq '.[0].number'
|
|
28
|
+
gh pr merge [PR-NUMBER] --merge --delete-branch=false
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Option B: GitHub Web UI**
|
|
32
|
+
1. Open PR → **Merge pull request** → "Create a merge commit" → **Confirm merge**
|
|
33
|
+
|
|
34
|
+
**Do NOT delete `develop`** — it's the permanent working branch.
|
|
35
|
+
|
|
36
|
+
### Step 2: Sync Branches
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
git checkout main && git pull origin main
|
|
40
|
+
git checkout develop && git pull origin develop
|
|
41
|
+
git merge main --no-edit && git push origin develop
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Step 3: Verify Production Deployment
|
|
45
|
+
|
|
46
|
+
Wait for auto-deploy to complete, then:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# Health check
|
|
50
|
+
curl -s [PRODUCTION_URL]/[HEALTH_ENDPOINT]
|
|
51
|
+
# Expected: success response
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
If it fails, check hosting platform logs. See deployment reference doc for troubleshooting.
|
|
55
|
+
|
|
56
|
+
### Step 3a: Run Post-Deploy Actions (if any)
|
|
57
|
+
|
|
58
|
+
Check the release ticket's **Post-Deploy Actions** section. If actions are listed:
|
|
59
|
+
|
|
60
|
+
1. Run each action in order against the **production** environment
|
|
61
|
+
2. Verify each completes successfully before proceeding
|
|
62
|
+
3. Record results in the release ticket's Audit Trail
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# Example: data migration
|
|
66
|
+
npx tsx scripts/backfill-x.ts "[PROD_CONNECTION_STRING]"
|
|
67
|
+
# Verify: check output for success, record row counts
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
If the release ticket says "No post-deploy actions required", skip to Step 4.
|
|
71
|
+
|
|
72
|
+
> **Important:** Run post-deploy actions BEFORE smoke tests. Smoke tests should verify the application works with the migration applied.
|
|
73
|
+
|
|
74
|
+
### Production Verification Policy
|
|
75
|
+
|
|
76
|
+
Production verification is **read-only and non-destructive**. It confirms the deployment succeeded and the application is accessible. It does NOT exercise application logic.
|
|
77
|
+
|
|
78
|
+
| Allowed (read-only) | NOT allowed (destructive) |
|
|
79
|
+
|---------------------|--------------------------|
|
|
80
|
+
| Health checks (HTTP GET) | E2E tests (Playwright) |
|
|
81
|
+
| Public endpoint status codes | Database operations |
|
|
82
|
+
| Security header inspection | API mutations (POST/PUT/DELETE) |
|
|
83
|
+
| Auth redirect verification | Test data creation |
|
|
84
|
+
| Smoke test (homepage loads) | Authenticated flows |
|
|
85
|
+
|
|
86
|
+
E2E tests run on `develop` (CI) and UAT — never production. The `post-deploy-prod.yml` workflow automates the read-only checks below.
|
|
87
|
+
|
|
88
|
+
### Step 4: Production Smoke Test
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
curl -s [PRODUCTION_URL]/[PUBLIC_ENDPOINT] | head -c 200
|
|
92
|
+
curl -s -o /dev/null -w "%{http_code}" [PRODUCTION_URL]/
|
|
93
|
+
# Expected: 200
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Step 5: Production Security Verification
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
# Access control
|
|
100
|
+
curl -s -o /dev/null -w "%{http_code}" [PRODUCTION_URL]/[ADMIN_ENDPOINT]
|
|
101
|
+
# Expected: 401 or 403
|
|
102
|
+
|
|
103
|
+
# Security headers
|
|
104
|
+
curl -s -I [PRODUCTION_URL]/ | grep -iE 'x-frame-options|x-content-type|strict-transport|content-security'
|
|
105
|
+
|
|
106
|
+
# No stack traces
|
|
107
|
+
curl -s [PRODUCTION_URL]/[NONEXISTENT_ENDPOINT]
|
|
108
|
+
# Expected: generic error
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Record results:
|
|
112
|
+
```bash
|
|
113
|
+
cat >> compliance/evidence/REQ-XXX/security-summary.md << EOF
|
|
114
|
+
|
|
115
|
+
## Production Post-Deploy Verification — $(date -I)
|
|
116
|
+
- PROD Health check: PASS
|
|
117
|
+
- PROD Admin auth check: PASS
|
|
118
|
+
- PROD Security headers: PASS
|
|
119
|
+
- PROD No stack traces: PASS
|
|
120
|
+
- PROD URL: [PRODUCTION_URL]
|
|
121
|
+
EOF
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Step 5a: Post-Deploy Release Approval in DevAudit (CONDITIONAL)
|
|
125
|
+
|
|
126
|
+
**When this step applies:** Project's `sdlc-config.json` has `production_review.terminal_status: "prod_review"` (the default in sdlc-v1.22.0+). The `post-deploy-prod.yml` workflow has just PATCHed the release to status `prod_review` and is now waiting for human acknowledgement.
|
|
127
|
+
|
|
128
|
+
**When to skip:** Project has `production_review.terminal_status: "released"` (Option B — preserves v1.21.x auto-release behaviour). The workflow has already advanced the release to `released` and no human clicks are needed.
|
|
129
|
+
|
|
130
|
+
#### What this step is for
|
|
131
|
+
|
|
132
|
+
The post-deploy approval gate captures an explicit audit trail: a named human (or auto-approver, depending on `approval.mode`) attests that they verified production behaved correctly after deploy, separate from the pre-merge Release Approval. Two distinct events are recorded:
|
|
133
|
+
1. `release.production_approved` — human reviewed prod smoke results + did any extra checks they consider appropriate.
|
|
134
|
+
2. `release.released` — human formally closed out the release lifecycle.
|
|
135
|
+
|
|
136
|
+
The backend stores both with reviewer identity, SHA, and timestamp. This satisfies SOC2 CC7.4 (post-deployment monitoring) and ISO 29119 §5.6 (release closure).
|
|
137
|
+
|
|
138
|
+
#### Steps
|
|
139
|
+
|
|
140
|
+
1. Wait for `post-deploy-prod.yml` to complete (the workflow's "Advance release status" step prints `Release vYYYY.MM.DD → prod_review` when done).
|
|
141
|
+
2. Open the release in DevAudit: `https://[DEVAUDIT_BASE_URL]/projects/[PROJECT_SLUG]/releases/[releaseId]`.
|
|
142
|
+
3. Review the `prod-smoke-results.json` evidence (uploaded by the workflow) plus any post-deploy actions logged in the release ticket.
|
|
143
|
+
4. Click **Approve Production** — status transitions to `prod_approved`.
|
|
144
|
+
5. Click **Mark as Released** — status transitions to `released`. Pipeline lifecycle complete in DevAudit.
|
|
145
|
+
|
|
146
|
+
If the smoke results look wrong or a manual verification fails, click **Reject** on the production approval and follow the Rollback procedure below before retrying.
|
|
147
|
+
|
|
148
|
+
#### Approver mode (same as Stage 3 Step 11)
|
|
149
|
+
|
|
150
|
+
`approval.mode` is checked again here. `dual_actor` means the post-deploy approver must differ from the release creator. `solo_with_gap` accepts self-approval but records the control gap. `auto_low_risk` allows LOW-risk requirements to auto-advance through both transitions on workflow completion; MEDIUM/HIGH always require a human click.
|
|
151
|
+
|
|
152
|
+
### Step 6: Finalize Compliance (Tracked Requirements Only)
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
mv compliance/pending-releases/RELEASE-TICKET-REQ-XXX.md compliance/approved-releases/
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Update `compliance/RTM.md`:
|
|
159
|
+
```markdown
|
|
160
|
+
| REQ-XXX | Description | [RISK] | files | evidence | APPROVED - DEPLOYED | [Reviewer] | [Date] |
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Add audit trail to release ticket:
|
|
164
|
+
```markdown
|
|
165
|
+
| [date] | UAT verification passed | [who] | Health + smoke + feature verified on UAT |
|
|
166
|
+
| [date] | PR approved | [reviewer] | PR #[number] |
|
|
167
|
+
| [date] | CI verification | GitHub Actions | All gates passed independently |
|
|
168
|
+
| [date] | Deployed to production | System | Auto-deploy from main |
|
|
169
|
+
| [date] | PROD post-deploy verification | [who] | Health + security checks passed on PROD |
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
git add compliance/RTM.md compliance/approved-releases/ compliance/evidence/REQ-XXX/
|
|
174
|
+
git rm compliance/pending-releases/RELEASE-TICKET-REQ-XXX.md 2>/dev/null
|
|
175
|
+
git commit -m "compliance: [REQ-XXX] approved and deployed - PR #[number]"
|
|
176
|
+
git push origin develop
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Step 7: Close the GitHub Issue
|
|
180
|
+
|
|
181
|
+
If the requirement was linked to a GitHub Issue, close it with a reference to the PR:
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
gh issue close [ISSUE-NUMBER] --comment "Implemented in PR #[PR-NUMBER] (REQ-XXX). [Brief summary of what was delivered]."
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
This is the final traceability link: Issue → Requirement → PR → Deployment → Issue closed.
|
|
188
|
+
|
|
189
|
+
### Step 8: Final Sync
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
git checkout main && git merge develop --no-edit && git push origin main
|
|
193
|
+
git checkout develop
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## Rollback
|
|
197
|
+
|
|
198
|
+
1. **Hosting dashboard:** Redeploy previous version
|
|
199
|
+
2. **Git:** `git checkout main && git revert HEAD --no-edit && git push origin main`
|
|
200
|
+
3. **Document:** Add rollback entry to release ticket audit trail
|
|
201
|
+
|
|
202
|
+
### Environment Summary
|
|
203
|
+
|
|
204
|
+
If the project uses separate UAT and Production environments:
|
|
205
|
+
|
|
206
|
+
| Environment | Branch | Auto-deploy | Purpose |
|
|
207
|
+
|-------------|--------|-------------|---------|
|
|
208
|
+
| UAT | `develop` | Yes | Pre-PR verification — CI evidence uploaded to DevAudit, reviewed and approved before PR |
|
|
209
|
+
| Production | `main` | Yes | Live deployment after PR approval — post-deploy evidence captured and uploaded to DevAudit |
|
|
210
|
+
|
|
211
|
+
UAT-environment verification (if applicable per risk class) and Release Approval are completed in workflow 3 before the PR is created. After merge to main, the post-deploy workflow runs smoke tests against production, uploads evidence to DevAudit (environment=production), and advances the release to `production_review.terminal_status` from `sdlc-config.json` (default `prod_review` — human acknowledges via portal; or `released` — auto-release).
|
|
212
|
+
|
|
213
|
+
### Automated Post-Deploy Workflow
|
|
214
|
+
|
|
215
|
+
If your project has `post-deploy-prod.yml` (template in `sdlc/files/ci/`), Steps 3-4 are handled automatically by CI after merge. The workflow:
|
|
216
|
+
|
|
217
|
+
1. Waits for deployment to propagate
|
|
218
|
+
2. Runs production smoke tests (health check, key endpoints)
|
|
219
|
+
3. Uploads production evidence to DevAudit with `--environment production`
|
|
220
|
+
4. Advances the release to `production_review.terminal_status` from `sdlc-config.json`:
|
|
221
|
+
- **`prod_review` (default, Option A)** — stops at `prod_review`, expects a human to walk Step 5a (Approve Production → Mark as Released) in the DevAudit portal. Captures two named audit events post-deploy.
|
|
222
|
+
- **`released` (Option B)** — PATCHes straight to `released`, no human click expected. Preserves v1.21.x behaviour for projects that don't want post-deploy ceremony.
|
|
223
|
+
|
|
224
|
+
Manual verification (Step 5: security checks) is still recommended for MEDIUM/HIGH risk releases regardless of which terminal_status is configured.
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## Output
|
|
229
|
+
|
|
230
|
+
- PR merged, production deployment verified
|
|
231
|
+
- Production security verification passed
|
|
232
|
+
- Branches synced
|
|
233
|
+
- Release ticket finalized
|
|
234
|
+
- RTM: `APPROVED - DEPLOYED`
|
|
235
|
+
|
|
236
|
+
## Pipeline Complete
|
|
237
|
+
|
|
238
|
+
```
|
|
239
|
+
Requirement (RTM + Risk)
|
|
240
|
+
→ Test Scope (planned before implementation)
|
|
241
|
+
→ AI Use Documented
|
|
242
|
+
→ Implementation (develop)
|
|
243
|
+
→ Local Gates (SAST + deps + E2E — comprehensive)
|
|
244
|
+
→ Evidence Compiled
|
|
245
|
+
→ UAT Verification (auto-deployed from develop)
|
|
246
|
+
→ PR Created → CI Gates (independent verification)
|
|
247
|
+
→ Review (LOW: self-merge | MEDIUM/HIGH: second reviewer)
|
|
248
|
+
→ PROD Deployment (auto-deploy from main)
|
|
249
|
+
→ PROD Verification (health + security)
|
|
250
|
+
→ Finalization (RTM closed)
|
|
251
|
+
```
|