qoder 0.2.32: a check-in offered nothing with this device's own identity says so, and that Qoder desktop can claim it (#304)

ReneXiong (#304): on Linux ARM64 with Qoder CLI 1.1.78 signed in, the
plugin read the CLI's runtime-info and sent its identity, and the campaigns
list had no CLAIM_BENEFIT, while the same account and device token with the
macOS desktop's identity listed a claimable 100. The check-in answered a
bare { outcome: "inactive" }, with nothing saying why.

Now that branch (identity read and sent, list has no CLAIM_BENEFIT) is
inactive with a message: "<site> check-in: <site> offered this device's
identity, read from this machine's own <site> runtime-info, no daily
credits campaign right now. <site> decides per device whether to offer it;
if <site> desktop shows today's credits, claim them there". It names only
what the plugin knows: the identity came from this machine's runtime-info
and the list offered nothing. It does not say whether the runtime was the
CLI's or the desktop's, nor why Qoder offered none. Outcome is unchanged
(still inactive), so magpie's day logic is the same. "no campaigns page
for this account" and the ineligible/failed paths are unchanged.

Run: TMPDIR=<scratch> HOME=<scratch>/h bun test packages/qoder: 202 pass,
0 fail (native-checkin.test.mjs: one test rewritten, one CN test new).
Repo root, same sandbox: 2381 pass, 0 fail. bun scripts/check.mjs qoder ok.
Broken by hand: with origin/main's index.mjs both tests are red (message
undefined).

Not tried: a real Qoder account; the wording is from the code path, not a
live answer.
This commit is contained in:
yetone
2026-10-24 14:21:16 +08:00
parent d1b65007ff
commit 74be6323e3
4 changed files with 38 additions and 4 deletions
+7
View File
@@ -296,6 +296,13 @@ the account's credentials.
- A helper that is there but can't be read, or gives an invalid identity,
is `failed` and asked again later, rather than a false "no activity"
result.
- With the identity read and sent, a list with no daily claim is
`inactive`, with a message (since 0.2.32) saying Qoder offered this
device's identity no daily credits campaign, that Qoder decides that per
device, and that the credits can be claimed in Qoder desktop when it
shows them (#304: a Linux CLI identity was offered none while the same
account's desktop identity was). The plugin never sends another
device's identity.
Qoder CN (since 0.2.30) sends its own device identity the same way when
Qoder CN is installed: its desktop 0.4.9 and CLI (`qoderclicn`) both ask
+11 -1
View File
@@ -1655,6 +1655,12 @@ class RuntimeMissing extends Error {
}
}
// noCampaign is why a check-in asked with this machine's own device
// identity found nothing to claim: all the list says is that it offered
// that identity no daily credits, not why.
const noCampaign = (name) =>
`${name} check-in: ${name} offered this device's identity, read from this machine's own ${name} runtime-info, no daily credits campaign right now. ${name} decides per device whether to offer it; if ${name} desktop shows today's credits, claim them there`
// Read the SDK identity as Qoder does: environment 3 is international, 0
// Qoder CN; on Windows and macOS the uid goes over stdin, never into the
// command line.
@@ -2094,7 +2100,11 @@ const makePlugin = (site) => async ({ client }) => {
// (no Qoder CN on this machine) or ask again (it didn't answer).
if (unread instanceof RuntimeMissing) return { outcome: "ineligible", message: unread.message }
if (unread) return { outcome: "failed", message: unread.message }
return { outcome: "inactive" }
// Asked with this machine's own identity and still offered nothing:
// Qoder decides per device (plugins#304, a Linux CLI identity was
// offered none while the same account's desktop identity was), so
// say that much, and where the credits can still be claimed.
return { outcome: "inactive", message: noCampaign(site.name) }
}
const claimRes = await call(base.replace(/\/$/, "") + "/" + encodeURIComponent(campaign.campaignId) + "/claim", "POST", "{}")
let claim = {}
+19 -2
View File
@@ -80,9 +80,26 @@ test("an already-claimed campaign is done without another claim", async () => {
expect(p.seen.map((x) => x.path)).toEqual(["/sash/api/v1/me/campaigns"])
})
test("no benefit campaign is inactive", async () => {
// plugins#304 (ReneXiong): the identity was read and sent, and the list
// still had no CLAIM_BENEFIT. Qoder decides that per device, so the answer
// says it was this device's identity that was offered nothing, and that
// Qoder desktop can still claim it, instead of a bare "inactive".
test("no benefit campaign is inactive, saying this device's identity was offered none", async () => {
const p = await checkin(QoderAuthPlugin, () => json({ campaigns: [{ campaignId: "x", actionType: "VIEW_DETAILS", claimStatus: "CLAIMABLE" }] }))
expect(p.out).toEqual({ outcome: "inactive" })
expect(p.out.outcome).toBe("inactive")
expect(p.out.message).toContain("Qoder offered this device's identity")
expect(p.out.message).toContain("no daily credits campaign")
expect(p.out.message).toContain("claim them there")
expect(p.out.message).toContain("Qoder desktop")
expect(reads).toHaveLength(1)
})
test("CN offered nothing with Qoder CN's own identity is inactive, naming Qoder CN", async () => {
const p = await checkin(QoderCNAuthPlugin, () => json({ campaigns: [] }), "https://openapi.qoder.com.cn")
expect(p.out.outcome).toBe("inactive")
expect(p.out.message).toContain("Qoder CN offered this device's identity")
expect(p.out.message).toContain("Qoder CN desktop")
expect(reads).toHaveLength(1)
})
test("a claim answer with nested data is read", async () => {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@magpie-community/opencode-qoder-auth",
"version": "0.2.31",
"version": "0.2.32",
"description": "Qoder subscriptions in OpenCode and magpie: Qoder (qoder.com) and Qoder CN (qoder.cn)",
"type": "module",
"main": "./index.mjs",