Document security patterns, timing constants, and pre-submission checklist#249
Document security patterns, timing constants, and pre-submission checklist#249bensonwong merged 2 commits intomainfrom
Conversation
…, and workflow Analyzed ~37 non-dependabot PRs (#200-#247) to identify recurring patterns in AI code review feedback, false positives, and coding issues. AGENTS.md additions: - Pre-submission checklist (build, test, size, exports, dedup) - Popover timing constants with "do not flag as race condition" guidance - CSS overflow rules for popovers (recurring in PRs #243, #244, #247) - SSR safety patterns - Testing rules and existing coverage catalog - PR description guidelines - Bundle size awareness CLAUDE.md additions: - Security utilities canonical locations (urlSafety, objectSafety, regexSafety, logSafety) - Security patterns section with concrete rules and code examples - Timing constants table in Interaction Behavior section - Type safety rules (discriminated unions, no unsafe casts, export verification) https://claude.ai/code/session_0157XtUZgvrxbD6diyJRXQAx
Lint/format failures (Biome) are the most common CI failure. Add npm run check:fix as step 1 in the checklist and to the Commands quick-reference, with explicit guidance to run it before every commit. https://claude.ai/code/session_0157XtUZgvrxbD6diyJRXQAx
✅ Playwright Test ReportStatus: Tests passed 📊 Download Report & Snapshots (see Artifacts section) What's in the Visual SnapshotsThe gallery includes visual snapshots for:
Run ID: 22049432732 |
PR Review: Documentation for Security Patterns, Timing Constants, and Pre-Submission ChecklistSummaryThis is a documentation-only PR that captures existing patterns, best practices, and workflow requirements. The documentation is well-structured, accurate, and addresses real issues identified from analyzing previous PRs. ✅ Strengths1. Security Documentation is Accurate & Valuable
2. Timing Constants Are Well-Documented
3. Pre-Submission Checklist Is Practical
4. Test Coverage Documentation Is Accurate
5. CSS Rules Address Real Issues
6. Type Safety Guidelines Are Sound
🔍 Minor Issues1. Test File Count Discrepancy (AGENTS.md line 198)
2. Missing Context on PR Analysis Scope (AGENTS.md)
🎯 Code Quality AssessmentBest Practices: ✅ Excellent
Potential Bugs: ✅ None
Performance: ✅ N/A
Security: ✅ Excellent
Test Coverage: ✅ Already well-tested
📋 Recommendations
✅ ApprovalThis PR is approved with minor suggestions. The documentation is accurate, well-researched, and addresses real workflow pain points. The test count discrepancy is trivial and can be fixed before merge. Impact: This will significantly reduce false positives in AI code reviews and help human contributors avoid common security pitfalls. Review generated by Claude Code after verification of:
|
Summary
This PR adds comprehensive documentation for critical development patterns and pre-submission requirements:
Security Patterns (CLAUDE.md): Documents dedicated security utilities in
src/utils/with examples for URL domain matching, prototype pollution prevention, ReDoS prevention, log injection prevention, and image source validation. Emphasizes never using ad-hoc patterns for these security-sensitive operations.Timing Constants (CLAUDE.md): Documents the carefully calibrated popover timing values (
HOVER_CLOSE_DELAY_MS,REPOSITION_GRACE_PERIOD_MS,SPINNER_TIMEOUT_MS,TOUCH_CLICK_DEBOUNCE_MS) with their purposes and test coverage. Clarifies these are deliberate and well-tested, not race conditions.Type Safety Guidelines (CLAUDE.md): Adds rules for discriminated unions, unsafe casts, and export verification to prevent common type-related bugs.
Pre-Submission Checklist (AGENTS.md): Documents the required checks before opening a PR, with emphasis on running
npm run check:fixfirst (the most common CI failure). Includes bundle size limits and export verification.Testing Rules (AGENTS.md): Clarifies that tests must validate existing implemented behavior, documents current test coverage (28 unit test files, 9 Playwright specs), and provides guidance on when to add tests.
PR Description Guidelines (AGENTS.md): Requires PR descriptions to match the actual diff and calls out security changes and breaking changes explicitly.
Additional Context (AGENTS.md): Documents CSS rules for popovers (addressing recurring overflow issues), SSR safety patterns, and popover timing constants for agents.
Type of Change
Checklist
Notes
This is a documentation-only change that captures existing patterns, constraints, and best practices already in use throughout the codebase. No functional changes or code modifications are included.
https://claude.ai/code/session_0157XtUZgvrxbD6diyJRXQAx