Skip to content

autoclaw 0.2.16: the usage card names the campaign wallet as the source - #770

Closed
yunwang2442-creator wants to merge 1 commit into
magpie-community:mainfrom
yunwang2442-creator:autoclaw/campaign-wallet-source
Closed

yunwang2442-creator wants to merge 1 commit into
magpie-community:mainfrom
yunwang2442-creator:autoclaw/campaign-wallet-source

Conversation

@yunwang2442-creator

Copy link
Copy Markdown
Contributor

Follow-up to #769 (merged as 0.2.15).

Problem

The card shows a bare total (6800 积分) with no hint of where a big balance came from. The campaign rewards that 0.2.15 now claims — AutoClaw Weekly Perks / AutoClaw 用户登录奖励 — land in the wallet with public_wallet_type: reward, while the daily check-in's points live in the daily wallet. A user seeing 6800 cannot tell the one-off campaign grant from the +400 daily.

Fix

usage() names the reward wallet as 活动 in the balance line, and keeps any remaining daily points visible:

6800 积分(活动 奖励积分 6800) · 今日签到剩 400
  • Uses the wallets.v2 response the card already fetches — no new request, no new endpoint.
  • display: false internal wallets are not repeated; the existing parts breakdown is unchanged for accounts without a reward wallet.
  • No change to windows, balance-based routing, or the check-in flow.

Verification

  • bun test packages/autoclaw: 62 pass, 0 fail (Bun 1.3.1). The new case goes red if the campaign split is removed.
  • bun scripts/check.mjs: pass.
  • Live read on intl and CN accounts: 6800 积分(活动 奖励积分 6800) and 6400 积分(活动 奖励积分 6400).

The version bump to 0.2.16 is required for publish.yml (paths: packages/*/package.json) to ship to the dist branch and npm.

A large balance gives no hint of where it came from: usage() showed only the
total ("6800 积分"), while the weekly-perk / login-reward credits paid by the
0.2.15 fix land in the wallet with public_wallet_type=reward. Name that wallet
as 活动 in the balance line (e.g. "6800 积分(活动 奖励积分 6800)")
and keep any remaining daily points visible, so a user can tell a campaign
grant from the daily check-in's +400.

The split comes from the wallets.v2 response already fetched for the card; no
new request, no new endpoint, no change to the windows or routing. Wallets the
card doesn't show (display=false) are not repeated; the parts list is unchanged
for accounts without a reward wallet.

Tests: 62 pass (bun test packages/autoclaw); the new case goes red if the
campaign split is removed. bun scripts/check.mjs passes.
@yunwang2442-creator
yunwang2442-creator deleted the autoclaw/campaign-wallet-source branch November 5, 2026 20:05

@yetone yetone left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks. I reviewed f637e25 line by line and ran it on a remote box (Bun 1.4.2, HOME=$(mktemp -d)). Requesting changes, because the card now names the same wallet twice, including in this PR's own fixture.

What's fine

  • Based on 6fa3f48. It merges cleanly over f58fa9d and keeps that comment fix and #769.
  • Only the balance string changes. windows, the 积分余额 balance window, 本轮消耗 and routing are unchanged.
  • 0.2.16 is the next version after dist's latest (0.2.15).
  • bun test (6186 pass, 0 fail) and bun scripts/check.mjs pass. With only the test file applied, the new test fails on main (Received: "6800 积分(奖励积分 6400)").

1. The reward wallet is listed twice. named (the existing parts list) still includes the reward row whenever its balance differs from the total, so campaignPart and parts both print it. Here is usage().balance at the PR head:

PR's own fixture (reward 6400 visible, daily 400 display:false, total 6800):
6800 积分(活动 奖励积分 6400) · 今日签到剩 400(奖励积分 6400)

reward 6400 + daily 400, both visible (no display field), total 6800:
6800 积分(活动 奖励积分 6400) · 今日签到剩 400(奖励积分 6400 · 每日积分 400)

The body says "the existing parts breakdown is unchanged", and that is the bug: the breakdown should drop the rows that are now named on their own. The live examples in the body (6800 积分(活动 奖励积分 6800)) have reward equal to the total. named filters that row out, so the duplicate path was never exercised.

2. display: false is not respected for the daily wallet. The commit says "Wallets the card doesn't show (display=false) are not repeated", but dailyWallet has no display check. In the fixture the daily row is display: false and it is still printed as 今日签到剩 400. When the daily row is visible, it is printed twice (second case above).

3. "今日签到剩 N" claims more than the data says. It prints the daily wallet's balance, which is not "what is left of today's check-in". Is the daily wallet reset each day? Does the check-in credit land there, and only there? The same goes for "活动": does reward hold only campaign credits, or also redeem codes and gifts? There is no real wallets.v2 body in the repo with public_wallet_type. Please paste a redacted real response (field names, types and the display flags) from an account where reward ≠ total. A label should say only what the field is known to mean. If that isn't known, 奖励积分 6400 as it already shows is accurate.

4. The test can't catch any of this. It uses toContain and startsWith, so the duplicate passes. Please assert the whole string with toBe, and add cases for:

  • reward ≠ total with a visible daily row;
  • a display: false daily row;
  • reward == total;
  • no typed wallets. The old 赠送积分/会员积分 shape must stay byte-identical.

5. Shape. 总(活动 …) · 今日签到剩 N(…) puts two bracket groups around a ·. One bracket group is easier to read, e.g. 6800 积分(活动 奖励积分 6400 · 每日积分 400), with each wallet printed once. Please update the README example to match.

Repro: a test file that calls hooks.auth.usage with each wallets fixture above and prints balance. The outputs are pasted as printed.

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