Build Accessibility Auditing for Smart Contract Playground#845
Open
midenotch wants to merge 2 commits into
Open
Build Accessibility Auditing for Smart Contract Playground#845midenotch wants to merge 2 commits into
midenotch wants to merge 2 commits into
Conversation
|
@midenotch is attempting to deploy a commit to the Ayomide Adeniran's projects Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
Author
|
Done, Close: #845 |
|
@midenotch Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
Close: #817
What was built
Core engine — SorobanAccessibilityAuditor.ts
A pure TypeScript auditor that statically analyzes Soroban smart contract source code for 8 accessibility rules covering the contract's interface accessibility (how usable/readable the contract is for developers and tooling):
Rule Severity Detects
missing-contract-attribute error Soroban struct missing #[contract]
missing-fn-doc warning Public #[contractimpl] functions with no /// doc comment
opaque-error-code warning Single-char or E1/Err1-style error variant names
undocumented-error-enum info #[contracterror] enum with no doc comment
event-missing-topics info env.events().publish() with fewer than 2 topics
raw-bytes-storage-key info Bytes::/BytesN:: used as storage keys instead of Symbol
panic-only-error-handling error/warning panic!() (error) or .unwrap() (warning) in contract code
unnamed-fn-params info Public functions with _ as a parameter name
Exports: auditSorobanSource(), filterIssuesBySeverity(), formatAuditSummary() + all TypeScript types.
Hook — useAccessibilityAudit.ts
A debounced React hook that watches editor content and re-runs the audit 500ms after the last change. Exposes result, isPending, runAudit(), and getIssuesBySeverity().
UI Panel — AccessibilityAuditPanel.tsx
A fully accessible panel component rendered in the playground's right column (below the terminal) with:
Live issue count with severity badges
Filter tabs (All / Errors / Warnings / Info) with role="tablist"
Collapsible issue rows with aria-expanded, aria-controls, suggestions
Error issues auto-expanded; others collapsed by default
Refresh button, spinner state, "All checks passed" view
Full ARIA:
Wired into playground — page.tsx + CodeEditor.tsx
CodeEditor now accepts an onCodeChange callback to surface live editor content
Playground page tracks the code, passes it to useAccessibilityAudit, and renders between the terminal and the lab notes
Tests — 92 passing
SorobanAccessibilityAuditor.test.ts — 47 unit tests covering every rule (positive + negative cases), counts, sort order, helpers
useAccessibilityAudit.test.ts — 13 hook tests covering debounce, enable/disable, manual trigger, timer precision
AccessibilityAuditPanel.test.tsx — 32 component tests covering rendering states, ARIA attributes, filter tabs, expand/collapse, refresh button