-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/marks filter history #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: near
Are you sure you want to change the base?
Conversation
- better-sqlite3: SQLite persistence for transaction history - clipboardy: Cross-platform clipboard support
- services/history.ts: SQLite persistence for blocks/txs and marks - services/jump-marks.ts: Mark management with pinning and navigation - services/filters.ts: Transaction filter compilation and matching Supports: persistent history, jump marks with [/] navigation, live filtering with signer:, receiver:, method:, action: syntax
- FilterBar: Live transaction filtering input - HistorySearch: Search historical transactions (Ctrl+F) - JumpList: Mark management overlay with pin/delete (M) - near-args-decoder: Decode FunctionCall arguments (JSON/text/binary) - JSON formatters: Worker and WASM formatting utilities
- StatusBar: Add viewMode, pinnedLabels, pinnedTotal props, show pinned marks chip - HelpOverlay: Complete keyboard shortcuts documentation - TxDetails: Add mode prop, update label to show PRETTY/RAW mode
- Add SQLITE_DB_PATH to .env.template - Install better-sqlite3 and clipboardy dependencies
Documents implementation status, architecture, and integration requirements for marks, filter, and history features. All components completed except final battle-station.tsx integration.
PR Review: Feature/marks filter historyOverviewThis is a major architectural migration from Cosmos/CosmWasm to NEAR Protocol with significant new features. The PR includes:
✅ Strengths1. Excellent Documentation
2. Robust RPC Layer (
|
| Category | Score | Notes |
|---|---|---|
| Architecture | ⭐⭐⭐⭐⭐ | Excellent separation of concerns |
| Documentation | ⭐⭐⭐⭐⭐ | Outstanding CLAUDE.md |
| Type Safety | ⭐⭐⭐ | Could use more interfaces |
| Error Handling | ⭐⭐⭐ | Too many silent failures |
| Security | ⭐⭐⭐ | Credential handling needs review |
| Performance | ⭐⭐⭐⭐ | Good patterns, minor issues |
| Testing | ⭐⭐ | No automated tests |
Overall: ⭐⭐⭐⭐ (4/5) - Solid migration with room for improvement in error handling and testing
🎯 Priority Recommendations
High Priority
- Add validation/logging for credential file permissions
- Implement proper error logging (at least for debugging)
- Add startup configuration validation
Medium Priority
- Add cleanup/dispose methods to services
- Improve type safety for RPC responses
- Add basic automated tests
Low Priority
- Optimize toast rendering performance
- Add CHANGELOG.md for breaking changes
- Document npm → yarn migration
✅ Approval Status
This PR represents a significant architectural improvement and migration. The code quality is generally good, following the project's pragmatic TypeScript style. The main concerns are around error handling visibility and security hardening for credential management.
Recommendation: ✅ Approve with suggestions - The issues identified are not blockers but should be addressed in follow-up PRs.
Great work on this migration! The documentation and architecture are excellent.
Reviewed following CLAUDE.md guidelines for CSLI Dashboard
Pull Request Review: Feature/marks filter historyOverviewThis PR represents a major migration from Cosmos/CosmWasm to NEAR Protocol, along with significant feature additions. Changes: +8,874 additions, -16,581 deletions across 54 files. ✅ Strengths1. Excellent Architecture
2. Robust Error Handling
3. Performance Optimizations
4. Documentation
|
Pull Request Review: Feature/marks filter historyThis is a substantial and well-architected PR that adds powerful features to the NEAR dashboard. Overall code quality is high with good separation of concerns. Below is my detailed analysis. ✅ Strengths1. Excellent Architecture
2. Strong Security Practices
3. Good Code Quality
4. Performance Considerations
|
| Category | Rating | Notes |
|---|---|---|
| Code Quality | ⭐⭐⭐⭐ | Clean, readable, follows conventions |
| Architecture | ⭐⭐⭐⭐⭐ | Excellent separation of concerns |
| Security | ⭐⭐⭐⭐ | Strong, but needs input validation fixes |
| Performance | ⭐⭐⭐⭐ | Well optimized, minor improvements possible |
| Test Coverage | ⭐ | No automated tests |
| Documentation | ⭐⭐⭐⭐ | Good inline docs, CLAUDE.md updated |
Overall: ⭐⭐⭐⭐ (4/5) - High quality PR with excellent architecture. Address the race condition and validation issues, then this is ready to merge.
🔧 Recommended Actions Before Merge
Must Fix
- Add request IDs to worker messages to prevent race conditions
- Add transaction/block size validation in history worker
- Handle critical initialization errors (database, credentials)
Should Fix
- Add basic tests for path sanitization (security-critical)
- Improve type safety in filter functions
- Fix worker cleanup on errors
Nice to Have
- Add JSDoc to public APIs
- Debounce filter input
- Add pagination to history search
Great work on this feature! The architecture is solid and the security considerations are thoughtful. Once the critical issues are addressed, this will be a valuable addition. 🎉
Pull Request Review: Feature/marks filter historyOverviewThis is an excellent feature addition that adds transaction filtering, history persistence, jump marks, and credential tracking to the CSLI Dashboard. The PR shows solid engineering practices with proper security considerations, clean architecture, and comprehensive documentation updates. Summary: 49 files changed, introducing SQLite-based persistence, real-time filtering, and enhanced navigation features. ✅ Strengths1. Security-First Design
2. Architecture & Design
3. Code Quality
4. Performance Considerations
|
Security Enhancements: - Fix WebSocket race condition with thread-safe WebSocketManager - Add resource limits (max connections, buffer sizes, DB size) - Enhance error handling with AppError class and user-friendly messages - Add pragmatic TypeScript types without over-engineering - Create test framework with Jest for critical security paths Key Components Added: - WebSocketManager: Thread-safe client management with connection limits - Error handler: Centralized error handling with severity levels - Circuit breaker: Enhanced implementation (was already present) - Common types: Simple, useful TypeScript definitions - Test suite: Security-focused tests for path traversal, WebSocket, JSON parsing Configuration Updates: - Add WS_MAX_CONNECTIONS environment variable - Update error boundaries with proper logging Documentation: - SECURITY-ANALYSIS.md: Comprehensive security audit - TESTING.md: Guide for running security tests All critical security issues from PR #22 are now addressed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Pull Request Review - Feature/marks-filter-historyOverviewThis is a significant and well-architected PR that adds major features to the CSLI Dashboard: transaction history persistence, filtering, marks/bookmarks system, and improved UI components. The PR includes 61 files changed (+4,616/-3,414 lines) across 12 commits. Overall Assessment: ✅ APPROVE with minor recommendations ✅ Strengths1. Excellent Security Implementation
The 2. Well-Structured Architecture
3. Comprehensive Testing
4. Smart JSON Auto-Parse ImplementationThe // Security: 1MB max string size prevents JSON bombs
// Recursion limit (7 levels) prevents infinite loops
// Graceful fallback on parse failuresWorks on real NEAR patterns like 5. Thread-Safe WebSocket ManagerFixes critical race condition: // OLD: Direct Set iteration (concurrent modification risk)
// NEW: Snapshot iteration with Array.from()
const clients = Array.from(this.clients.values());
for (const client of clients) { ... }Includes connection limits, buffer overflow protection, keep-alive pings, and graceful error handling. 6. Documentation Quality
🟡 Areas for Improvement1. Error Handling Enhancement (Medium Priority)Several areas could benefit from more defensive error handling: In const { sql, params } = buildSearchSQL(m.query, !!hasFTS, m.order ?? 'desc', m.limit ?? 200);
const rows = db.prepare(sql).all(...params) as any[];Recommendation: Wrap database operations in try-catch for robustness: try {
const { sql, params } = buildSearchSQL(...);
const rows = db.prepare(sql).all(...params) as any[];
// ... process rows
parentPort!.postMessage({ ok: true, type: 'search', rows });
} catch (error) {
parentPort!.postMessage({
ok: false,
type: 'search',
error: `Search failed: ${error.message}`
});
}In 2. Type Safety (Low Priority)In const rows = db.prepare(sql).all(...params) as any[]; // ⚠️
const row = db.prepare(`SELECT...`).get(m.hash) as any; // ⚠️Recommendation: Define explicit interfaces: interface TxSearchRow {
hash: string;
height: number;
ts_ms: number;
signer?: string;
receiver?: string;
actions_json?: string;
methods?: string;
}
const rows = db.prepare(sql).all(...params) as TxSearchRow[];3. Performance Consideration (Low Priority)In where.push(`(${vals.map(() => `${col} LIKE ?`).join(' OR ')})`);
for (const v of vals) params.push(`%${v.toLowerCase()}%`);Leading wildcards ( Recommendation: Consider adding a note in documentation about expected performance characteristics or add pagination limits. 4. Test Coverage Gaps (Medium Priority)While security tests are excellent, consider adding:
5. Configuration Validation (Low Priority)In WS_MAX_CONNECTIONS=100
WS_HIGH_WATER_MARK=1000000Recommendation: Add validation in const maxConnections = Math.max(1, Math.min(10000,
parseInt(process.env.WS_MAX_CONNECTIONS || '100', 10)
));6. Magic Numbers (Low Priority)In }, 15000); // Keep-alive intervalRecommendation: Extract to named constants: const KEEP_ALIVE_INTERVAL_MS = 15000;
const PING_TIMEOUT_MS = 30000;🔍 Code Quality ObservationsPositive Patterns
Minor Style Notes
🛡️ Security Validation Summary✅ SQL Injection: SAFE - All queries use parameterized statements 📊 Test Coverage Assessment
Overall: Strong coverage of security-critical paths. UI testing could be enhanced. 🎯 Recommendations PriorityMust-Have Before Merge
Should-Have (Next PR)
Nice-to-Have
📝 SummaryThis PR represents high-quality work with strong attention to:
The code follows the repository's "pragmatic TypeScript" philosophy (per CLAUDE.md) - using Recommendation: ✅ APPROVE - Ready to merge with suggestions for follow-up improvements. Great work on this feature! The marks/filter/history system will significantly enhance the dashboard's usability for blockchain developers. 🔗 Files Reviewed
|
No description provided.