upstream取り込み: v2 file editor foundation (#3526 前半)#310
Conversation
…-sh#3526) Cherry-pick PR4 slice of upstream c504a50. Scoped to the foundation layer only so existing v2 code continues to work unchanged; the registry/store is not wired yet. PR5 will do the FilePane / page.tsx / useWorkspaceHotkeys / useDefaultContextMenuActions adaptation. Scope: - Add @replit/codemirror-css-color-picker dep (CodeEditor CSS swatches) - Add `trpcClient` to WorkspaceClientContextValue so the store can acquire per-document tRPC handles - Export `withAlpha` from shared/themes (consumed by editor theme) - New v2 file editor subsystem (unwired): - state/fileDocumentStore/** — shared document store + provider + hook - hooks/usePaneRegistry/components/FilePane/registry/** — view registry (CodeView / MarkdownPreviewView / ImageView / BinaryWarningView) with CodeMirror editor stack - hooks/usePaneRegistry/components/FilePane/components/{ErrorState, FilePaneHeaderExtras, FileViewToggle, LoadingState, OrphanedBanner, SaveErrorBanner}/** — chrome building blocks - Extend FilePaneData with optional `viewId` / `forceViewId` so the new chrome can typecheck; existing `hasChanges` / `displayName` and BrowserPaneData fork fields are untouched (deferred to PR5) FORK NOTES: - upstream apps/desktop/package.json drop of fork-only deps (@xyflow/react, elkjs, exceljs, ansi_up, cron-parser, cronstrue, diff, dockerfile-*, @codemirror/merge, @taplo/lib, @superset/macos-window-blur) is NOT applied here — those deps are still in use. - upstream apps/desktop/src/shared/themes/editor-theme.ts token removals (docComment, controlKeyword, storageKeyword, escape, variableProperty, annotation, markdown*) are NOT applied here — fork's shiki-theme.ts (upstream-absent) reads them. Deferred to PR5 so editor-theme.ts and shiki-theme.ts can move together. - upstream's removal of hooks/host-service/useFileDocument/** and the old FilePane renderers/ folder is deferred to PR5, once the new registry is wired.
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 6 minutes and 26 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (57)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 563121a567
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| entry.byteSize = result.byteLength; | ||
| entry.orphaned = false; | ||
| entry.hasExternalChange = false; |
There was a problem hiding this comment.
Guard loadEntry against stale async read responses
loadEntry applies the fetched payload to entry unconditionally after await, but this store can trigger overlapping loads (initial acquire, manual reload, and fs:update events). If an older request resolves after a newer one, it overwrites the newer content/revision and clears external-change flags, so the pane can show stale data until another filesystem event arrives. Adding a per-entry request token (or revision check) before mutating state would prevent out-of-order writes.
Useful? React with 👍 / 👎.
| entry.absolutePath = event.absolutePath; | ||
| entries.set(key(entry.workspaceId, entry.absolutePath), entry); | ||
| notify(entry); |
There was a problem hiding this comment.
Avoid clobbering tracked entry on rename key collision
The rename path rewrites the map key with entries.set(...) without handling an existing entry at the destination path. If both source and destination files are currently tracked (e.g., rename/move onto an already-open path), this overwrites the destination map entry while its handles remain alive, which desynchronizes ref-counting and later releaseDocument/event routing for that pane. Handle destination collisions explicitly before re-keying to avoid state corruption.
Useful? React with 👍 / 👎.
Upstream commits processed (cherry-picked, then adapted where needed): - 07c1ee0 fix(desktop): Cmd+O firing open-in twice on v1 workspace route (superset-sh#3511) → PR #302 (with fork tearoff-window adaptation for Cmd+O) - 4a1f41a chore(deps): upgrade tanstack/db + electric, drop durable-streams patch (superset-sh#3509) → PR #303 (fork keeps fstream patch) - a3df489 feat(desktop): v2 PR checkout via widened checkout procedure (superset-sh#3525) → PR #304 (clean) - c504a50 feat(desktop): v2 file editor — foundation, views, and stability pass (superset-sh#3526) → PR #310 (foundation: 58 files path-checkout) → PR #311 (adaptation: 20 files manual port with SpreadsheetViewer/memo/fork-hotkeys preserved) - 78b7dc8 feat(desktop): promote "Create Section Below" to top-level on workspace menu (superset-sh#3537) → PR #308 Record merge so upstream/main..main shows 0 behind.
概要
upstream
c504a5036 feat(desktop): v2 file editor — foundation, views, and stability pass (#3526)の 前半 = 未配線の新規土台 を path-checkout で取り込む PR です。c504 の 78 files のうち 58 files を PR4 に、残り 20 files は PR5 で fork adaptation 必要のため defer。behind 4 → 3(c504後半残)。取り込み内容(新規のみ、既存 wiring は touch しない)
apps/desktop/package.json: `@replit/codemirror-css-color-picker` 追加のみ(fork-only dep drop は適用せず)bun.lock: 対応 diffpackages/workspace-client/src/providers/WorkspaceClientProvider/WorkspaceClientProvider.tsx: `trpcClient` を context に追加apps/desktop/src/shared/themes/index.ts: `withAlpha` export 追加v2-workspace/\$workspaceId/state/fileDocumentStore/**: 共有ドキュメントストア + provider + hook(新規)FilePane/registry/**: view registry(CodeView / MarkdownPreviewView / ImageView / BinaryWarningView)+ CodeMirror editor stackFilePane/components/{ErrorState,FilePaneHeaderExtras,FileViewToggle,LoadingState,OrphanedBanner,SaveErrorBanner}/**: chrome building blockstypes.ts: `FilePaneData` に `viewId?` / `forceViewId?` を optional 追加のみ(`hasChanges` / `displayName` 維持)fork 適応 / 除外したもの(PR5 に defer)
以下は fork 独自領域との衝突があるため、PR4 では適用せず PR5 で手動移植予定:
検証
Codex pre-review
Yes(全5項目):
テストチェックリスト