Skip to content

Sync v2: Remove direct integration with set_if_absent#9012

Merged
CDRussell merged 2 commits into
developfrom
feature/craig/sync_exchange_v2_remove_direct_set_if_absent_integration
Jun 26, 2026
Merged

Sync v2: Remove direct integration with set_if_absent#9012
CDRussell merged 2 commits into
developfrom
feature/craig/sync_exchange_v2_remove_direct_set_if_absent_integration

Conversation

@CDRussell

@CDRussell CDRussell commented Jun 25, 2026

Copy link
Copy Markdown
Member

Task/Issue URL: https://app.asana.com/1/137249556945/project/1203822806345703/task/1216036247181808?focus=true
Tech Design URL (if applicable):

Description

Drop the direct POST /sync/keys/.../set-if-absent call from the 3party credential creation flow which previously existed as its own distinct step. Removing this also means we can remove some now-redundant dev tooling for it.

Steps to test this PR


Note

Medium Risk
Changes the sync v2 crypto path for first-time ai_chats keys and 3party credential setup; mistakes could break scoped login or key consistency, though behavior is localized to the 3party credential flow behind the v2 feature flag.

Overview
3party credential creation no longer calls POST /sync/keys/.../set-if-absent or uses ProtectedKeyManager. When the account has no ddg-wrapped ai_chats key, the client mints an RSA keypair via mintDdgWrappedProtectedKey and includes both ddg and 3party ProtectedKeyEntry rows (same kid) in the POST /access-credentials/3party keys[] payload, alongside re-wrapped existing ddg keys.

The setProtectedKeyIfAbsent Retrofit/API surface, SyncAccountRepository.createProtectedKey, ProtectedKeyManager, and related tests/dev UI (“Create Protected Key”) are removed. ThirdPartyCredentialManager adds bounded retries on concurrent_modification 409s for that credential POST and broadens 409 handling messaging before the adopt-existing-credential path.

Reviewed by Cursor Bugbot for commit b0288d5. Configure here.

CDRussell commented Jun 25, 2026

Copy link
Copy Markdown
Member Author

@CDRussell CDRussell changed the base branch from develop to graphite-base/9012 June 25, 2026 15:07
@CDRussell CDRussell force-pushed the graphite-base/9012 branch from b70ae25 to 63e932f Compare June 25, 2026 15:08
@CDRussell CDRussell force-pushed the feature/craig/sync_exchange_v2_remove_direct_set_if_absent_integration branch from c69e02b to 717a48c Compare June 25, 2026 15:08
@CDRussell CDRussell changed the base branch from graphite-base/9012 to feature/craig/fix/craig/sync_exchange_v2_remove_sleep June 25, 2026 15:08
@CDRussell CDRussell force-pushed the feature/craig/fix/craig/sync_exchange_v2_remove_sleep branch from 63e932f to 15b9f51 Compare June 25, 2026 15:23
@CDRussell CDRussell force-pushed the feature/craig/sync_exchange_v2_remove_direct_set_if_absent_integration branch from 717a48c to e0ac7f9 Compare June 25, 2026 15:23
@CDRussell CDRussell force-pushed the feature/craig/fix/craig/sync_exchange_v2_remove_sleep branch from 15b9f51 to 00e6b25 Compare June 26, 2026 10:30
@CDRussell CDRussell force-pushed the feature/craig/sync_exchange_v2_remove_direct_set_if_absent_integration branch from e0ac7f9 to ab87bae Compare June 26, 2026 10:30
@CDRussell CDRussell changed the base branch from feature/craig/fix/craig/sync_exchange_v2_remove_sleep to graphite-base/9012 June 26, 2026 10:56
@CDRussell CDRussell force-pushed the feature/craig/sync_exchange_v2_remove_direct_set_if_absent_integration branch from ab87bae to 9adc18b Compare June 26, 2026 10:56
@CDRussell CDRussell force-pushed the graphite-base/9012 branch from 00e6b25 to db6a0bf Compare June 26, 2026 10:56
if (isConcurrentMod && attempt < MAX_CONCURRENT_MODIFICATION_RETRIES) {
attempt++
logcat { "Sync-ScopedToken: 3party credential POST hit concurrent_modification; retry $attempt/$MAX_CONCURRENT_MODIFICATION_RETRIES" }
runCatching { Thread.sleep(CONCURRENT_MODIFICATION_RETRY_DELAY_MILLIS * attempt) }

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

will switch to coroutine / delay in higher branch

@CDRussell CDRussell force-pushed the feature/craig/sync_exchange_v2_remove_direct_set_if_absent_integration branch from 9adc18b to b0288d5 Compare June 26, 2026 12:04
@CDRussell CDRussell changed the base branch from graphite-base/9012 to feature/craig/sync_exchange_v2_upgrade_flow_use_same_hashed_password June 26, 2026 12:04
@CDRussell CDRussell marked this pull request as ready for review June 26, 2026 12:05
@CrisBarreiro

Copy link
Copy Markdown
Collaborator

Looks good but retry on "concurrent_modification" and “stop after max retries” branches could use some testing

CDRussell commented Jun 26, 2026

Copy link
Copy Markdown
Member Author

Merge activity

  • Jun 26, 4:45 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jun 26, 4:47 PM UTC: Graphite rebased this pull request as part of a merge.
  • Jun 26, 4:59 PM UTC: @CDRussell merged this pull request with Graphite.

@CDRussell CDRussell changed the base branch from feature/craig/sync_exchange_v2_upgrade_flow_use_same_hashed_password to graphite-base/9012 June 26, 2026 16:45
@CDRussell CDRussell changed the base branch from graphite-base/9012 to develop June 26, 2026 16:45
@CDRussell CDRussell force-pushed the feature/craig/sync_exchange_v2_remove_direct_set_if_absent_integration branch from b0288d5 to daef8d3 Compare June 26, 2026 16:46
@CDRussell CDRussell merged commit 8343770 into develop Jun 26, 2026
12 checks passed
@CDRussell CDRussell deleted the feature/craig/sync_exchange_v2_remove_direct_set_if_absent_integration branch June 26, 2026 16:59
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.

2 participants