Personal Telegram developer console for GitHub
docs: record G0 evidence, remaining gates and economical next-chat handoff
Codex committed
Oct 24, 2026 at 18:41 UTC
c863ab33f43c2f426b281094fefc3f3288bcefd0
6 files changed
+276
-8
AGENTS.md
new
+12
@@ -0,0 +1,12 @@
1
+# Nexa Studio working instructions
2
+
3
+- Start with `docs/handoff/START_HERE.md` and the authoritative `docs/contract/NEXA_STUDIO_V3.md`. The original DOCX next to it wins over transcription differences. The proposed roadmap in PR #62 does not replace or weaken that contract.
4
+- Respect G0 → G4 and owner acceptance at each gate. Do not claim completion from mock tests, a draft PR, or a local build. Never invent device recordings, human review, CI or runtime evidence.
5
+- Continue this Worker/DO codebase. No rewrite or unapproved infrastructure. Keep owner checks, Safe Approval, durable replay, TOTP and Kill Switch. No direct default-branch writes or force pushes.
6
+- The owner wants economical handoffs: inspect changed/assigned files and relevant tests, use the recorded audit inventory, avoid repeating full audits or broad test runs without a code change or failure. Routine work may go to another chat; a chat without tools must return patches/checklists, not pretend it executed them.
7
+- Before behavior changes, demonstrate a failing regression, implement narrowly, then run relevant tests. Run full verification once on the final tree. Use Node 22, `npm ci`, `npm run lint`, `npm run format:check`, `npm test`, `npm run build:check`.
8
+- Keep logic changes separate from formatting. The initial formatting-only commit is `40e14f7`; do not redo that sweep.
9
+- Escalate sensitive changes for focused review: auth/session/grants, credentials/encryption/rotation, approval/replay/TOTP/kill-switch, write orchestration, webhook claims, concurrency, schema migration, deployment/rollback. Never include tokens, source/draft bodies or raw provider errors in logs, URLs, callbacks, handoffs or commits.
10
+- Do not re-enable old unlock callbacks: they lack signed Approval + TOTP. Do not infer production revision from any unrelated runtime version at 100% traffic.
11
+- Preserve current repository visibility. Check live GitHub state instead of assuming a billing restriction or its removal. User's latest stated intent was that they changed it to public; observed API state must be recorded separately.
12
+- Use a feature branch and draft PR for unaccepted work. No main merge or deployment while required CI, owner/device evidence or gate approval is missing. Record exact SHA, test counts, outstanding requirements, and the next smallest task in the handoff.
docs/handoff/NEXT_CHAT_PROMPT_FA.md
new
+24
@@ -0,0 +1,24 @@
1
+میخواهم ادامهٔ پروژهٔ Nexa Studio را کمهزینه و مرحلهای جلو ببری.
2
+
3
+مخزن: https://github.com/davoodmehraban89/nexa-dev-bot
4
+شاخهٔ ادامه: `feat/studio-g0-foundation`؛ خودسرانه از main قدیمی شروع نکن و شاخه را force-push نکن.
5
+PR تحویل: https://github.com/davoodmehraban89/nexa-dev-bot/pull/65
6
+
7
+ابتدا در همین شاخه فقط اینها را بخوان:
8
+1. `AGENTS.md`
9
+2. `docs/handoff/START_HERE.md`
10
+3. `docs/roadmap/G0_IMPLEMENTATION_REPORT.md`
11
+4. `docs/contract/NEXA_STUDIO_V3.md`؛ Word اصلی کنار آن است. این قرارداد نسخهٔ ۳ الزامآور است و نقشهراه پیشنهادی PR #62 جای آن را نمیگیرد.
12
+
13
+وضعیت تحویل: کد پایهٔ G0 پیادهسازی و محلی با Node 22 آزموده شده: ۳۱۱ تست پاس، lint بدون خطا با ۱۳ هشدار قدیمی، فرمت و dry-run Worker موفق. CI گیتهاب روی کد G0 هم موفق شد: https://github.com/davoodmehraban89/nexa-dev-bot/actions/runs/40121709579 . فرمتکردن کد کامیت جدا دارد. اینها به معنی پذیرش G0، استقرار یا تکمیل Nexa Studio نیستند. ابتدا SHA و PR و CI زنده را بررسی کن. مخزن در پایان جلسه public دیده شد؛ خطاهای Billing قدیمی را بدون بررسی، مانع فعلی حساب نکن.
14
+
15
+کار تو در اولین نوبت:
16
+- آخرین CI همین شاخه را بررسی کن؛ فقط خطای واقعی و محدود آن را با تست اصلاح کن. اگر ابزار اجرا نداری، صریح بگو و patch/دستور بده؛ ادعای اجرا یا ثبت تغییر نکن.
17
+- جدول شواهد G0 را تکمیل کن؛ R-26 به Approval و آزمون واقعی مالک نیاز دارد. ویدئو، تأیید انسانی، Commit یا Deploy واقعی را جعل یا خودسرانه اجرا نکن.
18
+- تا پذیرش مکتوب G0، وارد G1 نشو. بعد از پذیرش، فقط یک برش کوچک از کتابچه را انتخاب کن و به ترتیب جلو برو.
19
+
20
+محدودیتها: بازنویسی از صفر، تغییر مستقیم main، force-push، حذف تست، تضعیف Approval/replay/TOTP، ذخیره یا ارسال توکن در چت/لاگ و موفقیت ساختگی ممنوع. زیرساخت فقط Cloudflare طبق قرارداد. قفل اضطراری از مسیر قدیمی قابل بازکردن نیست؛ آن را دور نزن. R-07 دربارهٔ محتوای کد/دیف در تلگرام هنوز کامل نشده و گزارش صریح دارد.
21
+
22
+برای صرفهجویی: ممیزی کامل قبلی را تکرار نکن؛ فهرست R-27 ثبت شده است. فقط فایلهای مرتبط و تغییرکرده را بخوان، یک کار کوچک بردار، تست مرتبط و در پایان تست کامل بزن. خروجی هر نوبت کوتاه باشد: تغییر واقعی، SHA/PR، آزمون اجراشده، مانع با شاهد، کار بعدی.
23
+
24
+کارهای عادی مثل متن راهنما، سناریوی تست، اصلاح ظاهری یا پاکسازی محدود هشدارها را خودت انجام بده. برای تغییر حساس در احراز هویت، مجوزها، رمزنگاری/توکن، Approval/TOTP/replay، webhook، همزمانی، migration یا انتشار، یک diff کوچک و تست RED/GREEN آماده کن و دقیق بگو چه چیزی نیازمند بازبینی Codex/امنیتی است. کار حساس را با حدس یا ادعای بدون شاهد نهایی نکن.
docs/handoff/START_HERE.md
new
+52
@@ -0,0 +1,52 @@
1
+# ادامهٔ کار Nexa Studio
2
+
3
+هدف این تحویل: کارهای عادی و محدود در یک چت دیگر انجام شود؛ تغییرهای حساس به امنیت و داده با بازبینی متمرکز انجام شوند. از نو ممیزی کامل یا بازنویسی پروژه شروع نکن.
4
+
5
+## منابع به ترتیب اعتبار
6
+1. دستورهای مستقیم و جدید مالک؛ تغییر الزامهای قرارداد باید بهصورت مکتوب ثبت شود.
7
+2. [قرارداد نسخهٔ ۳](../contract/NEXA_STUDIO_V3.md) و Word اصلی کنار آن؛ عنوان داخلی نسخهٔ ۳ است، نام فایل دریافتی نسخهٔ ۲ بود.
8
+3. [گزارش G0](../roadmap/G0_IMPLEMENTATION_REPORT.md)، [فهرست بازبینی R-27](../roadmap/G0_READ_INVENTORY.md) و وضعیت زندهٔ GitHub.
9
+4. برنامهٔ اجرا: `docs/superpowers/plans/2026-10-24-studio-g0-foundation.md`.
10
+
11
+PR #62 یک نقشهراه پیشنهادی تعدیلشده بود و جای قرارداد اصلی را نمیگیرد. PRهای #63 و #64 اصلاحات امنیتی جدا داشتند که در شاخهٔ G0 ادغام محلی شدند؛ ادغام محلی به معنی ورود به main نیست.
12
+
13
+## محل ادامه
14
+- مخزن: `davoodmehraban89/nexa-dev-bot`
15
+- شاخهٔ تحویل: `feat/studio-g0-foundation`
16
+- PR تحویل: [#65](https://github.com/davoodmehraban89/nexa-dev-bot/pull/65)؛ Draft است، ادغام نشده.
17
+- شاخهٔ main مبنا: `5d1c083d326db327cc3973a9d3adecc1d8092c91`؛ وضعیت زنده را پیش از کار بررسی کن.
18
+- وضعیت محصول: **پایهٔ G0 پیادهسازی شده؛ پذیرش G0 و شروع G1 هنوز تأیید نشده است.**
19
+- هیچ ادعای ویدئوی Android/iOS، آزمون ایران، تأیید امنیتی انسانی یا استقرار این شاخه وجود ندارد.
20
+
21
+## اجرای قابل تکرار
22
+```bash
23
+git switch feat/studio-g0-foundation
24
+git pull --ff-only
25
+node --version # Node 22
26
+npm ci
27
+npm run lint
28
+npm run format:check
29
+npm test
30
+npm run build:check # فقط dry-run؛ انتشار نیست
31
+```
32
+نسخههای ابزار و وابستگیها در lockfile قفل شدهاند. هشدارهای lint میراث کد قدیمیاند و خطاهای lint نباید نادیده گرفته شوند؛ پاکسازی هشدارها باید با کامیت محدود و مستقل باشد.
33
+
34
+## کار بعدی به ترتیب
35
+1. وضعیت زندهٔ visibility و CI شاخهٔ G0 را بررسی کن. ابتدای این جلسه GitHub هنوز private و خطای حساب مالی نشان داد؛ در پایان public شد و [CI کد G0](https://github.com/davoodmehraban89/nexa-dev-bot/actions/runs/40121709579) موفق بود. به فرض یا گزارش قدیمی تکیه نکن و visibility یا بودجه را خودت تغییر نده.
36
+2. اگر CI اجرا شد، تنها خطای واقعی آن را اصلاح کن؛ اگر پیش از checkout شکست خورد، annotation را ثبت کن. موفقیت محلی جای CI را نمیگیرد.
37
+3. گزارش G0 را با شواهد دقیق تکمیل کن: R-26 تاریخی را از آزمون تازهٔ مالک جدا کن. ویدئو/Approval واقعی را فقط مالک میتواند انجام دهد. هیچ Commit یا Deploy واقعی برای نمایش پیشرفت خودسرانه انجام نده.
38
+4. قبل از ارائه برای پذیرش، بازبینی متمرکز تغییر webhook/kill-switch و موارد باز امنیتی را انجام بده. فهرست مشکلات در گزارش ممیزی است؛ با تست سبز آنها را انجامشده حساب نکن.
39
+5. پس از پذیرش مکتوب G0، G1 را به برشهای کوچک تقسیم کن: صفحههای فارسی RTL و CodeMirror، قرارداد API و revision/409، سپس ویزارد PAT با متن دقیق کتابچه. جمعآوری توکن واقعی قبل از رمزنگاری/پاکسازی لاگ/بازبینی امنیتی ممنوع است.
40
+
41
+## کارهای مناسب چت ارزانتر
42
+- تهیهٔ جدول الزام → فایل → آزمون → شاهد و بهروزکردن گزارش با شواهد موجود.
43
+- متن راهنما/خطا و سناریوی تست از روی متن دقیق کتابچه.
44
+- پاکسازی محدود هشدارهای lint یا اصلاح ظاهری، با حفظ منطق و تست موجود.
45
+- آمادهسازی طرح صفحه/patch قابلبازبینی برای کار مشخص، پس از بازشدن دروازهٔ مربوط.
46
+
47
+اگر چت ابزار GitHub/فایل/اجرای Node ندارد، باید صریح بگوید و فقط patch یا دستور آزمون بدهد. نباید ادعا کند کد را ثبت، تست یا مستقر کرده است.
48
+
49
+## مواردی که به بازبینی حساس نیاز دارند
50
+سشن، initData، دسترسی کاربر/Grant، توکن و رمزنگاری، Approval/replay/TOTP/unlock، نوشتن GitHub، schema/migration، همزمانی، quota و انتشار/rollback. برای اینها diff کوچک، تست RED/GREEN و پرسش دقیق آماده کن؛ سپس به محیط اجرایی و بازبین حساس بسپار.
51
+
52
+در پایان هر نوبت فقط اینها را گزارش کن: تغییر واقعی، SHA/PR، تست اجراشده، مانع با شاهد، کار بعدی. از گزارش پیشرفت ساختگی و درخواست تکراری مجوز برای کارهای قبلاً مجاز خودداری کن.
docs/roadmap/G0_IMPLEMENTATION_REPORT.md
new
+58
@@ -0,0 +1,58 @@
1
+# Nexa Studio v3 — G0 implementation checkpoint, 2026-10-24
2
+
3
+**Status: implementation foundation delivered for review; G0 NOT ACCEPTED; no G1 advancement, merge or deployment.**
4
+
5
+## Revision and source
6
+- Main baseline: `5d1c083d326db327cc3973a9d3adecc1d8092c91`.
7
+- Delivery branch: `feat/studio-g0-foundation`; obtain its latest exact SHA from GitHub before resuming.
8
+- Delivery PR: [#65](https://github.com/davoodmehraban89/nexa-dev-bot/pull/65), draft/unmerged.
9
+- Behavior implementation verified locally: `abf760e5d2631c8c4ef48a7738b33a9eae34ab4d`.
10
+- Original owner booklet is preserved in `docs/contract/NEXA_STUDIO_V3.original.docx`; its SHA-256 is `299459be0e364175d0d8afa96f924b5e5cab49f9015e21ce6047a5f1a98bbf13`. Filename originally said v2; internal title and owner's direction identify v3. Independent comparison found no missing nonblank source paragraphs in the readable transcription.
11
+- PR #62's proposed/softened roadmap is historical context, not the authoritative contract. PR #63 and #64 safety changes were integrated locally; their inclusion is not a production merge.
12
+
13
+## Requirement evidence
14
+
15
+| ID | Implemented / evidence | Outstanding acceptance |
16
+| --- | --- | --- |
17
+| R-10 | Formatting-only commit `40e14f7`; 116 executable JS ASTs and template literal values unchanged. Pinned Prettier 3.6.2, ESLint 10.13.0 and lockfile. Baseline 282 tests pass before/after. | Exact-head GitHub CI and final acceptance; 13 legacy lint warnings remain explicitly visible. |
18
+| R-11 | `WORKSPACE_EDITOR_LIMITS` supplies editor default, API, upload default and guide messages. Existing byte/code-point boundaries plus two default-upload regressions pass. Current ceilings remain 20,000 / 65,536, 8 files / 131,072 aggregate bytes. | Device evidence and CI. Old 3,000/12,000 claims belong to historical Phase 1 plans. |
19
+| R-12 | `/health` returns plain `ok` with no-store; `/` and `/status` version comes from package.json via `src/version.js`. New health/version tests and actual workerd route smoke pass. | Exact-SHA deployment and independent runtime check; no deployment done here. |
20
+| R-13 | Durable 24h update-ID claim in isolated bot/update domain using existing Replay Guard; atomic expiry+alarm; malformed update 400, guard outage 503 before effects, duplicate 200. Claimed handled/thrown errors acknowledge 200 with fixed metadata logs. Unit/concurrency/expiry/error tests plus actual SQLite runtime restart smoke pass. | CI and device/runtime smoke. At-most-once crash gap below is explicit. |
21
+| R-27 | Full-read required inventory of 86 baseline files in `G0_READ_INVENTORY.md`; additional core/DO modules reviewed; confirmed defects and remaining risks recorded. | Findings require their own fixes/reviews; reading is not full security acceptance. |
22
+| R-26 | Existing historical Phase 1 evidence at `docs/FINAL_ACCEPTANCE_V2_1.md`: branch `nexa/edit-b4Od3BIMYd`, commit `0b7c796efb3d77ac2c225d5fe6d1cacaaf4eabe2`. Phase 2 evidence is separate. | **Blocked by fresh authorized owner-device Approval/Telegram/Cloudflare/GitHub evidence on the candidate.** No new real provider commit was made for this report. |
23
+
24
+## Other confirmed defects corrected
25
+- Sensitive-path file preview withholds contents instead of sending them into Telegram; PR draft state is retained so merge guards reject drafts.
26
+- `/status` and `📊 وضعیت` await the asynchronous status view; malformed Cloudflare HTML closing tag removed.
27
+- Historical unlock/confirm-unlock callbacks could select lock and had no signed Approval/TOTP. They now fail closed without any state mutation; locked view offers safe navigation, not an unavailable unlock button. A complete signed/TOTP unlock protocol remains outstanding, not implemented by this patch.
28
+- CI installs with `npm ci` and checks lint, formatting, full tests and pinned Worker bundle dry-run.
29
+
30
+## Local verification
31
+
32
+Environment: Node **22.23.4**, Wrangler **4.152.0**, existing Cloudflare compatibility date **2026-10-02**.
33
+
34
+- Full suite: **311 passed; 0 failed, cancelled, skipped or todo**.
35
+- ESLint: **0 errors, 13 legacy warnings**; no warnings were concealed as clean lint.
36
+- Prettier check and `git diff --check`: pass.
37
+- Worker `deploy --dry-run`: pass, all five existing DO bindings, no upload.
38
+- Actual workerd + SQLite DO smoke: `/health`, `/status`, editor route; 8 concurrent claims → exactly 1 success + 7 duplicates; duplicate remains after complete local runtime restart. The smoke's initial persistence setup was corrected to the current Miniflare `resourcePersistencePath`; no application fix was required.
39
+- RED/GREEN: health 1 expected failure → green; default upload 2 failures → green; bot status/HTML 5 failures → green; sensitive preview/draft state 2 failures → green; unsafe unlock 3 failures → green; webhook tests exposed missing claims, repeated effects and raw error handling before correction.
40
+- Three focused independent AI-agent reviews examined changes outside each reviewer's own implementation; no implementation blockers found. They are not the independent human security review required before G3.
41
+
42
+## Live provider observations
43
+- GitHub initially still reported private and the retried old CI job `120950845582` had zero steps and the account billing annotation. Later the API confirmed **public**, with visibility update `2026-10-24T18:32:22Z`. Old billing failures must not be treated as current proof of blockage; read the latest candidate CI.
44
+- Cloudflare read-only observation: current deployment `0f5655b0-4ea8-4b46-8332-d8a21cdbfba9`, version `94d93413-e25e-4e27-8e83-7926125ce98f`, 100% traffic, created `2026-10-07T18:16:12.156144Z`. Version metadata did not expose a commit SHA, so this is not proof of the candidate's production revision.
45
+- No repository visibility, account budget, production code, secrets, deployment or provider state was changed by this implementation work.
46
+- Candidate CI details and final PR link are recorded in the PR/handoff once the latest run is available.
47
+- **Fresh GitHub CI succeeded** on behavior head `abf760e5d2631c8c4ef48a7738b33a9eae34ab4d`: [run 40121709579](https://github.com/davoodmehraban89/nexa-dev-bot/actions/runs/40121709579). The former billing block no longer prevented that run. Check the PR's latest head again after documentation-only updates; do not confuse old failed runs with current CI.
48
+
49
+## Open blockers and assumptions
50
+- **R-07 remains incomplete:** ordinary source/diff/PR patch content still reaches Telegram through legacy views. Sensitive-path suppression does not satisfy the full prohibition. Blocked on authenticated Mini App display migration and focused security review; never call it done.
51
+- **G0 acceptance remains blocked** on required fresh owner/device evidence, unresolved applicable safety findings and written owner gate approval; CI on the behavior head is now green. Keep requiring exact-head CI for subsequent commits. Do not start G1 merely because tests pass.
52
+- Claim-before-effects is **at-most-once**, not exactly-once or a queue. A crash after durable claim and before handler completion can lose an update; retry is suppressed for 24h. No raw update is persisted for replay. Approval-level idempotent reconciliation remains separate.
53
+- Three-level Kill Switch, secure TOTP unlock, per-user encryption/replay, sessions/grants/D1, If-Match, PAT wizard, CodeMirror, longer Workspace TTL and complete repository pagination are not delivered here.
54
+- Bounded diff memory, automation duplicate-effect races, incident concurrency and unverifiable runtime/SHA correlation remain in `G0_READ_INVENTORY.md`; these are review triggers, not hidden completed work.
55
+- No Android/iOS recordings, Iran network tests, 2-week owner trial, human security review or public-launch evidence was fabricated. Their contract gates remain outstanding.
56
+
57
+## Next execution
58
+Use `docs/handoff/START_HERE.md` and `docs/handoff/NEXT_CHAT_PROMPT_FA.md`. First read live CI on the delivery branch, then complete G0 evidence and acceptance; take only one small reviewed task at a time.
docs/roadmap/G0_READ_INVENTORY.md
new
+119
@@ -0,0 +1,119 @@
1
+# G0 R-27 read inventory
2
+
3
+Baseline reviewed: main `5d1c083d326db327cc3973a9d3adecc1d8092c91` plus pending PR #63 and PR #64, integrated locally before behavior changes. Three focused audit agents and the coordinator read the required modules and all baseline tests in full. This is an AI-assisted source review, not a human security review, a CI result, or a device smoke.
4
+
5
+The list below covers the required files at formatting commit `40e14f7`; additional core/DO files were also reviewed. New implementation tests were read during implementation and review.
6
+
7
+```text
8
+.github/workflows/ci.yml
9
+.github/workflows/deploy.yml
10
+src/bot-legacy.js
11
+src/bot.js
12
+src/cloudflare-menu.js
13
+src/core/totp.js
14
+src/core/workspace-policy.js
15
+src/guide-menu.js
16
+src/kill-switch-bot.js
17
+src/menu.js
18
+src/ops-menu.js
19
+src/platform-menu.js
20
+src/plugins/cloudflare/manifest.js
21
+src/plugins/cloudflare/plugin.js
22
+src/plugins/cloudflare/service.js
23
+src/plugins/github/manifest.js
24
+src/plugins/github/plugin-legacy.js
25
+src/plugins/github/plugin.js
26
+src/plugins/github/workspace-commit.js
27
+src/plugins/github/workspace.js
28
+test/action-policy.test.js
29
+test/approval-expiry-ui.test.js
30
+test/approval-flow.test.js
31
+test/approval-provider-error-ui.test.js
32
+test/approval.test.js
33
+test/audit.test.js
34
+test/automation.test.js
35
+test/bot.test.js
36
+test/bounded-json.test.js
37
+test/cicd-control-plane.test.js
38
+test/cloudflare-deploy-config.test.js
39
+test/cloudflare-menu.test.js
40
+test/cloudflare-ops-completion.test.js
41
+test/cloudflare-plugin.test.js
42
+test/cloudflare-service.test.js
43
+test/destructive-second-factor.test.js
44
+test/durable-replay.test.js
45
+test/final-acceptance-contract.test.js
46
+test/final-delivery.test.js
47
+test/github-advanced-plugin.test.js
48
+test/github-advanced-read-error-ui.test.js
49
+test/github-advanced-read.test.js
50
+test/github-advanced-write-completion.test.js
51
+test/github-issues-pagination.test.js
52
+test/github-live-findings.test.js
53
+test/github-pagination.test.js
54
+test/github-plugin.test.js
55
+test/github-pr-merge.test.js
56
+test/github-repository-fallback.test.js
57
+test/github-workspace-approval.test.js
58
+test/github-workspace-bot-approval.test.js
59
+test/github-workspace-file-upload.test.js
60
+test/github-workspace-integration.test.js
61
+test/github-workspace-provider-error-ui.test.js
62
+test/github-workspace-provider.test.js
63
+test/github-workspace-ui.test.js
64
+test/github.test.js
65
+test/help-guide.test.js
66
+test/incidents.test.js
67
+test/index.test.js
68
+test/kill-switch.test.js
69
+test/menu.test.js
70
+test/navigation.test.js
71
+test/ops-console.test.js
72
+test/phase2-controller.test.js
73
+test/phase2-editor-multifile.test.js
74
+test/phase2-multifile-acceptance.test.js
75
+test/phase2-ready.test.js
76
+test/platform-experience.test.js
77
+test/plugin-registry.test.js
78
+test/plugin-router.test.js
79
+test/security.test.js
80
+test/telegram-file-upload.test.js
81
+test/telegram-menu-e2e.test.js
82
+test/telegram-persistent-menu-input.test.js
83
+test/telegram.test.js
84
+test/workspace-approved-recovery.test.js
85
+test/workspace-editor-dom-safety.test.js
86
+test/workspace-editor-v2.test.js
87
+test/workspace-editor-worker.test.js
88
+test/workspace-multifile-commit.test.js
89
+test/workspace-multifile.test.js
90
+test/workspace-policy.test.js
91
+test/workspace-recovery-validation.test.js
92
+test/workspace-store-file-input.test.js
93
+test/workspace-store.test.js
94
+```
95
+
96
+Total required baseline files read: **86**.
97
+
98
+## Confirmed findings and disposition
99
+
100
+- Compressed source: formatted in a separate commit; 116 executable JS ASTs and template values compared unchanged; baseline 282 tests passed before and after.
101
+- Duplicate limit text/defaults: consolidated against WORKSPACE_EDITOR_LIMITS; old 3,000/12,000 values occur in historical Phase 1 plans rather than current policy.
102
+- /health exposed version/runtime metadata and release version was hardcoded: addressed in G0 worker changes.
103
+- Webhook had no update deduplication and returned 400 for handled errors: addressed with durable 24h at-most-once claims and metadata-only logs.
104
+- Sensitive-path file previews leaked source into Telegram: withheld. Ordinary legacy previews/diffs still conflict with the strict full R-07 target and require the Mini App migration; not declared compliant.
105
+- GitHub PR normalization dropped draft state: preserved so existing merge guard applies.
106
+- Async status view was not awaited on text commands; Cloudflare delivery text had unmatched HTML: corrected with regressions.
107
+- Unlock callbacks matched the lock suffix and had no signed Approval/TOTP: disabled fail-closed pending a complete verified unlock protocol; no insecure shortcut enabled.
108
+
109
+## Open safety backlog — require focused security review
110
+
111
+1. **R-07:** migrate all source/draft/PR patch display from Telegram to the authenticated Mini App; ordinary source/diff messages still exist.
112
+2. **Diff memory:** O(beforeLines × afterLines) allocation can exceed Worker memory for newline-heavy valid drafts. Add bounded diff algorithms/tests before expanding use.
113
+3. **Automation:** step effects precede durable completion with no execution claim; concurrent resumes may repeat effects. Do not enable new write recipes.
114
+4. **Incidents:** nontransactional read/await/write update may lose concurrent records.
115
+5. **Delivery evidence:** current correlation accepts an unrelated runtime version at 100% once CI/deploy SHAs match; require independent version-to-SHA verification.
116
+6. **TOTP/unlock:** per-user encryption and last-step replay protection, plus signed/TOTP unlock, remain R-17/R-25 work.
117
+7. **G1/G2:** shared token/default owner, 20-repository cap, fixed commit identity, no D1/grants/sessions, no If-Match, 30-minute Workspace TTL and inline CSP are future contract gaps.
118
+
119
+No one should infer that G0 or later gates passed from this inventory.
docs/superpowers/plans/2026-10-24-studio-g0-foundation.md
+11
-8
@@ -26,16 +26,16 @@
26
- Formatting: executable ASTs and template literal bytes unchanged.
27
28
## Tasks
29
-1. [ ] Read every R-27 module and test, record exact file inventory, findings and future-phase gaps.
30
-2. [ ] Integrate pending tested editor safety PRs locally, preserve original v3 booklet and record baseline tests.
31
-3. [ ] R-10: pin formatter/linter and lockfile; format JS/config/workflows in a dedicated commit. Compare pre/post executable ASTs, including template literals; run existing tests. Configure lint to catch real undefined references, not enforce a new product design.
32
-4. [ ] R-11: write failing tests for page policy consumption and upload guidance; derive all current editor ceilings from workspace-policy.js. Preserve 20,000 code points / 65,536 bytes / 8 files / 131,072 aggregate bytes; mark older specs as historical.
33
-5. [ ] R-12: write failing /health and version tests; make /health return only `ok` and derive product release version from package.json. Keep /status shape compatible.
34
-6. [ ] R-13: write failing worker/DO tests for duplicate/concurrent updates, 24-hour expiry, storage failure, malformed/unauthorized updates, handled errors and log redaction. Deduplicate before effects through existing Replay Guard, using a bot-specific separate domain. No update bodies stored. Document at-most-once processing and crash recovery limits.
35
-7. [ ] Fix only confirmed baseline operational bugs with RED/GREEN tests if found during R-27.
29
+1. [x] Read every R-27 module and test, record exact file inventory, findings and future-phase gaps.
30
+2. [x] Integrate pending tested editor safety PRs locally, preserve original v3 booklet and record baseline tests.
31
+3. [x] R-10: pin formatter/linter and lockfile; format JS/config/workflows in a dedicated commit. Compare pre/post executable ASTs, including template literals; run existing tests. Configure lint to catch real undefined references, not enforce a new product design.
32
+4. [x] R-11: write failing tests for page policy consumption and upload guidance; derive all current editor ceilings from workspace-policy.js. Preserve 20,000 code points / 65,536 bytes / 8 files / 131,072 aggregate bytes; mark older specs as historical.
33
+5. [x] R-12: write failing /health and version tests; make /health return only `ok` and derive product release version from package.json. Keep /status shape compatible.
34
+6. [x] R-13: write failing worker/DO tests for duplicate/concurrent updates, 24-hour expiry, storage failure, malformed/unauthorized updates, handled errors and log redaction. Deduplicate before effects through existing Replay Guard, using a bot-specific separate domain. No update bodies stored. Document at-most-once processing and crash recovery limits.
35
+7. [x] Fix only confirmed baseline operational bugs with RED/GREEN tests if found during R-27.
36
8. [ ] Run Node 22 full tests, lint, format check and pinned Wrangler dry-run. Review changes independently. Push a draft PR with exact test/SHA/CI evidence; no automatic main merge or deployment.
37
9. [ ] Record R-26 historical evidence and pending fresh owner-device/runtime proof; G0 acceptance remains pending required evidence/owner approval.
38
-10. [ ] Create `docs/handoff/START_HERE.md` and a copyable Persian prompt with branch/PR, commands, requirement status, next safe tasks and triggers for security review. A chat without execution tools must produce patches/checklists rather than claim implementation.
38
+10. [x] Create `docs/handoff/START_HERE.md` and a copyable Persian prompt with branch/PR, commands, requirement status, next safe tasks and triggers for security review. A chat without execution tools must produce patches/checklists rather than claim implementation.
39
40
## Implementation interfaces
41
- `WORKSPACE_EDITOR_LIMITS`: existing immutable policy object remains the reference.
@@ -45,3 +45,6 @@
45
46
## Scope limits
47
G1 connection wizard, D1, sessions, CodeMirror and multi-user access are not built in this pass. Staging, exact-SHA GitHub CI and device/runtime acceptance must not be inferred from local verification. A 24-hour at-most-once marker prevents repeated side effects but is not a durable queue or exactly-once execution guarantee.
48
+
49
+## Checkpoint
50
+Local verification: 311/311 tests, zero lint errors (13 legacy warnings), format and bundle pass. Code head abf760e5d2631c8c4ef48a7738b33a9eae34ab4d passed GitHub CI run 40121709579. PR #65 remains draft; tasks8/9 retain final-head CI/device/runtime/gate acceptance work. See docs/roadmap/G0_IMPLEMENTATION_REPORT.md.