Personal Telegram developer console for GitHub
docs: design control plane completion phases 2-7
davoodmehraban89 committed
Oct 5, 2026 at 05:25 UTC
d14b190392bd9182c498a6bb9698c4f86c7e9a42
1 file changed
+56
docs/superpowers/specs/2026-10-05-control-plane-completion-design.md
new
+56
@@ -0,0 +1,56 @@
1
+# Nexa Dev Bot — Control Plane Completion Design (Roadmap 2–7)
2
+
3
+## Intent
4
+Complete the next six roadmap capabilities without weakening the existing owner-only, Safe Approval, durable replay, branch-only Workspace, public `/status`, or Production/Preview isolation boundaries.
5
+
6
+## Delivery decomposition
7
+This architectural program is delivered as six independently reviewable subprojects in dependency order. Each subproject must ship working, tested software before the next relies on it.
8
+
9
+### CP2 — Multi-file Repository Workspace
10
+Extend the existing durable Workspace from one editable file to a bounded set of text files. A Workspace records repository/base SHA plus per-file base SHA, path and draft material. Diff and Ready intent cover the complete immutable file set. Commit remains a single atomic Git tree/commit on a `nexa/edit-*` branch; `main` is never directly mutated. Any base/material change invalidates Ready intent. Sensitive/binary/LFS/oversize policies apply per file and to an aggregate bounded payload.
11
+
12
+Acceptance: add/remove/replace draft files, aggregate diff, immutable Ready intent, stale-base rejection, one Safe Approval, one atomic branch commit, idempotent retry/reconciliation, recovery UI, and regression coverage proving no direct-main write.
13
+
14
+### CP3 — GitHub Advanced WRITE completion
15
+Keep GitHub mutation behind the central action policy. Add only high-value Actions controls not already present: workflow dispatch and job rerun where the provider supports them. Existing rerun-failed, cancel and exact-head PR merge remain unchanged. Approval targets bind repository + immutable operation target; provider permission failures are explicit and never reported as success.
16
+
17
+Acceptance: source-backed eligibility, DESTRUCTIVE/WRITE classification as appropriate, compact approval callback under Telegram limits, durable replay rejection, provider mutation only after approval, and exact provider-error feedback.
18
+
19
+### CP4 — Cloudflare Ops Plugin completion
20
+Extend the existing Cloudflare READ foundation into a first-class plugin. READ surfaces current Worker deployments/versions, traffic, bindings by name/type only, observability state and recent safe runtime error summaries. Mutations are intentionally limited to redeploy/rollback to a known version; they require Safe Approval, exact target version/deployment binding and post-action runtime verification. Secret values are never returned or audited.
21
+
22
+Acceptance: Production/Preview distinction, source-backed READ, fail-closed mutation, rollback/redeploy approval, exact target verification, and independent post-action version/traffic/binding verification.
23
+
24
+### CP5 — CI/CD Control Plane
25
+Compose GitHub Actions and Cloudflare deployment state into one owner-only view. The view correlates repository, exact commit SHA, CI run/jobs, deploy workflow and active Cloudflare version. It diagnoses mismatches rather than declaring success from a single green run. Actions delegate to CP3/CP4 policy-protected operations rather than bypassing them.
26
+
27
+Acceptance: exact-SHA correlation, clear pending/failed/success/mismatch states, drill-down and recovery, no invented SLA/latency, and deploy acceptance only when GitHub and Cloudflare evidence agree.
28
+
29
+### CP6 — Monitoring & Incident Manager
30
+Create durable incident records only from source-backed failures: failed CI/deploy, Cloudflare runtime/provider failure, or explicit health degradation. Incidents have deterministic fingerprints for deduplication, severity, evidence references, status and investigation notes. Sensitive logs/source are redacted before persistence. Owner notifications are informative; remediation actions route through existing policy/approval paths.
31
+
32
+Acceptance: create/dedupe/update/resolve incidents, evidence redaction, provider-outage handling, recovery navigation and tests for repeated events and false-success prevention.
33
+
34
+### CP7 — Automation Engine
35
+Add a durable, resumable orchestration layer for bounded developer workflows. An automation is a versioned state machine with idempotency key, step status, attempts and durable checkpoints. READ steps may run automatically; WRITE/DESTRUCTIVE steps pause for Safe Approval and resume only with a matching one-time approval. Retries never duplicate provider mutation; terminal failure is explicit. Initial recipes are deliberately limited to existing capabilities (for example diagnose failed CI, prepare recovery action, wait for approval, execute, verify).
36
+
37
+Acceptance: durable resume after Worker restart, idempotent retry, approval pause/resume, cancellation, terminal failure, audit-safe event trail, and no direct Production bypass.
38
+
39
+## Shared architecture
40
+- Telegram remains the owner control surface; Mini App is used only where richer Workspace editing is needed.
41
+- Plugin manifests declare actions and risk; central policy remains authoritative.
42
+- `ApprovalReplayGuard` remains the one-time approval boundary and fails closed for mutations.
43
+- `WorkspaceStore` may be extended with versioned multi-file schema; migration must preserve existing single-file drafts or fail explicitly without data corruption.
44
+- Automation/incident durable state uses dedicated Durable Object classes/bindings rather than mixing unrelated state into approval replay.
45
+- Provider adapters contain API mechanics; orchestration never embeds secrets or bypasses adapters.
46
+- Public `GET /status` stays minimal health-only. Operational diagnostics remain owner-only in Telegram.
47
+- Production and Preview Durable Object namespaces remain isolated.
48
+
49
+## Security and risk
50
+All provider mutations must be target-bound, expiry-bound, owner-bound and replay-safe. Cloudflare rollback/redeploy and any operation changing deployed code are DESTRUCTIVE. GitHub workflow dispatch/rerun are WRITE unless the concrete action is later shown to have destructive semantics. Logs, source code bodies, drafts, tokens, signed approvals and secret values are excluded from incident/audit persistence.
51
+
52
+## Verification strategy
53
+Every subproject follows RED → GREEN → relevant tests → full `npm test` → diff/security review → PR CI → Preview where applicable → locked-head merge → post-merge main CI → exact-SHA deploy → independent Cloudflare runtime verification. A subproject is not complete on documentation or mocks alone.
54
+
55
+## Non-goals for this program
56
+AI Copilot, Browser QA as a new subsystem, broad third-party plugin marketplace and general multi-project tenancy remain later roadmap items. CP2–CP7 must leave extension points but must not implement those later phases opportunistically.