# Ideation: Orca v0.7 — Hardening & Completion

Full autonomy mode: all ideas with confidence >= 0.60 are auto-accepted.
The RESEARCH stage (commit `7c4b603`) surfaced 5 codebase gaps which are
assessed below alongside 8 additional ideas generated by the 3-tier
ideation process.

Total generated: 13 ideas (5 Tier 1 + 5 Tier 2 + 3 Tier 3) plus 5
inherited research findings = 18 considered. 13 accepted (all >= 0.60),
0 skipped, 0 deferred. 4 of the accepted ideas are implementation
refinements with no new REQ; 4 map to the v0.7 REQs (REQ-053..056)
already declared in SPECIFY; the research findings confirmed the v0.7
scope.

## Tier 1: Mechanical Analysis (git + filesystem)

### 1.1 Git-Native Pattern Mining

- `git log --all --grep="lessons:"` — 1 lesson found (orch-engine P00
  config.json schema reference). No repeated lessons in orca's own
  history → no systemic process gap.
- `git log --all --grep="escalation:"` — 0 escalations. The pipeline
  has run clean across v0.1–v0.6.
- `git log --all --grep="compound:"` — 0 compound learnings.
- Low-confidence decisions (confidence < 0.7): none in `---ci---`
  blocks. The lowest-confidence v0.7 decision is D-040 (pprof) at 0.85,
  above threshold.

### 1.2 Coverage Gap Analysis

| ID | Idea | Source | Confidence | Status | Maps to |
|----|------|--------|------------|--------|---------|
| I-401 | `orca cert` command tree is unreachable — `NewCommand` in `internal/cli/cert.go` is never AddCommand'd to `rootCmd` | research §1.1 + `grep -rn "rootCmd.AddCommand"` (cert absent) | 0.98 | Accepted | REQ-053 |
| I-402 | `internal/store/cert_repo.go` has no test file — every other repo has one | research §1.2 + `ls internal/store/*_test.go` | 0.95 | Accepted | REQ-053 (P01 companion) |
| I-403 | `internal/engine` coverage 8.3% — only `scheduler_test.go` exists; executor, dispatcher, peer untested | research §1.3 + `go test -cover` | 0.90 | Accepted | REQ-055 |
| I-404 | `internal/transport` coverage 26.3% — only `idempotency_test.go`; mtls, dispatch, handshake_log untested | research §1.3 | 0.90 | Accepted | REQ-055 |
| I-405 | `internal/audit` has no test files — Emit, EmitWithErr, LogHandshake* untested | research §1.3 + `ls internal/audit/*_test.go` | 0.88 | Accepted | REQ-055 |

### 1.3 Verification Layer Inversion (missing items)

- **Structural**: `internal/cli/cert.go` defines a command that is
  never wired in — a "documented but unreachable" component (I-401).
- **Behavioral**: 4 packages below 50% coverage (I-403/404/405 + proxmox).
- **Security**: no STRIDE gap — v0.7 adds no new trust boundary (pprof
  is operator-only, addr-gated; cert registration exposes existing
  security code).
- **Quality**: no unresolved P1/P2 findings from v0.6 final review.

## Tier 2: Backend-Enriched Analysis

| ID | Idea | Source | Confidence | Status | Maps to |
|----|------|--------|------------|--------|---------|
| I-406 | HCL config file parser — `internal/config` package reusing `hclsimple.Decode` pattern from jobspec; D-009 promised it, never built | research §1.4 + D-009 | 0.92 | Accepted | REQ-054 |
| I-407 | `--pprof <addr>` opt-in on `orca daemon` — I-308 deferred since v0.2; stdlib only, separate mux | research §1.5 + I-308 | 0.82 | Accepted | REQ-056 |
| I-408 | Config precedence flag>env>file>default — table-driven test covering all 4 layers | backend-enriched (D-039) | 0.90 | Accepted | (refinement of REQ-054; no new REQ) |
| I-409 | pprof on separate `*http.Server` + `*http.ServeMux`, never on mTLS daemon listener | backend-enriched (AD-024) | 0.90 | Accepted | (refinement of REQ-056; no new REQ) |
| I-410 | CI coverage gate: `go test -cover ./internal/engine ./internal/transport ./internal/proxmox ./internal/audit` assert each ≥ 50% | backend-enriched (AD-025) | 0.85 | Accepted | (refinement of REQ-055; no new REQ) |

## Tier 3: Cross-Project Pattern Transfer

| ID | Idea | Source | Confidence | Status | Maps to |
|----|------|--------|------------|--------|---------|
| I-411 | `orca version --json` already outputs structured `{version, commit, go_version, build_time}` (I-307 accepted v0.2) — verify still works, no new REQ | cross-project (carry-forward from v0.2 I-307) | 0.80 | Accepted (verification only) | (no new REQ; confirm in P03) |
| I-412 | `orca cert` registration via `init()` co-located in `cert.go` — matches the self-registering pattern in `daemon.go`/`audit.go` | cross-project (orca's own convention) | 0.88 | Accepted | (refinement of REQ-053; no new REQ) |
| I-413 | No new direct dependencies in v0.7 — `net/http/pprof` (stdlib), `hashicorp/hcl/v2` (already direct) | cross-project (minimal-deps ethos) | 0.95 | Accepted | (constraint; no new REQ) |

## Research-stage findings (assessed)

| Finding | Verdict | Maps to |
|---------|---------|---------|
| cert command unreachable (§1.1) | **Accepted** (I-401) | REQ-053 (P01) |
| cert_repo has no test (§1.2) | **Accepted** (I-402) | REQ-053 (P01) |
| low coverage: engine/transport/proxmox/audit (§1.3) | **Accepted** (I-403/404/405) | REQ-055 (P03) |
| no HCL config parser (§1.4) | **Accepted** (I-406) | REQ-054 (P02) |
| pprof deferred since v0.2 (§1.5) | **Accepted** (I-407) | REQ-056 (P04) |

All 5 findings map to the v0.7 REQs declared in SPECIFY. The IDEATE
stage confirms the scope and adds 8 implementation refinements
(I-408..I-413) that inform the PLAN stage.

## Dropped ideas (confidence < 0.60)

None. The lowest-confidence accepted idea is I-407 (pprof) at 0.82.

## Accepted Ideas (auto-accepted, full autonomy)

13 ideas accepted (5 Tier 1 + 5 Tier 2 + 3 Tier 3). 4 map to net-new
REQs (REQ-053..056, already declared in SPECIFY); 9 are implementation
refinements recorded for the PLAN stage's benefit.

## Resulting REQ additions

| New REQ | Title | Phase | Source ideas |
|---------|-------|-------|--------------|
| REQ-053 | `orca cert` command tree registered + cert_repo tests | P01 | I-401, I-402, I-412 |
| REQ-054 | HCL config file parsing (`internal/config`) | P02 | I-406, I-408 |
| REQ-055 | Test coverage uplift — engine/transport/proxmox/audit ≥ 50% | P03 | I-403, I-404, I-405, I-410 |
| REQ-056 | `--pprof <addr>` opt-in on `orca daemon` | P04 | I-407, I-409 |

**Total net-new REQs**: 4 (REQ-053..056). All declared in SPECIFY;
IDEATE confirms mapping and adds implementation refinements.

## Deferred (recorded but not v0.7)

None. I-308 (pprof) is no longer deferred — it is REQ-056 in P04.

## Followup notes for PLAN stage

- **P01** is the highest-impact, lowest-effort phase: a 1-line
  `rootCmd.AddCommand` + a regression test + cert_repo_test.go. The
  smoke test should run `cert ca-init` + `cert gen` + `cert show` +
  `cert fingerprint` against a temp `ORCA_HOME` to catch any latent
  bugs in the never-exercised cert subcommands.
- **P02** config package must be a pure function (`Load(paths) ->
  *Config`) with no package-level state. The `--config` flag on root
  command loads the file and passes the merged `*Config` down via
  cobra's `cmd.SetContext` or a struct field on the command.
- **P03** coverage: target the interface seams (SSH dialer, peer
  client) for mocks; use `httptest.NewTLSServer` for transport. Any
  races uncovered by `-race` get fixed in P03, not deferred.
- **P04** pprof: keep the daemon's mTLS listener untouched; start a
  second `http.Server` only when `--pprof` is non-empty. Log a WARN
  that the endpoint is unauthenticated.