You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a React-based monitoring and management interface for YDB clusters. The codebase follows specific patterns and conventions that must be maintained.
10
10
11
-
## Critical Rules (Prevent 67% of Bugs)
11
+
## Tech Stack Requirements
12
12
13
-
> Based on analysis of 267 code review comments - these prevent production issues.
13
+
- Use React 18.3 with TypeScript 5.x
14
+
- Use Redux Toolkit 2.x with RTK Query for state management
15
+
- Use Gravity UI (@gravity-ui/uikit) 7.x for UI components
16
+
- Use React Router v5 (NOT v6) for routing
17
+
- Use Monaco Editor 0.52 for code editing features
14
18
15
-
### API & State Management
16
-
-**NEVER** call APIs directly → use `window.api.module.method()` pattern
17
-
-**NEVER** mutate Redux state → return new objects/arrays
18
-
-**ALWAYS** wrap `window.api` calls in RTK Query with `injectEndpoints`
19
+
## Critical Bug Prevention Patterns
20
+
21
+
> Based on analysis of 267 code review comments - these prevent 67% of production issues.
19
22
20
23
### React Performance (MANDATORY)
21
24
-**ALWAYS** use `useMemo` for expensive computations, object/array creation
- Register keysets with `registerKeysets()` using unique component name
69
+
70
+
### State Management
71
+
72
+
- Use Redux Toolkit with domain-based organization
73
+
- NEVER mutate state in RTK Query - return new objects/arrays
74
+
- Clear errors on user input in forms
75
+
- Always handle loading states in UI
96
76
97
-
## Quality Gates (Before Every Commit)
98
-
99
-
1. ✅ Run `npm run lint` and `npm run typecheck` - NO exceptions
100
-
2. ✅ Verify ALL user-facing strings use i18n (search for hardcoded text)
101
-
3. ✅ Check ALL useEffect hooks have proper cleanup functions
102
-
4. ✅ Ensure memoization for ALL expensive operations
103
-
5. ✅ Validate error handling for ALL async operations
104
-
6. ✅ Confirm NO authentication tokens exposed in logs
105
-
7. ✅ Test mathematical expressions for edge cases (zero division)
106
-
107
-
## Code Suggestions Context
108
-
109
-
### Common Patterns to Suggest
110
-
-`const b = cn('component-name')` for new components
111
-
-`useMemo` for any array/object creation or filtering
112
-
-`useCallback` for event handlers in dependencies
113
-
-`i18n('key_name')` instead of hardcoded strings
114
-
-`Number(value) || 0` instead of `Number(value)`
115
-
-`condition > 0 ? calculation : 0` for divisions
116
-
117
-
### Avoid Suggesting
118
-
- Direct API calls (suggest `window.api` instead)
119
-
- Hardcoded strings (suggest i18n keys)
120
-
- State mutations (suggest immutable returns)
121
-
- Missing cleanup in useEffect
122
-
- Missing error boundaries for async operations
77
+
### UI Components
78
+
79
+
- Prefer Gravity UI components over custom implementations
80
+
- Use `createToast` for notifications
81
+
- Use `ResponseError` component for API errors
82
+
- Use `Loader` and `TableSkeleton` for loading states
83
+
84
+
### Form Handling
85
+
86
+
- Always use controlled components with validation
87
+
- Clear errors on user input
88
+
- Validate before submission
89
+
- Use Gravity UI form components with error states
90
+
91
+
### Dialog/Modal Patterns
92
+
93
+
- Use `@ebay/nice-modal-react` for complex modals
94
+
- Use Gravity UI `Dialog` for simple dialogs
95
+
- Always include loading states
123
96
124
97
### Type Conventions
125
-
- API types: `TTenantInfo`, `TClusterInfo` (T prefix)
126
-
- Located in `src/types/api/`
127
-
- Use strict TypeScript, avoid `any`
98
+
99
+
- API types prefixed with 'T' (e.g., `TTenantInfo`, `TClusterInfo`)
100
+
- Types located in `src/types/api/` directory
101
+
102
+
### Performance Requirements
103
+
104
+
- Use React.memo for expensive renders
105
+
- Lazy load Monaco Editor
106
+
- Batch API requests when possible
107
+
- Use virtual scrolling for tables
108
+
109
+
### Testing Patterns
110
+
111
+
- Unit tests colocated in `__test__` directories
112
+
- E2E tests use Playwright with page objects pattern
113
+
- Use CSS class selectors for E2E element selection
128
114
129
115
### Navigation (React Router v5)
130
-
- Use `useHistory`, `useParams` (NOT v6 hooks)
116
+
117
+
- Use React Router v5 hooks (`useHistory`, `useParams`)
131
118
- Always validate route params exist before use
132
119
133
-
## Common Utilities for Suggestions
120
+
## Common Utilities
134
121
135
-
-**Formatters**: `formatBytes()`, `formatDateTime()` from `src/utils/dataFormatters/`
136
-
-**Class Names**: `cn()` from `src/utils/cn`
137
-
-**Time Parsing**: utilities in `src/utils/timeParsers/`
138
-
-**Query Helpers**: `src/utils/query.ts` for SQL/YQL
122
+
- Formatters: `formatBytes()`, `formatDateTime()` from `src/utils/dataFormatters/`
123
+
- Time parsing: utilities in `src/utils/timeParsers/`
124
+
- Query utilities: `src/utils/query.ts` for SQL/YQL helpers
139
125
140
-
## Performance Requirements
126
+
## Before Making Changes
141
127
142
-
When suggesting code changes:
143
-
- Always consider React performance impact
144
-
- Suggest memoization for expensive operations
145
-
- Consider rendering performance for large datasets
146
-
- Prefer Gravity UI components over custom implementations
128
+
- Run `npm run lint` and `npm run typecheck` before committing
129
+
- Follow conventional commit message format
130
+
- Use conventional commit format for PR titles with lowercase subjects (e.g., "fix: update api endpoints", "feat: add new component", "chore: update dependencies")
131
+
- PR title subjects must be lowercase (no proper nouns, sentence-case, start-case, pascal-case, or upper-case)
132
+
- Ensure all user-facing text is internationalized
133
+
- Test with a local YDB instance when possible
134
+
135
+
## Debugging Helpers
136
+
137
+
-`window.api` - Access API methods in browser console
138
+
-`window.ydbEditor` - Monaco editor instance
139
+
- Enable request tracing with `DEV_ENABLE_TRACING_FOR_ALL_REQUESTS`
0 commit comments