pg_reports 0.5.4 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +69 -0
- data/README.md +123 -370
- data/app/controllers/pg_reports/dashboard_controller.rb +21 -21
- data/app/views/layouts/pg_reports/application.html.erb +135 -69
- data/app/views/pg_reports/dashboard/_show_modals.html.erb +22 -22
- data/app/views/pg_reports/dashboard/_show_scripts.html.erb +105 -55
- data/app/views/pg_reports/dashboard/_show_styles.html.erb +49 -11
- data/app/views/pg_reports/dashboard/index.html.erb +123 -114
- data/app/views/pg_reports/dashboard/show.html.erb +30 -26
- data/config/locales/en.yml +597 -0
- data/config/locales/ru.yml +562 -0
- data/config/locales/uk.yml +607 -0
- data/lib/pg_reports/compatibility.rb +63 -0
- data/lib/pg_reports/configuration.rb +2 -0
- data/lib/pg_reports/dashboard/reports_registry.rb +112 -5
- data/lib/pg_reports/definitions/indexes/fk_without_indexes.yml +30 -0
- data/lib/pg_reports/definitions/indexes/index_correlation.yml +31 -0
- data/lib/pg_reports/definitions/indexes/inefficient_indexes.yml +45 -0
- data/lib/pg_reports/definitions/queries/temp_file_queries.yml +39 -0
- data/lib/pg_reports/definitions/schema_analysis/always_null_columns.yml +31 -0
- data/lib/pg_reports/definitions/schema_analysis/unused_columns.yml +32 -0
- data/lib/pg_reports/definitions/system/wraparound_risk.yml +31 -0
- data/lib/pg_reports/definitions/tables/tables_without_pk.yml +28 -0
- data/lib/pg_reports/definitions/tables/unused_tables.yml +30 -0
- data/lib/pg_reports/definitions/tables/update_hotspots.yml +32 -0
- data/lib/pg_reports/engine.rb +6 -0
- data/lib/pg_reports/module_generator.rb +2 -1
- data/lib/pg_reports/modules/indexes.rb +3 -0
- data/lib/pg_reports/modules/queries.rb +1 -0
- data/lib/pg_reports/modules/schema_analysis.rb +261 -2
- data/lib/pg_reports/modules/system.rb +27 -0
- data/lib/pg_reports/modules/tables.rb +1 -0
- data/lib/pg_reports/query_monitor.rb +64 -36
- data/lib/pg_reports/report_definition.rb +20 -24
- data/lib/pg_reports/sql/indexes/fk_without_indexes.sql +23 -0
- data/lib/pg_reports/sql/indexes/index_correlation.sql +27 -0
- data/lib/pg_reports/sql/indexes/inefficient_indexes.sql +22 -0
- data/lib/pg_reports/sql/queries/temp_file_queries.sql +16 -0
- data/lib/pg_reports/sql/schema_analysis/always_null_columns.sql +25 -0
- data/lib/pg_reports/sql/schema_analysis/unused_columns.sql +36 -0
- data/lib/pg_reports/sql/system/checkpoint_stats.sql +20 -0
- data/lib/pg_reports/sql/system/checkpoint_stats_legacy.sql +19 -0
- data/lib/pg_reports/sql/system/wraparound_risk.sql +21 -0
- data/lib/pg_reports/sql/tables/tables_without_pk.sql +20 -0
- data/lib/pg_reports/sql/tables/unused_tables.sql +19 -0
- data/lib/pg_reports/sql/tables/update_hotspots.sql +26 -0
- data/lib/pg_reports/version.rb +1 -1
- data/lib/pg_reports.rb +5 -0
- metadata +24 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 77275298b8ef6a1dba986e9b47849d1685e2d09cacdd64e3b086b20ab403574c
|
|
4
|
+
data.tar.gz: 893da425321112adf5d4f9944fb72028898c77119ec95ad92d27c21681a80a0e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c99a83908899a5896734b7025b4b593dad0c0d4045b9578e1912ccb332aa9f29dcb0c1e79fe69a403f4a248e99a540fc1b0627af44d7ddc1c1c889c738c1ffa7
|
|
7
|
+
data.tar.gz: 4ff3fe8ae5a907dee4a6eb9186adb1e9819d49e62c84c7447c49999dd2c4f09d01cd962711461437f18f1853ba1c3ea9b226af5a822a373034f61f93521ef1f5
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,75 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.6.1] - 2026-04-24
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **8 new reports** — 4 dead-schema/write-amplification reports plus 4 Rails-schema-consistency reports:
|
|
15
|
+
- `unused_columns` (Schema Analysis) — columns with `pg_stats.n_distinct = 1`, indicating no `UPDATE` has ever changed them since creation. Strong signal that the application code no longer references the column.
|
|
16
|
+
- `always_null_columns` (Schema Analysis) — nullable columns where ~100% of rows are NULL. Companion to `unused_columns` from a different angle.
|
|
17
|
+
- `update_hotspots` (Tables) — tables with high `updates_per_row` (same rows rewritten repeatedly) or low `hot_update_pct` (indexed columns being updated, defeating HOT). Includes refactor guidance: split hot/cold columns, event-log tables, write batching, fillfactor tuning.
|
|
18
|
+
- `unused_tables` (Tables) — tables with zero `seq_scan + idx_scan` since the last stats reset. Surfaces `db_stats_since` so you know how much history the verdict rests on.
|
|
19
|
+
- `polymorphic_without_index` (Schema Analysis) — polymorphic `belongs_to` associations whose `(*_type, *_id)` pair has no composite index. With table growth, association loads turn into seq scans.
|
|
20
|
+
- `counter_cache_issues` (Schema Analysis) — `belongs_to ..., counter_cache: ...` declarations whose target column is missing on the parent. Counter is silently broken — writes go nowhere, reads return nil/zero.
|
|
21
|
+
- `soft_delete_without_scope` (Schema Analysis) — tables with a `deleted_at` / `discarded_at` / `archived_at` column whose model has no scope filtering soft-deleted rows. Plain queries leak deleted data into reports, indexes, exports.
|
|
22
|
+
- `orphan_tables` (Schema Analysis) — DB tables with no corresponding Rails model class. Classified as `join_table_candidate` (likely legitimate HABTM), `join_model_without_class` (probably should be a model), or `legacy` (the interesting ones).
|
|
23
|
+
- New problem keys: `unused_column`, `always_null_column`, `hot_rows`, `low_hot_update`, `unused_table`, `polymorphic_no_index`, `counter_cache_missing_column`, `soft_delete_unprotected`, `orphan_table_legacy`.
|
|
24
|
+
- Full i18n for all new reports (en/ru/uk).
|
|
25
|
+
- **Full UI localization (en/ru/uk).** All dashboard chrome — buttons, modals, toasts, status badges, metric labels, filter labels, error messages, monitoring panels — now reads from a new `pg_reports.ui.*` locale namespace (183 keys per language). Plus three sibling namespaces resolved at access time from `Dashboard::ReportsRegistry` and `ReportDefinition#filter_parameters`:
|
|
26
|
+
- `pg_reports.categories.*` — the 6 dashboard category names (Queries / Indexes / Tables / Connections / System / Schema Analysis).
|
|
27
|
+
- `pg_reports.reports.<name>.{name, description}` — short name and one-line description for all 47 reports shown in the dashboard listing.
|
|
28
|
+
- `pg_reports.parameters.<name>.{label, description}` plus `threshold_label`/`threshold_description` templates for filter inputs.
|
|
29
|
+
Previously only the per-report long-form documentation was translated; the surrounding UI was hardcoded English regardless of `I18n.locale`.
|
|
30
|
+
- Added `window.PG_REPORTS_I18N` injected by the layout (`I18n.t('pg_reports.ui').to_json`) so client-side JS strings (toasts, dynamically rendered HTML, EXPLAIN output, IDE menu, query monitor feed) all respect the active locale.
|
|
31
|
+
- `<html lang>` now reflects `I18n.locale` instead of being hardcoded to `en`.
|
|
32
|
+
- Controller-level error/success messages (`reset_statistics`, `live_metrics`, `explain_analyze`, `execute_query`, `create_migration`, etc.) now use `I18n.t`.
|
|
33
|
+
|
|
34
|
+
### Changed
|
|
35
|
+
|
|
36
|
+
- `module_generator` now camelizes multi-word module names (`schema_analysis` → `SchemaAnalysis`) so YAML-defined reports can live under multi-word modules. Previously only single-word modules worked via auto-generation.
|
|
37
|
+
- `NEW` badge moved off the seven 0.6.0 reports onto the four added in this version.
|
|
38
|
+
|
|
39
|
+
## [0.6.0] - 2026-04-11
|
|
40
|
+
|
|
41
|
+
### Added
|
|
42
|
+
|
|
43
|
+
- **7 new reports** covering previously undetected PostgreSQL problems:
|
|
44
|
+
- `inefficient_indexes` — indexes with high read-to-fetch ratio indicating misaligned composite index column order
|
|
45
|
+
- `fk_without_indexes` — foreign keys on child tables missing a supporting index, causing seq scans on parent DELETE/UPDATE
|
|
46
|
+
- `index_correlation` — low physical correlation between index order and row order, causing excessive random I/O on range scans
|
|
47
|
+
- `temp_file_queries` — queries spilling intermediate results to disk due to insufficient `work_mem` (requires pg_stat_statements)
|
|
48
|
+
- `tables_without_pk` — tables missing primary keys, which breaks logical replication and causes ORM issues
|
|
49
|
+
- `wraparound_risk` — transaction ID age proximity to the 2-billion wraparound limit that triggers emergency PostgreSQL shutdown
|
|
50
|
+
- `checkpoint_stats` — checkpoint frequency and background writer metrics with PostgreSQL 17+ support
|
|
51
|
+
- **AI Prompt Export** — "Copy Prompt" button in the Export dropdown generates a ready-to-paste prompt for AI coding assistants (Claude Code, Cursor, Codex) with problem description, fix instructions, and actual report data as examples. Available for 28 actionable reports.
|
|
52
|
+
- **Compatibility warnings** — the gem now warns at boot if Ruby, Rails, or PostgreSQL versions are below minimum supported (Ruby 2.7, Rails 5.0, PostgreSQL 12)
|
|
53
|
+
- **`inefficient_index_threshold_ratio`** configuration option (default: 10) for the inefficient indexes report
|
|
54
|
+
- Full i18n support for all new reports in English, Russian, and Ukrainian
|
|
55
|
+
|
|
56
|
+
### Fixed
|
|
57
|
+
|
|
58
|
+
- **Critical: infinite recursion in Query Monitor with database-backed cache stores** (SolidCache, ActiveRecord Cache Store) — `handle_sql_event` called `Rails.cache.read()` on every SQL event to check `enabled` state, which with DB-backed caches generated new SQL events, creating an infinite loop. Fixed by storing monitoring state in local instance variables (`@enabled`, `@session_id`) and syncing from cache only at initialization. Added reentrancy guard as additional safety net. (Reported via [PR #7](https://github.com/deadalice/pg_reports/pull/7))
|
|
59
|
+
- **`checkpoint_stats` compatibility with PostgreSQL 17+** — checkpoint columns were moved from `pg_stat_bgwriter` to `pg_stat_checkpointer` with renamed columns. The report now auto-detects the PostgreSQL version and uses the appropriate query.
|
|
60
|
+
- **26 previously failing Query Monitor specs** now pass — tests no longer depend on `Rails.cache` availability
|
|
61
|
+
|
|
62
|
+
### Changed
|
|
63
|
+
|
|
64
|
+
- **Dashboard UI redesign** — flattened the visual style to remove typical AI-generated patterns:
|
|
65
|
+
- Removed gradient buttons, gradient text on logo, backdrop blur on modals
|
|
66
|
+
- Removed `translateY` hover animations on cards and buttons
|
|
67
|
+
- Unified `border-radius` to 6px across all components (was 8–16px)
|
|
68
|
+
- Subdued box-shadows (`0 4px 16px` instead of `0 10px 40px`)
|
|
69
|
+
- Muted color palette — same CSS variables, lower saturation
|
|
70
|
+
- Background warmed from `#0f1114` to `#151719`
|
|
71
|
+
- Removed colored icon backgrounds from category cards
|
|
72
|
+
- Report links now transparent by default (tertiary fill on hover only)
|
|
73
|
+
- NEW badge restyled: tinted background instead of solid green
|
|
74
|
+
- Buttons use flat solid color instead of gradients
|
|
75
|
+
- "Download" button renamed to "Export" with AI Prompt option added to the dropdown
|
|
76
|
+
- New reports tagged with `NEW` badge in the dashboard sidebar
|
|
77
|
+
- Query Monitor `enabled` and `session_id` public methods now return local state instead of hitting cache on every call
|
|
78
|
+
|
|
10
79
|
## [0.5.4] - 2026-02-11
|
|
11
80
|
|
|
12
81
|
### Fixed
|