fix(api): widen slugify suffix from 4 to 8 chars or add retry loop

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

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

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

評価

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

調査の方向性

Start by reading the slug generation in packages/api/src/routes/admin/events/index.ts and packages/api/src/routes/eventsSubmit.ts, then check whether shared slug.ts from #2002 exists. Run the relevant unit tests and add coverage for 10,000 slugs from the same name; done means duplicate-free generation and no generic unique-constraint failure path.

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

説明

Summary

Event slug generation uses Math.random().toString(36).slice(2, 6) — a 4-character base36 suffix. Birthday-paradox math gives a collision rate around 1-in-1.6M per name, surfacing as a generic 500 from the unique-constraint insert. Low but non-zero.

Requirements

  • Widen the suffix to 8 characters (~1-in-2.8B collision per name) OR add a try/retry loop that regenerates on unique-constraint conflict
  • Files affected: packages/api/src/routes/admin/events/index.ts, packages/api/src/routes/eventsSubmit.ts
  • If a shared slug.ts helper lands first (#2002), apply the fix once there
  • Unit test: 10,000 random slugifies of the same name produce zero duplicates

Context

Flagged in the Plan 2 review. Forms (Plan 4) will also need slug generation — fix once and reuse.

主要言語
HTML
スター
33
フォーク
107
平均マージ
14時間 6分
マージ済み PR(30日)
19

環境構築

はじめの一歩

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

USRSE/usrse.github.io のほかの issue

USRSE/usrse.github.io の issue をすべて見る

似ている issue

Backend & API Design の issue をもっと見る

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

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