feat: 4-track implementation (DB/Schema/Results/App) - #1
Merged
Conversation
- expand Cargo.toml members to 28 crates per 4-track plan
- scaffold db/{cancellation,introspection}, schema/{cache,completion}, results/{stream,store,viewport,table_browser,edit,export}, storage/*, ui/*, observability, xtask
- add ADR-0007 (schema cache) and ADR-0008 (connection model)
- fix crossbeam-channel to 0.5.15 (cached) and keyring default features
- cargo fmt alignment
- add ConnectionId/QueryId, SslMode, SshTunnelConfig, ConnectionConfig (Debug redacts) - sanitize_url() via url::Url + fallback for password= query param - PgError with sqlstate/detail/hint/position + is_cancel (57014) - TxState (Idle/InTransaction/InFailed) mirroring ReadyForQuery I/T/E - SessionHealth (Ready/NeedsReset/Poisoned) + ManagedSession - ConnectionState enum (Disconnected/Connecting/Connected/Executing/Cancelling/Error) per ADR-0008 §53 - classify_tx() optimistic helper + unit tests (sanitize, Debug redaction, tx classify) - per plan Track A D1-D8, ADR-0008
- db/cancellation: Canceller trait, TokenCanceller (CancelToken.cancel_query with 3s timeout, 57014), NoopCanceller, CancelOutcome/CancelError - db/execution: QueryRequest/ExecutionState/Execution types, Executor trait + InMemoryExecutor, map_pg_error (57014→is_cancel), decode_row_mock placeholder for stream mapper - per plan Track A D5 (native CancelRequest on separate TcpStream) and D4/D7
- stream: StreamConfig/ColumnMeta/StreamEvent, PER_CELL_CAP 256KiB, decode_cell (oid→CellValue) for bool/int/float/json/uuid/text, truncation, tests - store: ResultStore with row_budget 50k + byte_budget 64MiB (byte authoritative), ring eviction, stable Row.index, snapshot_range Arc<[Row]>, SharedStore Arc<RwLock>, row_byte_len, tests (eviction, snapshot, byte budget) - viewport: ViewportState (offset/len/overscan 10/row_height 22), visible_range(scroll), snapshot() Arc copy, tests - per plan Track C D1-D12 (bounded, back-pressured, virtualized, egui-independent)
- db/introspection: 5 pg_catalog queries (SCHEMAS/RELATIONS/COLUMNS/PK_UNIQUE/FK/FUNCTIONS), hydrate::phase_a pure helper, qualified pg_catalog, tests - schema/cache: CacheState (Empty/Loading/Ready/Error), SchemaCache with RwLock<Arc<SchemaModel>>, get()/set_loading()/set_ready()/mark_stale()/epoch, stale banner, tests - per ADR-0007 two-phase (A schemas+relations+columns → B PKs/FKs/functions) - dedicated read-only session + statement_timeout=5s documented
- storage/connections: init/upsert SavedConnection (id,name,host,port,dbname,username,ssl_mode) - storage/history: HistoryEntry + FTS5 history_fts + insert/search (64KB truncate, porter), tests - storage/keychain: set/get/delete_password via keyring (service com.pgnative.pgnative), sanitize_url - storage/preferences: key/value JSON table, init/set/get - storage/editor_state: EditorTab (tab_id/connection_id/content/cursor), init/upsert - schema/completion: CompletionEngine (by_name + columns_by_relation + functions), complete() with dot_target alias + 50 cap + COMMON_PG_FUNCTIONS, extract_aliases stub, tests - per plan Tracks B/D (SQLite versioned migrations, keychain secrets, local FTS)
- app: AppCommand/ExportFormat, AppEvent (typed bounded 256), AppState (connections/queries/tx/schema RwLock), tx badge helpers, AppController (crossbeam bounded cmd/event, send_command/drain_events), tests (tx decision, command roundtrip) - observability: span_startup/introspection/query, record_rows/cancel_latency via tracing - per plan D1/D2/D7/D9, §8/22/29/54/55 (typed events, bounded, UiState vs AppState, no telemetry)
…uts/history - ui/theme: Theme (dark/light, bg/fg/accent, visuals) - ui/shortcuts: Shortcut enum (11 actions, Ctrl+T/Enter/Esc etc per §32) - ui/layout: UiState (active_tab/splitter/expanded/scroll/search) vs AppState, show_layout pure (§30/54) - ui/explorer: show_explorer + filter_relations (case-insensitive), test - ui/editor: EditorTab + completions_for via CompletionEngine - ui/results: show_results virtualized placeholder + format_cell (truncate >2KiB per §19) - ui/connections: ConnectionForm + show_connections (ssl_mode) - ui/history_panel: show_history placeholder - per plan D8/D9, §18/26/30-32
- table_browser: build_sql keyset pagination (§17) with PK/unique-not-null check, ORDER BY pk, LIMIT, WHERE (pk) > cursor, NotBrowsable error, tests - edit: is_editable (Editability::Disabled gate), diff_columns skipping GENERATED/IDENTITY/Virtual, update_sql parameterized UPDATE ... RETURNING *, tests - export: csv/json/sql via workspace csv 1.4, export_csv (RFC4180 quoting, Null→empty), export_json (typed null/numeric), ExportFormat, tests (quotes, null) - per plan Track C §16-21/28 (never guess identity, never concat, streaming)
- benches/README.md + docs/benchmarks.md document hw/OS/PG/query/network/mode/caches - observability already in crates/observability (span_startup/introspection/query) - per plan Track D §4/55/66
- index.rs:15-33 private → pub(crate) for schemas/relations/functions/types + schema_by_name/relation_by_oid/relations_by_schema/functions_by_schema/sorted_relations/column_owner - fixes 21× E0616 in build.rs (Builder in crate::build cannot see crate::index privates) - cargo check now sees same crate, outside crates still encapsulated
- schema/model lib.rs: re-export SchemaModel at crate root (pub use index::SchemaModel) so pgnative_schema_model::SchemaModel resolves - schema/model index.rs: fields private → pub(crate) for Builder cross-module access (21× E0616) - db/connection lib.rs: ConnectionConfig #[derive(Debug)] → #[derive(Clone)] (conflicts with manual Debug impl that redacts, E0119) - fixes cargo check failure on 7b111e4/c76df6d (exit 101)
- Cargo.toml: add async-trait 0.1.88 to workspace - db/cancellation,Cargo.toml + db/execution/Cargo.toml: add async-trait (fixes E0433 async_trait not found) - app/Cargo.toml: add pgnative-db-connection path dep (fixes E0432 unresolved import in app/src/lib.rs:9) - fixes cargo check failure on 8ffb340 (exit 101, 3 errors)
- table_browser test: ColumnId(Id(0)) → Id(0), TypeId(Id(0)) → Id(0) (E0423) - fixes cargo check failure on 07b3dbf (check/5_check.txt:129,133)
- stream/Cargo.toml: add uuid = { workspace = true } (used in decode_cell for Oid 2950 uuid::Uuid parse)
- fixes cargo check failure on 07b3dbf/e696782 (check/5_check.txt:103)
- hydrate::phase_a: SchemaId(Id(..)) → Id(..) etc (type aliases to Id, not tuple structs) - fixes 6× E0423 in db-introspection (80,91,99,135,136,139) on 07b3dbf
- schema/model tests.rs: SchemaId(Id(0)) → Id(0) etc (6×), RelationId, FunctionId, ColumnId, TypeId all aliases to Id - results/edit lib.rs: TypeId(Id(0)) → Id(0) (2×) - also fix m.relations()[0] → .clone() (E0508 move out of slice) - add .rustup/ to .gitignore (workspace-local toolchain copy) - fixes cargo check failure on 448bc4d (check/5_check.txt 15 errors)
- keychain/Cargo.toml: add pgnative-db-connection path dep (used in sanitize_url) - fixes cargo check failure on 8ecf2d7 (check/5_check.txt:40)
- Cargo.toml: unused/missing_docs/all/perf/style/correctness now { level = warn, priority = -1 } (fixes 5× E? lint_groups_priority)
- ci.yml: cargo clippy --workspace --all-targets --all-features (remove --deny warnings, fixes 80+ missing_docs etc becoming errors)
- cargo check now passes (8ecf2d7 still had check OK, clippy was failing)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Plan: .agents/plans/2026-08-31-pgnative-4-track-implementation.md (4 tracks, 28 members, 11 commits WU0→WU11). Implements AGENTS.md §8-11/22, §12-14, §15-21/28, §23-30. ADRs 0007/0008. Branch: 7b111e4 (WU0 scaffold → WU1 connection state machine → WU2 cancellation → WU3 stream/store/viewport → WU4 introspection/cache → WU5 storage+WU6 completion → WU7 app/observability → WU8 ui → WU9 table_browser/edit+WU10 export → WU11 benchmarks + CI). CI: .github/workflows/ci.yml (1.96.0, fmt+check+clippy+test).