docs: add design notes to README - #55
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 285a19fd94
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| **Why a proxy server for a frontend app** — Codeforces doesn't send CORS headers, so the browser can't call the API directly. The Express proxy handles that, and also scrapes problem statement HTML, which is impossible cross-origin from the browser. A side benefit: one chokepoint for rate limiting, so a buggy client can't hammer Codeforces and get the shared hosting IP temporarily banned. | ||
|
|
||
| **Why the daily pick is deterministic** — The same UTC date produces the same problem for every user. Refreshing doesn't reroll (no slot-machine effect), the pick is trivially cacheable, and two people can discuss "today's graph problem" the way people discuss Wordle answers. It also makes the selection logic easy to test: fix the date and inputs, snapshot the expected output. |
There was a problem hiding this comment.
Clarify daily pick is per user, not global
This design note says the same UTC date produces the same problem for every user, but the daily selection first filters by userRating and solvedIds before applying the date seed (pickDailyProblem), so different handles/ratings/solved histories can get different candidates and different picks on the same day. This can mislead anyone using the README to reason about caching or user-visible behavior; it should say the result is deterministic for the same date and inputs rather than globally identical.
Useful? React with 👍 / 👎.
…tical per Codex review
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ec9afe9a89
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| ## Design notes | ||
|
|
||
| **Why a proxy server for a frontend app** — Codeforces doesn't send CORS headers, so the browser can't call the API directly. The Express proxy handles that, and also scrapes problem statement HTML, which is impossible cross-origin from the browser. A side benefit: one chokepoint for rate limiting, so a buggy client can't hammer Codeforces and get the shared hosting IP temporarily banned. |
There was a problem hiding this comment.
Align the proxy note with direct contest fetches
This design note overstates the proxy as a single rate-limiting chokepoint: the Timeline and Bounty pages still call fetchCodeforcesContests(), which fetches https://codeforces.com/api/contest.list directly from the browser instead of going through /api/cf, so those requests bypass the Express rate limiter. As written, the README can mislead maintainers into thinking all Codeforces traffic is protected by the proxy; either qualify the note to the proxied endpoints or route contest fetching through the proxy too.
Useful? React with 👍 / 👎.
|
@codex review |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Adds a 'Design notes' section on why the Express proxy exists (CORS + HTML parsing + rate limiting), why deterministic daily picks are a feature, why the rating band is asymmetric, and why Promise.allSettled instead of Promise.all.