Personal Telegram developer console for GitHub

docs: checkpoint workspace file upload verification

davoodmehraban89 committed Oct 3, 2026 at 14:49 UTC 758368aa680a141b3349dc1d9dcfbab75d3db2f6
1 file changed +53 -79
PROJECT_MEMORY.md
+53 -79
@@ -21,7 +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.
24 +- Owner-scoped Repository Workspace storage via production `WORKSPACE_STORE` / `WorkspaceStore` Durable Object.
25 - GitHub plugin in `src/plugins/github/`; provider adapter in `src/github.js`.
26 - Exact-commit CI/deploy workflows under `.github/workflows/`.
27
@@ -119,98 +119,72 @@ Conclusion:
119 - Releases source-backed empty state: VERIFIED.
120 - Telegram owner-device/runtime evidence: VERIFIED.
121
122 -## Repository Workspace / Code Editor Phase 1 — PR #21 IN PROGRESS
122 +## Repository Workspace / Code Editor Phase 1 — PR #21 DEPLOYED, WRITE ACCEPTANCE PENDING
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`.
125 -- Implementation branch: `spec/repository-workspace-editor`.
126 -- PR #21 targets `main` and contains the complete Phase-1 implementation pending merge/deploy/owner-device acceptance.
127 -- Phase 1 remains branch-first only: no direct default-branch mutation, no force update, no automatic merge/rebase/conflict resolution.
125 +- Phase 1 is branch-first only: no direct default-branch mutation, no force update, no automatic merge/rebase/conflict resolution.
126 +- PR #21 merged to `main` at `5bbd943891189609dd85d40fd02fcb065bbe5c58`.
127 +- Post-merge CI #224 / run `37116152691` succeeded on that exact SHA with 31 test files and 142/142 tests passing, 0 fail/skip/cancelled.
128 +- Deploy #160 / run `37116164087` succeeded after checking out that exact SHA.
129 +- Active Cloudflare production version after deploy: `0a78af44-faa2-4ba1-8e32-7e2d5c5f1724` at 100% traffic.
130 +- Cloudflare version resources independently verified both `APPROVAL_REPLAY_GUARD` / `ApprovalReplayGuard` and `WORKSPACE_STORE` / `WorkspaceStore` bindings/classes active in production.
131
132 ### Locked implementation constraints
133 - 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.
134 +- Editable text ceiling: 3,000 Unicode code points and 12,000 UTF-8 bytes; overflow is rejected, never silently truncated.
135 - Sensitive/private-key-like paths, binary-like content and Git LFS pointers are not editable.
136 - Navigation/workspace handles are 10 URL-safe chars; commit-intent IDs are exactly 8 URL-safe chars.
137 - Target branch is `nexa/edit-<workspaceId>`.
138 - Draft/source content is never placed in callback data or audit metadata.
139 - Repeated Ready on unchanged material reuses the existing immutable intent.
137 -- Provider Git commit creation remains NOT VERIFIED live until owner-device production acceptance passes.
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 -
166 -### Task 5 — GitHub Git Data commit primitives: COMPLETE
167 -- RED CI #209 / run `37114394075`, job `111178254379`: 132 tests total, 127 pass / 5 expected failures for missing Git Data primitives.
168 -- `requestJson` supports opt-in `allowNotFound`; only HTTP 404 may return `null`, while 403/409/422 and other provider errors remain explicit.
169 -- Added `getGitRef`, `createGitBlob`, multi-file-capable `createGitTree`, deterministic `createGitCommit`, and create-only `createGitBranchRef`.
170 -- Branch paths containing `/` are safely encoded for ref reads; every provider/object SHA is full 40-hex validated.
171 -- Commit author/committer identity and timestamp are deterministic, making ambiguous Git object creation retries material-stable.
172 -- Phase 1 intentionally exposes no update-ref/force-ref primitive.
173 -- GREEN CI #210 / run `37114509763`, job `111178575800`: 28 test files, 132/132 pass, 0 fail/skip/cancelled.
174 -- These Git Data writes are verified only against mocked provider contracts; live GitHub branch commit remains NOT VERIFIED.
175 -
176 -### Task 6 — Safe Approval + idempotent branch commit orchestration: COMPLETE IN CI
177 -- Workspace commit approval uses a compact owner/action/risk/repo/8-char-intent-bound HMAC token; full Telegram `approve:` callback is regression-tested within the 64-byte limit.
178 -- `wscommit` returns approval metadata before execution; pre-approval route evaluation performs zero GitHub Git Data writes.
179 -- Approved orchestration revalidates immutable workspace material, exact base HEAD and target-branch absence before object creation.
180 -- Commit flow is blob -> tree -> deterministic commit -> persist candidate SHA -> create-only branch ref -> durable `COMMITTED` result.
181 -- `COMMITTING` and already `COMMITTED` retries reconcile idempotently; ambiguous create-ref failures are accepted only if the target ref resolves to the exact recorded candidate SHA.
182 -- Audit metadata is allowlisted and excludes source/draft text and signed token material.
183 -- Existing workflow-run Safe Approval behavior and replay protection remain covered.
184 -- GREEN CI #219 / run `37115479051`, job `111181371564`: 30 test files, 141/141 pass, 0 fail/skip/cancelled.
185 -- Live Repository Workspace provider mutation remains NOT VERIFIED.
186 -
187 -### Task 7 — Whole-branch review/hardening: IN PROGRESS
188 -- Review found one visible-error gap: approved workspace provider error text was inserted into Telegram HTML without escaping.
189 -- RED CI #220 / run `37115793196`, job `111182246421`: 31 test files, 142 tests total, 141 pass / exactly 1 expected failure on that regression.
190 -- Fix escapes provider error text before Telegram rendering.
191 -- GREEN CI #221 / run `37115965768`, job `111182732367`: 31 test files, 142/142 pass, 0 fail/skip/cancelled.
192 -- Secret-pattern review found no actual PAT/Telegram secret in the PR diff; occurrences of `ghp_` / `github_pat_` are only the documented scan-pattern names. `approve:` occurrences are expected callback construction/parsing and explicit negative audit tests, not logged live tokens.
193 -- A fresh CI is still required after this durable checkpoint because the documentation commits move the PR head.
194 -
195 -### Not yet production-accepted
196 -- PR #21 is not yet merged/deployed at this checkpoint.
197 -- Exact post-merge `main` CI: NOT VERIFIED.
198 -- Production `WORKSPACE_STORE` / `WorkspaceStore` binding/runtime: NOT VERIFIED.
199 -- Live owner-device browse/edit/diff/READY pre-approval smoke: NOT VERIFIED.
200 -- Live proof of zero provider WRITE before workspace approval: NOT VERIFIED for this new action.
201 -- Live approved branch-only GitHub commit and exact provider SHA feedback: NOT VERIFIED.
202 -- Main/default branch remaining unchanged after the branch-only commit: NOT VERIFIED live.
140 +
141 +### Implementation verification summary
142 +- Task 1 policy/diff primitives: GREEN CI #185, 105/105.
143 +- Task 2 Durable Workspace Store: GREEN CI #192, 113/113.
144 +- Task 3 path-safe browser/editor entry: GREEN CI #200 / run `37112677199`, 121/121.
145 +- Task 4 Draft input/diff/sealed intent: RED CI #201 121/126; GREEN CI #207 / run `37114230736`, 127/127.
146 +- Task 5 Git Data primitives: RED CI #209 127/132; GREEN CI #210 / run `37114509763`, 132/132.
147 +- Task 6 Safe Approval/idempotent commit orchestration: GREEN CI #219 / run `37115479051`, 141/141.
148 +- Whole-branch provider-error hardening: RED CI #220 141/142; GREEN CI #221 / run `37115965768`, 142/142.
149 +- Final PR head CI #223 succeeded before merge; post-merge exact-main CI #224 confirmed 142/142.
150 +
151 +### Production acceptance status
152 +- Production deployment and Durable Object bindings: VERIFIED.
153 +- Owner-device file browsing and editor entry: VERIFIED enough to reach draft input UI.
154 +- Live branch-only workspace provider WRITE: NOT VERIFIED because the original Paste Text smoke was intentionally stopped before Safe Approval; no `nexa/edit-*` branch was created and `main` remained unchanged.
155 +- Production acceptance therefore remains pending an owner-device Safe Approval branch commit.
156 +
157 +## Repository Workspace Upload File UX — PR #22 IN PROGRESS
158 +- Branch: `feat/workspace-file-upload`; PR #22 targets `main`.
159 +- User-requested change: make Telegram document upload the primary whole-file draft input, retaining Paste Text as fallback to avoid Telegram rich-format/newline corruption.
160 +- Uploaded filename is transport metadata only; the destination repository path remains the file selected in Workspace.
161 +- Telegram `getFile` + download is bounded before/after transfer and decoded with strict UTF-8.
162 +- Existing workspace policy remains authoritative: max 3,000 Unicode code points, max 12,000 UTF-8 bytes, sensitive destination paths/binary-like content/LFS pointers rejected.
163 +- Wrong message type, oversized document metadata, download failure or invalid UTF-8 are rejected visibly before Workspace dispatch so the owner can retry without consuming the pending file input.
164 +- Successful upload changes only the local Durable draft; GitHub WRITE remains behind the existing READY -> Safe Approval -> branch-only commit flow.
165 +- Source/draft bytes are not added to callback data or audit metadata.
166 +
167 +### TDD / review evidence for PR #22
168 +- Initial RED CI #225 / run `37118318146`, job `111189318207`: 148 total, 142 pass / 6 expected failures defining Telegram text-file download, `draft_file` pending mode, Workspace upload route and Bot document routing.
169 +- Initial implementation GREEN CI #230 / run `37118846278`, job `111190824552`: 34 test files, 149/149 pass, 0 fail/skip/cancelled.
170 +- Review found one UX mismatch: upload prompt described only the 12,000-byte ceiling while the enforced policy also has a 3,000-Unicode-code-point ceiling.
171 +- Hardening RED CI #231 / run `37118977060`, job `111191215894`: 151 total, 150 pass / exactly 1 expected failure for that prompt mismatch; new retry-path tests for wrong message type and oversized Telegram document already passed.
172 +- Prompt was aligned with the actual policy.
173 +- Final code-head GREEN CI #232 / run `37119129503`, job `111191655311`, head `e004506144c1787d4d33f03957048e8d086f8ef1`: 34 test files, 151/151 pass, 0 fail/skip/cancelled.
174 +- PR diff secret-pattern review found no actual PAT/Telegram secret; Safe Approval code path is unchanged.
175 +- A final fresh CI is still required after this documentation checkpoint because this commit moves the PR head.
176
177 ## Next Executable Actions
205 -1. Run fresh CI on the final checkpoint head and review exact PR #21 diff/metadata.
206 -2. Mark PR #21 ready and merge only that reviewed green head.
207 -3. Verify exact post-merge `main` CI, deploy SHA, active Cloudflare version and both Durable Object bindings/classes.
208 -4. Perform owner-device production smoke up to the Approval screen; verify no target branch/provider WRITE exists before confirmation.
209 -5. Owner confirms the fresh Safe Approval; verify the new `nexa/edit-*` branch, exact commit SHA, main unchanged, Cloudflare audit success and Telegram success feedback.
210 -6. Do not call Repository Workspace Phase 1 production-accepted until Telegram, GitHub and Cloudflare runtime evidence agree.
178 +1. Run fresh CI on the final PR #22 documentation head and review exact diff/metadata.
179 +2. Mark PR #22 ready and merge only the reviewed green head using expected-head locking.
180 +3. Verify exact post-merge `main` CI, deploy SHA, active Cloudflare version and Workspace bindings.
181 +4. Owner-device smoke: select a safe repo text file, use `📎 بارگذاری فایل`, verify draft + exact diff, enter commit message and reach Safe Approval.
182 +5. Before approval, verify no `nexa/edit-*` provider branch exists and `main` is unchanged.
183 +6. Owner presses the actual Telegram `✅ تأیید و اجرا`; verify created branch/commit SHA, branch file content, main unchanged, Cloudflare audit success and Telegram success feedback.
184 +7. Do not call Repository Workspace Phase 1 production-accepted until Telegram, GitHub and Cloudflare runtime evidence agree.
185
186 ## Remaining Roadmap
213 -1. Repository Workspace / Code Editor Phase 1 production acceptance, then multi-file expansion.
187 +1. Repository Workspace / Code Editor production acceptance, then multi-file expansion.
188 2. Remaining useful GitHub Advanced WRITE actions, always through Safe Approval.
189 3. Cloudflare Ops plugin: deployments, versions, bindings, health, telemetry/runtime errors and approval-gated rollback/deploy operations.
190 4. CI/CD Control Plane and release acceptance orchestration.