Personal Telegram developer console for GitHub

docs: add phase 2 acceptance gate

Davood Mehraban committed Oct 5, 2026 at 17:22 UTC 5d89631ab56254ddd886f4f1d8357570ba5b4574
4 files changed +53 -3
README.md
+2 -2
@@ -14,7 +14,7 @@ V2.1 شامل Workspace Editor، Ops Console، Security Center، Configuration C
14 - مشاهده Workflow Run، Job، Step، bounded log و Artifact metadata.
15 - اجرای کنترل‌شدهٔ `Re-run failed jobs` و `Cancel workflow run` فقط بعد از Safe Approval.
16 - مرور پوشه‌ها و فایل‌ها و پیش‌نمایش فایل‌های متنی مناسب.
17 -- Workspace Editor برای اصلاح فایل روی Draft پایدار، بدون WRITE مستقیم به GitHub.
17 +- Workspace Editor برای اصلاح یک **multi-file Change Set** محدود و پایدار، بدون WRITE مستقیم به GitHub؛ حالت تک‌فایل با **single-file compatibility** به‌صورت Change Set یک‌عضوی حفظ شده است.
18 - Telegram Mini App چندخطی برای ویرایش Draft؛ مسیر Paste عادی Telegram فقط fallback است.
19 - ساخت Commit روی Branch جداگانه به شکل `nexa/edit-*`؛ مسیر Workspace به‌صورت مستقیم `main` را تغییر نمی‌دهد.
20 - Ops Console فقط‌خواندنی برای Self-check، GitHub READ probe، Cloudflare Worker READ status، Runtime/Bindings، Plugin Registry و Ping داخلی.
@@ -29,7 +29,7 @@ V2.1 شامل Workspace Editor، Ops Console، Security Center، Configuration C
29
30 1. `پروژه‌ها` → انتخاب Repository.
31 2. `فایل‌ها` → انتخاب فایل متنی مجاز.
32 -3. `Edit` → Pin شدن Base snapshot و ساخت Workspace.
32 +3. `Edit` → Pin شدن **exact base SHA** و ساخت Workspace/Change Set.
33 4. `Editor` → باز شدن Telegram Mini App.
34 5. `ذخیره Draft` → فقط Draft داخل `WORKSPACE_STORE` به‌روزرسانی می‌شود.
35 6. `Diff` → مقایسه Original و Draft.
docs/OPERATIONS_RUNBOOK.md
+3 -1
@@ -20,7 +20,9 @@ Lock and unlock are owner-only sensitive controls and must not bypass the centra
20 Rollback only to a known-good deployed version. Any Cloudflare operation changing deployed code remains DESTRUCTIVE and must use owner-bound Safe Approval with durable one-time replay protection. After rollback, independently verify active version/traffic/runtime state and record the evidence.
21
22 ## Workspace safety
23 -Workspace mutations remain Draft → Diff → Commit Message → Ready → Safe Approval → branch commit. The target is `nexa/edit-*`; direct `main` mutation, force update and silent conflict resolution are prohibited.
23 +Workspace mutations remain Draft → Diff → Commit Message → Ready → Safe Approval → branch commit. Phase 2 treats the Workspace as a bounded **multi-file Change Set** pinned to an **exact base SHA**; **single-file compatibility** remains a one-entry Change Set. Any file-list/order/content or commit-message change after Ready requires resealing and a fresh approval. The global **Kill Switch** is checked before provider mutation and fails closed if unreadable. The target is `nexa/edit-*`; direct `main` mutation, force update and silent conflict resolution are prohibited.
24 +
25 +For production smoke, use at least two safe text files, confirm aggregate/per-file Diff and no GitHub mutation before approval, approve once, then verify exactly one branch commit contains both intended changes while `main` remains at the pinned base SHA. Record exact SHA, sealed intent digest, target branch, resulting commit SHA, CI/deploy/runtime evidence and owner-device outcome in `docs/PHASE2_MULTIFILE_ACCEPTANCE.md`.
26
27 ## DESTRUCTIVE second factor
28 Every DESTRUCTIVE action requires two independent checks: the existing owner-bound Safe Approval and a six-digit TOTP generated from the separately provisioned `DESTRUCTIVE_TOTP_SECRET`. If the TOTP secret, durable pending state, approval token or TOTP code is unavailable/invalid/expired, the operation fails closed and performs no provider mutation. Five invalid TOTP attempts cancel the pending second-factor challenge and require a fresh Approval. TOTP codes, the TOTP secret and signed Approval tokens must never be written to audit, incident or application logs.
docs/PHASE2_MULTIFILE_ACCEPTANCE.md new
+28
@@ -0,0 +1,28 @@
1 +# Phase 2 Multi-file Workspace Acceptance
2 +
3 +## Contract
4 +Phase 2 extends Repository Workspace to a bounded **multi-file Change Set** while preserving **single-file compatibility** as a one-entry Change Set. Every Change Set is pinned to an **exact base SHA**, uses one commit message, renders aggregate/per-file Diff, seals deterministic file descriptors/digests, and publishes only to `nexa/edit-*`.
5 +
6 +Provider mutation remains behind central Policy, **Safe Approval**, durable replay protection and the global **Kill Switch**. There is **no direct `main` mutation**, force update, automatic merge/rebase or silent conflict resolution. Source/draft bodies, secrets and signed approval material are excluded from callbacks, audit, incident records and logs.
7 +
8 +## Production evidence
9 +- Merge SHA: `c2aafc36950e39f06e11c940d29a1692d527c526` (PR #54).
10 +- Exact-head PR CI: success on `ec64e8386288416a4315b6aff8867704190cfc68`.
11 +- Post-merge exact-SHA CI: success on merge SHA `c2aafc36950e39f06e11c940d29a1692d527c526`.
12 +- Cloudflare deploy workflow: success for the same merge SHA; production Worker deployment observed at 2026-10-05T13:34:08Z with version `15193b2b-9ef6-4aa5-9675-d1883f9ab107` at 100% traffic.
13 +- Runtime evidence: production Worker root returned HTTP 200 with the minimal online status payload after deployment.
14 +- Local exact-main regression: 258/258 tests passed before this acceptance-doc contract was added.
15 +
16 +## Owner-device smoke gate
17 +The final owner-device production smoke must use a safe repository and a Change Set containing at least two bounded text files. Verify aggregate/per-file Diff, one commit message, Ready resealing semantics, no provider mutation before approval, Safe Approval, and exactly one `nexa/edit-*` branch commit containing both intended file changes while `main` remains unchanged.
18 +
19 +Owner-device outcome: **PENDING OWNER INTERACTION**. This gate cannot be truthfully closed without the owner completing the Telegram approval/TOTP interaction on the authorized device. Until that evidence is recorded below, Phase 2 implementation is production-deployed but final acceptance is not marked complete.
20 +
21 +## Smoke evidence to record
22 +- Target repository / exact base SHA: pending
23 +- Sealed intent ID/digest: pending
24 +- Target `nexa/edit-*` branch: pending
25 +- Resulting commit SHA: pending
26 +- Evidence that both intended files are in the resulting tree: pending
27 +- Evidence that `main` remained at the original SHA: pending
28 +- Owner-device/runtime outcome and timestamp: pending
test/phase2-multifile-acceptance.test.js new
+20
@@ -0,0 +1,20 @@
1 +import test from 'node:test';
2 +import assert from 'node:assert/strict';
3 +import { readFile } from 'node:fs/promises';
4 +
5 +const read = (path) => readFile(new URL(`../${path}`, import.meta.url), 'utf8');
6 +
7 +test('Phase 2 acceptance docs lock the multi-file safety contract', async () => {
8 + const [readme, runbook, acceptance] = await Promise.all([
9 + read('README.md'),
10 + read('docs/OPERATIONS_RUNBOOK.md'),
11 + read('docs/PHASE2_MULTIFILE_ACCEPTANCE.md')
12 + ]);
13 + const docs = `${readme}\n${runbook}\n${acceptance}`;
14 + for (const phrase of ['multi-file Change Set', 'nexa/edit-*', 'exact base SHA', 'Safe Approval', 'Kill Switch', 'single-file compatibility']) {
15 + assert.match(docs, new RegExp(phrase.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'i'), `missing acceptance phrase: ${phrase}`);
16 + }
17 + assert.match(docs, /no direct [`]?main[`]? mutation|main.*never.*mutat|direct.*main.*prohibit/i);
18 + for (const evidence of ['CI', 'deploy', 'Runtime', 'Owner-device']) assert.match(acceptance, new RegExp(evidence, 'i'));
19 + assert.match(acceptance, /merge SHA/i);
20 +});