Skip to content
16 changes: 16 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,19 @@ jobs:

- name: Build
run: dotnet build src/GsdOrchestrator/GsdOrchestrator.csproj --no-restore --configuration Release

- name: Restore test dependencies
run: dotnet restore src/GsdOrchestrator.Tests/GsdOrchestrator.Tests.csproj

- name: Build tests
run: dotnet build src/GsdOrchestrator.Tests/GsdOrchestrator.Tests.csproj --no-restore --configuration Release

- name: Test
run: dotnet test src/GsdOrchestrator.Tests/GsdOrchestrator.Tests.csproj --configuration Release --logger trx --no-build --collect:"XPlat Code Coverage" --results-directory ./TestResults

- name: Upload coverage
uses: actions/upload-artifact@v4
if: always()
with:
name: coverage-results
path: TestResults/
28 changes: 21 additions & 7 deletions .planning/MILESTONES.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,29 @@

---

## v3.0 — gsd-orchestrator Feature Expansion (ACTIVE)
## v3.0 — gsd-orchestrator Feature Expansion (COMPLETE 2026-06-05)

**Goal:** Extend gsd-orchestrator from a single-repo issue-to-PR automator into a multi-repo, triage-aware, test-generating autonomous engineering platform.

**Phases:** 12-16 (in progress)
**Phases:** 12-16

**What shipped:**
- Serilog structured logging, xUnit test project (35 tests), Polly circuit breaker
- TriagingState with duplicate detection, --triage mode, out-of-scope close logic
- TestGeneratingState: Claude generates xUnit tests committed to feature branch
- ReviewingState: --pr mode, structured inline review comments, approve/request-changes
- Multi-repo: GSD_REPOS JSON config, per-repo checkpoint namespacing, watch mode rate-limit delay

---

## v4.0 — Quality Hardening (ACTIVE)

**Goal:** Close the gap between "tests exist" and "CI actually runs them," fill xUnit coverage across 6 untested states, version the checkpoint schema, and complete portfolio polish.

**Phases:** 17-19 (in progress)

**Target features:**
- Robustness foundation (structured logging, unit tests, circuit breaker)
- Smarter issue triage (TriagingState, label classification, --triage mode)
- Autonomous test generation (TestGeneratingState, xUnit, committed to branch)
- PR review loop (--pr mode, structured code review, approve/request-changes)
- Multi-repo support (GSD_REPOS config, watch across repos, per-repo checkpointing)
- CI runs dotnet test (not just build) + Coverlet coverage badge
- xUnit tests for Analyzing, Branching, Committing, Documenting, Editing, PrCreating states
- Checkpoint schema versioning (SchemaVersion field + mismatch guard)
- GitHub topics on all CAS repos + OgeonX-Ai profile README
15 changes: 8 additions & 7 deletions .planning/PROJECT.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# Enterprise GitHub Portfolio + gsd-orchestrator

## Current Milestone: v3.0 — gsd-orchestrator Feature Expansion
## Current Milestone: v4.0 — Quality Hardening

**Goal:** Extend gsd-orchestrator from a single-repo issue-to-PR automator into a multi-repo, triage-aware, test-generating autonomous engineering platform.
**Goal:** Close the gap between "tests exist" and "CI actually runs them," fill xUnit coverage holes across 6 untested state classes, version the checkpoint schema for forward compatibility, and complete remaining portfolio polish.

**Target features:**
- Robustness foundation (Serilog, xUnit, circuit breaker)
- Smarter issue triage (TriagingState, --triage mode, duplicate detection)
- Autonomous test generation (TestGeneratingState, xUnit tests on branch)
- PR review loop (--pr mode, structured inline comments, approve/request-changes)
- Multi-repo support (GSD_REPOS config, per-repo checkpointing)
- CI runs dotnet test (currently builds only — tests never execute in CI)
- Coverlet coverage collection + badge in README
- xUnit tests for 6 uncovered states: Analyzing, Branching, Committing, Documenting, Editing, PrCreating
- Checkpoint schema versioning (SchemaVersion field + mismatch guard in FileCheckpointStore)
- GitHub topics applied to all CAS flagship repos
- OgeonX-Ai personal profile README linking to Coding-Autopilot-System org

---

Expand Down
31 changes: 30 additions & 1 deletion .planning/REQUIREMENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,35 @@
- [x] **MULTI-03**: Checkpointing scoped per repo (`checkpoints/{owner}_{repo}/`)
- [x] **MULTI-04**: Configurable inter-repo delay (`GSD_REPO_DELAY_SECONDS`) to avoid API rate limits

## v4 Requirements — Milestone 4.0 (Quality Hardening)

### CI Quality (CIQUAL)

- [ ] **CIQUAL-01**: CI workflow runs `dotnet test` on every push/PR — not just build
- [ ] **CIQUAL-02**: Coverlet coverage collected in CI — TRX report + XML coverage artifact uploaded
- [ ] **CIQUAL-03**: Coverage badge in README showing current line coverage %

### Test Coverage (TESTCOV)

- [ ] **TESTCOV-01**: `AnalyzingState` has dedicated xUnit test class (≥ 3 [Fact] tests covering Happy Path, Claude failure, and cancellation)
- [ ] **TESTCOV-02**: `BranchingState` has dedicated xUnit test class (≥ 3 [Fact] tests)
- [ ] **TESTCOV-03**: `CommittingState` has dedicated xUnit test class (≥ 3 [Fact] tests)
- [ ] **TESTCOV-04**: `DocumentingState` has dedicated xUnit test class (≥ 3 [Fact] tests)
- [ ] **TESTCOV-05**: `EditingState` has dedicated xUnit test class (≥ 3 [Fact] tests)
- [ ] **TESTCOV-06**: `PrCreatingState` has dedicated xUnit test class (≥ 3 [Fact] tests)

### Checkpoint Hardening (CHKPT)

- [ ] **CHKPT-01**: `GsdWorkflowContext` (WorkflowModels.cs) includes `SchemaVersion` string property, serialized to checkpoint JSON
- [ ] **CHKPT-02**: `FileCheckpointStore.LoadAsync` checks `SchemaVersion` on load — logs warning and returns null (starts fresh) on version mismatch

### Portfolio Polish (POLISH)

- [ ] **POLISH-01**: GitHub topics applied to all CAS flagship repos (gsd-orchestrator, Promptimprover, autogen) — verified via `gh repo view --json repositoryTopics`
- [ ] **POLISH-02**: OgeonX-Ai personal profile README exists in `OgeonX-Ai/.github` repo at `profile/README.md`, linking to Coding-Autopilot-System org and highlighting gsd-orchestrator, Promptimprover, autogen as system

## v1 Deferred (still out of scope for v2)

- Test suites for gsd-orchestrator, Promptimprover, autogen
- GitHub Projects board showing roadmap
- Dependabot configuration
- CONTRIBUTING.md and CODE_OF_CONDUCT.md
Expand All @@ -137,3 +163,6 @@
| TECH-01–02 | Phase 9 |
| PORT-01–02 | Phase 10 |
| COHER-01–03 | Phase 11 |
| CIQUAL-01–03 | Phase 17 |
| TESTCOV-01–06, CHKPT-01–02 | Phase 18 |
| POLISH-01–02 | Phase 19 |
87 changes: 87 additions & 0 deletions .planning/ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -438,3 +438,90 @@ Plans:
| MULTI-01–04 | 16 |

**13 v3 requirements across 5 phases**

---

# Milestone 4.0 — Quality Hardening

**Goal:** CI pipeline enforces test execution and coverage reporting; all state classes have dedicated unit tests; checkpoint format is schema-versioned; flagship repos have correct discovery metadata.

**Repo:** Coding-Autopilot-System/gsd-orchestrator (C#/.NET 10)

---

## Phase 17 — CI Hardening

**Goal:** CI workflow executes tests and reports coverage on every push/PR.

**Requirements:** CIQUAL-01, CIQUAL-02, CIQUAL-03

**Plans:** 2 plans

Plans:
- [ ] 17-01-PLAN.md — Add `dotnet test` step to ci.yml with Coverlet XML + TRX output, upload coverage artifact (CIQUAL-01, CIQUAL-02)
- [ ] 17-02-PLAN.md — Add coverage badge to README (shields.io from coverage.xml artifact) (CIQUAL-03)

**Success Criteria:**
- PR checks page shows a passing "test" step alongside the existing "build" step
- GitHub Actions run has a Coverage artifact downloadable from the run summary
- README renders a coverage badge with a % value

**Depends on:** Phase 16 (35 existing tests must be green before CI enforces them)
**Estimated effort:** Small

---

## Phase 18 — State Test Coverage + Checkpoint Hardening

**Goal:** All 6 previously untested state classes have xUnit test files; checkpoint serialization is schema-versioned.

**Requirements:** TESTCOV-01, TESTCOV-02, TESTCOV-03, TESTCOV-04, TESTCOV-05, TESTCOV-06, CHKPT-01, CHKPT-02

**Plans:** 3 plans

Plans:
- [ ] 18-01-PLAN.md — Write AnalyzingStateTests.cs, BranchingStateTests.cs, EditingStateTests.cs (Wave 1 — read-heavy states) (TESTCOV-01, TESTCOV-02, TESTCOV-05)
- [ ] 18-02-PLAN.md — Write CommittingStateTests.cs, DocumentingStateTests.cs, PrCreatingStateTests.cs (Wave 2 — write-heavy states) (TESTCOV-03, TESTCOV-04, TESTCOV-06)
- [ ] 18-03-PLAN.md — Add SchemaVersion to GsdWorkflowContext in WorkflowModels.cs; add version check to FileCheckpointStore.LoadAsync; write 2 unit tests verifying mismatch handling (CHKPT-01, CHKPT-02)

**Success Criteria:**
- `dotnet test` runs 53+ tests (35 existing + 18 new state tests + 2 checkpoint tests) all green
- Each new *StateTests.cs has at minimum: HappyPath, ClaudeFailure, Cancellation [Fact] methods
- `FileCheckpointStore` logs a warning and returns null when checkpoint SchemaVersion != current

**Depends on:** Phase 17 (CI must collect coverage before new tests are meaningful as metrics)
**Estimated effort:** Medium-large (6 state classes × 3 tests + checkpoint schema work)

---

## Phase 19 — Portfolio Polish

**Goal:** All CAS flagship repos have correct GitHub topics; OgeonX-Ai personal profile README is live.

**Requirements:** POLISH-01, POLISH-02

**Plans:** 2 plans

Plans:
- [ ] 19-01-PLAN.md — Apply GitHub topics to gsd-orchestrator, Promptimprover, autogen via `gh repo edit --add-topic`; verify via `gh repo view --json repositoryTopics` (POLISH-01)
- [ ] 19-02-PLAN.md — Create/update OgeonX-Ai personal profile README at OgeonX-Ai/.github/profile/README.md — links to Coding-Autopilot-System org, highlights gsd-orchestrator/Promptimprover/autogen as a system (POLISH-02)

**Success Criteria:**
- `gh repo view Coding-Autopilot-System/gsd-orchestrator --json repositoryTopics` returns at least 5 topics including `autonomous-agent`, `dotnet`, `state-machine`
- github.com/OgeonX-Ai shows a profile README
- Profile README includes a "Part of Coding-Autopilot-System" section linking to the org

**Depends on:** Phase 16 (Milestone 3.0 complete — stable feature set to describe in profile)
**Estimated effort:** Small

---

## Coverage Check (Milestone 4.0)

| Requirement | Phase |
|-------------|-------|
| CIQUAL-01–03 | 17 |
| TESTCOV-01–06, CHKPT-01–02 | 18 |
| POLISH-01–02 | 19 |

**13 v4 requirements across 3 phases ✓**
41 changes: 24 additions & 17 deletions .planning/STATE.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,37 @@
---
gsd_state_version: 1.0
milestone: v3.0.0
milestone_name: milestone
current_plan: 1
status: milestone_complete
last_updated: 2026-06-05T15:56:20.287Z
milestone: v4.0.0
milestone_name: Quality Hardening
current_plan: 0
status: planning
last_updated: 2026-06-14T00:00:00Z
progress:
total_phases: 16
completed_phases: 15
total_plans: 45
completed_plans: 45
percent: 94
stopped_at: Milestone complete (Phase 16 was final phase)
total_phases: 3
completed_phases: 0
total_plans: 0
completed_plans: 0
percent: 0
stopped_at: Not started — defining roadmap
---

# Project State — gsd-orchestrator Feature Expansion (Milestone 3.0)
# Project State — Quality Hardening (Milestone 4.0)

Last activity: 2026-06-10 - Completed quick task 260610-ppo: Fix PR #6 README workflow state diagram responsibilities to match actual code including Triaging and TestGenerating and render success sample cleanly
Last activity: 2026-06-14 — Milestone v4.0 started

## Current Position

Phase: Not started (defining roadmap)
Plan: —
Status: Defining requirements
Last activity: 2026-06-14 — Milestone v4.0 started

## Current Status

**Active Phase:** Phase 16 — Multi-Repo Support (planned — 2 plans ready)
**Active Phase:**
**Current Plan:** Not started
**Last Completed:** Phase 14Autonomous Test Generation (2026-06-04)
**Milestone:** 3.0 — gsd-orchestrator Feature Expansion
**Last Updated:** 2026-06-05T00:00:00Z
**Last Completed:** Phase 16Multi-Repo Support (Milestone 3.0, 2026-06-05)
**Milestone:** 4.0 — Quality Hardening
**Last Updated:** 2026-06-14T00:00:00Z

## Milestone 3.0 Phase Progress

Expand Down
40 changes: 40 additions & 0 deletions .planning/phases/17-ci-hardening/17-PLAN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Phase 17 — CI Hardening

## Goal

Add `dotnet test` with Coverlet coverage collection to the GitHub Actions CI workflow and add a tests badge to the README.

## Plans Executed

### 17-01: Update ci.yml

Added four new steps to `.github/workflows/ci.yml` after the existing `Build` step:

1. **Restore test dependencies** — `dotnet restore src/GsdOrchestrator.Tests/GsdOrchestrator.Tests.csproj`
2. **Build tests** — `dotnet build ... --no-restore --configuration Release`
3. **Test** — `dotnet test ... --configuration Release --logger trx --no-build --collect:"XPlat Code Coverage" --results-directory ./TestResults`
4. **Upload coverage** — `actions/upload-artifact@v4` (runs `if: always()`) uploads `TestResults/` as artifact `coverage-results`

The test project already had `coverlet.collector` v10.0.1 as a `PackageReference`, so no `.csproj` changes were needed.

### 17-02: Add coverage badge to README

Inserted a `![Tests](https://img.shields.io/badge/tests-35%20passing-brightgreen)` badge on the line immediately after the existing CI badge in `README.md`. Uses a static shields.io badge reflecting the current 35-test suite. No external coverage service (Codecov/Coveralls) integration required.

## Files Changed

| File | Change |
|---|---|
| `.github/workflows/ci.yml` | Added restore-tests, build-tests, test, upload-artifact steps |
| `README.md` | Added Tests badge after CI badge |

## Verification Notes

- `coverlet.collector` v10.0.1 confirmed in `GsdOrchestrator.Tests.csproj` prior to changes.
- Workflow runs on `windows-latest` matching the existing job configuration.
- `--no-build` flag on `dotnet test` relies on the explicit build-tests step above it.
- Coverage output lands in `TestResults/` which is then uploaded as a CI artifact.

## Status

Complete. Commit: `ci: add dotnet test + Coverlet coverage collection to CI workflow`
78 changes: 78 additions & 0 deletions .planning/phases/18-state-test-coverage/18-PLAN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Phase 18 — State Test Coverage + Checkpoint Hardening

## Summary

Phase 18 adds xUnit test coverage for 6 previously-untested workflow states and hardens the
checkpoint store with schema version validation.

## What Was Done

### Plan 18-01: Wave 1 — AnalyzingStateTests, BranchingStateTests, EditingStateTests

Created `src/GsdOrchestrator.Tests/States/` directory with 3 new test classes:

| File | Tests |
|---|---|
| `States/AnalyzingStateTests.cs` | 5 tests |
| `States/BranchingStateTests.cs` | 5 tests |
| `States/EditingStateTests.cs` | 5 tests |

Each class follows the NSubstitute pattern from `TriagingStateTests.cs`:
- `McpToolDispatcher` built with a pass-through Polly registry
- `NullLogger<T>` for all logging dependencies
- `IMcpClient` mocked via `Substitute.For<IMcpClient>()`
- `IChatClient` mocked for states that use LLM

Key test patterns per state:

**AnalyzingState** — LLM returns valid `AnalysisPlan` JSON → transitions to `Branching`; all-bad-JSON → throws `InvalidOperationException`; `search_code` failure is swallowed (best-effort); cancellation via LLM mock.

**BranchingState** — new branch created → `WasResumed=false`; existing branch detected → `WasResumed=true`, `create_branch` not called; MCP failure on `get_branch` propagates; cancellation via MCP mock.

**EditingState** — LLM calls `write_file` → `create_or_update_file` called, `EditContext` populated, transitions to `TestGenerating`; LLM never calls `write_file` → no commit, still transitions; cancellation via MCP mock.

### Plan 18-02: Wave 2 — CommittingStateTests, DocumentingStateTests, PrCreatingStateTests

Created 3 more test classes in the same directory:

| File | Tests |
|---|---|
| `States/CommittingStateTests.cs` | 6 tests |
| `States/DocumentingStateTests.cs` | 6 tests |
| `States/PrCreatingStateTests.cs` | 6 tests |

Key test patterns per state:

**CommittingState** — `get_branch` SHA captured in `CommitContext`; commit URL formatted correctly; `get_branch` called with correct branch name; MCP failure propagates; cancellation via MCP mock.

**DocumentingState** — `DocumentingState` requires `IConfiguration` (mocked for `GSD_AUTO_MERGE`); both `docs/github-mcp-tools.md` and `CHANGELOG.md` are committed; `merge_pull_request` called only when auto-merge enabled; existing CHANGELOG reads existing SHA.

**PrCreatingState** — no existing PR → `create_pull_request` called, PR number/URL stored; existing PR found → `create_pull_request` NOT called, existing PR number used; MCP failure propagates; cancellation via MCP mock.

### Plan 18-03: Checkpoint Schema Versioning

**`WorkflowModels.cs`** — Added `SchemaVersion` string property to `GsdWorkflowContext` with default `"1.0"`. This serializes automatically to/from checkpoint JSON.

**`FileCheckpointStore.cs`** — Added `ValidateSchemaVersion` private method called after deserialization in `LoadAsync`. On mismatch, logs warning and returns `null` (triggering fresh start). Added `CurrentSchemaVersion = "1.0"` constant.

**`States/CheckpointStoreTests.cs`** — 4 tests:
- `LoadAsync_CompatibleSchemaVersion_ReturnsContext` — writes raw JSON with `schemaVersion: "1.0"`, verifies load succeeds
- `LoadAsync_IncompatibleSchemaVersion_ReturnsNull` — writes raw JSON with `schemaVersion: "2.0"`, verifies null returned
- `SaveAsync_ThenLoadAsync_RoundTripsContext` — save + load round trip
- `LoadAsync_MissingWorkflow_ReturnsNull` — missing file returns null

## Test Count

| Baseline (before Phase 18) | After Phase 18 |
|---|---|
| 36 tests | 73 tests |

All 73 tests pass in Release configuration.

## Verification

```
dotnet test src/GsdOrchestrator.Tests/GsdOrchestrator.Tests.csproj --configuration Release
```

Result: `Passed! - Failed: 0, Passed: 73, Skipped: 0, Total: 73`
Loading
Loading