Skip to content

fix(apps): retry without re-granting trust from the trust-saved dialog state - #23257

Merged
bolichen97 merged 1 commit into
mainfrom
fix/trust-retry-no-regrant-21459
Oct 23, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
fix/trust-retry-no-regrant-21459

Conversation

@JLargent42

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: In the app trust dialog's trust-saved state, "Try again" retries the action and writes no trust.

After a trust grant lands and the retried enable, install or update fails, the dialog shows the trust-saved state with a "Try again" button. That button ran the same handler as the first consent, which writes the trust grant again before retrying. A trust the user removed in Settings while the dialog stayed open was written back by a button whose label does not mention trust.

Why it matters

A trust grant lets an app run its own code. A control that writes one must say so; a retry button that silently re-writes a grant the user just removed undoes their decision.

Not a goal

  • Changing the first consent click, the not-saved retry, or the orphan-grant rollback.
  • Changing any dialog copy or label.
  • Server-side trust checks.

What changed (motivation → approach → change)

The symptom is a trust grant written by "Try again". The cause is that useTrustGate().confirm always called api.trustApp before gate.retry, whatever state the dialog was in.

confirm now reads the granted state. When the dialog is in the trust-saved state, it skips api.trustApp and calls only gate.retry. If that retry is refused because the trust is missing (isTrustDeniedError), the earlier grant no longer stands: nothing is rolled back, and the dialog moves to the not-saved state, whose "trust and try again" button names the grant it writes. The trusted-apps views are refreshed on that path too. The app detail page's install and update retry now throws its trust refusal with the code property set, so the dialog recognizes it the same way as a refused enable. The first click and the not-saved retry still write trust exactly as before.

Backwards compatibility

Compatible: the first consent and the not-saved retry behave as on main; only the trust-saved retry stops writing a grant.

Removes nothing: the change drops a redundant write from one button; no path, record, key or function is removed.

Tests

website/src/test/TrustAppModal.test.tsx:

  • retries without writing trust again from the trust-saved state (#21459): after a landed grant and a failed retry, "Try again" re-runs the enable and trustApp stays at one call.
  • returns to the not-saved state when the trust-saved retry finds the trust gone (#21459): on the Library enable path, a retry refused for missing trust shows the trust-and-retry button, writes no trust and rolls nothing back.
  • returns the update dialog to the not-saved state when the trust-saved retry finds the trust gone (#21459): the same on the app detail page's update path.

The first two fail against main's TrustAppModal.tsx, and the third fails against main's AppDetailPage.tsx; all pass with the fix. Each new test passed under 5 shuffled-order runs. TrustAppModal, AppDetailPage*, useAppUpdates and DiscoverPage.updatesTab suites: 194/194 pass. tsc -p tsconfig.app.json and eslint clean.

Manual verification

N/A — unit coverage sufficient: the change is one branch in a hook, exercised end to end through the Library page in the tests above.

Screenshots / video

Why no screenshot: no component, string or layout changes; the dialog renders the same existing states, and only the handler behind one button changes.

Related Issues

Closes #21459

Sibling sweep

Swept: git grep -n "api.trustApp|trustApp(|new Error(APP_EXECUTION_DENIED" -- website/src
Sibling: website/src/pages/AppDetailPage.tsx -- changed here -- its retry threw the trust refusal without a code.

Pattern harvest

Not generalizable: the defect is one handler shared by two dialog states with different labels; no repeatable code shape to lint for.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@JLargent42
JLargent42 requested review from a team and KiroCrewCaptain as code owners October 23, 2026 00:25
@JLargent42
JLargent42 requested a review from CrysisDeu October 23, 2026 00:25
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 23, 2026
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of f743a21c008b6207a0761b87deed5546c0a0eede — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: a small handler fix for a real consent bug, with every retry path now reporting trust refusals by code.

Notes

  • Retries now depend on each retry callback throwing an error that carries code: APP_EXECUTION_DENIED. Without it, a missing grant leaves the dialog in an endless "Try again" loop that never writes trust again. Today's callers meet this: the detail page's install and update now throw the code, and useAppUpdates.retryUpdate throws the API error. A new trust.open(…, retry) caller that throws a bare Error would bring the loop back.

[DESIGN-REVIEWED] f743a21

Description read

[DESCRIPTION-READ] b507c2786e6579b8390d80af0a11c8fba7cc1a37ef314563ccb6ca2d2982ed16

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of f743a21c008b6207a0761b87deed5546c0a0eede — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

Nothing blocks: no control, string or layout changes. "Try again" now does only what its label says, and a missing trust lands in the existing not-saved state, whose button says it writes trust.

[UX-REVIEWED] f743a21

Description read

[DESCRIPTION-READ] daa79fc2a0b1314ec332aaf465a9d427f81a6a669b4a9aa0d56961f4bbacda1d

That sha256 names everything this verdict read: the PR description, plus the 3 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of f743a21c008b6207a0761b87deed5546c0a0eede — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing blocks. The fix is in the shared confirm handler, where the defect starts, and the one other place that throws the trust refusal is fixed in the same change.

What this change ships

Inventory (4 items) — 4 justified

Intent: when a user clicks "Try again" in the trust-saved dialog, only the action is retried and no trust grant they may have removed gets written back (#21459). FIX.

  1. The trust-saved "Try again" no longer writes a trust grant before retrying — justified
  2. If that retry is refused because trust is missing, the dialog goes back to the not-saved "trust and try again" state, with no rollback — justified
  3. The trusted-apps views refresh after that refused retry too — justified
  4. On the app detail page, the install/update retry's trust refusal now carries code, so the dialog recognises it — justified

[FIRST-PRINCIPLES-REVIEWED] f743a21

Description read

[DESCRIPTION-READ] 200f71187a64d34ca484f29037f269f1bd6d0adada057a2290333890fa4d9cf0

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed f743a21c008b6207a0761b87deed5546c0a0eede — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] f743a21

Verdict parsed from the review's SHA-scoped output markers for commit f743a21c008b6207a0761b87deed5546c0a0eede.

False positive or not applicable? A repository writer can comment:
/ai-review override fable f743a21c008b6207a0761b87deed5546c0a0eede: <one-sentence reason>

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of f743a21c008b6207a0761b87deed5546c0a0eede and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] f743a21

False positive or not applicable? A repository writer can comment:
/ai-review override gpt f743a21c008b6207a0761b87deed5546c0a0eede: <one-sentence reason>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 23, 2026
@JLargent42

Copy link
Copy Markdown
Contributor Author

CI on c1ea1ed (this PR changes only website/ files):

@JLargent42
JLargent42 force-pushed the fix/trust-retry-no-regrant-21459 branch from c1ea1ed to f743a21 Compare October 23, 2026 06:27
@JLargent42

Copy link
Copy Markdown
Contributor Author

Rebased once onto main for the #23264 Windows fix.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 23, 2026
@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 23, 2026
@bolichen97
bolichen97 enabled auto-merge (squash) October 23, 2026 16:15

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Deep review passed — retrying from the trust-saved dialog no longer calls the only trust-grant endpoint. It performs only the requested enable, install, or update action, and current-head checks are clean.

[Security: this changes an application-consent retry path. The retry preserves the user's existing decision and cannot recreate revoked trust; the normal explicit trust action remains the only grant path.]

@bolichen97
bolichen97 merged commit 1a3a891 into main Oct 23, 2026
106 checks passed
@bolichen97
bolichen97 deleted the fix/trust-retry-no-regrant-21459 branch October 23, 2026 16:16
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 23, 2026
bolichen97 added a commit that referenced this pull request Nov 1, 2026
…6958)

test_reduced_backend_scope_populates_every_ci_shard runs
scripts/ci-surface-tests.py --surface backend in a subprocess capped at 45s.
On loaded windows-latest runners the scan sometimes passes 45s, so
Backend Tests (Windows) (7) goes red on PRs that never touch CI files.

On Windows the scan now gets a named lost-run ceiling of 425s: 10x the
slowest passing Windows call measured (42.251775s, windows-pytest-progress-7
of run 39911553168, the PR #23257 head). The module declares
pytest.mark.timeout(850) so the ceiling is half the test timeout and an
expired scan fails by name instead of killing the xdist worker. Other
platforms keep 45s. A scan that does time out now fails with the command,
the ceiling and the tail of what the child wrote.

Carries LuckVd's change from #23386 without the PR numbers in the code
comment, which the Comment History Gate refuses.

Closes #23365

Co-authored-by: w <w@k.local>
Co-authored-by: LuckVd <37114923+LuckVd@users.noreply.github.com>
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.

Trust dialog 'Try again' in the trust-saved state re-grants trust removed in another window

2 participants