Share surfaces database test fails when the local database already has rate limit counters

オープン 初心者向け
#301 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

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

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
82/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
postgresql, sql, supabase
領域
databases, testing

調査の方向性

失敗しているアサーションは supabase/tests/database/16_public_share_surfaces.test.sql の 205 行目付近のテスト 25 で、purge_public_rate_limit_counters(date_trunc('minute', now()), 100) を呼び出し、削除が 0 件であることを期待しています。ファイル全体を読んで、テストが現在の分のカウンターをどのようにシードするか、およびロールバックされるトランザクション内で実行されることを確認し、その後、purge のチェック前にそのトランザクション内で既存の古いカウンターを削除するか、シードされた現在の分の行がまだ存在することをアサートしてください。以前の e2e 実行からのカウンターをすでに保持しているローカルスタックで npm run test:db を使って再現してください。そのダーティなデータベースでテスト 25 が通り、現在の分のカウンターが purge されると引き続き失敗し、ファイル内の他のどのテストも自分が作成していない行に依存しないときに完了です。兄弟 issue #247 が 15_project_pages.test.sql のテスト 6 で同じパターンを追跡していることに注意してください。

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

説明

area: database bug impact: low priority: P3 size: XS

Summary

supabase/tests/database/16_public_share_surfaces.test.sql test 25 expects purge_public_rate_limit_counters(date_trunc('minute', now()), 100) to delete nothing (line 205). The purge is instance wide by design (it is the retention job), so on a local database where earlier requests to the badge, card, or public JSON routes left counters from past minutes, it deletes those rows and the test fails even though nothing is wrong:

# Failed test 25: "purge_public_rate_limit_counters: the current minute's counters are kept"
#         have: 12
#         want: 0

Reproduced on 2026-11-11 with npm run test:db against the shared local stack, on integration/demo-2026-11 and on the 258-workspace-handles branch alike; that branch does not touch the file or the function. The shared database held 13 counter rows from earlier e2e runs at the time. CI passes only because it starts from an empty database.

The same kind of failure in 15_project_pages.test.sql test 6 is already tracked in #247.

Fix

Make the assertion independent of rows the test did not create. For example, delete the counters older than the current minute inside the test's transaction before the two purge checks (the file already rolls back), or assert that the counters the test seeded for the current minute are still present instead of asserting how many rows the purge deleted.

Acceptance criteria

  • Test 25 passes on a local database that already holds rate limit counters from earlier minutes.
  • Test 25 still fails if the purge deletes a counter from the current minute.
  • No other test in the file depends on rows it did not create.

Model: anthropic/claude-opus-5-5 | Reasoning effort: unknown

主要言語
TypeScript
スター
1
フォーク
1
平均マージ
6時間 56分
マージ済み PR(30日)
136

環境構築

はじめの一歩

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

eddiejaoude/StackDash のほかの issue

eddiejaoude/StackDash の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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