Skip to content

Use cs as the only public subject for coding retrieval (LeetCode-backed)#6

Merged
wellingtonmapise merged 1 commit intofeature/leetcode-backend-setupfrom
debug/leetcode-backend
Mar 20, 2026
Merged

Use cs as the only public subject for coding retrieval (LeetCode-backed)#6
wellingtonmapise merged 1 commit intofeature/leetcode-backend-setupfrom
debug/leetcode-backend

Conversation

@wellingtonmapise
Copy link
Copy Markdown
Collaborator

Summary

This PR makes cs the only public API subject for coding-problem retrieval.

Internally, retrieval still uses the existing LeetCode artifacts (LEETCODE_*), but clients now send subject: "cs".

Changes

  • Updated src/routes.py:
    • subject="cs" now maps to the LeetCode retrieval pipeline.
    • subject="leetcode" is now rejected with a 400 and message:
      • "subject 'leetcode' is not supported. Use 'cs'."
    • Subject validation now allows only:
      • "math" and "cs"
  • Updated README.md:
    • Replaced LeetCode subject examples with subject: "cs".
    • Updated supported subject docs to "math" and "cs".
    • Updated curl example to use "cs".

Why

  • Keeps frontend/API contract simple and stable.
  • Uses domain-facing naming (cs) instead of data-source naming (leetcode).
  • Preserves existing artifact pipeline without renaming files/config yet.

Testing

  • Positive test:
    • POST /api/search with {"subject":"cs","query":"two pointers array","top_k":5}
    • returns ranked coding-problem results.
  • Negative test:
    • POST /api/search with {"subject":"leetcode",...}
    • returns 400 with unsupported-subject message.

Comment thread src/routes.py

def resolve_subject(subject):
"""Maps subject aliases onto a concrete retrieval dataset."""
if subject == "leetcode":
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we are catching all other cases at the end no need for the first if.

@wellingtonmapise wellingtonmapise merged commit e51789d into feature/leetcode-backend-setup Mar 20, 2026
@wellingtonmapise wellingtonmapise deleted the debug/leetcode-backend branch March 20, 2026 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants