Feature Requirements: phase-2-ci-quality
Metadata
- Feature: phase-2-ci-quality
- Status: APPROVED
- Created: 2026-02-07
- Author: Factory Plan Mode
- Parent Epic: #179 (ZERG Public Release)
- Issues: #189, #190
1. Problem Statement
1.1 Background
ZERG is preparing for public release. Phase 0 (blockers) and Phase 1 (community governance) are complete. The repo has basic CI (ci.yml with quality, smoke, test, audit jobs) but lacks security scanning, type checking in CI, Python 3.13 coverage, a documentation site, and structured GitHub Discussions.
1.2 Problem
- No automated security scanning (CodeQL) — vulnerabilities in PRs go undetected
- mypy runs locally but is not enforced in CI — type regressions can merge
- CI only tests Python 3.12 — no 3.13 verification despite
>=3.12 requirement
- Documentation exists as raw markdown in
docs/ — no searchable, navigable site
- GitHub Discussions enabled but has no categories or README link
1.3 Impact
Without Phase 2:
- Security vulnerabilities merge undetected
- Type errors regress silently
- Contributors on Python 3.13 hit untested issues
- Users can't easily browse documentation
- Community questions end up as issues instead of discussions
2. Users
2.1 Primary Users
- Open-source contributors submitting PRs (benefit from CI checks)
- Developers evaluating ZERG (benefit from docs site)
2.2 Secondary Users
- Maintainer (rocklambros) — benefits from automated security scanning and type enforcement
- Community members — benefit from structured Discussions categories
3. Functional Requirements
3.1 Core Capabilities
| ID |
Requirement |
Priority |
Issue |
Notes |
| FR-001 |
CodeQL security scanning workflow |
Must |
#189 |
Python, security-and-quality suite, push + PR + weekly schedule |
| FR-002 |
mypy in CI quality job |
Must |
#189 |
Use existing pyproject.toml config, block merge on failure |
| FR-003 |
Python 3.12 + 3.13 test matrix |
Must |
#189 |
Add 3.13 to matrix, update pyproject.toml classifiers |
| FR-004 |
CODEOWNERS file |
Must |
#189 |
Default @rocklambros, specific paths for core, CI, docs |
| FR-005 |
mkdocs.yml config |
Must |
#190 |
Material theme, navigation tabs, search |
| FR-006 |
docs/index.md |
Must |
#190 |
Landing page for docs site (can adapt from README) |
| FR-007 |
GitHub Pages deployment workflow |
Must |
#190 |
.github/workflows/docs.yml, deploy on push to main |
| FR-008 |
GitHub Discussions categories |
Must |
#190 |
Q&A, Ideas, Show and Tell, General |
| FR-009 |
README Discussions link |
Must |
#190 |
Add link in README |
| FR-010 |
mkdocs + mkdocs-material in optional deps |
Must |
#190 |
[project.optional-dependencies.docs] |
| FR-011 |
Coverage badge in README |
Should |
#189 |
shields.io coverage badge |
3.2 Inputs
- Existing
ci.yml workflow (add mypy step, expand matrix)
- Existing
pyproject.toml mypy config (strict mode, py312)
- Existing
docs/ folder content (8 markdown files)
- GitHub API for Discussions categories
3.3 Outputs
- 3 new files:
codeql.yml, docs.yml, CODEOWNERS
- 2 new files:
mkdocs.yml, docs/index.md
- 2 modified files:
ci.yml (mypy + matrix), pyproject.toml (classifiers + docs deps)
- 1 modified file:
README.md (Discussions link, coverage badge)
- 1 modified file:
CHANGELOG.md (Phase 2 entries)
- GitHub API: Discussions categories
3.4 Business Rules
- CodeQL must scan on push to main, PRs, and weekly cron
- mypy failure must block merge (required check)
- Python 3.13 tests use same test suite — no special handling
- Docs site uses Material for MkDocs theme
- Docs site deploys automatically on push to main
- CODEOWNERS uses @rocklambros as default owner
4. Non-Functional Requirements
4.1 Performance
- CodeQL scan should complete within 10 minutes
- Docs build should complete within 2 minutes
- Adding mypy to quality job should add <60s to CI
4.2 Security
- CodeQL provides automated vulnerability detection (SAST)
- CODEOWNERS ensures review for sensitive paths
4.3 Reliability
- Docs deployment should not block CI (separate workflow)
- CodeQL failure should not block merge (advisory only initially)
5. Scope
5.1 In Scope
- CodeQL workflow (.github/workflows/codeql.yml)
- mypy added to CI quality job
- Python 3.12 + 3.13 test matrix
- CODEOWNERS file
- mkdocs configuration and docs site
- GitHub Pages deployment workflow
- GitHub Discussions categories
- README updates (Discussions link, coverage badge)
5.2 Out of Scope
- Coverage floor change (keeping at 50 per user decision)
- Terminal demo / social preview (Phase 3, #191)
- Making repo public (separate decision)
- FUNDING.yml (Phase 3)
- Link checker workflow (Phase 3)
- Secret scanning (requires public repo or Advanced Security)
5.3 Assumptions
- Repo stays private during Phase 2 (docs site won't be publicly visible until repo is public)
- GitHub Discussions is already enabled (confirmed — linked in issue template)
- All current dependencies support Python 3.13
mkdocs build --strict should pass with existing docs content
5.4 Constraints
- Must not break existing 5 required CI checks (quality, smoke, test (1), test (2), audit)
- mypy must use existing pyproject.toml config (strict mode)
- Docs site must build from existing
docs/ content without major rewrites
6. Dependencies
6.1 Internal Dependencies
| Dependency |
Type |
Status |
| Phase 0 (blockers) |
Required |
Complete |
| Phase 1 (community governance) |
Required |
Complete |
| Existing ci.yml |
Modify |
Exists |
| Existing pyproject.toml |
Modify |
Exists |
| Existing docs/ folder |
Reference |
8 files present |
6.2 External Dependencies
| Dependency |
Type |
Owner |
| GitHub CodeQL |
Security scanning |
GitHub |
| GitHub Pages |
Docs hosting |
GitHub |
| mkdocs-material |
Docs theme |
squidfunk |
| shields.io |
Coverage badge |
External |
7. Acceptance Criteria
7.1 Definition of Done
7.2 Test Scenarios
| ID |
Scenario |
Given |
When |
Then |
| TC-001 |
CodeQL scan |
codeql.yml exists |
PR opened |
CodeQL runs Python security scan |
| TC-002 |
mypy in CI |
mypy step in quality |
PR with type error |
quality job fails |
| TC-003 |
Python 3.13 |
Matrix includes 3.13 |
Tests run |
All tests pass on 3.13 |
| TC-004 |
Docs build |
mkdocs.yml exists |
mkdocs build --strict |
Build succeeds |
| TC-005 |
CODEOWNERS |
File exists |
PR touches zerg/*.py |
@rocklambros auto-requested |
8. Open Questions
| ID |
Question |
Owner |
Status |
| Q-001 |
Should CodeQL failure block merge or be advisory? |
maintainer |
Resolved: Advisory (don't add to required checks initially) |
| Q-002 |
Should we add a docs required check? |
maintainer |
Open |
9. Approval
| Role |
Name |
Date |
Signature |
| Product |
rocklambros |
|
PENDING |
10. Documentation
After implementation:
- CHANGELOG.md updated with Phase 2 entries (ALWAYS required)
- README.md updated with Discussions link + coverage badge
- pyproject.toml updated with 3.13 classifier + docs deps
11. Documentation Impact Analysis
11.1 Files Requiring Documentation Updates
| File |
Current State |
Required Update |
Priority |
CHANGELOG.md |
Has [Unreleased] |
Add Phase 2 entries |
Must |
README.md |
Has 4 badges |
Add coverage badge, Discussions link |
Must |
pyproject.toml |
3.12 classifier only |
Add 3.13 classifier, docs optional deps |
Must |
CONTRIBUTING.md |
Complete |
No changes needed |
— |
11.2 Documentation Tasks for Design Phase
1---2name: feature-requirements-phase-2-ci-quality3description: ZERG is preparing for public release. Phase 0 (blockers) and Phase 1 (community governance) are complete.4---5# Feature Requirements: phase-2-ci-quality67## Metadata8- **Feature**: phase-2-ci-quality9- **Status**: APPROVED10- **Created**: 2026-02-0711- **Author**: Factory Plan Mode12- **Parent Epic**: #179 (ZERG Public Release)13- **Issues**: #189, #1901415---1617## 1. Problem Statement1819### 1.1 Background20ZERG is preparing for public release. Phase 0 (blockers) and Phase 1 (community governance) are complete. The repo has basic CI (`ci.yml` with quality, smoke, test, audit jobs) but lacks security scanning, type checking in CI, Python 3.13 coverage, a documentation site, and structured GitHub Discussions.2122### 1.2 Problem23- No automated security scanning (CodeQL) — vulnerabilities in PRs go undetected24- mypy runs locally but is not enforced in CI — type regressions can merge25- CI only tests Python 3.12 — no 3.13 verification despite `>=3.12` requirement26- Documentation exists as raw markdown in `docs/` — no searchable, navigable site27- GitHub Discussions enabled but has no categories or README link2829### 1.3 Impact30Without Phase 2:31- Security vulnerabilities merge undetected32- Type errors regress silently33- Contributors on Python 3.13 hit untested issues34- Users can't easily browse documentation35- Community questions end up as issues instead of discussions3637---3839## 2. Users4041### 2.1 Primary Users42- Open-source contributors submitting PRs (benefit from CI checks)43- Developers evaluating ZERG (benefit from docs site)4445### 2.2 Secondary Users46- Maintainer (rocklambros) — benefits from automated security scanning and type enforcement47- Community members — benefit from structured Discussions categories4849---5051## 3. Functional Requirements5253### 3.1 Core Capabilities5455| ID | Requirement | Priority | Issue | Notes |56|----|-------------|----------|-------|-------|57| FR-001 | CodeQL security scanning workflow | Must | #189 | Python, security-and-quality suite, push + PR + weekly schedule |58| FR-002 | mypy in CI quality job | Must | #189 | Use existing pyproject.toml config, block merge on failure |59| FR-003 | Python 3.12 + 3.13 test matrix | Must | #189 | Add 3.13 to matrix, update pyproject.toml classifiers |60| FR-004 | CODEOWNERS file | Must | #189 | Default @rocklambros, specific paths for core, CI, docs |61| FR-005 | mkdocs.yml config | Must | #190 | Material theme, navigation tabs, search |62| FR-006 | docs/index.md | Must | #190 | Landing page for docs site (can adapt from README) |63| FR-007 | GitHub Pages deployment workflow | Must | #190 | .github/workflows/docs.yml, deploy on push to main |64| FR-008 | GitHub Discussions categories | Must | #190 | Q&A, Ideas, Show and Tell, General |65| FR-009 | README Discussions link | Must | #190 | Add link in README |66| FR-010 | mkdocs + mkdocs-material in optional deps | Must | #190 | `[project.optional-dependencies.docs]` |67| FR-011 | Coverage badge in README | Should | #189 | shields.io coverage badge |6869### 3.2 Inputs70- Existing `ci.yml` workflow (add mypy step, expand matrix)71- Existing `pyproject.toml` mypy config (strict mode, py312)72- Existing `docs/` folder content (8 markdown files)73- GitHub API for Discussions categories7475### 3.3 Outputs76- 3 new files: `codeql.yml`, `docs.yml`, `CODEOWNERS`77- 2 new files: `mkdocs.yml`, `docs/index.md`78- 2 modified files: `ci.yml` (mypy + matrix), `pyproject.toml` (classifiers + docs deps)79- 1 modified file: `README.md` (Discussions link, coverage badge)80- 1 modified file: `CHANGELOG.md` (Phase 2 entries)81- GitHub API: Discussions categories8283### 3.4 Business Rules84- CodeQL must scan on push to main, PRs, and weekly cron85- mypy failure must block merge (required check)86- Python 3.13 tests use same test suite — no special handling87- Docs site uses Material for MkDocs theme88- Docs site deploys automatically on push to main89- CODEOWNERS uses @rocklambros as default owner9091---9293## 4. Non-Functional Requirements9495### 4.1 Performance96- CodeQL scan should complete within 10 minutes97- Docs build should complete within 2 minutes98- Adding mypy to quality job should add <60s to CI99100### 4.2 Security101- CodeQL provides automated vulnerability detection (SAST)102- CODEOWNERS ensures review for sensitive paths103104### 4.3 Reliability105- Docs deployment should not block CI (separate workflow)106- CodeQL failure should not block merge (advisory only initially)107108---109110## 5. Scope111112### 5.1 In Scope113- CodeQL workflow (.github/workflows/codeql.yml)114- mypy added to CI quality job115- Python 3.12 + 3.13 test matrix116- CODEOWNERS file117- mkdocs configuration and docs site118- GitHub Pages deployment workflow119- GitHub Discussions categories120- README updates (Discussions link, coverage badge)121122### 5.2 Out of Scope123- Coverage floor change (keeping at 50 per user decision)124- Terminal demo / social preview (Phase 3, #191)125- Making repo public (separate decision)126- FUNDING.yml (Phase 3)127- Link checker workflow (Phase 3)128- Secret scanning (requires public repo or Advanced Security)129130### 5.3 Assumptions131- Repo stays private during Phase 2 (docs site won't be publicly visible until repo is public)132- GitHub Discussions is already enabled (confirmed — linked in issue template)133- All current dependencies support Python 3.13134- `mkdocs build --strict` should pass with existing docs content135136### 5.4 Constraints137- Must not break existing 5 required CI checks (quality, smoke, test (1), test (2), audit)138- mypy must use existing pyproject.toml config (strict mode)139- Docs site must build from existing `docs/` content without major rewrites140141---142143## 6. Dependencies144145### 6.1 Internal Dependencies146| Dependency | Type | Status |147|------------|------|--------|148| Phase 0 (blockers) | Required | Complete |149| Phase 1 (community governance) | Required | Complete |150| Existing ci.yml | Modify | Exists |151| Existing pyproject.toml | Modify | Exists |152| Existing docs/ folder | Reference | 8 files present |153154### 6.2 External Dependencies155| Dependency | Type | Owner |156|------------|------|-------|157| GitHub CodeQL | Security scanning | GitHub |158| GitHub Pages | Docs hosting | GitHub |159| mkdocs-material | Docs theme | squidfunk |160| shields.io | Coverage badge | External |161162---163164## 7. Acceptance Criteria165166### 7.1 Definition of Done167- [ ] CodeQL workflow runs on PRs and weekly168- [ ] mypy passes in CI quality job169- [ ] Tests pass on Python 3.12 and 3.13170- [ ] CODEOWNERS assigns @rocklambros as default reviewer171- [ ] `mkdocs build --strict` passes172- [ ] Docs workflow deploys on push to main173- [ ] Discussions has 4 categories (Q&A, Ideas, Show and Tell, General)174- [ ] README links to Discussions175- [ ] CI passes on PR176- [ ] CHANGELOG.md updated177178### 7.2 Test Scenarios179180| ID | Scenario | Given | When | Then |181|----|----------|-------|------|------|182| TC-001 | CodeQL scan | codeql.yml exists | PR opened | CodeQL runs Python security scan |183| TC-002 | mypy in CI | mypy step in quality | PR with type error | quality job fails |184| TC-003 | Python 3.13 | Matrix includes 3.13 | Tests run | All tests pass on 3.13 |185| TC-004 | Docs build | mkdocs.yml exists | `mkdocs build --strict` | Build succeeds |186| TC-005 | CODEOWNERS | File exists | PR touches zerg/*.py | @rocklambros auto-requested |187188---189190## 8. Open Questions191192| ID | Question | Owner | Status |193|----|----------|-------|--------|194| Q-001 | Should CodeQL failure block merge or be advisory? | maintainer | Resolved: Advisory (don't add to required checks initially) |195| Q-002 | Should we add a `docs` required check? | maintainer | Open |196197---198199## 9. Approval200201| Role | Name | Date | Signature |202|------|------|------|-----------|203| Product | rocklambros | | PENDING |204205---206207## 10. Documentation208209After implementation:210- CHANGELOG.md updated with Phase 2 entries (ALWAYS required)211- README.md updated with Discussions link + coverage badge212- pyproject.toml updated with 3.13 classifier + docs deps213214---215216## 11. Documentation Impact Analysis217218### 11.1 Files Requiring Documentation Updates219| File | Current State | Required Update | Priority |220|------|--------------|-----------------|----------|221| `CHANGELOG.md` | Has [Unreleased] | Add Phase 2 entries | Must |222| `README.md` | Has 4 badges | Add coverage badge, Discussions link | Must |223| `pyproject.toml` | 3.12 classifier only | Add 3.13 classifier, docs optional deps | Must |224| `CONTRIBUTING.md` | Complete | No changes needed | — |225226### 11.2 Documentation Tasks for Design Phase227- [x] CHANGELOG.md update task (ALWAYS required)228- [x] README.md update (badge + link)229- [x] pyproject.toml updates (classifiers + deps)