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

Đang mở
#2,006 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
52/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
typescript
Lĩnh vực
api, backend

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
HTML
Star
33
Fork
107
Merge trung bình
14 giờ 6 phút
Pull request đã merge (30 ngày)
19

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của USRSE/usrse.github.io

Tất cả issue của USRSE/usrse.github.io

Issue tương tự

Thêm issue về Backend & API Design

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.