Migration error caret is missing or misplaced when the statement contains multibyte characters
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 88/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- postgresql, typescript
調査の方向性
apps/cli/src/command-internal/migration-apply.ts の markError と、バイトベースの動作を確認する既存の単体テストから始めます。前の migration 行にマルチバイト文字を入れて offset を再現し、その後、テストがパスし、正しい行で PostgreSQL が報告した文字の下にキャレットが表示されることを確認します。
索引モデルが issue の本文から書いたものです。
説明
Affected area: Migrations
Supabase CLI version: current develop (d38ccd7e)
Operating system: Any. Reproduced with a unit test on Linux.
Installation method: Built from source
Command
supabase db push
Actual output
When a migration statement fails, the CLI prints the statement and a caret under the position that PostgreSQL reports. If an earlier line of the statement contains multibyte characters, the caret is missing or printed under the wrong line.
For example, with this statement in a migration:
insert into notes (body) values ('éééééééé'),
(foo bar);
PostgreSQL reports the error position as a 1-based count of characters into the statement. markError compares that count with the UTF-8 byte length of each line, so the first line, which is longer in bytes than in characters, absorbs part of the offset. The output shows the statement without a caret, or with the caret under the wrong line.
Expected behavior
The caret appears under the character that PostgreSQL reports, on the correct line, regardless of the characters used on earlier lines.
Steps to reproduce
- Add a migration whose statement has a multibyte character on an early line and a syntax error on a later line, as shown above.
- Run
supabase db pushagainst a database. - Read the error output.
Additional context
The PostgreSQL protocol documentation states that the error position is measured in characters, not bytes. markError in apps/cli/src/command-internal/migration-apply.ts uses utf8ByteLength(line), and an existing unit test asserts the byte behavior. Measuring each line in code points fixes the offset. A unit test that calls markError with a multibyte first line fails on develop and passes with the change.
I have a fix with a unit test ready and can open a PR if this is open for contribution.
- 主要言語
- TypeScript
- スター
- 2.4k
- フォーク
- 537
- 平均マージ
- 18時間 43分
- マージ済み PR(30日)
- 373
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
supabase/cli のほかの issue
-
🐛 Bug supabase/cli
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
fix(init): correct web3 standard attribution and add missing ethereum provider in config.toml template対応中かも @7ttp が今日担当しました。 オープン📘 Docs supabase/cli
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
メンテナーはふだん 1 日以内に返信
-
stack: the gateway sets no X-Forwarded-For or X-Real-IP, so Edge Functions cannot see the client IP対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン🐛 Bug supabase/cli
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
config push: changing auth.oauth_server.authorization_url_path fails with 400 (enabled and path must be sent together)再び着手できるかも @itz-puneet が 9 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン🐛 Bug supabase/cli
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
supabase/cli#7087 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
db schema declarative sync: no way to fail (non-zero exit) when the generated migration is destructive再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン✨ Feature supabase/cli
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
verified
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
メンテナーはふだん 5 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
anomalyco/opencode#59589 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Bug: During run init command, finish the git initialize process without question to user('Initialize a new git repository?')対応中かも @nishu-murmu が今日担当しました。 オープンpending-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
knaw-huc/textannoviz#739 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信