feat(ads-client): add data_dir support with context_id persistence#7221
Draft
Almaju wants to merge 1 commit intomozilla:mainfrom
Draft
feat(ads-client): add data_dir support with context_id persistence#7221Almaju wants to merge 1 commit intomozilla:mainfrom
Almaju wants to merge 1 commit intomozilla:mainfrom
Conversation
Introduce AdsClientBuilder with a data_dir option that allows the component to manage its own persistent files (cache DB, context_id) in a dedicated ads-client/ subdirectory. Data dir resolution follows a fallback chain: 1. Explicit data_dir provided via builder 2. Parent directory of legacy cache_config.db_path 3. $HOME environment variable (iOS, macOS, Linux, Windows) 4. $APPDATA / $LOCALAPPDATA (Windows fallback) When resolved, context_id is persisted to a file so the 3-day rotation actually works across app restarts (previously a fresh UUID was generated on every client init, making rotation meaningless). Changes: - New client/builder.rs: AdsClientBuilder with all resolution, cache building, and context_id persistence logic - Simplified AdsClient::new() to accept pre-built components - Added try_build() to MozAdsClientBuilder (returns Result) - Deprecated build() in favor of try_build() - Added data_dir() method to MozAdsClientBuilder - Removed unused AdsCacheConfig and AdsClientConfig types - Added BuildError enum (NoDataDir, CreateDataDir)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduce AdsClientBuilder with a data_dir option that allows the component to manage its own persistent files (cache DB, context_id) in a dedicated ads-client/ subdirectory.
Data dir resolution follows a fallback chain:
When resolved, context_id is persisted to a file so the 3-day rotation actually works across app restarts (previously a fresh UUID was generated on every client init, making rotation meaningless).
Changes:
Pull Request checklist
[ci full]to the PR title.