Repository navigation
feat: prepare Worker API for release - #60
Conversation
Co-authored-by: Codex
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
clashking-api | e56bd7a | Commit Preview URL Branch Preview URL |
Sep 09 2026, 05:07 AM |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b4ef578389
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9523dc4c52
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f89281ae2a
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4f80cf2379
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d2ac65b1e8
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1a742d50d2
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d5154ee1d8
ℹ️ 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".
| try: (signal) => bindings.CLASH_PROXY.fetch(new Request(`http://clash-proxy.internal/v1/${path}`, { | ||
| signal, method: body === undefined ? "GET" : "POST", headers: { accept: "application/json", ...(body === undefined ? {} : { "content-type": "application/json" }) }, |
There was a problem hiding this comment.
Add a timeout to Clash link verification
When the Clash proxy accepts a link lookup or token-verification request but never returns headers, this helper waits until platform termination because the surrounding link routes apply no Effect timeout. As a result, POST /v2/links/:userId and server-scoped linking can remain pending indefinitely; combine the interruption signal with the bounded timeout already used by the other Clash proxy callers.
Useful? React with 👍 / 👎.
| const fetchDiscord = (request: Request) => Effect.tryPromise({ | ||
| try: async () => { |
There was a problem hiding this comment.
Propagate Effect interruption through Discord retries
When a request fiber is interrupted while Discord is returning 429s, this Effect.tryPromise callback ignores its interruption signal, so the delay and subsequent Discord retry continue after the caller has canceled. The current API-client transport now bridges this signal, but this internal transport remains independently affected; make both the delay and fetches abortable by the supplied Effect signal.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e56bd7a197
ℹ️ 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".
| if (name !== "" && !translated.toLowerCase().includes(name)) continue | ||
| if (village !== "" && villageCategories.has(category) && item.village.toLowerCase() !== village) continue | ||
| if (query.type && category === "buildings" && item.type !== query.type) continue | ||
| if (query.category && category === "troops" && query.category !== "") continue |
There was a problem hiding this comment.
Preserve troop categories when filtering names
When /v2/static/troops/names receives any nonempty category query, this condition is always true and skips every troop, so valid filters return an empty list. The R2 decoder also discards each item's category; retain that field and compare it with query.category as the replaced implementation did.
Useful? React with 👍 / 👎.
| ? {} | ||
| : { body: request.body }), | ||
| }) | ||
| const response = await bindings.CLASH_PROXY.fetch(upstream) |
There was a problem hiding this comment.
Bound public proxy service requests
If the Clash service binding never returns response headers, an authenticated /proxy/v1/* request remains pending because this fetch has neither an abort signal nor a timeout, and the entrypoint applies no outer bound. Pass the Effect interruption signal and a bounded timeout into the upstream request so stalled providers and disconnected callers do not leave Worker invocations hanging.
Useful? React with 👍 / 👎.
The API still depended on the retired Go server and committed generated artifacts, while the completed Effect Worker rewrite was not connected to a production build or API release lifecycle.
This change makes the TypeScript Worker the maintained API implementation, removes the obsolete Go/Sonar/generated files, consumes the authoritative Clash wire contract, keeps proxy operations out of public Swagger, and adds a Cloudflare Git deploy command for the
clashking-apiWorker. Publishing a GitHub Release tagged to the shared package version now builds and attaches immutable@clashking/api-contractsand@clashking/api-clientarchives with an integrity manifest.Validation:
npm run typechecknpm test(1,283 tests)npm run test:scriptsnpm run lintnpm run worker:dry-runv0.1.0-rc.4