refactor(trace): dedupe downloads_dir secret resolution into one helper - #494
Open
HappyDevs1 wants to merge 1 commit into
Open
refactor(trace): dedupe downloads_dir secret resolution into one helper#494HappyDevs1 wants to merge 1 commit into
HappyDevs1 wants to merge 1 commit into
Conversation
The ${VAR}-resolution ladder for a browser's downloads_dir was
copy-pasted verbatim in three places (recorder.rs, cli/lib.rs,
replay/lib.rs), each feeding WebBrowserConfig::from_setup_parts. Three
copies of secret-resolution code is exactly the shape where a future
change lands in two of three places and the third silently regresses.
resolve_downloads_dir() now lives once in flowproof_trace::secret,
next to resolve_refs which it composes. Each call site keeps its own
existing error-conversion idiom. Pure refactor, no behavior change.
Fixes #491
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.
Summary
${VAR}-resolution ladder for a browser'sdownloads_dirwas copy-pasted verbatim in three places —flowproof-agent'sweb_browser_from_setup,flowproof-cli'sstage_surface_browser, andflowproof-replay'srun_trace_with_exports— each feedingWebBrowserConfig::from_setup_parts. Secret-resolution code with three copies is exactly the shape where a future fix or rule change lands in two of three places and the third silently regresses.resolve_downloads_dir()tocrates/flowproof-trace/src/secret.rs, next toresolve_refs/resolve_refs_in_jsonwhich it composes. All three call-site crates already depend onflowproof-tracedirectly, so no new dependency edges.?/#[from] MissingSecretvs. the CLI's manualmap_err).viewport/user_agent/args/clock/random/downloads_dirinto a struct, no change tofrom_setup_parts's#[allow(clippy::too_many_arguments)]— that's a larger, separate refactor.${VAR}-resolution path (all constructeddownloads_dir: None).Test plan
cargo test -p flowproof-trace -p flowproof-agent -p flowproof-cli -p flowproof-replay— all suites green, 0 failurescargo fmt --checkcargo clippy -p flowproof-trace -p flowproof-agent -p flowproof-cli -p flowproof-replay --all-targets -- -D warningsPure refactor — no behavior change.
Fixes #491
🤖 Generated with Claude Code