Personal Telegram developer console for GitHub

docs: checkpoint repository workspace tasks 1-4

davoodmehraban89 committed Oct 3, 2026 at 13:19 UTC e716884afedd4ab6fe8b28a7ec372393633a7b36
1 file changed +55 -37
PROJECT_MEMORY.md
+55 -37
@@ -21,6 +21,7 @@
21 - Plugin Registry + central Action Policy + Audit Logger + Plugin Router in `src/core/`.
22 - HMAC approval tokens in `src/core/approval.js`.
23 - Durable Object replay guard via `APPROVAL_REPLAY_GUARD` / `ApprovalReplayGuard`.
24 +- Owner-scoped Repository Workspace storage via `WORKSPACE_STORE` / `WorkspaceStore` on the implementation branch; production deployment is still NOT VERIFIED.
25 - GitHub plugin in `src/plugins/github/`; provider adapter in `src/github.js`.
26 - Exact-commit CI/deploy workflows under `.github/workflows/`.
27
@@ -30,7 +31,7 @@
31 - Approval is owner/action/risk/target/expiry-bound and one-time consumed through Durable Object storage.
32 - Provider mutation never executes before policy approval.
33 - Provider errors are explicit; no fabricated success or fallback data.
33 -- Secrets and signed approval callback tokens must not appear in logs/docs.
34 +- Secrets, source/draft text and signed approval callback tokens must not appear in logs/docs.
35 - Telegram callback data and rendered provider text must remain bounded.
36
37 ## Production-Accepted Foundation
@@ -118,49 +119,66 @@ Conclusion:
119 - Releases source-backed empty state: VERIFIED.
120 - Telegram owner-device/runtime evidence: VERIFIED.
121
121 -## Current Design / Planning Work — Repository Workspace / Code Editor
122 -- Owner explicitly requires the ability to open a file in any accessible repository, edit it from the Nexa mobile control plane, review the change, commit it, and send it back to GitHub.
123 -- Owner approved the architectural direction and then explicitly approved the written spec on 2026-10-03.
122 +## Repository Workspace / Code Editor Phase 1 — PR #21 IN PROGRESS
123 - Design spec: `docs/superpowers/specs/2026-10-03-repository-workspace-editor-design.md`.
124 - Implementation plan: `docs/superpowers/plans/2026-10-03-repository-workspace-editor.md`.
126 -- Design/plan branch: `spec/repository-workspace-editor`.
127 -- Draft PR #21 contains design + plan only; no product implementation has been added yet.
128 -- Current plan head after self-review: `6990647df6b24120169e778800893d5e23a9bdb3` before this memory checkpoint commit.
129 -
130 -### Approved design direction
131 -- Phase 1: durable owner-scoped single-file text workspace, exact diff, conflict/staleness checks, branch-first GitHub commit, Safe Approval, commit SHA + CI handoff.
132 -- Commit engine is based on Git Data blobs/trees/commits/refs so Phase 2 can atomically commit multiple files without redesign.
133 -- Draft content is stored outside Telegram callback data/process memory in a dedicated `WORKSPACE_STORE` Durable Object; existing `APPROVAL_REPLAY_GUARD` remains dedicated to approval replay protection.
134 -- Commit intent is idempotent: committed result metadata/SHA is persisted so Telegram/network retries or a fresh approval cannot create a duplicate commit for the same unchanged workspace intent; ambiguous provider outcomes require ref reconciliation before retry.
135 -- Direct writes to `main` are out of scope for Phase 1 and may be added later only as an explicitly enabled high-risk path that respects GitHub protection rules.
136 -- Binary/LFS, automatic conflict resolution, secret/private-key-like files and arbitrary shell execution are out of scope for Phase 1.
137 -- Production acceptance requires owner-device evidence proving draft-only behavior before approval, exact diff, one approved commit, replay rejection, idempotent retry, and GitHub/Cloudflare evidence agreement.
138 -
139 -### Plan decisions locked by self-review
140 -- Path-safe navigation uses short owner-scoped Durable Object refs; raw long paths are never placed in callback data.
141 -- Phase-1 edit ceiling is 3,000 Unicode characters and 12,000 UTF-8 bytes; input over the limit is rejected rather than silently truncated.
142 -- Navigation/workspace handles are 10 URL-safe chars; commit-intent IDs are 8 URL-safe chars so compact approval tokens remain within the existing 56-character token ceiling.
143 -- Repeated Ready on unchanged material reuses the existing intent instead of minting a new intent.
144 -- Git commit request metadata is deterministic for idempotent retry; target refs are never force-updated in Phase 1.
145 -- Existing declarative Cloudflare Durable Object `exports` lifecycle is preserved; `WorkspaceStore` will be added as SQLite storage without introducing legacy `migrations`.
146 -
147 -### Not yet implementation-complete
148 -- Implementation plan still requires owner review/acceptance before implementation starts.
149 -- No workspace storage binding/class has been deployed yet.
150 -- No editor WRITE action has been added yet.
151 -- No new GitHub commit mutation has been added yet.
152 -- No production editor smoke has been run yet.
125 +- Implementation branch: `spec/repository-workspace-editor`.
126 +- PR #21 targets `main` and now contains implementation work; it is no longer design-only.
127 +- Phase 1 remains branch-first only: no direct default-branch mutation, no force update, no automatic merge/rebase/conflict resolution.
128 +
129 +### Locked implementation constraints
130 +- Owner-scoped short navigation refs; raw long paths never appear in callback data.
131 +- Editable Phase-1 text ceiling: 3,000 Unicode code points and 12,000 UTF-8 bytes; overflow is rejected, never silently truncated.
132 +- Sensitive/private-key-like paths, binary-like content and Git LFS pointers are not editable.
133 +- Navigation/workspace handles are 10 URL-safe chars; commit-intent IDs are exactly 8 URL-safe chars.
134 +- Target branch is `nexa/edit-<workspaceId>`.
135 +- Draft/source content is never placed in callback data or audit metadata.
136 +- Repeated Ready on unchanged material reuses the existing immutable intent.
137 +- Provider Git commit creation is still NOT VERIFIED because Task 5/6 and production acceptance have not run.
138 +
139 +### Task 1 — Workspace policy/diff primitives: COMPLETE
140 +- `src/core/workspace-policy.js` implements editable-file policy, commit-message normalization, target-branch normalization, SHA-256 digests and bounded unified diff with exact full-content counts.
141 +- RED evidence was captured before implementation.
142 +- GREEN checkpoint CI #185 completed with 105/105 passing at that task head.
143 +
144 +### Task 2 — Durable owner-scoped Workspace Store: COMPLETE
145 +- Added `WORKSPACE_STORE` / `WorkspaceStore` client + Durable Object state machine.
146 +- Owner isolation, navigation/workspace expiry, one-shot pending input, READY invalidation/reuse, COMMITTING/COMMITTED state and cancellation are covered by tests.
147 +- GREEN checkpoint CI #192 completed with 113/113 passing at that task head.
148 +- Production deployment of the new binding/class: NOT VERIFIED.
149 +
150 +### Task 3 — Path-safe repository browser/editor entry: COMPLETE
151 +- Workspace file navigation uses short Durable refs after policy; legacy tree/blob/path-bearing callbacks remain compatible.
152 +- Eligible file preview exposes Edit; sensitive/LFS/oversized files remain readable with edit disabled.
153 +- `wedit` pins current default-branch HEAD/tree and exact file/blob/content before creating a durable local draft.
154 +- Archived repositories cannot create editable drafts.
155 +- GREEN checkpoint CI #200 / run `37112677199`, job `111173499300`: 121/121 pass, 0 fail/skip/cancelled.
156 +
157 +### Task 4 — Telegram Draft Input, Diff and Sealed Intent UX: COMPLETE
158 +- RED CI #201 / run `37113613413`, job `111176071940`: 126 tests total, 121 pass / 5 expected failures for missing message routing and `wtext`/`wmsg`/`wdiff`/`wready` behavior.
159 +- Added policy-routed `dispatchMessage`; source text is not audit metadata.
160 +- Bot preserves `/start`/`/menu`/`/repos`/`/status` precedence, then owner pending workspace text is routed with the exact untrimmed message body.
161 +- Pending draft/message input is one-shot; rejected draft input does not mutate the prior draft.
162 +- Diff is HTML escaped and bounded while additions/deletions are computed over complete content.
163 +- READY requires changed content + normalized commit message, binds stable digests/base/path/branch/timestamp, reuses unchanged intent and emits only short `wscommit:<repoId>:<intentId>` callback data.
164 +- GREEN CI #207 / run `37114230736`, job `111177792978`: 27 test files, 127/127 pass, 0 fail/skip/cancelled.
165 +- No GitHub provider mutation exists in Tasks 1-4; provider commit remains NOT VERIFIED.
166 +
167 +### Remaining implementation tasks
168 +- Task 5: GitHub Git Data commit primitives with deterministic request bodies and no force-update primitive.
169 +- Task 6: compact workspace Safe Approval codec + idempotent commit orchestration + audit metadata.
170 +- Task 7: whole-branch review, merge, exact post-merge CI/deploy, Cloudflare binding verification and owner-device production acceptance.
171
172 ## Next Executable Actions
155 -1. Owner reviews `docs/superpowers/plans/2026-10-03-repository-workspace-editor.md` and confirms it captures the desired implementation.
156 -2. Use the project's already-established native execution mode in this harness (no independent subagent tool is exposed) and implement task-by-task with TDD.
157 -3. Before implementation, merge the approved design/plan-only PR #21 to `main`, verify exact post-merge CI/deploy, then create an isolated implementation branch from that verified main.
158 -4. Execute Tasks 1-7 from the plan: policy/diff -> durable store -> path-safe editor entry -> draft/diff intent -> Git Data primitives -> Safe Approval/idempotent commit -> production acceptance.
159 -5. Only after Repository Workspace Phase 1 production acceptance, continue remaining useful GitHub Advanced WRITE operations and then Cloudflare Ops.
173 +1. Execute Task 5 RED -> GREEN for Git Data ref/blob/tree/commit/create-ref primitives.
174 +2. Execute Task 6 RED -> GREEN for Safe Approval/idempotent branch commit orchestration; no provider WRITE before approval.
175 +3. Run Task 7 exact whole-branch verification and secret-pattern scan; review PR #21 against the approved spec.
176 +4. Merge only a reviewed green head, verify exact `main` CI and Cloudflare deployment/bindings, then perform owner-device pre-approval and approved-commit smoke.
177 +5. Do not call Repository Workspace Phase 1 production-accepted until Telegram, GitHub and Cloudflare runtime evidence agree.
178
179 ## Remaining Roadmap
180 1. Repository Workspace / Code Editor Phase 1, then multi-file expansion.
163 -2. Remaining useful GitHub Advanced WRITE actions (for example workflow dispatch/specific-job rerun), always through Safe Approval.
181 +2. Remaining useful GitHub Advanced WRITE actions, always through Safe Approval.
182 3. Cloudflare Ops plugin: deployments, versions, bindings, health, telemetry/runtime errors and approval-gated rollback/deploy operations.
183 4. CI/CD Control Plane and release acceptance orchestration.
184 5. Monitoring + Incident Manager.