You are working on the hyperswitch repository (Rust payment processing system).…
- User
You are working on the hyperswitch repository (Rust payment processing system).
REPOSITORY SETUP:
- Repository: juspay/hyperswitch
- Working directory: ./repos/hyperswitch_pool_8 (already cloned)
- Base commit: 839eb2e8fb436ec0a79fe0073923fcb060b42cfc
- Task ID: juspay__hyperswitch-7933
- Version: v1.114.0
TASK DESCRIPTION: Bug: Persist Last Used Lineage Context in Database Instead of Redis
Currently, the last used lineage context (org_id, merchant_id, profile_id, role_id, tenant_id) is cached temporarily in Redis with a 7-day TTL. While this improves user experience across sessions, it introduces problems like:
- Redis is volatile — lineage context is lost if redis crashes
- Users switching between v1/v2 deployments have inconsistent Redis prefixes, leading to stale context (this has been fixed)
- Adds unnecessary dependency on Redis for critical authentication flow.
Objectives:
- Move the lineage context storage from Redis to the database (preferably to the users table as a new column).
- Ensure lineage context is persistently stored and updated in DB.
Tasks:
-
Add a new nullable last_used_lineage_context (JSON/JSONB) column to the users table.
-
Modify lineage context get and set helpers to use the DB instead of Redis.
DETAILED CONTEXT & HINTS:
Type of Change
- Bugfix
- New feature
- Enhancement
- Refactoring
- Dependency updates
- Documentation
- CI/CD
Description
Previously, the user's
lineage_context(userid, org_id, merchant_id, profile_id, role_id, tenant_id) was cached in Redis. This PR moves the storage and retrieval oflineage_contextto the PostgreSQLuserstable instead of Redis.This ensures permanent persistence of lineage_context in DB, as opposed to the 7 days TTL when stored in Redis.
Assistant
I'll help you implement the feature to persist the last used lineage context in the database instead of Redis. Let me start by understanding the current implementation and identifying the key files that need to be modified.
Assistant
Let me first explore the codebase to understand the current lineage context implementation and locate the relevant files.
Assistant
(no content)
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.