Personal Telegram developer console for GitHub

docs: record implemented G0 hardening and verified branch build recovery

Codex committed Oct 25, 2026 at 07:27 UTC e9d6f28317d3796870d239f7bc20e6afcd0384f5
4 files changed +53
AGENTS.md
+2
@@ -1,5 +1,7 @@
1 # Nexa Studio working instructions
2
3 +- Latest owner direction (2026-10-25): continue real implementation here. Handoff files are continuity records, not a substitute for execution. Read `docs/roadmap/G0_HARDENING_2026_10_25.md` for the latest completed fixes and explicit remaining limits.
4 +
5 - 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.
6 - 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.
7 - 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.
PROJECT_MEMORY.md
+7
@@ -1,5 +1,12 @@
1 # PROJECT_MEMORY.md
2
3 +## Latest implementation checkpoint — 2026-10-25
4 +- Owner requested continued implementation in this environment. Delivery branch remains `feat/studio-g0-foundation`, PR #65; main baseline remains `5d1c083d326db327cc3973a9d3adecc1d8092c91`.
5 +- Code head `e02e9fb976f11167aa04a842f881dedb3e11a3ef`: bounded exact Diff, durable Automation claims/CAS, transactional Incident updates, active-runtime/SHA correlation and workflow tagging, metadata-only Telegram source views plus authenticated read-only Mini App file/Diff reading.
6 +- Full local Node 22 suite: 353 pass, zero fail/skip/cancel; lint zero errors (13 existing warnings), formatting and Worker dry-run pass. Actual local workerd/SQLite concurrency/restart smoke and jsdom read-only rendering smoke pass.
7 +- Cloudflare Preview failure was confirmed as error10067 /100DO namespace Free limit. Only the G0 branch trigger was changed reversibly to `npm run build:check`; no namespace deletion, paid upgrade or production deploy.
8 +- Full details and remaining R-07/G0/device/approval/ambiguous-effect limits: `docs/roadmap/G0_HARDENING_2026_10_25.md`. Historical checkpoints below are not current blockers or gate acceptance.
9 +
10 ## Project Identity
11 - Name: Nexa Dev Bot
12 - Repository: `davoodmehraban89/nexa-dev-bot`
docs/handoff/START_HERE.md
+2
@@ -2,6 +2,8 @@
2
3 هدف این تحویل: کارهای عادی و محدود در یک چت دیگر انجام شود؛ تغییرهای حساس به امنیت و داده با بازبینی متمرکز انجام شوند. از نو ممیزی کامل یا بازنویسی پروژه شروع نکن.
4
5 +**تصمیم جدید مالک — ۲۰۲۶/۱۰/۲۵:** ادامهٔ پیاده‌سازی در همین محیط اجرایی انجام می‌شود. این راهنما فقط حافظهٔ ادامه است؛ تحویل دوبارهٔ پرامپت جای کار واقعی را نمی‌گیرد. آخرین تغییرات و محدودیت‌ها در [گزارش ادامهٔ G0](../roadmap/G0_HARDENING_2026_10_25.md) ثبت شده‌اند: ۳۵۳ تست محلی موفق، Diff محدود، claim پایدار Automation، Incident اتمیک، شواهد SHA نسخهٔ فعال و نمایش محتوا در Mini App.
6 +
7 ## منابع به ترتیب اعتبار
8 1. دستورهای مستقیم و جدید مالک؛ تغییر الزام‌های قرارداد باید به‌صورت مکتوب ثبت شود.
9 2. [قرارداد نسخهٔ ۳](../contract/NEXA_STUDIO_V3.md) و Word اصلی کنار آن؛ عنوان داخلی نسخهٔ ۳ است، نام فایل دریافتی نسخهٔ ۲ بود.
docs/roadmap/G0_HARDENING_2026_10_25.md new
+42
@@ -0,0 +1,42 @@
1 +# G0 hardening continuation — 2026-10-25
2 +
3 +Owner instruction: continue implementation in this execution environment; do not stop at another chat handoff. This report supplements the historical G0 report; it is not gate acceptance.
4 +
5 +## Implemented code
6 +
7 +| Change | Commit | Evidence |
8 +| --- | --- | --- |
9 +| Bounded exact Diff | `77c7894` | Intercepted the old 800,160,008-byte allocation safely in RED. Ordinary LCS capped at 65,536 cells; large sparse diff uses bounded Myers/banded reconstruction, max distance 64, max band 1,000,000 bytes, max work 2,000,000. Preserves exact insertion-first ties/counts. 540 randomized oracle comparisons and maximum newline/sparse/adversarial cases. |
10 +| Durable automation claims / atomic incidents | `a9a082b` | Claim before real router dispatch, persistent revision/CAS and claim-token completion; concurrent/stale/terminal calls do not repeat effects. Incident body parsed before transactional upsert/resolve. RED reproduced duplicate effects, stale authorization and lost rows/counts. |
11 +| Runtime/SHA evidence | `ace882c` | Actual active version selected from deployment traffic; detail fetched when omitted from latest list or lacking markers. Success requires active ID plus full matching documented `workers/commit_sha` or SHA-valued `workers/tag`. Missing proof stays UNKNOWN, mismatch stays MISMATCH. Workflow pins Wrangler and tags exact verified checkout SHA. Tightened an old false-positive test and fixed the plugin's short-SHA adapter. |
12 +| Source boundary / authenticated reader | `e02e9fb` | Telegram file, workspace Diff, PR patch and raw job-log views no longer forward their source fields. File and Diff content is available in the existing owner-authenticated Mini App via opaque owner-scoped refs and workspace IDs, read-only with Save hidden/disabled. Sensitive files/expired refs/nonowners rejected. Raw provider error strings do not escape the new preview API. Raw job logs remain accessible on GitHub. |
13 +
14 +## Verification on code head e02e9fb976f11167aa04a842f881dedb3e11a3ef
15 +
16 +- Node **22.23.4**, full `npm test`: **353 passed, zero failed/cancelled/skipped/todo**.
17 +- ESLint: zero errors, 13 existing warnings. Prettier and `git diff --check` pass.
18 +- Wrangler **4.152.0** `deploy --dry-run` passes with the five existing bindings; no upload.
19 +- Actual local workerd/SQLite smoke: exactly one of eight Automation claims wins; exactly one of eight completion attempts succeeds; completed state survives full runtime restart; twelve concurrent identical Incident updates produce one record with count twelve.
20 +- Actual jsdom parsing: authenticated read-only file/Diff views render hostile-shaped content literally, expose no Save action and issue no save/provider request when Save is invoked programmatically.
21 +- Independent focused AI reviews checked source/owner boundaries, durable concurrency, bounded Diff and runtime evidence. No implementation blocker remained. These are not human security or device acceptance.
22 +- One full-run integration fixture lacked the newly required active-version detail response; it was updated to return real-shaped untagged version metadata. No production check was weakened.
23 +
24 +## Cloudflare build blocker: confirmed and addressed for this branch
25 +
26 +The earlier failing Workers build `cea884d0-9e1c-477d-b390-264a64722268` on commit `4ddab54f8faf27ad1be571e7ae50e2da4f3b15db` ran `npx wrangler preview` and returned Cloudflare error **10067**: the account reached the Free plan's **100 Durable Object namespaces** limit. This was a preview provisioning quota, not a compilation/test error.
27 +
28 +After reading the trigger's live configuration, changed only trigger `30efc160-813b-4c61-b588-532cd74fbbfa`, whose branch filter is exactly `feat/studio-g0-foundation`, from `npx wrangler preview` to **`npm run build:check`**. Read-back confirmed the command and branch filter at `2026-10-25T07:12:14.657Z`. This reversible branch build validates the bundle without deploying previews or creating more namespaces; it also follows D-10's exclusion of Preview Environment from the current product scope. No production trigger, secret, deployment, stored namespace or paid plan was changed.
29 +
30 +The account quota itself is not increased and no namespaces were deleted. A future staging deployment may still require an owner-reviewed resource inventory/cleanup decision. Rollback of this trigger-only configuration is restoring its prior command; doing so would resume preview attempts and can reproduce the quota failure.
31 +
32 +GitHub and Cloudflare exact-head results are linked in PR #65 after pushing the final candidate; avoid creating another documentation commit merely to record its own CI.
33 +
34 +## Limits and unresolved gate work
35 +
36 +- These changes harden existing G0 paths. They do not constitute G1, multi-user access, CodeMirror, D1, encrypted PAT onboarding, sessions/grants or secure signed/TOTP unlock.
37 +- Very complex valid edits can be refused with `DIFF_COMPLEXITY_LIMIT` (Mini App HTTP 422 with a Persian next step). No approximate diff/counts or silent success is returned. Splitting changes may be necessary; editor content ceilings are unchanged.
38 +- An interrupted automation effect leaves **step_unresolved** indefinitely. No expiring automatic claim/retry is allowed because a provider effect may already have happened. Cancellation/reset PUTs while unresolved return conflict instead of pretending the effect was revoked. Manual reconciliation is still needed; exactly-once external execution is not claimed.
39 +- Runtime commit markers are authenticated Cloudflare metadata, not cryptographic source attestations. Untagged or ambiguous deployments remain unverified. A latest-list entry carrying only a non-SHA human tag may cause a conservative UNKNOWN until metadata is enriched.
40 +- The known outbound source-bearing fields are covered by sentinel regression tests. Legacy owner-initiated Telegram Paste/upload compatibility and arbitrary user-entered metadata still exist. Do not claim the full contract's source/token lifecycle or C-30 token interception is implemented; those need the remaining migration/security work.
41 +- R-26 still needs fresh owner-produced device/Approval/GitHub/Cloudflare evidence. No recording, owner click, human review or provider test commit was fabricated. Existing main/production revision has not been merged or deployed by this continuation.
42 +- G0 acceptance and permission to cross into G1 remain pending the contract's evidence and written owner decision.