Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
ab6756e
chore: migrate gettext strings to python brace format
gtripoli Mar 12, 2026
4625a08
Clean up engine contexts and document AbstractContext
gtripoli Mar 14, 2026
90709bf
refactor(dataview): add observable models and update tab models
gtripoli Mar 14, 2026
df43621
ui(dataview): reuse app icon registry and editor dialog factory
gtripoli Mar 14, 2026
9dc6ed0
feat(query): add cancelable execution and richer result metadata
gtripoli Mar 14, 2026
16be462
feat(engines): improve datatype alias mapping and result typing
gtripoli Mar 14, 2026
b991e27
i18n: update catalogs
gtripoli Mar 14, 2026
7d16e35
chore(ui): update wxFormBuilder project layout
gtripoli Mar 14, 2026
969f0a4
refactor(settings): move Settings to helpers and restructure key schema
gtripoli Mar 16, 2026
191ca25
docs(style): fix contradictions and merge duplicate rule sections
gtripoli Mar 16, 2026
ba6bd42
feat(engines): support skip_before/after_connect in context.connect()
gtripoli Mar 16, 2026
c8e9e95
refactor(query): expose extract_all_statements in StatementExtractor
gtripoli Mar 16, 2026
ff00625
feat(ui): add multi-tab query editor with configurable shortcuts
gtripoli Mar 16, 2026
e040e2e
docs: merge ROADMAP into PROJECT_STATUS and update progress
gtripoli Mar 16, 2026
079dd56
refactor(autocomplete): remove dead code and fix typing violations
gtripoli Mar 17, 2026
01f6e5f
feat(database): update action buttons state based on option changes
gtripoli Mar 17, 2026
e4926b3
refactor(records): replace advanced cell editor with column content d…
gtripoli Mar 17, 2026
161b795
refactor(autocomplete): simplify settings lookups in controller
gtripoli Mar 17, 2026
550a790
Preserve expanded tree state after failed connection attempt
gtripoli Mar 17, 2026
060204c
Remove database character set option and refresh apply state on colla…
gtripoli Mar 17, 2026
e73a534
Fix DataView has-value detection for record-backed rows
gtripoli Mar 17, 2026
8efe25b
fix: address code review findings (typing, imports, lazy import comme…
gtripoli Mar 17, 2026
dadc277
feat(table-options): add row_format and convert_data for MySQL/MariaDB
gtripoli Mar 17, 2026
d59afd8
docs(engines): add docstrings to type parsing and mapping methods
gtripoli Mar 17, 2026
bc43516
chore: checkpoint before windows/main reorganization
gtripoli Mar 17, 2026
93a82b0
Refactor windows/main modules and update UI controllers/tests imports
gtripoli Mar 18, 2026
1c876dc
Extend SQL autocomplete context detection for INSERT/UPDATE/DELETE an…
gtripoli Mar 18, 2026
4e13a5e
feat(autocomplete): improve parsing, provider behavior and coverage
gtripoli Mar 23, 2026
a685754
feat(ui): add table execution flow and update related views
gtripoli Mar 23, 2026
5197794
chore(i18n): refresh translation catalogs
gtripoli Mar 23, 2026
c955a4a
chore(project): update project files and local settings
gtripoli Mar 23, 2026
495ff86
update
gtripoli Apr 27, 2026
167e924
fix(dataviewer): fix record apply and COUNT(*) crash
gtripoli Apr 27, 2026
5cffe51
docs: update README and PROJECT_STATUS to April 2026
gtripoli Apr 27, 2026
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
40 changes: 14 additions & 26 deletions CODE_STYLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,18 @@ If a requested change conflicts with these rules, the change must **stop** and c

---

## Core Rules (Quick Reference)
## Mandatory Rules (Quick Reference)

The following rules are the most critical and must always be respected:
The following rules are strict and MUST NOT be violated. When generating or modifying code, tools and agents MUST consult this file before producing changes.

1. All code, comments, documentation, commit messages, and user-facing text MUST be written in English.
2. Python typing rules MUST be respected (PEP 585 generics; `Optional[T]`, not `T | None`).
3. Import ordering and grouping rules MUST be followed exactly.
4. Functions and methods MUST NOT exceed 50 lines.
5. Code changes MUST avoid modifying unrelated code.
6. Naming MUST remain explicit and descriptive (no aggressive abbreviations).
7. Code MUST remain mypy-friendly whenever possible.

When generating or modifying code, tools and agents MUST consult this file before producing changes.

---

## Mandatory Rules

The following rules are strict and MUST NOT be violated:

- English must always be used for code and documentation.
- `typing.Optional[T]` MUST be used instead of `T | None`.
- `from __future__ import annotations` MUST NOT be used.
- Import ordering rules MUST be respected exactly.
- Functions MUST NOT exceed the maximum size limit.
3. `from __future__ import annotations` MUST NOT be used.
4. Import ordering and grouping rules MUST be followed exactly.
5. Functions and methods MUST NOT exceed 80 lines.
6. Code changes MUST avoid modifying unrelated code.
7. Naming MUST remain explicit and descriptive (no aggressive abbreviations).
8. Code MUST remain mypy-friendly whenever possible.

---

Expand Down Expand Up @@ -431,9 +418,10 @@ This rule applies only to builtin modules.
import os
import sys

import gettext as _

import numpy as np
import pandas as pd
import gettext as _
```

#### Bad example
Expand All @@ -448,7 +436,7 @@ import sys

When importing multiple symbols from the same module:

- Parenthesized multiline `from ... import (...)` MUST NOT be used for functions or methods.
- Parenthesized multiline `from ... import (...)` MUST NOT be used.
- Imports MUST NOT be split into one line per symbol.
- Prefer a single `from ... import ...` line whenever possible.
- If a `from ... import ...` statement would exceed the maximum line width:
Expand Down Expand Up @@ -632,14 +620,14 @@ class Example:

## 9. Function and Method Size

- A function/method MUST be at most 50 lines.
- If it exceeds 50 lines, it MUST be split into smaller functions/methods with clear names.
- A function/method MUST be at most 80 lines.
- If it exceeds 80 lines, it MUST be split into smaller functions/methods with clear names.

---

## 10. Walrus Operator ( := )

- The walrus operator MAY be used when it improves clarity and avoids redundant calls.
- The walrus operator MUST be used whenever it avoids redundant calls or repeated expressions.
- It MUST NOT be used when it makes the control flow harder to read.

#### Good examples
Expand Down
167 changes: 102 additions & 65 deletions PROJECT_STATUS.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,33 @@
# PeterSQL — Project Status

> **Last Updated:** 2026-03-10
> **Validation Policy:** new engine features are marked **PARTIAL** until broader integration validation is complete.
> **Last Updated:** 2026-04-27
> **Status Rule:** newly implemented features are tracked as **PARTIAL** until validated across supported versions.
> **Definition of DONE:** engine methods implemented, integration tests pass on target versions, UI workflow exists (if user-facing), no known regressions, documentation updated.

---

## 1. Executive Summary
## Priority Matrix

### ✅ Solid and Stable Areas
| Priority | Focus | Target |
|----------|-------|--------|
| 🔴 **P0 - Validation Now** | stabilize newly added engine features | 1-2 weeks |
| 🟡 **P1 - Engine Gaps** | close remaining CRUD parity gaps | 2-4 weeks |
| 🟢 **P2 - UI Completeness** | add missing editors for exposed objects | 1-2 months |
| 🔵 **P3 - Advanced Features** | schema/security/import-export roadmap | 2-3 months |

---

## 1. Solid and Stable Areas

| Area | Status |
|------|--------|
| **SQLite Engine** | Most mature path with complete day-to-day table/record workflows. |
| **MySQL/MariaDB Core** | Strong parity for tables, columns, indexes, foreign keys, records, views, triggers, functions. |
| **UI Core Editors** | Table, columns, indexes, foreign keys, records, and view editor are operational. |
| **Multi-tab Query Editor** | Multi-tab editor with per-tab dirty tracking, autosave, cancelable execution, and configurable shortcuts. |
| **Explorer Navigation** | Databases, tables, views, triggers, procedures, functions, and events are visible in tree explorer. |
| **SSH Tunnel Support** | Implemented for MySQL, MariaDB, and PostgreSQL. |

### 🟡 Partial / Under Validation

| Area | Current State |
|------|---------------|
| **MySQL Procedure** | Class + CRUD methods exist, context introspection exists, integration tests added, broader validation still ongoing. |
| **MariaDB Procedure** | Class + CRUD methods exist, context introspection exists, integration tests added, broader validation still ongoing. |
| **PostgreSQL Function** | Class + CRUD methods exist, context introspection exists, integration tests now cover create/alter/drop across supported PG versions; broader validation still ongoing. |
| **PostgreSQL Procedure** | Class + CRUD methods exist, context introspection exists, integration tests now cover create/alter/drop across supported PG versions; broader validation still ongoing. |
| **Check Constraints (MySQL/MariaDB/PostgreSQL)** | Engine classes and introspection exist, cross-version validation still needed. |
| **Connection Reliability Features** | Persistent connection statistics, empty DB password support, and TLS auto-retry are implemented and need longer real-world validation. |
| **SQL Dump / Backup** | `SQLDatabase.dump()` produces object-driven `.sql` dumps (schema + records); restore/import workflow is still missing. |
| **Database Lifecycle (Create/Drop)** | Engine database objects expose lifecycle methods, but context/UI workflow parity is still incomplete. |

### ❌ Missing / Not Implemented

| Area | Notes |
|------|-------|
| **Function/Procedure UI Editors** | Explorer lists objects, but dedicated create/edit UI is still missing. |
| **Database Create/Drop UI** | No complete create/drop workflow across engines. |
| **Schema/Sequence Management** | PostgreSQL schema/sequence CRUD is not available. |
| **User/Role/Grants** | Not implemented for any engine. |

---

## 2. Engine Capability Matrix
Expand Down Expand Up @@ -112,68 +101,116 @@
| Table / Column / Index / Foreign Key | ✅ | ✅ | ✅ | ✅ | Main table editor workflow complete. |
| Check Constraint | ✅ | 🟡 | 🟡 | 🟡 | `TableCheckController` exists; broader multi-engine UX validation pending. |
| View | ✅ | ✅ | ✅ | ✅ | Dedicated view editor is available. |
| Trigger | ✅ | ❌ | ❌ | ❌ | Explorer only; no dedicated trigger editor panel yet. |
| Trigger | ✅ | ❌ | ❌ | ❌ | Explorer only; no dedicated editor yet. |
| Function | ✅ | ❌ | ❌ | ❌ | Explorer only; no dedicated editor yet. |
| Procedure | ✅ | ❌ | ❌ | ❌ | Explorer only; no dedicated editor yet. |
| Event | ✅ | ❌ | ❌ | ❌ | Explorer only. |
| Records | ✅ | ✅ | ✅ | ✅ | Insert/update/delete/duplicate in table records tab. |
| Query Editor | ✅ | ✅ | ✅ | ✅ | Multi-tab, cancelable execution, configurable shortcuts, autosave. |

---

## 4. Cross-Cutting Notes
## 4. Feature Backlog

### Recently Added
### 🔴 P0 - Validation Now

- Persistent connection statistics in connection model and dialog.
- Empty database password accepted in connection validation.
- Automatic TLS retry path for MySQL/MariaDB when server requires TLS.
- Unit reliability coverage for MySQL/MariaDB TLS auto-retry and SSH tunnel lifecycle contracts.
- SQL dump/backup pipeline is now object-driven via `SQLDatabase.dump()` + per-object `raw_create()`.
- CI workflow split into `test`, `update` (nightly), and `release` jobs.
- [x] **PostgreSQL Function engine implementation** (PARTIAL)
- **Files:** `structures/engines/postgresql/database.py`, `structures/engines/postgresql/context.py`
- **Next:** long-run/manual workflow validation + broader regression checks.

### Main Remaining Risks
- [x] **PostgreSQL Procedure engine implementation** (PARTIAL)
- **Files:** `structures/engines/postgresql/database.py`, `structures/engines/postgresql/context.py`
- **Next:** long-run/manual workflow validation + introspection consistency checks.

- PostgreSQL Function/Procedure now have integration coverage for create/alter/drop, but still need broader long-run/manual validation.
- Check constraints across MySQL/MariaDB/PostgreSQL need more cross-version coverage.
- SQL dump/backup still needs broader cross-engine manual restore validation.
- SSH tunnel integration validation with testcontainers remains blocked (existing SSH integration suites are still skipped).
- UI parity lags engine parity for Trigger/Function/Procedure editors.
- [x] **Check constraint implementations for MySQL/MariaDB/PostgreSQL** (PARTIAL)
- **Files:** `structures/engines/mysql/`, `structures/engines/mariadb/`, `structures/engines/postgresql/`
- **Next:** cross-version validation matrix.

---
- [x] **Connection reliability updates** (PARTIAL)
- **Scope:** persistent connection statistics, empty DB password support, TLS auto-retry (MySQL/MariaDB).
- **Files:** `structures/connection.py`, `windows/dialogs/connections/`
- **Next:** SSH testcontainers integration validation (currently skipped) + long-run behavioral validation.

## 5. Actionable Backlog (High Signal)
- [x] **SQL dump/backup object-driven flow** (PARTIAL)
- **Scope:** `SQLDatabase.dump()` generates SQL dump files through domain objects (`raw_create()`).
- **Files:** `structures/engines/database.py`, `structures/engines/dump.py`, per-engine `database.py`
- **Next:** cross-engine manual restore/import verification from produced dumps.

### Priority A — Validate Newly Implemented Features
### 🟡 P1 - Engine Gaps

1. PostgreSQL Function/Procedure long-run validation (manual workflows + regression suites after integration coverage).
2. Check constraints validation matrix for MySQL, MariaDB, PostgreSQL.
3. Connection statistics + TLS auto-retry robustness checks.
- [x] **MySQL Procedure implementation** (PARTIAL)
- **Files:** `structures/engines/mysql/context.py`, `structures/engines/mysql/database.py`

### Priority B — Close Engine Gaps
- [x] **MariaDB Procedure implementation** (PARTIAL)
- **Files:** `structures/engines/mariadb/context.py`, `structures/engines/mariadb/database.py`

1. Complete context/UI wiring for database lifecycle (create/drop) across engines.
- [ ] **Database lifecycle parity (context + UI wiring)**
- **Current state:** engine database objects expose create/alter/drop, but context/UI workflow remains read/list oriented.
- **Files:** `structures/engines/*/context.py`

### Priority C — UI Completeness
### 🟢 P2 - UI Completeness

1. Trigger create/edit UI.
2. Function create/edit UI.
3. Procedure create/edit UI.
- [x] **View Create/Edit Dialog** — DONE. (`windows/main/tabs/view.py`, `helpers/sql.py`)
- [x] **Multi-tab query editor** — DONE. (`windows/main/controller.py`, `windows/main/tabs/query.py`)
- [x] **Cancelable query execution with richer result metadata** — DONE. (`windows/main/tabs/query.py`)
- [x] **Configurable keyboard shortcuts for query editor** — DONE. (`windows/main/controller.py`, `windows/dialogs/settings/`)
- [ ] **Trigger Create/Edit UI** — Explorer visibility exists, editor panel missing.
- [ ] **Function Create/Edit UI** — Explorer visibility exists, editor panel missing.
- [ ] **Procedure Create/Edit UI** — Explorer visibility exists, editor panel missing.
- [ ] **Database Create/Drop UI** — Depends on engine create/drop API parity.

### Priority D — Future Platform Features
### 🔵 P3 - Advanced Features

1. PostgreSQL schema CRUD.
2. PostgreSQL sequence CRUD.
3. User/role/grants management.
4. Restore and structured import/export workflows.
- [ ] PostgreSQL schema CRUD
- [ ] PostgreSQL sequence CRUD
- [ ] User/role management
- [ ] Privileges/grants management
- [ ] Restore + structured import/export workflows
- [ ] PostgreSQL advanced objects (materialized views, partitioning, extensions)

---

## 6. Definition of DONE
## 5. Progress Snapshot

- **P0 implemented (partial):** 5/5
- **P1 gaps closed:** 2/3
- **P2 UI tasks complete:** 4/8
- **P3 advanced tasks complete:** 0/6

A capability is treated as **DONE** only when:
---

## 6. Recently Added

- SQL autocomplete extended to INSERT / UPDATE / DELETE and string literals; parser improved with JSON and multi-table coverage.
- Table execution flow updated in the records UI.
- `row_format` and `convert_data` options added to the MySQL/MariaDB table editor.
- `windows/main/` modules restructured into subdirectories (`database/`, `table/`, `query/`) for better separation of concerns.
- Advanced cell editor replaced with a dedicated `ColumnContentDialog` for displaying and editing large cell content.
- Database options action buttons now update live when options change.
- Tree explorer preserves expanded state after a failed connection attempt.
- Multi-tab query editor with per-tab dirty tracking, autosave before execution, and close/save confirmation dialogs.
- Cancelable query execution with background thread, per-statement result rendering, and execution summary.
- Configurable keyboard shortcuts for all query editor actions (execute, stop, new tab, close tab, save, save-as).
- `save` toolbar tool is disabled when the query has no unsaved changes.
- Settings module moved to `helpers/settings.py` with restructured key schema.
- `skip_before_connect` / `skip_after_connect` support added to all engine contexts.
- Persistent connection statistics in connection model and dialog.
- Empty database password accepted in connection validation.
- Automatic TLS retry path for MySQL/MariaDB when server requires TLS.
- Unit reliability coverage for MySQL/MariaDB TLS auto-retry and SSH tunnel lifecycle contracts.
- SQL dump/backup pipeline is now object-driven via `SQLDatabase.dump()` + per-object `raw_create()`.
- CI workflow split into `test`, `update` (nightly), and `release` jobs.

---

## 7. Main Remaining Risks

- PostgreSQL Function/Procedure still need broader long-run/manual validation.
- Check constraints across MySQL/MariaDB/PostgreSQL need more cross-version coverage.
- SQL dump/backup still needs broader cross-engine manual restore validation.
- SSH tunnel integration validation with testcontainers remains blocked.
- UI parity lags engine parity for Trigger/Function/Procedure editors.

---

- Engine methods are implemented (`create/read/update/delete` where applicable).
- Integration tests pass on target engine versions.
- UI workflow exists (if feature is user-facing in explorer).
- No known regression in existing suites.
- Documentation is updated (`README`, `PROJECT_STATUS`, `ROADMAP`).
*This document is a living reference and should be updated whenever a PARTIAL item is validated or a new gap is identified.*
Loading
Loading