Fix #38: add typed Redis wrapper and domain types#53
Conversation
… functions - Create app/lib/types.ts with Bounty, Bid, Cast, and parsed types - Create app/lib/redis.ts with shared getRedis singleton and typed helpers - Refactor autonomous/route.ts: all 7 functions use Bounty/Redis types - Refactor settle/route.ts: remove getBountyFromRedis/updateBountyInRedis, use types - Refactor webhook/route.ts: typed casts, remove duplicate Groq block - Refactor poller/casts/route.ts: inline Redis ops with Bounty/Bid types - Fix potential taskDescription undefined crash in webhook handleAssigned
|
Deployment failed with the following error: Learn More: https://vercel.link/3Fpeeb1 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 99939b8f57
ℹ️ 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".
| export async function saveBounty(bounty: Bounty): Promise<void> { | ||
| const redis = await getRedis(); | ||
| if (!redis) return; | ||
| await redis.set(`bounty:${bounty.id}`, JSON.stringify(bounty)); |
There was a problem hiding this comment.
Index saved bounties for status queries
Update saveBounty to maintain the same Redis indexes used by readers: it currently writes only bounty:<id>, but getBountiesByStatus enumerates bounties:all (and getOpenBounties relies on bounties:open). Any bounty persisted through this new helper will be invisible to those query helpers, so workflows that save then list bounties by status will return incomplete/empty results.
Useful? React with 👍 / 👎.
Summary
app/lib/types.tswithBounty,Bid,Cast, parsed interfaces +parseBounty/parseBidvalidatorsapp/lib/redis.tswith sharedgetRedis()singleton + typed helpers:getBounty,saveBounty,getBid,saveBid,getBountiesByStatus,updateBountyStatus,getOpenBountiesautonomous/route.ts: all 7 functions (getBounties, checkTaskCapabilities, evaluateWithAI, submitBid, acceptBid, settleBounty, executeTask) use concreteBountyandRedistypes instead ofanysettle/route.ts: eliminate localgetBountyFromRedis/updateBountyInRedis, use shared singletonwebhook/route.ts: typed cast params, fix duplicate Groq block bugpoller/casts/route.ts: typed Redis param + inline typed bounty/bid constructiontaskDescriptionundefined crash in webhookhandleAssigned