Repository navigation
Allow --trust with --dry-run in q2 add / q2 use brand (bd-cjqhcaz6) - #948
Merged
Merged
Conversation
…use brand Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A non-interactive dry run of a remote source was impossible: without --trust the trust gate refused, and with --trust the flag guard refused. A dry run still downloads the source to build its table/plan, and the trust gate governs that download, so --trust has a job in a dry run. - Both guards now reject only --force with --dry-run. - The no-terminal trust refusal is mode-aware: a dry run is told to re-run with --dry-run --trust, a real run with --trust. - Consent for the fetch stays required in every mode; an interactive dry run still asks before downloading. - Move the localhost archive server and tar_gz fixture into a shared tests/integration/archive_server.rs, used by add and use_brand. - Docs: extensions.qmd and brand.qmd explain the dry-run/trust interaction and why a preview can prompt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
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.
Problem
Without a terminal (
--no-prompt,--json, CI, an agent shell), you could not dry-runq2 addorq2 use brandagainst a remote source. Each error told you to do what the other forbade:--trust: "Refusing to download … Re-run with --trust"--trust: "--trust cannot be combined with --dry-run"The guard's rationale ("--dry-run writes nothing, so there is nothing for --trust to authorize") is right for
--forcebut wrong for--trust. A dry run of a remote source still downloads it to build the[Install]/[Update]/[No Change]table (add) or the file plan (use brand), and the trust gate governs that download.Strand: bd-cjqhcaz6, discovered while installing
posit-dev/product-doc-theme(bd-0i6fii0k).Changes
add/mod.rs,use_cmd/mod.rs): only--forceis rejected with--dry-run. The comments now say why--trustis different.confirm_trustfunctions): a refused dry run is told to re-run with--dry-run --trust, a refused real run with--trust. Both functions already readreq.dry_run, so no new parameter was needed.--trustand with no terminal is still refused before any request. An interactive dry run still asks the trust question before downloading.tar_gzmoved fromadd.rsintotests/integration/archive_server.rssouse_brand.rscan use them too.extensions.qmdandbrand.qmdexplain that a dry run of a remote source needs trust, why a preview can prompt, and that--trustworks with--dry-runwhile--forcedoes not.claude-notes/plans/2026-10-27-trust-with-dry-run.mdrecords the investigation and the design decisions.Tests
New or rewritten. All failed before the fix and pass after it:
add::a_trusted_remote_dry_run_shows_the_table_and_writes_nothing: prints the[Install]table, leaves_extensions/absent, makes exactly one request.add::a_remote_dry_run_without_trust_is_refused_before_any_request: zero requests, and the hint names--dry-run --trust.use_brand::trust_with_dry_run_previews_a_remote_source_and_writes_nothing: replacestrust_with_dry_run_is_rejected.use_brand::a_remote_dry_run_without_trust_is_refused_before_any_requestthe_trust_refusal_hint_matches_the_modeinadd/resolve.rsanduse_cmd/brand.rs.addrefusal test now also checks that the real-run hint does not mention--dry-run.--force --dry-runstays rejected in both commands (existing tests).cargo xtask verify(full, including the hub build) passes locally on macOS.Windows:
cargo clippy -p quarto --all-targets --target x86_64-pc-windows-msvccannot cross-check from macOS: theringandaws-lc-sysbuild scripts fail to compile C for MSVC. The change adds no platform-specific code. The moved test server usesstd::net::TcpListeneron loopback, unchanged from before.🤖 Generated with Claude Code