Skip to content

fix(interactions): resolve alias slug trong api.user-interactions #47

Description

@mrgoonie

Vấn đề

apps/web/app/routes/api.user-interactions.ts (khoảng dòng 26-28) resolve slug do client gửi lên bằng inArray(skills.slug, slugs), tức chỉ khớp canonical slug. Sau #25, một slug cũ vẫn resolve bình thường trên mọi route khác nhờ bảng skill_aliases, nhưng ở đây thì không: client gửi slug cũ sẽ nhận về overlay rỗng (trạng thái favorite/vote biến mất) mà không có lỗi nào.

Bằng chứng

  • resolveSkillBySlug (apps/web/app/lib/db/skill-aliases.ts) là đường duy nhất có alias: nó tra skills.slug trước, rồi skill_aliases.slug, rồi lấy row theo skill_id.
  • Các route khác (detail, rate, review, favorite, install, vote, usage report) đều đã đi qua resolveSkillBySlug; chỉ api.user-interactions.ts còn tra thẳng theo skills.slug.
  • Đây là hạn chế đã ghi trong PR fix(skills): canonical skill identity from source repo and path (#25) #43 phần "Known limitations" và trong ledger plans/reports/live-verify-260922-0843-issue-25-24.md.

Đề xuất

Cho mỗi slug đầu vào đi qua resolveSkillBySlug (hoặc một truy vấn join skill_aliases), rồi tập hợp canonical id để tra interactions. Thêm test: slug cũ trỏ tới skill có favorite/vote vẫn trả đúng overlay.

Mức độ

Thấp về tác động, nhưng là lỗ hổng nhất quán của hợp đồng alias mà #25 đã thiết lập: "mọi slug cũ vẫn resolve" hiện chưa đúng ở route này.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions