Skip to content

Commit 7ec71e0

Browse files
authored
Merge pull request #52 from ric-v/main
Performance optimization for Chat attach picker & Added comprehensive Testing flow
2 parents 55c927a + 184cc50 commit 7ec71e0

59 files changed

Lines changed: 7280 additions & 236 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/test.yml

Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
name: Test PostgreSQL Integration
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main, develop]
8+
9+
jobs:
10+
unit-tests:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
node-version: [18.x, 20.x, 22.x]
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Use Node.js ${{ matrix.node-version }}
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: ${{ matrix.node-version }}
23+
cache: 'npm'
24+
25+
- name: Install dependencies
26+
run: npm ci
27+
28+
- name: Compile TypeScript
29+
run: npm run compile
30+
31+
- name: Run unit tests
32+
run: npm run test
33+
34+
- name: Generate coverage report
35+
run: npm run coverage
36+
37+
- name: Upload coverage to Codecov
38+
uses: codecov/codecov-action@v3
39+
with:
40+
files: ./coverage/coverage-final.json
41+
flags: unittests
42+
name: codecov-umbrella
43+
fail_ci_if_error: false
44+
45+
integration-tests:
46+
runs-on: ubuntu-latest
47+
strategy:
48+
matrix:
49+
postgres-version: [12, 14, 15, 16, 17]
50+
51+
services:
52+
postgres:
53+
image: postgres:${{ matrix.postgres-version }}-alpine
54+
env:
55+
POSTGRES_USER: testuser
56+
POSTGRES_PASSWORD: testpass
57+
POSTGRES_DB: testdb
58+
options: >-
59+
--health-cmd pg_isready
60+
--health-interval 10s
61+
--health-timeout 5s
62+
--health-retries 5
63+
ports:
64+
- 5432:5432
65+
66+
steps:
67+
- uses: actions/checkout@v4
68+
69+
- name: Use Node.js 20.x
70+
uses: actions/setup-node@v4
71+
with:
72+
node-version: 20.x
73+
cache: 'npm'
74+
75+
- name: Install dependencies
76+
run: npm ci
77+
78+
- name: Compile TypeScript
79+
run: npm run compile
80+
81+
- name: Run integration tests
82+
run: npm run test:integration
83+
env:
84+
DB_HOST: localhost
85+
DB_PORT: 5432
86+
DB_USER: testuser
87+
DB_PASSWORD: testpass
88+
DB_NAME: testdb
89+
90+
- name: Upload integration test results
91+
if: always()
92+
uses: actions/upload-artifact@v3
93+
with:
94+
name: integration-test-results-pg${{ matrix.postgres-version }}
95+
path: test-results/
96+
97+
renderer-component-tests:
98+
runs-on: ubuntu-latest
99+
100+
steps:
101+
- uses: actions/checkout@v4
102+
103+
- name: Use Node.js 20.x
104+
uses: actions/setup-node@v4
105+
with:
106+
node-version: 20.x
107+
cache: 'npm'
108+
109+
- name: Install dependencies
110+
run: npm ci
111+
112+
- name: Compile TypeScript
113+
run: npm run compile
114+
115+
- name: Run renderer component tests
116+
run: npm run test:renderer
117+
118+
- name: Generate renderer test coverage
119+
run: npm run test:renderer:coverage
120+
121+
docker-integration:
122+
runs-on: ubuntu-latest
123+
124+
steps:
125+
- uses: actions/checkout@v4
126+
127+
- name: Set up Docker Buildx
128+
uses: docker/setup-buildx-action@v3
129+
130+
- name: Start PostgreSQL test containers
131+
run: docker-compose -f docker-compose.test.yml up -d
132+
133+
- name: Wait for PostgreSQL services
134+
run: |
135+
for port in 5412 5414 5415 5416 5417; do
136+
echo "Waiting for PostgreSQL on port $port..."
137+
until pg_isready -h localhost -p $port -U testuser; do
138+
sleep 1
139+
done
140+
done
141+
env:
142+
PGPASSWORD: testpass
143+
144+
- name: Use Node.js 20.x
145+
uses: actions/setup-node@v4
146+
with:
147+
node-version: 20.x
148+
cache: 'npm'
149+
150+
- name: Install dependencies
151+
run: npm ci
152+
153+
- name: Compile TypeScript
154+
run: npm run compile
155+
156+
- name: Run version compatibility tests
157+
run: npm run test:versions
158+
env:
159+
DB_HOST: localhost
160+
DB_USER: testuser
161+
DB_PASSWORD: testpass
162+
DB_NAME: testdb
163+
164+
- name: Cleanup Docker containers
165+
if: always()
166+
run: docker-compose -f docker-compose.test.yml down
167+
168+
lint-and-format:
169+
runs-on: ubuntu-latest
170+
171+
steps:
172+
- uses: actions/checkout@v4
173+
174+
- name: Use Node.js 20.x
175+
uses: actions/setup-node@v4
176+
with:
177+
node-version: 20.x
178+
cache: 'npm'
179+
180+
- name: Install dependencies
181+
run: npm ci
182+
183+
- name: Check TypeScript
184+
run: npm run compile -- --noEmit
185+
186+
coverage-report:
187+
runs-on: ubuntu-latest
188+
needs: [unit-tests, integration-tests, renderer-component-tests]
189+
if: always()
190+
191+
steps:
192+
- uses: actions/checkout@v4
193+
194+
- name: Download all coverage reports
195+
uses: actions/download-artifact@v3
196+
with:
197+
path: coverage-reports
198+
199+
- name: Generate coverage summary
200+
run: |
201+
echo "## Test Coverage Summary" >> $GITHUB_STEP_SUMMARY
202+
echo "" >> $GITHUB_STEP_SUMMARY
203+
echo "Unit Tests: ✓ Completed" >> $GITHUB_STEP_SUMMARY
204+
echo "Integration Tests: ✓ Completed (PostgreSQL 12-17)" >> $GITHUB_STEP_SUMMARY
205+
echo "Renderer Component Tests: ✓ Completed" >> $GITHUB_STEP_SUMMARY
206+
echo "Docker Integration: ✓ Completed" >> $GITHUB_STEP_SUMMARY
207+
208+
security-audit:
209+
runs-on: ubuntu-latest
210+
211+
steps:
212+
- uses: actions/checkout@v4
213+
214+
- name: Run security audit
215+
run: npm audit --audit-level=moderate || true
216+
217+
- name: Check for known vulnerabilities
218+
run: |
219+
npm list | grep vulnerable || echo "No known vulnerabilities found"

.nycrc.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"all": true,
3+
"include": [
4+
"src/**/*.ts"
5+
],
6+
"exclude": [
7+
"src/**/*.test.ts",
8+
"src/test/**",
9+
"src/activation/**",
10+
"**/*.d.ts",
11+
"node_modules/**"
12+
],
13+
"reporter": [
14+
"text",
15+
"text-summary",
16+
"html",
17+
"lcov",
18+
"json"
19+
],
20+
"report-dir": "./coverage",
21+
"temp-dir": "./.nyc_output",
22+
"check-coverage": false,
23+
"lines": 50,
24+
"statements": 50,
25+
"functions": 50,
26+
"branches": 50,
27+
"per-file": false,
28+
"cache": true,
29+
"produce-source-map": true,
30+
"instrument": true,
31+
"require": [
32+
"ts-node/register"
33+
],
34+
"extension": [
35+
".ts"
36+
]
37+
}

.vscodeignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,4 @@ coverage/**
5454
docs/**
5555
.nycrc
5656
index.js
57+
venv/**

CHANGELOG.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,66 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
---
99

10+
## [Unreleased] - 0.8.1
11+
12+
### Added
13+
- **Connection Safety Features**: Environment tagging (🔴 PROD, 🟡 STAGING, 🟢 DEV), read-only mode enforcement, query safety analyzer with risk scoring, and status bar risk indicator.
14+
- **Auto-LIMIT for SELECT**: Automatically appends LIMIT clause to SELECT queries (default 1000 rows, configurable).
15+
- **EXPLAIN CodeLens**: One-click EXPLAIN/EXPLAIN ANALYZE buttons on SQL queries, results inserted directly into notebooks.
16+
- **Table Intelligence**: New table operations for comprehensive insights:
17+
- **Profile**: Size breakdown, column statistics, and bloat metrics.
18+
- **Activity Monitor**: Access patterns, modifications, maintenance history, and bloat warnings.
19+
- **Index Usage**: Performance statistics with unused index detection.
20+
- **Definition Viewer**: Complete DDL, constraints, indexes, and relationships.
21+
22+
### Improved
23+
- **Connection Form**: Enhanced with "Safety & Security" section for environment selection and read-only mode.
24+
- **Notebook Integration**: EXPLAIN results now insert directly into notebooks for seamless workflow.
25+
26+
---
27+
28+
## [0.8.0] - 2026-02-08
29+
30+
### Added
31+
- **AI Usage Metrics**: AI service responses now include token usage information, displayed in the UI for transparency and monitoring.
32+
- **Comprehensive Test Suite**: Added extensive test utilities and unit tests for renderer components:
33+
- `TestDatabaseSetup`: Manages test database connections and schema setup.
34+
- `TestTimer` and `CoverageReporter`: Performance measurement and coverage reporting.
35+
- Unit tests for notebook cell rendering, dashboard components, form validation, and accessibility features.
36+
- **EXPLAIN Plan Visualizer**: New `ExplainProvider` for visualizing EXPLAIN ANALYZE plans in an interactive webview.
37+
- **Transaction Management**: Advanced transaction control system:
38+
- `TransactionToolbarManager`: Notebook toolbar for transaction controls.
39+
- Support for savepoints, isolation levels, and auto-rollback features.
40+
- Visual indicators for transaction status in notebooks.
41+
- **Row Deletion**: Added support for deleting rows directly from the table renderer.
42+
43+
### Improved
44+
- **Schema Cache**: Implemented adaptive TTL that optimizes cache behavior based on access patterns.
45+
- **Connection Pool**: Added metrics and automatic idle timeout for better resource management.
46+
- **Tree View Performance**:
47+
- Debounced tree refresh to improve UI responsiveness during rapid operations.
48+
- Support for tree view virtualization to handle large schemas efficiently.
49+
- **Chat Navigation**: Enhanced chat templates with breadcrumb navigation for improved database object selection.
50+
51+
### Changed
52+
- **Edit Connection**: Added command to edit existing connection settings from the tree view.
53+
54+
---
55+
56+
## [0.7.9] - 2026-01-05
57+
58+
### Fixed
59+
- **Changelog Loading**: Enhanced changelog loading to check multiple casing variants (CHANGELOG.md, changelog.md, Changelog.md) with detailed debug information.
60+
61+
---
62+
63+
## [0.7.7] - 2026-01-05
64+
65+
### Fixed
66+
- **What's New Screen**: Fixed issues with the What's New welcome screen display and markdown rendering.
67+
68+
---
69+
1070
## [0.7.6] - 2026-01-05
1171

1272
### Added

0 commit comments

Comments
 (0)