Skip to content

feat: get key ttl from cross cloud; remove unused cloudType from sign… - #1379

Open
pranavs6 wants to merge 1 commit into
mainfrom
feat/keyTTLmultiCloud
Open

pranavs6 wants to merge 1 commit into
mainfrom
feat/keyTTLmultiCloud

Conversation

@pranavs6

@pranavs6 pranavs6 commented Jun 27, 2026

Copy link
Copy Markdown
Member

…ature

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates

Description

Additional Changes

  • This PR modifies the database schema (database migration added)
  • This PR modifies dhall configs/environment variables

Motivation and Context

How did you test it?

Checklist

  • I formatted the code and addressed linter errors ./dev/format-all-files.sh
  • I reviewed submitted code
  • I added unit tests for my changes where possible
  • I added a CHANGELOG entry if applicable

Summary by CodeRabbit

  • New Features

    • Added support for reading TTL values from a secondary Redis source when the primary returns a missing-key result, improving resilience in multi-cloud setups.
  • Bug Fixes

    • Updated multi-cloud Redis list and maybe-list reads to use a more flexible environment access pattern, helping these reads work more reliably across deployments.

@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Updated LTS multi-cloud Redis helpers to use field-based environment access, and added a TTL helper that retries on the secondary LTS Redis when the primary lookup returns -2.

Changes

LTS Redis multi-cloud helpers

Layer / File(s) Summary
Helper constraints
lib/mobility-core/src/Kernel/Storage/Hedis/Queries.hs
runInMultiCloudLTSRedisForList and runInMultiCloudLTSRedisForMaybeList now read primary and secondary LTS Redis environments through HasField constraints instead of HedisLTSFlow.
TTL fallback helper
lib/mobility-core/src/Kernel/Storage/Hedis/Queries.hs
runInMultiCloudLTSRedisForTTL runs the TTL action against the primary environment first, retries on the secondary when the primary returns -2, and keeps the primary result if the secondary call fails.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • vijaygupta18
  • Vignesh-772

Poem

A bunny hops through Redis halls,
Two clouds now answer gentle calls.
If one path says “not here” today,
The second hop will find the way.
🐇✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main change: adding cross-cloud TTL retrieval and cleaning up the unused cloudType parameter.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/keyTTLmultiCloud

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@lib/mobility-core/src/Kernel/Storage/Hedis/Queries.hs`:
- Around line 358-363: The fallback path in runInMultiCloudLTSRedisForTTL is
hiding secondary lookup errors by returning primaryResult after a Left err,
which can make a cross-cloud failure look like a normal TTL miss. Update the
logic in this branch so that secondary read failures are surfaced distinctly
instead of collapsing to the primary result/-2, and keep the existing logging in
place to identify the failure source.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2b37a19a-f0c4-41f8-843c-c38c554b3875

📥 Commits

Reviewing files that changed from the base of the PR and between b4dd2e4 and e307a9d.

📒 Files selected for processing (1)
  • lib/mobility-core/src/Kernel/Storage/Hedis/Queries.hs

Comment on lines +358 to +363
withTryCatch "runInMultiCloudLTSRedisForTTL" $
local (\env -> env{hedisEnv = secondaryEnv, hedisClusterEnv = secondaryEnv}) action
case secondaryResult of
Left err -> do
logError $ "MULTI_CLOUD_LTS: Secondary read failed " <> show err
pure primaryResult

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Don't collapse secondary lookup failures into -2.

When the fallback read errors, pure primaryResult reports "key not found" even though the cross-cloud lookup actually failed. That makes transient secondary outages indistinguishable from a real TTL miss and can drive incorrect caller behavior.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lib/mobility-core/src/Kernel/Storage/Hedis/Queries.hs` around lines 358 -
363, The fallback path in runInMultiCloudLTSRedisForTTL is hiding secondary
lookup errors by returning primaryResult after a Left err, which can make a
cross-cloud failure look like a normal TTL miss. Update the logic in this branch
so that secondary read failures are surfaced distinctly instead of collapsing to
the primary result/-2, and keep the existing logging in place to identify the
failure source.

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.

1 participant