Skip to content

Commit fa6729b

Browse files
Sync public snapshot from freebuff-private
Source: CodebuffAI/freebuff-private@22fa3a04510e499f1a93a08d5a06be484fbae364
1 parent 08dafc3 commit fa6729b

4 files changed

Lines changed: 35 additions & 6 deletions

File tree

‎bun.lock‎

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎cli/src/utils/__tests__/freebuff-streak-line.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ describe('getFreebuffStreakBonusStatusForLayout', () => {
274274

275275
test('shows the credit and the local reset under the perk note', () => {
276276
expect(getFreebuffStreakBonusStatusForLayout(layout)).toBe(
277-
"Today's +15 is in your wallet · next after 3:00 PM",
277+
'+15 credited · next +15 with your first message after 3:00 PM',
278278
)
279279
})
280280

‎common/src/util/__tests__/freebuff-streak-line.test.ts‎

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,31 @@ describe('getFreebuffStreakBonusStatus', () => {
7979

8080
test('a landed credit says so, and when the next one opens', () => {
8181
expect(getFreebuffStreakBonusStatus({ ...base, todayCredited: true })).toBe(
82-
"Today's +15 is in your wallet · next after 3:00 PM",
82+
'+15 credited · next +15 with your first message after 3:00 PM',
8383
)
8484
})
8585

86+
// The 2026-09-29 Desktop report, as the ledger recorded it: a 17-day streak
87+
// in India, credited at 07:00Z every day (12:30 PM IST). At 11:15 AM IST
88+
// their local day and daily pool had rolled over, but the Pacific streak day
89+
// had not — its +15 had landed at 12:30 PM the previous LOCAL day, and was
90+
// already spent. "Today's +15 is in your wallet" was wrong on both counts.
91+
test('east of Pacific after local midnight, it never calls the credit "today\'s"', () => {
92+
const status = getFreebuffStreakBonusStatus({
93+
streak: 17,
94+
todayUsed: true,
95+
todayCredited: true,
96+
freebucksDailyBonus: 15,
97+
nextResetAt: '2026-09-29T07:00:00.000Z',
98+
now: new Date('2026-09-29T05:45:20.426Z'),
99+
timeZone: 'Asia/Kolkata',
100+
})
101+
expect(status).toBe(
102+
'+15 credited · next +15 with your first message after 12:30 PM',
103+
)
104+
expect(status).not.toMatch(/today|wallet/i)
105+
})
106+
86107
test('a used day without a confirmed credit promises only the next one', () => {
87108
for (const todayCredited of [false, null, undefined]) {
88109
expect(getFreebuffStreakBonusStatus({ ...base, todayCredited })).toBe(
@@ -98,7 +119,7 @@ describe('getFreebuffStreakBonusStatus', () => {
98119
todayUsed: false,
99120
todayCredited: false,
100121
}),
101-
).toBe("Send a message before 3:00 PM for today's +15")
122+
).toBe('Send a message before 3:00 PM to earn +15')
102123
})
103124

104125
test('hidden off the meter, below the milestone, or without a reset', () => {

‎common/src/util/freebuff-streak-line.ts‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ export function formatFreebuffStreakResetTime(params: {
166166

167167
/**
168168
* Where today's Freebucks streak bonus stands, for a 7+ day streak on the
169-
* meter: already in the wallet, still to come with a message, or next due
169+
* meter: already credited, still to come with a message, or next due
170170
* after the reset — with the reset in the reader's own clock. Null off the
171171
* meter, below the milestone, or without a server `nextResetAt` (an older
172172
* server), so a client never guesses the boundary.
@@ -201,12 +201,18 @@ export function getFreebuffStreakBonusStatus(params: {
201201
timeZone: params.timeZone,
202202
})
203203
if (params.todayCredited === true) {
204-
return `Today's +${bonus} is in your wallet · next after ${when}`
204+
// Not "today's": east of Pacific, between local midnight and the Pacific
205+
// reset, the credit landed on the reader's YESTERDAY while their daily
206+
// pool has already refilled — "Today's +15" then reads as a missing
207+
// bonus (2026-09-29 report, 17-day streak in India, credited every
208+
// Pacific day). Nor "in your wallet": the wallet is spent once the daily
209+
// pool runs out, so a credit can be gone by the time this is read.
210+
return `+${bonus} credited · next +${bonus} with your first message after ${when}`
205211
}
206212
// Today already counted, so its first message has been sent: whatever
207213
// became of that credit, the next one belongs to the next day.
208214
if (params.todayUsed) {
209215
return `Next +${bonus} with your first message after ${when}`
210216
}
211-
return `Send a message before ${when} for today's +${bonus}`
217+
return `Send a message before ${when} to earn +${bonus}`
212218
}

0 commit comments

Comments
 (0)