Skip to content

fix(mobile): hide expired bonus credits on the profile credits card - #7933

Open
iscekic wants to merge 1 commit into
mainfrom
drain/profile-bonus-expiry
Open

iscekic wants to merge 1 commit into
mainfrom
drain/profile-bonus-expiry

Conversation

@iscekic

@iscekic iscekic commented Oct 17, 2026

Copy link
Copy Markdown
Collaborator

Change

  • Include only grants whose expiry is strictly later than the current render time in the Profile bonus-credit amount and earliest expiry.
  • Apply the same filtering to personal and organization credits; leave the queried balance unchanged.
  • Add mounted regression coverage for elapsed grants, the exact expiry boundary, non-expiring grants, and mixed future grants.
  • Document the render-time behavior. No additional expiry timer.

Verification

  • Reproduced both regression cases before the fix; the targeted mounted suite now passes all 21 tests.
  • pnpm --filter kilo-app run typecheck — passed.
  • pnpm --filter kilo-app run lint — passed, zero warnings/errors.
  • Changed-file formatting and git diff --check — passed.
  • Actual iOS simulator dev client, local Metro and isolated local backend/database with a fake account: Profile at zero balance with elapsed grants displays no bonus subtitle. A mixed elapsed/future fixture displays only the future grant amount and future expiry. Add credits and balance visibility controls remain present.
  • Optional analytics disabled before required test-account consent. No payment or AI task performed. Native accessibility snapshots and screenshots retained with the session evidence.

Proxy answers

The owner's proxy gave these answers in the owner's place.

  1. Question: Expiry updates: Keep this fix to filtering at each render using the current time, or also add live expiry scheduling while the Profile stays open?
    Answer: Filter on render
    Confidence: 0.85 · Precedent: Speed and least work: "do the least amount of work possible, with no drop in quality" (session 7f3470e0ba6f)

@iscekic iscekic added drain Work item from the findings drain explorer:ios Finding surfaced by the iOS explorer labels Oct 17, 2026
@kilo-code-bot

kilo-code-bot Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

The Profile credits card now filters bonus grants by render-time expiry, and I found no bugs, security, or memory-leak issues in the changed lines; the change is small, well-typed, and covered by mounted tests.

Notes

  • apps/mobile/src/components/profile-credits-card.tsx:113-117 — now is read once per render and the filter uses parseTimestamp(b.expiry_date).getTime() > now, matching the documented decision to filter on render without an extra expiry timer. Non-null narrowing holds because CreditBlockSchema.expiry_date is z.string().nullable() (no undefined), and parseTimestamp never throws (invalid input yields NaN, which is excluded).
  • apps/mobile/src/components/profile-credits-card.mounted.test.tsx:284-312 — the new it.each covers elapsed grants, the exact boundary (2026-10-17T12:00:00Z excluded), non-expiring grants, and a mixed future grant, restores the Date.now spy in finally, and unmounts the renderer. No timer or subscription is introduced, so nothing leaks.
  • apps/mobile/README.md:14-19 — documentation matches the implemented behavior (strictly-future expiries, both personal and org, balance unchanged) and uses no images.

Review was performed read-only; I did not execute the tests or lint, so the PR's own verification claims were not independently reproduced.

Files Reviewed (3 files)
  • apps/mobile/README.md
  • apps/mobile/src/components/profile-credits-card.mounted.test.tsx
  • apps/mobile/src/components/profile-credits-card.tsx

Reviewed by deepseek-v4.1-flash · Input: 67.1K · Output: 5.6K · Cached: 523.6K

Review guidance: REVIEW.md from base branch main

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

drain Work item from the findings drain explorer:ios Finding surfaced by the iOS explorer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant