Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
219 changes: 219 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
name: Test PostgreSQL Integration

on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]

jobs:
unit-tests:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x, 22.x]

steps:
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Compile TypeScript
run: npm run compile

- name: Run unit tests
run: npm run test

- name: Generate coverage report
run: npm run coverage

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./coverage/coverage-final.json
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false

integration-tests:
runs-on: ubuntu-latest
strategy:
matrix:
postgres-version: [12, 14, 15, 16, 17]

services:
postgres:
image: postgres:${{ matrix.postgres-version }}-alpine
env:
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpass
POSTGRES_DB: testdb
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

steps:
- uses: actions/checkout@v4

- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Compile TypeScript
run: npm run compile

- name: Run integration tests
run: npm run test:integration
env:
DB_HOST: localhost
DB_PORT: 5432
DB_USER: testuser
DB_PASSWORD: testpass
DB_NAME: testdb

- name: Upload integration test results
if: always()
uses: actions/upload-artifact@v3
with:
name: integration-test-results-pg${{ matrix.postgres-version }}
path: test-results/

renderer-component-tests:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Compile TypeScript
run: npm run compile

- name: Run renderer component tests
run: npm run test:renderer

- name: Generate renderer test coverage
run: npm run test:renderer:coverage

docker-integration:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Start PostgreSQL test containers
run: docker-compose -f docker-compose.test.yml up -d

- name: Wait for PostgreSQL services
run: |
for port in 5412 5414 5415 5416 5417; do
echo "Waiting for PostgreSQL on port $port..."
until pg_isready -h localhost -p $port -U testuser; do
sleep 1
done
done
env:
PGPASSWORD: testpass

- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Compile TypeScript
run: npm run compile

- name: Run version compatibility tests
run: npm run test:versions
env:
DB_HOST: localhost
DB_USER: testuser
DB_PASSWORD: testpass
DB_NAME: testdb

- name: Cleanup Docker containers
if: always()
run: docker-compose -f docker-compose.test.yml down

lint-and-format:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Check TypeScript
run: npm run compile -- --noEmit

coverage-report:
runs-on: ubuntu-latest
needs: [unit-tests, integration-tests, renderer-component-tests]
if: always()

steps:
- uses: actions/checkout@v4

- name: Download all coverage reports
uses: actions/download-artifact@v3
with:
path: coverage-reports

- name: Generate coverage summary
run: |
echo "## Test Coverage Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Unit Tests: ✓ Completed" >> $GITHUB_STEP_SUMMARY
echo "Integration Tests: ✓ Completed (PostgreSQL 12-17)" >> $GITHUB_STEP_SUMMARY
echo "Renderer Component Tests: ✓ Completed" >> $GITHUB_STEP_SUMMARY
echo "Docker Integration: ✓ Completed" >> $GITHUB_STEP_SUMMARY

security-audit:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Run security audit
run: npm audit --audit-level=moderate || true

- name: Check for known vulnerabilities
run: |
npm list | grep vulnerable || echo "No known vulnerabilities found"
37 changes: 37 additions & 0 deletions .nycrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"all": true,
"include": [
"src/**/*.ts"
],
"exclude": [
"src/**/*.test.ts",
"src/test/**",
"src/activation/**",
"**/*.d.ts",
"node_modules/**"
],
"reporter": [
"text",
"text-summary",
"html",
"lcov",
"json"
],
"report-dir": "./coverage",
"temp-dir": "./.nyc_output",
"check-coverage": false,
"lines": 50,
"statements": 50,
"functions": 50,
"branches": 50,
"per-file": false,
"cache": true,
"produce-source-map": true,
"instrument": true,
"require": [
"ts-node/register"
],
"extension": [
".ts"
]
}
1 change: 1 addition & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,4 @@ coverage/**
docs/**
.nycrc
index.js
venv/**
60 changes: 60 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,66 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

---

## [Unreleased] - 0.8.1

### Added
- **Connection Safety Features**: Environment tagging (🔴 PROD, 🟡 STAGING, 🟢 DEV), read-only mode enforcement, query safety analyzer with risk scoring, and status bar risk indicator.
- **Auto-LIMIT for SELECT**: Automatically appends LIMIT clause to SELECT queries (default 1000 rows, configurable).
- **EXPLAIN CodeLens**: One-click EXPLAIN/EXPLAIN ANALYZE buttons on SQL queries, results inserted directly into notebooks.
- **Table Intelligence**: New table operations for comprehensive insights:
- **Profile**: Size breakdown, column statistics, and bloat metrics.
- **Activity Monitor**: Access patterns, modifications, maintenance history, and bloat warnings.
- **Index Usage**: Performance statistics with unused index detection.
- **Definition Viewer**: Complete DDL, constraints, indexes, and relationships.

### Improved
- **Connection Form**: Enhanced with "Safety & Security" section for environment selection and read-only mode.
- **Notebook Integration**: EXPLAIN results now insert directly into notebooks for seamless workflow.

---

## [0.8.0] - 2026-02-08

### Added
- **AI Usage Metrics**: AI service responses now include token usage information, displayed in the UI for transparency and monitoring.
- **Comprehensive Test Suite**: Added extensive test utilities and unit tests for renderer components:
- `TestDatabaseSetup`: Manages test database connections and schema setup.
- `TestTimer` and `CoverageReporter`: Performance measurement and coverage reporting.
- Unit tests for notebook cell rendering, dashboard components, form validation, and accessibility features.
- **EXPLAIN Plan Visualizer**: New `ExplainProvider` for visualizing EXPLAIN ANALYZE plans in an interactive webview.
- **Transaction Management**: Advanced transaction control system:
- `TransactionToolbarManager`: Notebook toolbar for transaction controls.
- Support for savepoints, isolation levels, and auto-rollback features.
- Visual indicators for transaction status in notebooks.
- **Row Deletion**: Added support for deleting rows directly from the table renderer.

### Improved
- **Schema Cache**: Implemented adaptive TTL that optimizes cache behavior based on access patterns.
- **Connection Pool**: Added metrics and automatic idle timeout for better resource management.
- **Tree View Performance**:
- Debounced tree refresh to improve UI responsiveness during rapid operations.
- Support for tree view virtualization to handle large schemas efficiently.
- **Chat Navigation**: Enhanced chat templates with breadcrumb navigation for improved database object selection.

### Changed
- **Edit Connection**: Added command to edit existing connection settings from the tree view.

---

## [0.7.9] - 2026-01-05

### Fixed
- **Changelog Loading**: Enhanced changelog loading to check multiple casing variants (CHANGELOG.md, changelog.md, Changelog.md) with detailed debug information.

---

## [0.7.7] - 2026-01-05

### Fixed
- **What's New Screen**: Fixed issues with the What's New welcome screen display and markdown rendering.

---

## [0.7.6] - 2026-01-05

### Added
Expand Down
Loading
Loading