Skip to content

feat(APP-625): integrate proposal audit into proposal UI#1103

Draft
cristianizzo wants to merge 5 commits into
mainfrom
feat/APP-625
Draft

feat(APP-625): integrate proposal audit into proposal UI#1103
cristianizzo wants to merge 5 commits into
mainfrom
feat/APP-625

Conversation

@cristianizzo
Copy link
Copy Markdown
Contributor

@cristianizzo cristianizzo commented Apr 28, 2026

Summary

Surfaces the backend audit (BE-213) on the multisig proposal page. Next to Approve proposal there's now a secondary button that:

  • Run audit — fires POST /v2/proposals/:id/audit when no audit is cached on the proposal yet, with a loading state for the ~15–30s round-trip.
  • Show audit — opens the dialog instantly with the cached audit once one is persisted on the proposal document (no extra cost).

The result is rendered in a dedicated dialog with:

  • A colour-coded risk badge (low → green, medium → orange, high / critical → red)
  • Summary
  • Per-finding cards (severity tag + category + description, plus action index when applicable)
  • Recommendations list
  • Tenderly trace link

Linear: APP-625
Backend PR: aragon/app-backend#1275 (BE-213)

Visibility rules

Proposal state Has cached audit Button
Open No Run audit
Open Yes Show audit
Executed No hidden
Executed Yes Show audit (review post-execution)

Test plan

  • Open a non-executed multisig proposal that has actions and no cached audit → button reads Run audit
  • Click → ~15–30s loading → dialog opens with the audit; refetch flips the button to Show audit
  • Click Show audit on the same proposal → dialog opens instantly with the cached audit
  • Open an executed proposal with a cached audit → button reads Show audit
  • Open an executed proposal with no audit → button is hidden
  • Backend not reachable → request fails cleanly (no UI crash, dialog stays closed)

Preview

config/.env.preview is temporarily flipped to point at sandbox so the Vercel preview exercises the new audit endpoint. Revert before merging to main.

Surfaces the backend audit (BE-213) on the multisig proposal page.
Adds a secondary button next to "Approve proposal" that:

- runs a fresh audit via POST /v2/proposals/:id/audit when none is
  cached, with a loading state while the request is in flight
- shows the cached audit (no extra cost) once persisted on the
  proposal document

The result is rendered in a dedicated dialog with a colour-coded risk
badge, summary, per-finding cards (severity + category + description),
recommendations, and a Tenderly trace link.
@linear
Copy link
Copy Markdown

linear Bot commented Apr 28, 2026

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 28, 2026

🚀 Preview Deployment: View Here

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 28, 2026

E2E results (preview)

Smoke

Base URL https://app-next-7cp2mh8rz-aragon-app.vercel.app
Suite smoke
Playwright result ✅ passed
Summary 79 passed, 1 skipped
HTML report View report
GitHub job ✅ completed

View run #4136

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Integrates the backend proposal security audit into the multisig proposal UI by adding a “Run audit / Show audit” flow, backed by a new API service + domain types and rendered in a dedicated dialog.

Changes:

  • Add a secondary audit button to the multisig proposal voting UI that triggers POST /v2/proposals/:id/audit and opens an audit dialog.
  • Introduce a new ProposalAuditDialog and register it in the governance dialog system.
  • Add proposal audit domain types, API service/mutation hook, and i18n strings.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/plugins/multisigPlugin/components/multisigSubmitVote/multisigSubmitVote.tsx Adds “Run audit / Show audit” button and mutation flow on the multisig proposal page.
src/modules/governance/dialogs/proposalAuditDialog/proposalAuditDialog.tsx New dialog UI for rendering risk badge, summary, findings, recommendations, and Tenderly link.
src/modules/governance/dialogs/proposalAuditDialog/index.ts Dynamic import + type exports for the new dialog.
src/modules/governance/constants/governanceDialogsDefinitions.ts Registers the new proposal audit dialog definition.
src/modules/governance/constants/governanceDialogId.ts Adds PROPOSAL_AUDIT dialog ID.
src/modules/governance/api/proposalAuditService/proposalAuditService.ts Adds backend service method to run audits via POST endpoint.
src/modules/governance/api/proposalAuditService/proposalAuditService.api.ts Adds request params typing for the audit endpoint.
src/modules/governance/api/proposalAuditService/mutations/useRunProposalAudit/useRunProposalAudit.ts Adds React Query mutation hook for running audits.
src/modules/governance/api/proposalAuditService/mutations/useRunProposalAudit/index.ts Re-exports the mutation hook.
src/modules/governance/api/proposalAuditService/mutations/index.ts Mutations barrel export.
src/modules/governance/api/proposalAuditService/index.ts Service module barrel export.
src/modules/governance/api/governanceService/domain/proposalAudit.ts Introduces IProposalAudit and IProposalAuditFinding domain types.
src/modules/governance/api/governanceService/domain/proposal.ts Extends proposal domain with optional cached audit field.
src/modules/governance/api/governanceService/domain/index.ts Exports the new audit domain types.
src/assets/locales/en.json Adds translations for audit dialog and multisig audit button labels.
.changeset/proposal-audit-ui.md Changeset for minor release documenting the feature.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/plugins/multisigPlugin/components/multisigSubmitVote/multisigSubmitVote.tsx Outdated
Comment thread src/plugins/multisigPlugin/components/multisigSubmitVote/multisigSubmitVote.tsx Outdated
Comment thread src/modules/governance/dialogs/proposalAuditDialog/proposalAuditDialog.tsx Outdated
Comment thread src/modules/governance/dialogs/proposalAuditDialog/proposalAuditDialog.tsx Outdated
Comment thread src/modules/governance/api/governanceService/domain/proposal.ts Outdated
- Scope queryClient.invalidateQueries to proposal-related caches via a
  predicate, so finishing an audit no longer nukes every React Query
  cache across the app.
- Show the audit button when a cached audit exists even after the
  proposal is executed (so members can still review the audit), but
  hide it on executed-without-audit since "Run audit" would fail
  upstream anyway.
- i18n the per-finding action label and use a 1-based index for users
  instead of the raw 0-based actionIndex from the API.
- Fix two JSDoc typos (singular `/v2/proposal/` → plural
  `/v2/proposals/`).
- Add a unit test for useRunProposalAudit matching the existing
  useSimulateActions pattern.
- Point config/.env.preview at sandbox so the PR's preview deploy
  exercises the new audit endpoint. Revert before merging.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/plugins/multisigPlugin/components/multisigSubmitVote/multisigSubmitVote.tsx Outdated
Comment thread src/modules/governance/dialogs/proposalAuditDialog/proposalAuditDialog.tsx Outdated
Comment thread src/modules/governance/dialogs/proposalAuditDialog/proposalAuditDialog.tsx Outdated
`IProposalAudit.riskLevel` and `IProposalAuditFinding.severity` are
required strings in the domain type, so the `?? 'low'` / `?? 'info'`
fallbacks were dead code and contradicted the contract. Use the values
directly; the backend's validateAudit guarantees they're populated
before persistence.
- Move audit button out of MultisigSubmitVote into ProposalAuditSection
- Show audit section between Voting and Actions on all proposal states
- Short summary preview with View Full Report button
- Loading phases: simulating → analyzing → generating report
- Error handling for failed audits
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