Applications editor: make the save/rename interlock hold across tabs

オープン
#1,964 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
typescript
領域
frontend

調査の方向性

Start with src/features/instance/applications/lib/editorSaveInterlock.ts, which holds the in-memory save/rename interlock added in #1959, and find the save and rename call sites that use it. The task is to make that lock span tabs, probably with the Web Locks API, which needs a design decision on lock names per instance and path. Done means two tabs on one application can't lose saved text when a save and a rename of the same file overlap; this is hard to test automatically, so a manual two-tab check is likely needed.

索引モデルが issue の本文から書いたものです。

説明

What happens

#1959 makes an application file's save and a rename wait for each other (src/features/instance/applications/lib/editorSaveInterlock.ts). A save that lands while a rename is copying the file would otherwise lose the saved text: the rename reads the file, writes the copy and drops the original.

That interlock lives in one tab's memory. Two tabs on the same instance don't see each other, so a save in tab A can still land in the middle of a rename in tab B, and the saved text is lost from the renamed file.

It takes two tabs on one application, with a save and a rename of the same file within a second or so of each other.

Possible fix

Take the interlock across tabs with the Web Locks API: navigator.locks.request on a name per instance and path, held for the save or the rename. All tabs of an origin share it, and a closed tab's locks are released. BroadcastChannel could tell other tabs that a lock is held, but on its own it can't make one tab wait for another.

This only covers tabs in one browser. Another person, or the assistant's tools run elsewhere, can still interleave. The server would have to make renames atomic to close that.

Review-Deferral: 10b5354eb1c693c0 severity=nit category=concurrency

Raised by the cross-model review of #1959 (#1945).

🤖 Generated by Anthropic Claude Code (Claude Opus 5.5); posted via @dawsontoth.

主要言語
TypeScript
スター
5
フォーク
4
平均マージ
1日 20時間
マージ済み PR(30日)
140

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

HarperFast/studio のほかの issue

HarperFast/studio の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。