Skip to content

feat: prepare Worker API for release - #60

Merged
MagicTheDev merged 28 commits into
mainfrom
feat/effect-rewrite
Sep 9, 2026
Merged

MagicTheDev merged 28 commits into
mainfrom
feat/effect-rewrite

Conversation

@MagicTheDev

Copy link
Copy Markdown
Member

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-api Worker. Publishing a GitHub Release tagged to the shared package version now builds and attaches immutable @clashking/api-contracts and @clashking/api-client archives with an integrity manifest.

Validation:

  • npm run typecheck
  • npm test (1,283 tests)
  • npm run test:scripts
  • npm run lint
  • npm run worker:dry-run
  • real package-pair build and pack for v0.1.0-rc.4

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 6, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-09T05:16:31.086322Z e56bd7a New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Comment thread .github/workflows/ci.yml Fixed
Comment thread .github/workflows/ci.yml Fixed
Comment thread scripts/api-documentation-navigation.test.mjs Fixed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread workers/api/src/stats.ts Outdated
Comment thread packages/api-client/src/index.ts
Comment thread packages/api-client/src/index.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread workers/api/src/database.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread wrangler.jsonc Outdated
Comment thread workers/api/src/ticket-json-transcript.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread workers/api/src/bot-adjacent-runtime.ts
Comment thread workers/api/src/app-content-notifications.ts
Comment thread packages/api-client/src/index.ts Outdated
Comment thread workers/api/src/public-metadata-runtime.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread wrangler.jsonc Outdated
Comment thread workers/api/src/database.ts Outdated
Comment thread scripts/local-admin-identity.mjs Fixed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread workers/api/src/bot-adjacent-runtime.ts
Comment thread workers/api/src/dashboard-roster-ai-context.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment on lines +60 to +61
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" }) },

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

Comment on lines +47 to +48
const fetchDiscord = (request: Request) => Effect.tryPromise({
try: async () => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

Comment thread workers/api/src/proxy.ts
? {}
: { body: request.body }),
})
const response = await bindings.CLASH_PROXY.fetch(upstream)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@MagicTheDev
MagicTheDev merged commit da0d691 into main Sep 9, 2026
6 checks passed
@MagicTheDev
MagicTheDev deleted the feat/effect-rewrite branch September 9, 2026 06:03
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