300 Commits

Author SHA1 Message Date
Jon Chery fc034218e3 docs(P00): clarify v0.7 ambiguities (5 decisions, full autonomy)
D-038 HCL config (reuse jobspec dep) | D-039 flag>env>file>default
D-040 pprof opt-in operator addr | D-041 cert registration order
D-042 50% coverage floor, 70% new-code floor

---ci---
project: orca
phase: 0
milestone: v0.7
status: clarify
---/ci---
2026-08-03 20:28:21 +00:00
Jon Chery bd4a34daa2 docs(init): validate v0.7 specification — hardening & completion
---ci---
project: orca
phase: 0
milestone: v0.7
status: specify
---/ci---
2026-08-03 20:28:05 +00:00
Jon Chery 55d4d699a3 docs(milestone): complete node-bootstrap-proxmox
Milestone v0.6 complete. All 6 requirements (REQ-047..052) shipped
across 3 execution phases + final review. Tags v0.5.0..v0.5.4.

---ci---
project: orca
phase: 4
milestone: v0.6
status: complete
requirements:
  covered: [REQ-047, REQ-048, REQ-049, REQ-050, REQ-051, REQ-052]
  partial: []
---/ci---
v0.5.4
2026-08-03 20:02:44 +00:00
Jon Chery 7cfc4b7027 docs(P03): verification report — all 4 layers PASS
---ci---
project: orca
phase: 3
milestone: v0.6
status: verify
---/ci---
v0.5.3
2026-08-03 20:00:12 +00:00
Jon Chery f66472fd37 feat(P03): doctor os + doctor proxmox + audit logging
Extends orca doctor with two new checks (REQ-052):
- doctor os: re-runs OS detection from /etc/os-release, compares to
  stored localhost node's os field. Drift = WARN (re-run orca init);
  match = PASS; missing localhost node = FAIL.
- doctor proxmox: iterates kind=proxmox nodes, SSH-probes each with
  `pveversion` (3s timeout per node, clones Network() pattern).
  Zero proxmox nodes = WARN; reachable = PASS; unreachable = FAIL.

Changes:
- internal/osdetect: new shared package (Detect + ParseID) extracted
  from internal/cli to avoid import cycle (cli + doctor both need it)
- internal/cli/osdetect.go: thin wrapper delegating to osdetect package
- internal/doctor/doctor.go: OS() and Proxmox() checks; All() extended;
  probeProxmoxPVEVersion uses orca SSH key + knownhosts TOFU
- internal/cli/doctor.go: doctor os + doctor proxmox subcommands (--json)
- internal/doctor/doctor_test.go: 5 new tests (OS match/drift/missing,
  proxmox no-nodes/unreachable)

E2E: orca init -> orca doctor shows 6 PASS / 1 WARN (proxmox=none) /
1 FAIL (network=daemon not running). doctor os --json valid.

---ci---
project: orca
phase: 3
milestone: v0.6
status: execute
---/ci---
2026-08-03 19:59:51 +00:00
Jon Chery 82dd01f620 docs(P02): verification report — all 4 layers PASS
---ci---
project: orca
phase: 2
milestone: v0.6
status: verify
---/ci---
v0.5.2
2026-08-03 19:56:05 +00:00
Jon Chery 797bc2f412 feat(P02): Proxmox SSH join + OrcaOperator role + sudoers
orca node join --type proxmox bootstraps a remote Proxmox VE 8/9 host
via SSH (REQ-050, REQ-051). The password is used only for initial auth;
subsequent access uses the deployed orca SSH key (D-031).

Changes:
- go.mod: add golang.org/x/crypto v0.54.0 (ssh + ssh/knownhosts + ed25519)
  bump x/sys to v0.47.0, add x/term (indirect)
- internal/certpaths: SSHKeyPath, SSHPubPath, KnownHostsPath (D-037)
- internal/security/sshkey.go: GenerateOrLoadSSHKey (Ed25519, PKCS8 PEM,
  0600/0644 modes, idempotent load per D-036)
- internal/proxmox/bootstrap.go: BootstrapProxmox SSH dance:
  1. Generate/load SSH key
  2. SSH dial (password + knownhosts.New TOFU per D-035)
  3. Deploy pubkey to ~orca/.ssh/authorized_keys (idempotent)
  4. useradd -m orca (idempotent)
  5. pveum role add OrcaOperator --privs 'VM.Audit Datastore.AllocateSpace SDN.Use'
  6. pveum user add orca@pam (AD-019: PAM realm, not @pve)
  7. pveum acl modify / -user orca@pam -role OrcaOperator
  8. Write /etc/sudoers.d/orca (AD-020: NOEXEC on pct/qm, no NOEXEC on
     apt-get/dpkg, pvesh EXCLUDED — API execute bypasses NOEXEC)
  9. visudo -cf validation (abort on failure)
  All steps idempotent; audit-logged.
- internal/cli/node.go: --type/--host/--ssh-user/--password/--ssh-port/
  --proxmox-user/--proxmox-role flags; joinProxmox() wires to
  proxmox.BootstrapProxmox + registers node with kind=proxmox, os=pve.
  Password zeroed after use (D-031).
- tests: sshkey generate/load round-trip, idempotency, file modes;
  proxmox sudoers content (NOEXEC/NOPASSWD/pvesh-excluded),
  privilege set, validation; node join flag wiring

---ci---
project: orca
phase: 2
milestone: v0.6
status: execute
---/ci---
2026-08-03 19:55:14 +00:00
Jon Chery e4edd9aeda docs(P01): verification report — all 4 layers PASS
---ci---
project: orca
phase: 1
milestone: v0.6
status: verify
---/ci---
v0.5.1
2026-08-03 19:48:56 +00:00
Jon Chery 56fcf8b399 feat(P01): orca init full bootstrap + schema 0006
orca init transforms from a bare mkdir into a full single-node cluster
bootstrap. After `orca init`, `orca doctor` passes with zero FAILs
on the bootstrap checks (CA, cert, db, localhost node).

Changes:
- migration 0006: nodes.kind + nodes.os nullable columns (REQ-049)
- model.Node: Kind + OS fields + NodeKind constants (localhost|linux|proxmox)
- NodeRepo: extended Insert/Get/List/Watch/scanNode for kind/os columns
  (NULL -> "" mapping); added GetByName + UpdateLastSeenAndOS helpers
- internal/cli/osdetect.go: detectOS() from /etc/os-release ID= field
  (D-032); fallback to /usr/lib/os-release then "linux"
- internal/cli/init.go: full bootstrap sequence (REQ-047, REQ-048):
  1. MkdirAll namespace dir
  2. store.Open (runs migrations 0001..0006)
  3. security.CAInit (idempotent fast-path)
  4. server cert gen if absent (D-036: skip if present)
  5. detectOS from /etc/os-release
  6. localhost node upsert (insert if new, refresh last_seen+os if exists)
  Idempotent re-run: no duplicate node, no cert regen, id/joined_at preserved
- --json output: full bootstrap summary (namespace, db, ca_fp, cert_fp,
  os, node_id, steps array)
- tests: init idempotency, osdetect parsing (ubuntu/debian/alpine/pve),
  kind/os round-trip, NULL->"" mapping, GetByName, UpdateLastSeenAndOS

E2E smoke test: orca init -> 5 PASS / 0 WARN / 1 FAIL (network=daemon
not running, expected); orca node list shows localhost node (os=ubuntu).

---ci---
project: orca
phase: 1
milestone: v0.6
status: execute
---/ci---
2026-08-03 19:47:59 +00:00
Jon Chery 77dcb32054 docs(P00): create phase plans
3 execution phases + final review (PLAN_v0.6.md):
- P01 (Wave 1): orca init full bootstrap + schema 0006 (REQ-047/048/049)
  - data-engineer: migration 0006, Node.Kind/OS, NodeRepo extension
  - backend-engineer: init.go full bootstrap orchestration
  - cli-engineer: osdetect.go, init output UX
- P02 (Wave 1, depends on P01): Proxmox SSH join (REQ-050/051)
  - security-engineer: sshkey.go (Ed25519), TOFU, sudoers, PVE role
  - backend-engineer: proxmox/bootstrap.go SSH session sequence
  - cli-engineer: --type/--host/--password flag wiring
- P03 (Wave 2, depends on P01+P02): doctor extensions (REQ-052)
  - backend-engineer: doctor OS() + Proxmox() checks
  - cli-engineer: doctor os/proxmox subcommands
  - security-engineer: audit logging of bootstrap/join actions
- P04 (Wave 3): final review + ship + audit (milestone release v0.5.4)

Wave ordering: P01 -\u003e P02 -\u003e P03 -\u003e P04 (sequential, parallelization off).
Tags: v0.5.0 (P0) .. v0.5.4 (P4 final = milestone release).

---ci---
project: orca
phase: 0
milestone: v0.6
status: plan
---/ci---
v0.5.0
2026-08-03 19:40:21 +00:00
Jon Chery d9978693f4 docs(P00): research findings
Research domains (delegated to ci-researcher x2, codebase-grounded):
- golang.org/x/crypto/ssh v0.54.0: API surface, Ed25519 keygen, TOFU
  via knownhosts.New, file upload via session heredoc (no SFTP dep)
- /etc/os-release: confirmed ID= values (ubuntu/debian/alpine/pve),
  parsing approach, fallback strategy
- Proxmox VE 8/9: pveum syntax (space-separated --privs), orca@pam
  realm (not @pve), OrcaOperator role, sudoers with NOEXEC on pct/qm,
  pvesh excluded (API execute bypasses NOEXEC)
- Codebase: 12 files to modify/create, 6 reuse opportunities, 12 pitfalls

Persona roster updated: data-engineer + security-engineer reactivated,
devops-engineer deactivated. ARCHITECTURE.md addendum with AD-017..021.

---ci---
project: orca
phase: 0
milestone: v0.6
status: research
---/ci---
2026-08-03 19:39:14 +00:00
Jon Chery 563e4bb452 docs(P00): clarify v0.6 ambiguities (8 decisions, full autonomy)
D-030..D-034 operator-confirmed in plan mode (SSH library, password
handling, OS detection, Proxmox role granularity, node kind/os schema).
D-035..D-037 auto-resolved at full autonomy within clarify_budget
(SSH host-key TOFU, init idempotency semantics, SSH keypair location
+ Ed25519 algorithm).

---ci---
project: orca
phase: 0
milestone: v0.6
status: clarify
---/ci---
2026-08-03 19:33:26 +00:00
Jon Chery fd2c57afeb docs(init): validate v0.6 specification
---ci---
project: orca
phase: 0
milestone: v0.6
status: specify
---/ci---
2026-08-03 19:32:53 +00:00
Jon Chery df8d5f5c80 docs(milestone): v0.5 checkpoint — milestone complete
Checkpoint cleared for next milestone. v0.5 Distribution is complete:
P0-P4 shipped (v0.4.1..v0.4.5), 6/6 requirements covered, merged to main.

---ci---
project: orca
phase: 4
milestone: v0.5
status: complete
---/ci---
2026-08-03 18:57:16 +00:00
Jon Chery 2a711dfa6d docs(milestone): complete v0.5-distribution
All 6 requirements complete:
- REQ-041: unified ORCA_HOME namespace root (P1, v0.4.2)
- REQ-042: --system flag for /root/.orca (P1, v0.4.2)
- REQ-043: install.sh 1-liner from public Gitea (P2, v0.4.3)
- REQ-044: in-place update preserves state (P2, v0.4.3)
- REQ-045: repo + releases publicly accessible (P0, v0.4.1)
- REQ-046: docker image on Gitea container registry (P3, v0.4.4)

E2e verified: unauth releases API (200), fresh install, update-in-place,
  ORCA_HOME namespace, --system, docker pull + run.

---ci---
project: orca
phase: 4
milestone: v0.5
status: complete
requirements:
  covered: [REQ-041, REQ-042, REQ-043, REQ-044, REQ-045, REQ-046]
  partial: []
---/ci---
2026-08-03 18:55:50 +00:00
Jon Chery bc57e17163 ship(P03): v0.4.4 released — docker image pushed to Gitea registry
REQ-046 satisfied: anonymous docker pull + run verified.
Image: git.cloudinit.dev/coreci/orca:v0.4.4 + :latest

---ci---
project: orca
phase: 3
milestone: v0.5
status: complete
---/ci---
2026-08-03 18:54:01 +00:00
Jon Chery de8fdc0fe4 feat(P03): docker release — multi-stage Dockerfile + Gitea container registry publish
REQ-046: Docker image published to Gitea container registry per release.

Dockerfile: multi-stage (golang:1.25 -> distroless/static-debian12:nonroot).
  CGO_ENABLED=0, ORCA_HOME=/var/lib/orca, ENTRYPOINT [/orca].
  Image size: ~28MB. Runs as nonroot.

.coreci.yml: new container-publish step in release pipeline (docker:24-cli,
  builds + tags + login + push + logout).

scripts/release.sh: docker build + push after Gitea release. Graceful
  skip if docker absent or GITEA_TOKEN unset. Env-overridable registry.

.dockerignore: excludes .git, bin/, .env, .ciagent/, testdata/, *.tar.gz.

docs/docker.md: pull, run, state persistence (volume mount), local build,
  manual publish guide.

Verified: docker build + run version/init with volume persistence.

---ci---
project: orca
phase: 3
milestone: v0.5
status: verify
---/ci---
2026-08-03 18:52:36 +00:00
Jon Chery 647e535489 ship(P02): v0.4.3 released — install.sh + in-place update complete
---ci---
project: orca
phase: 2
milestone: v0.5
status: complete
---/ci---
2026-08-03 18:50:08 +00:00
Jon Chery 85963dc320 feat(P02): install.sh 1-liner + in-place update + README quickstart
REQ-043: install.sh pulls release binary from public Gitea URL.
  User-level default (~/.local/bin/orca), --system for system-level
  (/usr/local/bin/orca). Defaults to latest release; --version pins.
  Env-overridable GITEA_URL/OWNER/REPO for testability.

REQ-044: in-place update detects existing binary, reads version via
  'orca version --json', prints update message, overwrites binary,
  preserves namespace dir (config/db/certs). Idempotent re-install.

REQ-016 (completion): README quickstart now documents the 1-liner
  install + --system variant + update-in-place pattern.

Tests: 8/8 pass in scripts/install_test.sh (real public Gitea releases,
  no mock server; timeout-guarded to prevent hangs).

Docs: docs/install.md covers user/system install, version pinning,
  in-place update, uninstall, troubleshooting.

---ci---
project: orca
phase: 2
milestone: v0.5
status: verify
---/ci---
2026-08-03 18:49:50 +00:00
Jon Chery 2ff8318556 ship(P01): v0.4.2 released — namespace unification complete
---ci---
project: orca
phase: 1
milestone: v0.5
status: complete
---/ci---
2026-08-03 18:05:23 +00:00
Jon Chery 4bfc246be4 feat(P01): unified namespace root via ORCA_HOME + --system flag
REQ-041: ORCA_HOME is now the single namespace root for all components
  (db, certs, init, daemon). store.Open("") and init command both
  route through certpaths.Dir()/DBPath() instead of hardcoding ~/.orca.
  Backward compatible: empty ORCA_HOME -> ~/.orca.

REQ-042: --system persistent flag on rootCmd sets ORCA_HOME=/root/.orca
  via PersistentPreRunE. Errors on conflict with pre-set ORCA_HOME.

Tests: 7 new tests in namespace_test.go (default, ORCA_HOME override,
  --system sets root, conflict detection, init --json, flag registered).
  Full suite passes (no regressions).

Docs: docs/namespace.md covers default, ORCA_HOME, --system, ORCA_DB,
  resolution order, and path layout tables.

---ci---
project: orca
phase: 1
milestone: v0.5
status: verify
---/ci---
2026-08-03 18:05:01 +00:00
Jon Chery e32cb0bbfc ship(P00): v0.4.1 release — v0.5 pre-execution complete
REQ-045 satisfied: repo + org visibility flipped to public.
Unauth access verified (HTTP 200 on releases API + asset download).

---ci---
project: orca
phase: 0
milestone: v0.5
status: complete
---/ci---
2026-08-03 18:02:16 +00:00
Jon Chery 2d1c2de585 docs(P00): create phase plans
4-phase plan for v0.5 Distribution:
P1: namespace unification (ORCA_HOME + --system) - REQ-041/042
P2: install.sh + in-place update - REQ-043/044/016
P3: docker release (Dockerfile + Gitea registry) - REQ-046
P4: final review + ship + audit (milestone release v0.4.5=v0.5.0)
Tags: v0.4.1..v0.4.5 on the v0.4.x patch line

---ci---
project: orca
phase: 0
milestone: v0.5
status: plan
---/ci---
2026-08-03 18:01:16 +00:00
Jon Chery 3b8a2c4e75 docs(P00): research findings
R-001: Gitea container registry (OCI, docker login/push, anon pull when public)
R-002: tea repos edit --private false (visibility flip for REQ-045)
R-003: Gitea releases API (Authorization: token header, asset download URLs)
R-004: ORCA_HOME propagation audit (3 sites: certpaths/store/init)
R-005: distroless static-debian12 base (CGO-free, modernc/sqlite)
R-006: install.sh curl|sh conventions + in-place update pattern
Pitfalls P-001..P-003 (docker-in-CI, public-history leak, CGO_ENABLED=0)
PERSONAS.md: devops-engineer reactivated, data/security/network deactivated for v0.5

---ci---
project: orca
phase: 0
milestone: v0.5
status: research
---/ci---
2026-08-03 18:00:26 +00:00
Jon Chery 0f71cf3f36 docs(P00): clarify v0.5 ambiguities (5 decisions, full autonomy)
D-025: /root/.orca system-level path (mirror of ~/.orca)
D-026: unify on ORCA_HOME as single namespace root + --system flag
D-027: Gitea built-in container registry for docker images
D-028: flip repo visibility to public via tea repos edit
D-029: install.sh defaults to latest release, optional --version pin

---ci---
project: orca
phase: 0
milestone: v0.5
status: clarify
---/ci---
2026-08-03 17:59:07 +00:00
Jon Chery a22c41164f docs(init): validate v0.5 specification
---ci---
project: orca
phase: 0
milestone: v0.5
status: specify
---/ci---
2026-08-03 17:58:32 +00:00
Jon Chery c814afa773 docs(audit): fix ROADMAP stale checkbox + v0.2 milestone status
---ci---
project: orca
phase: 3
milestone: v0.3
status: audit
---/ci---

Audit fixes:
- Phase 11 checkbox: [ ] → [x] (completed in v0.3 P01, shipped v0.3.1)
- v0.2 milestone status: 'pending merge to main' → 'COMPLETE (merged via v0.3)'
- v0.2 milestone tag: 'pending' → 'v0.4.0 shipped'
v0.4.1 v0.4.2 v0.4.3 v0.4.4 v0.4.5
2026-08-03 17:45:02 +00:00
Jon Chery dbdf679040 docs(milestone): v0.3 checkpoint — milestone complete
---ci---
project: orca
phase: 3
milestone: v0.3
status: complete
---/ci---

Milestone v0.3 complete. Checkpoint cleared for next milestone.
2026-08-01 20:07:06 +00:00
Jon Chery df58bc25a3 docs(milestone): complete scheduling-streaming (v0.3)
---ci---
project: orca
phase: 3
milestone: v0.3
status: complete
requirements:
  covered: [REQ-022, REQ-030, REQ-032]
  partial: []
---/ci---

v0.3 milestone merged to main. Includes all v0.2 work (P08-P10) that
was previously on the milestone branch but not yet merged to main, plus
the v0.3 completion work (iter.Seq streaming + doctor network/db).

v0.2 phases included: P08 (mTLS), P09 (scheduling), P10 (security scan).
v0.3 phases: P0 (pre-execution), P1 (iter.Seq streaming), P2 (doctor),
P3 (final review+ship).

Total: 40 requirements, all complete. No new go.mod dependencies.
Full test suite passes under -race. gofmt + go vet clean.
v0.4.0
2026-08-01 20:06:47 +00:00
ciagent f503404dda docs(audit): fix .ciagent/ file discipline findings from v0.2 P01 audit
CIAgent audit (.ciagent/AUDIT_v0.2_P01.md) surfaced 3 .ciagent/ file
discipline issues. This commit addresses all 3:

1. config.json: re-add the 'workflow' top-level block. It was added in
   d10f89d (v0.1 milestone) and lost from main during the parallel-
   history resolution that produced origin/main's be9afa2 PR-#1 merge.
   The 4 standing rules (no_hitl, release_flow_per_phase, merge_strategy,
   branching) are restored.

2. PROJECT.md: add literal '## What This Is' and '## Key Decisions'
   section headers. The v0.1 audit-fix (f1c55ca) added the content
   inline but without the explicit headers, so the audit check missed
   them. The Key Decisions section summarizes D-011..D-018.

3. REQUIREMENTS.md: consolidate two overlapping REQ tables (the v0.1
   status table and the v0.2 traceability table) into a single
   canonical table covering all 40 REQs (REQ-001..REQ-040). Each row
   has REQ-ID, summary, priority, phase, status. v0.1 REQs show
   'Complete'; v0.2 REQs show 'Complete' (P01 shipped) or 'Pending
   (P##)'. The v0.1 Milestone Summary and v0.2 Milestone Summary
   sections are preserved below the table.

4. AUDIT_v0.2_P01.md: the audit report itself, with reconstruction
   state, file discipline table, branch hygiene, commit discipline,
   and the 3 findings above (plus non-blocking observations). The
   report's verdict: 'v0.2 P01 ship is healthy; 3 issues are
   paper-cleanup items addressed in this commit. None block P02
   EXECUTE.'

---ci---
project: orca
phase: 0
milestone: v0.2
status: fix
---/ci---
2026-06-03 22:19:45 +00:00
Jon Chery f31bed2dc3 ship(P08): mTLS merged into v0.2 milestone
- Fast-forward merge of phase/08-mtls into milestone/v0.2-networking-observability-security
- Annotated tag v0.2.1 created at this commit
- Gitea release v0.2.1 published with orca-v0.2.1-linux-amd64.tar.gz
- P01 ships internal-CA mTLS, orca cert {ca-init,gen,show,renew,fingerprint},
  orca doctor, orca node join --ca-fingerprint, file mode enforcement
  (0600/0644), rotation alarm at 30d, cert show redaction, AEAD-only
  TLS 1.3 cipher allowlist, structured mTLS handshake log fields.
- REQ coverage: REQ-011, REQ-023, REQ-025, REQ-026, REQ-032,
  REQ-033, REQ-034, REQ-035, REQ-036, REQ-038.

---ci---
project: orca
phase: 8
milestone: v0.2
plan: 01
status: ship
version: v0.2.1
requirements:
  covered: [REQ-011, REQ-023, REQ-025, REQ-026, REQ-032, REQ-033, REQ-034, REQ-035, REQ-036, REQ-038]
  partial: []
---/ci---
v0.2.1
2026-06-03 21:39:36 +00:00
ciagent 31ccb52114 feat(P08): mTLS daemon + transport + cert CLI + doctor
Wave B/C/D of P01 mTLS implementation.

- internal/audit/audit.go — thin wrapper around engine.Audit for
  cert/handshake events (Action* and Result* constants; REQ-038).
- internal/certpaths/ — extracted path constants out of cli to break
  the cli<->doctor import cycle; cli re-exports the helpers for
  backward compat.
- internal/security/ca.go — public WriteCert/WriteKey helpers (0600
  for keys, 0644 for certs; REQ-033); used by the cert CLI and
  integration test.
- internal/daemon/tls.go — mTLS server with GetCertificate hot-swap
  callback. Plaintext HTTP remains the default for v0.1 compat;
  StartMTLS() flips the server into mTLS mode.
- internal/daemon/server.go — adds mtls *MTLSState field; MTLSActive()
  getter for health endpoints.
- internal/transport/mtls.go — mTLS client with VerifyPeerCertificate
  for pinned peer identity; DialContext for raw TLS.
- internal/transport/handshake_log.go — structured slog helpers for
  handshake ok/fail (REQ-038 fields: event, result, peer, cert_fp).
- internal/cli/cert.go — orca cert {ca-init,gen,show,renew,fingerprint}
  subcommands; file mode enforcement at every entry; redacted cert
  show (REQ-035).
- internal/cli/doctor.go — orca doctor {cert,network,db} subcommands
  (REQ-032); --json output supported.
- internal/cli/node.go — adds --ca-fingerprint to orca node join
  (REQ-026); fails fast on mismatch.
- internal/doctor/doctor.go — 6 checks: cert.ca, cert.server,
  cert.expiry, cert.fingerprint, network stub, db stub.
- internal/doctor/doctor_test.go — happy + sad path coverage.
- internal/security/integration_test.go — end-to-end: CA-init, CSR
  generation, mTLS handshake, mismatch failure, rotation alarm,
  redaction, file mode enforcement.

All tests pass with -race; gofmt -l . clean; go vet ./... clean.

---ci---
project: orca
phase: 8
milestone: v0.2
status: execute
---/ci---
2026-06-03 21:33:41 +00:00
Jon Chery 181cc769e6 feat(P08): CA, CSR, fingerprint, rotation, redact, TLS config + cert repo
Internal CA with CSR join, mTLS 1.3 config builders, rotation alarm,
PEM redaction, and cert inventory schema (REQ-033/034/035/036).

- internal/security/ca.go: CAInit/LoadCA/SignCSR, file mode enforcement
  (ca.crt 0644, ca.key 0600) per REQ-033
- internal/security/csr.go: GenerateCSR with DNS + IP SANs (REQ-036)
- internal/security/fingerprint.go: SHA-256 hex of cert DER
- internal/security/rotation.go: 30d pre-expiry alarm, history pruning
- internal/security/redact.go: PEM private key block stripping (REQ-035)
- internal/security/tls_config.go: TLS 1.3 with AEAD allowlist
- internal/security/certgen_test.go: round-trip + mode + rotation + redact
- internal/store/migrations/0004_certs.sql: cert inventory table
- internal/store/cert_repo.go: CRUD + PruneOlderThan (REQ-025)

---ci---
project: orca
phase: 8
milestone: v0.2
status: execute
---/ci---
2026-06-03 21:18:50 +00:00
Jon Chery bed5a2e8e5 docs(P00): create 4 v0.2 phase plans
v0.2 PLAN stage. Translates the IDEATE output (commit 1ee82fc) into 4
executable, vertical-slice phase plans with wave ordering, REQ
coverage, must-haves, and per-layer verification. The v0.1 section
above is preserved unchanged.

Plan structure mirrors v0.1 (per the v0.1 spec at lines 7-166):
  - Phase heading with **Branch** + **REQ Coverage** lines
  - ### Must-Haves checkbox list (atomic, file-anchored)
  - ### Verification block (build / behavior / smoke)
  - End-of-section ## Wave Ordering + ## Versioning

Phase numbering: v0.2 phases are numbered 8-11 (not 1-4) to avoid
colliding with v0.1's phase/01..07 branches. v0.1 already shipped
6 phases plus a P07 backfill; the v0.2 work is therefore the 8th
project phase overall.

Phase 8: mTLS handshake + internal CA with CSR join (Wave 1, branch
phase/08-mtls, REQs: 011, 023, 025, 026, 032, 033, 034, 035, 036,
038). 19 must-haves spanning internal/security (CA, CSR, fingerprint,
TLS config, rotation, redaction), internal/store (certs migration
0004 + cert_repo), internal/daemon (mTLS server bootstrap with
GetCertificate hot-swap), internal/transport (mTLS client + SAN
validation + handshake failure logging), internal/audit,
internal/cli (cert, node_join, doctor), config surface for trusted
CA fingerprint pinning. 11 verification points including a
two-node mTLS handshake integration test.

Phase 9: Multi-node scheduling & job dispatch (Wave 1, branch
phase/09-scheduling, REQs: 004 expansion, 017, 021, 028, 037). 15
must-haves covering internal/transport (dispatch h2c service,
idempotency, retry), internal/engine (dispatcher, scheduler
bin-pack extension, peer registry), internal/store (migration 0005
node_capacity + capacity_repo), HCL schema for NodeCapacity,
internal/cli (node capacity, job run --target), and the daemon
dispatch handler. 9 verification points including a two-node
dispatch integration test, cancellation with goleak, idempotency
dedupe, and deterministic bin-pack scoring.

Phase 10: gosec + govulncheck + gitleaks in CI (Wave 2, branch
phase/10-security-scan, REQs: 014, 027, 029, 031, 039, 040). 12
must-haves centered on .coreci.yml pipeline additions,
scripts/security_scan.sh wrapper, gosec.json baseline, offline
govulncheck (GOFLAGS=-mod=mod + GOVULNDB=offline per ROADMAP.md
P03 scope change), .gitleaks.toml stopwords (REQ-039), gitleaks
baseline (REQ-029), .golangci.yml (REQ-040), pre-commit gitleaks
hook, Makefile test-race and security-scan targets, and
docs/security-scanning.md. 7 verification points including a
network-namespace test that proves govulncheck runs offline.

Phase 11: iter.Seq streaming job/node lists (Wave 2, branch
phase/11-iter-seq, REQs: 022, 030, 032 expansion). 8 must-haves
for internal/store/iter.go (Watch(ctx, query) iter.Seq[T] with
500ms poll + notify hook), internal/cli job_list/node_list --watch
and --watch --json modes, signal.NotifyContext cancellation
wiring, internal/doctor expansion for jobs/nodes/certs streaming
output, plus unit and integration tests. 8 verification points
including NDJSON validation via jq -c and goroutine leak assertion
via goleak.

Wave ordering: P01 and P02 are Wave 1 (sequential because
parallelization.enabled=false; P01 is a hard prerequisite for P02
since dispatch endpoints are mTLS-protected). P03 and P04 are
Wave 2 (sequential; either order is viable but P03 first keeps the
security baseline in place while P04 lands the new CLI surface).

Versioning: per-phase tags v0.2.1 (P01), v0.2.2 (P02), v0.2.3
(P03), v0.2.4 (P04); milestone tag v0.3.0 (next minor per run.md
feature-milestone promotion). Per RELEASE_POLICY.md, every per-
phase tag also produces a Gitea release with tarball asset.

No changes to PROJECT.md, REQUIREMENTS.md, ROADMAP.md,
ARCHITECTURE.md, PERSONAS.md, IDEATION.md, or config.json — this
is a docs-only commit per the PLAN stage contract. No Go code
changes.

---ci---
project: orca
phase: 0
milestone: v0.2
status: plan
---/ci---
2026-06-03 21:09:15 +00:00
Jon Chery 1ee82fc2e2 docs(P00): ideation - 34 ideas accepted
v0.2 IDEATE stage. 29 new ideas generated (10 Tier 1 mechanical + 11
Tier 2 backend-enriched + 8 Tier 3 cross-project) plus 6 research-stage
candidates (REQ-cand-A..F from commit 08d321f) = 35 considered. Under
full autonomy, all 35 with confidence >= 0.60 are auto-accepted; 1
explicitly deferred to v0.3 (I-308 pprof). 34 accepted into v0.2.

Resulting net-new REQs (REQ-025..REQ-040) span P01-P04:
- P01 (mTLS): REQ-025 (cert rotation history), REQ-026 (CA fingerprint
  pinning), REQ-032 (orca doctor), REQ-033 (file mode enforcement),
  REQ-034 (rotation alarm), REQ-035 (cert show redaction), REQ-036
  (SAN validation), REQ-038 (mTLS failure log fields)
- P02 (multi-node): REQ-028 (NodeCapacity HCL schema, P02 enabler),
  REQ-037 (X-Orca-Idempotency-Key)
- P03 (security CI): REQ-027 (govulncheck offline mode -- changes P03
  scope: CI must not call vuln.go.dev), REQ-029 (gitleaks baseline for
  pre-existing .env leak), REQ-039 (.gitleaks.toml stopwords),
  REQ-040 (.golangci.yml)
- P04 (iter.Seq): REQ-030 (--watch --json mode)
- Cross-cutting: REQ-031 (go test -race)

Total v0.2 REQs: 20 (4 carried from v0.1 + 16 net-new).

ARCHITECTURE.md: added `internal/doctor/` component (§5) with
orca doctor {cert,network,db} subcommands; ASCII diagram updated.
ROADMAP.md: per-phase REQ coverage matrix added; P03 scope change
documented (govulncheck offline mode).
PROJECT.md: unchanged (vision is stable).

---ci---
project: orca
phase: 0
milestone: v0.2
status: ideate
---/ci---
2026-06-03 21:03:59 +00:00
Jon Chery 08d321f57f docs(P00): research findings
v0.2 RESEARCH stage. Synthesizes the 4-phase v0.2 scope (P01-P04) into
updated static docs. No code changes. Decisions are derived from
CLARIFY D-011..D-018 (already on main) and direct investigation of
go.mod, the codebase, and ecosystem docs (Go 1.25+ iter.Seq, govulncheck,
gosec, gitleaks, step-ca).

Key research conclusions logged here:

- ConnectRPC is NOT in go.mod (.ciagent/config.json lists it in
  frameworks but the dependency was never added). v0.2 falls back to
  stdlib net/http with h2c for the orca.v1.Dispatch service. Zero new
  direct deps. (ARCHITECTURE.md AD-014)

- Roll-our-own CA via crypto/x509 (not step-ca/cfssl/vault-pki) keeps
  the binary single, dependency-free, and aligned with offline-first
  (no external PKI network calls). (ARCHITECTURE.md AD-010)

- govulncheck default mode requires network access to vuln.go.dev. CI
  step must use -format json (always exits 0) + a wrapper that gates
  on findings via jq/cat, OR pre-mirror the database. Caller to decide
  in PLAN. Logged as REQ candidate for IDEATE.

- gosec exit codes: 0 clean, 1 unsuppressed finding. -no-fail always
  returns 0. Baseline JSON via -track-suppressions + exclude=. We
  adopt -no-fail on initial run, baseline suppressed findings, then
  tighten to fail-on-finding once baseline is empty.

- gitleaks default config covers most cases; we extend .gitleaks.toml
  with stopwords for our test data paths and CA cert PEM (which would
  otherwise trigger the generic-api-key rule).

- iter.Seq: yield func(V) bool, iter.Pull for pull-style, range over
  function types since Go 1.25. Cancellation flows through ctx
  (consumer-driven backpressure). Single-use vs multi-use semantics
  documented in Go spec; we use multi-use for repo.Watch() since
  callers can re-iterate.

- mTLS hot-swap via tls.Config.GetCertificate callback enables cert
  rotation without daemon restart. tls.Config is read on every
  handshake; reload picks up new server.crt/server.key.

ARCHITECTURE.md changes:
- Added Transport Layer (internal/transport) and Dispatcher
  (internal/engine/dispatcher.go) components.
- Added Security Manager (internal/security) component with full cert
  lifecycle API.
- Added certs table schema (migration 0004) and Cert Go struct.
- Extended Node with NodeCapacity (CPU/memory) for bin-packing.
- Added v0.2 Component Graph ASCII diagram.
- Added 4 named flows: cert issuance, mTLS handshake, job dispatch,
  iter.Seq streaming.
- Added 8 new AD-009..AD-016 decisions and AD-014 notes the
  ConnectRPC-not-in-go.mod reality.

PERSONAS.md changes:
- Added network-engineer (custom, NEW in v0.2) for transport/dispatcher.
- security-engineer marked phase_specific: [P01, P02] (off after P02).
- network-engineer marked phase_specific: [P02].
- cli-engineer marked phase_specific: [P04] (--watch is a CLI concern).
- data-engineer.territory extended to include
  internal/store/migrations/0004_certs.sql.
- security-engineer.territory extended to TLS-config portion of
  internal/transport.
- Frontmatter updated: active_personas, phase_specific, reason.

PROJECT.md changes:
- Moved "Multi-node scheduling" out of "Out of Scope" (it ships in P02).
- Added "External PKI / Let's Encrypt / cert transparency logs" to
  Out of Scope (per D-011).
- Added "gRPC framework dependency" to Out of Scope (per AD-014).
- Added v0.2 Scope Summary section (4 phases) with cross-refs to
  ARCHITECTURE.md flows.

REQ candidates surfaced for IDEATE stage (not added to REQUIREMENTS.md
in this commit — that's the IDEATE stage's job):
- REQ-cand-A: Bounded cert rotation history (retain last N=3 server
  certs per node for rollback; documented in ARCHITECTURE.md certs
  table as "retention" implication of the schema).
- REQ-cand-B: Trusted-CA fingerprint pinning (D-012 requires operator
  to pass --ca-fingerprint at join; the daemon should refuse to start
  if the on-disk CA's fingerprint doesn't match a config-pinned value,
  to protect against operator typos).
- REQ-cand-C: govulncheck offline mode (CI must not call vuln.go.dev
  by default; either pre-mirror the DB or set GOVULNCHECK_DB env to
  a local file).
- REQ-cand-D: HCL/YAML schema for NodeCapacity declaration (where
  does the operator declare a node's CPU/RAM? Current v0.1 Node model
  has no capacity field. P02 will add this — needs a config file
  surface, e.g. ~/.orca/node.hcl or flag on `orca node join`).
- REQ-cand-E: gitleaks baseline for pre-existing secrets in history
  (the v0.1 .env leak was rotated forward but git history still has
  a SHA-1 leak — gitleaks/git filter-repo remediation may need a
  baseline file to avoid the same class of false positive recurring).
- REQ-cand-F: --watch output format mode (iter.Seq stream is
  table-style by default; users may want --watch --json one-line-per-
  event for piping). P04 scope decision; log for IDEATE.

---ci---
project: orca
phase: 0
milestone: v0.2
status: research
---/ci---
2026-06-03 20:59:32 +00:00
ciagent b48f5cfde6 docs(P00): clarify v0.2 ambiguities (8 decisions, full autonomy)
v0.2 CLARIFY stage. Resolves 8 ambiguities introduced by the deferred
v0.2 scope (mTLS, scheduling, scanning, streaming). All decisions taken
under full autonomy (config.json autonomy.level: full) at confidence
>= 0.85, which is above the decision_confidence_threshold of 0.60.

- D-011: Internal CA with CSR join (vs. self-signed per-node or SPIFFE).
- D-012: Operator-mediated CA cert distribution with fingerprint verify
  (no automated secret distribution — matches offline-first principle).
- D-013: 90d server certs, 10y CA cert, 30d pre-expiry rotation.
- D-014: Eager mTLS handshake at  time.
- D-015: TLS 1.3 minimum, AEAD cipher allowlist (no TLS 1.2 fallback).
- D-016: gosec+govulncheck in  pipeline of .coreci.yml;
  gitleaks in pre-commit hook (opt-in).
- D-017: iter.Seq for  and .
- D-018: Bin-packing by CPU/memory with FIFO within node; ConnectRPC
  orca.v1.Dispatch for cross-node.

RESEARCH and IDEATE follow.

---ci---
project: orca
phase: 0
milestone: v0.2
status: clarify
---/ci---
2026-06-03 20:52:42 +00:00
ciagent 907f25e20d docs(init): validate v0.2 specification
Validates the v0.2 milestone specification against the deferred-v0.2
requirements in ROADMAP.md and the requirement status table. Updates:

- ROADMAP.md: v0.2 marked in-progress with 4 phases (P01 mTLS, P02
  multi-node scheduling, P03 gosec+govulncheck, P04 iter.Seq). Adds
  target milestone tag (v0.3.0) and per-phase tags (v0.2.1..v0.2.4)
  per the feature-milestone promotion rule and the RELEASE_POLICY.md
  standing rule on per-phase releases.
- REQUIREMENTS.md: flips REQ-011, REQ-014, REQ-022, REQ-023 from
  'Deferred (v0.2)' to 'Pending (v0.2 PXX)'. Adds a v0.2 summary
  section.

No code or schema changes. Pure SPECIFY output per run.md Step 3.
CLARIFY and RESEARCH follow.

---ci---
project: orca
phase: 0
milestone: v0.2
status: specify
---/ci---
2026-06-03 20:52:01 +00:00
ciagent e600e250b0 docs(milestone): complete v0.1-foundation — backfill, security untrack, cherry-pick to main
Final close-out of the v0.1 Foundation milestone after P07 backfill and
the parallel-history resolution. Summary:

- v0.1 Foundation shipped across 6 phases (P00-P06) on milestone/v0.1-initial
  with the per-phase tags v0.1.1..v0.1.6 and the milestone tag v0.2.0.
- All 8 Gitea releases published (v0.1.1..v0.1.7, v0.2.0), per the
  RELEASE_POLICY.md standing rule 'every phase tag produces a release'.
  v0.1.7 is the backfill phase; v0.2.0 is the milestone summary.
- P07 (backfill_releases.sh) verified across 4 layers (structural,
  behavioral, security, quality) per ciagent-verify.
- Layer-3 security finding: pre-existing .env secret leak in 0cba1aa
  documented in .ciagent/PHASE7_SECURITY_AUDIT.md as P0 for human
  remediation (token rotation + history scrub).
- Forward fix applied in P07: .env added to .gitignore (b1b2e3d) and
  untracked from the index (00127ce), closing the loop on the leak.
- milestone->main: cherry-picked the 4 P07/security commits onto main
  after the parallel PR-#1 merge (be9afa2) was discovered. The cherry-
  pick avoided the documented rebase conflicts and produced a clean
  linear main at 00127ce. All 4 cherry-picks passed go build, go vet,
  and make lint on main.

Coverage: 21/24 requirements complete; 3 deferred to v0.2 (REQ-011 mTLS,
REQ-014 gosec+govulncheck, REQ-022 iter.Seq, REQ-023 mTLS cert gen) —
all paired with multi-node networking or richer I/O scanning, explicitly
out of scope for v0.1 minimalism.

Next milestone: v0.2 — multi-node scheduling, mTLS handshake + cert
generation, gosec+govulncheck in CI, iter.Seq streaming.

---ci---
project: orca
phase: 0
milestone: v0.1
status: complete
version: v0.2.0
requirements:
  covered: [REQ-001, REQ-002, REQ-003, REQ-004, REQ-005, REQ-006, REQ-007, REQ-008, REQ-009, REQ-010, REQ-012, REQ-013, REQ-015, REQ-016, REQ-017, REQ-018, REQ-019, REQ-020, REQ-021, REQ-024]
  partial: []
---/ci---
2026-06-03 20:44:34 +00:00
ciagent 00127ce668 fix(security): untrack .env — secret in history, rotate forward
The .env file (containing GITEA_TOKEN) was committed in 0cba1aa during
P00 and remained tracked in git history despite the leak. The
.gitignore addition in 477b08c (P07) prevents future re-tracking but
does not untrack a file already in the index.

This commit runs 'git rm --cached .env' to remove the file from the
index while preserving the working-tree copy (which now contains the
rotated token post-P07-verify). The secret remains in git history at
0cba1aa and must be scrubbed by a human (see PHASE7_SECURITY_AUDIT.md
for the full remediation plan, including optional git-filter-repo
history rewrite).

Combined with 477b08c, this commit closes the forward-fix loop:
- .env is now ignored (.gitignore)
- .env is no longer tracked (this commit)
- New tokens in .env will not be committed accidentally
- The historical leak is documented for human remediation

---ci---
project: orca
phase: 7
milestone: v0.1
status: ship
version: v0.1.7
requirements:
  covered: [REQ-007]
  partial: []
---/ci---
2026-06-03 20:42:53 +00:00
Jon Chery 56b4274284 ship(P07): v0.1.7 release backfill merged into milestone
- Fast-forward merge of phase/07-v0.1-backfill into milestone/v0.1-initial
- Annotated tag v0.1.7 created at dc67522
- Gitea release v0.1.7 published with orca-v0.1.7-linux-amd64.tar.gz
- Fix  ->  typo in release.sh notes block
  (unbound variable under set -u; surfaced on first end-to-end run
  of release.sh for v0.1.7). Patch is minimal and contained to the
  release-notes echo line.
2026-06-03 20:42:48 +00:00
ciagent b1b2e3dcb6 fix(P07): harden .gitignore for .env and document pre-existing secret leak
Layer-3 security audit during P07 EXECUTE found that .env (containing
GITEA_TOKEN) was committed in 0cba1aa during P00 and remained in git
history. The pre-P07 .gitignore only excluded .env.local, not .env.

This commit:
1. Adds .env to .gitignore alongside .env.local (forward fix — prevents
   future re-tracking).
2. Documents the pre-existing leak in .ciagent/PHASE7_SECURITY_AUDIT.md
   with mitigation steps and required human actions (token rotation,
   history rewrite, access-log audit, CI secret scanning).

The backfill script itself (commit de69788) does not leak the secret: it
sources .env from disk and never echoes or passes it on the command line.
The leak is upstream of P07 and is documented as P0 for the human to
remediate out-of-band.

---ci---
project: orca
phase: 7
milestone: v0.1
status: execute
version: v0.1.7
requirements:
  covered: [REQ-007]
  partial: []
---/ci---
2026-06-03 20:42:39 +00:00
ciagent 4fd17c510c fix(P07): backfill_releases.sh — publish Gitea releases for v0.1.x tags
The v0.1 milestone COMPLETE commit (d76ff84) was tagged v0.2.0 and the
per-phase tags v0.1.1..v0.1.6 were created, but the standing rule
'every phase tag produces a Gitea release' was only codified in P06
(RELEASE_POLICY.md) and never applied retroactively.

This commit adds scripts/backfill_releases.sh, an idempotent helper that:
- iterates over v0.1.1..v0.1.6 and v0.2.0
- skips tags that already have a release
- builds the orca binary from the milestone branch HEAD (which includes
  the post-COMPLETE entry-point fix and workflow-block commits)
- injects the historical version via -ldflags
- packages a per-tag tarball (orca-<tag>-<os>-<arch>.tar.gz)
- creates a Gitea release with the tarball as an asset, and release
  notes that include the phase summary and a v0.2.0 milestone recap

After backfill, the v0.1 milestone is fully released end-to-end and the
discipline carries forward into v0.2.

---ci---
project: orca
phase: 7
milestone: v0.1
status: execute
version: v0.1.7
requirements:
  covered: [REQ-007]
  partial: []
---/ci---
2026-06-03 20:42:34 +00:00
cloudinit-bot be9afa2d2c ship: v0.1 Foundation milestone complete (#1) v0.1.7 2026-06-03 20:08:57 +00:00
Jon Chery 55aae5347e chore(P00): rename orch-engine to orca, configure gitea + coreci (v0.1)
---ci---
project: orca
phase: 0
milestone: v0.1
status: execute
---/ci---
2026-06-03 11:36:32 +00:00
Jon Chery 0cba1aa5fe chore(P00): set autonomy level to full
---ci---
project: orch-engine
phase: 0
milestone: v1.0
status: execute
---/ci---
2026-06-03 11:18:58 +00:00
Jon Chery e2e77e79b9 chore(P00): quick task - populate config.json with backlog reference
---ci---
project: orch-engine
phase: 0
milestone: v1.0
status: execute
lessons:
  - Referenced backlog project's config.json (also Go 1.25+) to establish proper schema including autonomy, personas, parallelization, sessions, ci, repository, and commands sections
---/ci---
2026-06-03 11:15:12 +00:00
Jon Chery 8c086def69 chore(config): populate ciagent config with standard settings
---ci---
project: orch-engine
phase: 0
milestone: v1.0
status: execute
---/ci---
2026-06-03 11:08:48 +00:00
Jon Chery 8774008c3e docs(init): validate specification
---ci---
project: orch-engine
phase: 0
milestone: v1.0
status: specify
---/ci---
2026-06-03 11:06:26 +00:00
Jon Chery 97f437f9ef docs(init): initialize orch-engine (6 phases)
---ci---
project: orch-engine
phase: 0
milestone: v1.0
status: specify
decisions:
  - id: D-001
    decision: Use single-project mode for initial setup
    rationale: Simplified configuration for the initial phase
    confidence: 1.0
    alternatives: []
---/ci---

Specification: Build an offline/CLI-first orchestration engine.
Requirements: Simplicity, AI-first, Offline-first, CLI-first, prioritize security/bug-fixes over features, Go 1.25+.
Constraints: Simpler than Nomad, far simpler than Kubernetes.
Out of scope: K8s complexity.
2026-06-03 10:59:05 +00:00