pg_sql_triggers 1.0.0 → 1.0.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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/.erb_lint.yml +47 -0
  3. data/.rubocop.yml +4 -1
  4. data/CHANGELOG.md +29 -1
  5. data/Goal.md +408 -123
  6. data/README.md +47 -215
  7. data/app/controllers/pg_sql_triggers/application_controller.rb +46 -0
  8. data/app/controllers/pg_sql_triggers/generator_controller.rb +10 -4
  9. data/app/controllers/pg_sql_triggers/migrations_controller.rb +18 -0
  10. data/app/models/pg_sql_triggers/trigger_registry.rb +20 -2
  11. data/app/views/layouts/pg_sql_triggers/application.html.erb +34 -1
  12. data/app/views/pg_sql_triggers/dashboard/index.html.erb +70 -30
  13. data/app/views/pg_sql_triggers/generator/new.html.erb +4 -4
  14. data/app/views/pg_sql_triggers/generator/preview.html.erb +14 -6
  15. data/app/views/pg_sql_triggers/shared/_confirmation_modal.html.erb +189 -0
  16. data/app/views/pg_sql_triggers/shared/_kill_switch_status.html.erb +40 -0
  17. data/app/views/pg_sql_triggers/tables/index.html.erb +0 -2
  18. data/app/views/pg_sql_triggers/tables/show.html.erb +3 -4
  19. data/db/migrate/20251222000001_create_pg_sql_triggers_tables.rb +1 -1
  20. data/docs/README.md +66 -0
  21. data/docs/api-reference.md +663 -0
  22. data/docs/configuration.md +541 -0
  23. data/docs/getting-started.md +135 -0
  24. data/docs/kill-switch.md +586 -0
  25. data/docs/screenshots/.gitkeep +1 -0
  26. data/docs/screenshots/Generate Trigger.png +0 -0
  27. data/docs/screenshots/Triggers Page.png +0 -0
  28. data/docs/screenshots/kill error.png +0 -0
  29. data/docs/screenshots/kill modal for migration down.png +0 -0
  30. data/docs/usage-guide.md +420 -0
  31. data/docs/web-ui.md +339 -0
  32. data/lib/generators/pg_sql_triggers/templates/create_pg_sql_triggers_tables.rb +1 -1
  33. data/lib/generators/pg_sql_triggers/templates/initializer.rb +36 -2
  34. data/lib/pg_sql_triggers/generator/service.rb +1 -1
  35. data/lib/pg_sql_triggers/migration.rb +1 -1
  36. data/lib/pg_sql_triggers/migrator.rb +27 -3
  37. data/lib/pg_sql_triggers/registry/manager.rb +6 -6
  38. data/lib/pg_sql_triggers/sql/kill_switch.rb +300 -0
  39. data/lib/pg_sql_triggers/testing/dry_run.rb +5 -7
  40. data/lib/pg_sql_triggers/testing/safe_executor.rb +23 -11
  41. data/lib/pg_sql_triggers/version.rb +1 -1
  42. data/lib/pg_sql_triggers.rb +12 -0
  43. data/lib/tasks/trigger_migrations.rake +33 -0
  44. metadata +35 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 868dfd4da507455302b3e00e6dd27a8cc5440c6e81c60e978e10a031a339e8c1
4
- data.tar.gz: e8b013e8485431fac4d30bfd7f3faade2130b4b55d1be4cfbf0f9ffdbad2ef6f
3
+ metadata.gz: 3d6bd35c06d2081333452a1417048b31fc8399c67722f0d14c1a59e73abfaf7c
4
+ data.tar.gz: 1cdee375336d7249e3587fb5368663d03eb8c9e0c4f7384802d1140932a03aa1
5
5
  SHA512:
6
- metadata.gz: 1265add39a041703438f7406a6a4b9c6f7b6e5dcf06240c8dc53c53f97c747cea850f1fa603d9eacbe072a43fbc4fe0cc371536e2bd8a215f30609171ccb8ffa
7
- data.tar.gz: e0d649df16316ef840fd5d42ef199b5dcf9f22d4ebe20134250ffe8b369d52c16f3774640ab95294ca487f4cb065d624bb7e386d1c223de536fc3dfc16d03511
6
+ metadata.gz: a8669ed888d53bb3557767ecaa238a24d2ada5c890ac969da51d9c73a70b0aaebde2f7e7ca27c1cceeb66bcccbe540f4b3a6ed8195c12ca0278996cef07e8cac
7
+ data.tar.gz: afacafb601e656ede4dd244022e6a3ecb492c49099add20c3198d11d0e93f82ab8f513f2e66549a9b110d573b7c3cb3797c6506a9db710289028d3984b61a99a
data/.erb_lint.yml ADDED
@@ -0,0 +1,47 @@
1
+ ---
2
+ # Enable all linters by default
3
+ EnableDefaultLinters: true
4
+
5
+ # Exclude vendor files from linting
6
+ exclude:
7
+ - 'vendor/**/*'
8
+
9
+ linters:
10
+ # Syntax and parsing
11
+ ParserErrors:
12
+ enabled: true
13
+
14
+ # Whitespace and formatting
15
+ TrailingWhitespace:
16
+ enabled: true
17
+ ExtraWhitespace:
18
+ enabled: true
19
+ SpaceAroundErbTag:
20
+ enabled: true
21
+ ClosingErbTagIndent:
22
+ enabled: true
23
+ SpaceInHtmlTag:
24
+ enabled: true
25
+
26
+ # Code quality
27
+ CommentSyntax:
28
+ enabled: true
29
+ SelfClosingTag:
30
+ enabled: true
31
+
32
+ # Security
33
+ NoJavascriptTagHelper:
34
+ enabled: true
35
+ RequireScriptNonce:
36
+ enabled: false # Disable if not using CSP nonces
37
+
38
+ # Accessibility
39
+ RequireInputLabel:
40
+ enabled: true
41
+
42
+ # Rails best practices
43
+ DeprecatedClasses:
44
+ enabled: true
45
+ SimpleFormat:
46
+ enabled: false # Disable if you intentionally use simple_format
47
+
data/.rubocop.yml CHANGED
@@ -8,7 +8,7 @@ plugins:
8
8
  - rubocop-factory_bot
9
9
 
10
10
  AllCops:
11
- TargetRubyVersion: 2.7
11
+ TargetRubyVersion: 3.0
12
12
  NewCops: enable
13
13
  SuggestExtensions: false
14
14
  Exclude:
@@ -88,6 +88,9 @@ Rails:
88
88
  Rails/I18nLocaleTexts:
89
89
  Enabled: false
90
90
 
91
+ Rails/StrongParametersExpect:
92
+ Enabled: false
93
+
91
94
  # RSpec
92
95
  RSpec/ExampleLength:
93
96
  Max: 10
data/CHANGELOG.md CHANGED
@@ -5,6 +5,29 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.0.1] - 2025-12-28
9
+
10
+ - Production kill switch for safety (blocks destructive operations in production by default)
11
+ - Core kill switch module with environment detection, confirmation validation, and thread-safe overrides
12
+ - CLI integration: All rake tasks protected (`trigger:migrate`, `trigger:rollback`, `trigger:migrate:up`, `trigger:migrate:down`, `trigger:migrate:redo`, `db:migrate:with_triggers`, `db:rollback:with_triggers`, `db:migrate:up:with_triggers`, `db:migrate:down:with_triggers`, `db:migrate:redo:with_triggers`)
13
+ - Console integration: Kill switch checks in `TriggerRegistry#enable!`, `TriggerRegistry#disable!`, `Migrator.run_up`, and `Migrator.run_down` methods
14
+ - UI integration: Kill switch enforcement in `MigrationsController` (up/down/redo actions) and `GeneratorController#create` action
15
+ - Configuration options: `kill_switch_enabled`, `kill_switch_environments`, `kill_switch_confirmation_required`, `kill_switch_confirmation_pattern`, `kill_switch_logger`
16
+ - ENV variable override support: `KILL_SWITCH_OVERRIDE` and `CONFIRMATION_TEXT` for emergency overrides
17
+ - Comprehensive logging and audit trail for all operations
18
+ - Confirmation modal UI component with client-side and server-side validation
19
+ - Kill switch status indicator in web UI
20
+
21
+ ### Fixed
22
+ - Added missing `mattr_accessor` declarations for kill switch configuration attributes (`kill_switch_environments`, `kill_switch_confirmation_required`, `kill_switch_confirmation_pattern`, `kill_switch_logger`) to ensure proper configuration access
23
+ - Fixed debug info display issues
24
+ - Fixed README documentation formatting
25
+ - Fixed Rails 6.1 compatibility issues
26
+ - Fixed BigDecimal dependency issues
27
+ - Fixed gemlock file conflicts
28
+ - Fixed RuboCop linting issues
29
+ - Fixed spec test issues
30
+
8
31
  ## [1.0.0] - 2025-12-27
9
32
 
10
33
  ### Added
@@ -14,7 +37,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
14
37
  - Drift detection between DSL definitions and database state (Managed & In Sync, Managed & Drifted, Manual Override, Disabled, Dropped, Unknown)
15
38
  - Permission system with three levels (Viewer, Operator, Admin)
16
39
  - Mountable Rails Engine with web UI for trigger management
17
- - Production kill switch for safety (blocks destructive operations in production by default)
18
40
  - Console introspection APIs (list, enabled, disabled, for_table, diff, validate!)
19
41
  - Migration system for registry table
20
42
  - Install generator (`rails generate pg_sql_triggers:install`)
@@ -49,4 +71,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
49
71
 
50
72
  ### Security
51
73
  - Production kill switch prevents destructive operations in production environments
74
+ - Blocks all destructive operations (migrations, trigger enable/disable) in production and staging by default
75
+ - Requires explicit confirmation text matching operation-specific patterns
76
+ - Thread-safe override mechanism for programmatic control
77
+ - ENV variable override support for emergency scenarios (`KILL_SWITCH_OVERRIDE`)
78
+ - Comprehensive logging of all kill switch checks and overrides
79
+ - Protection enforced across CLI (rake tasks), UI (controller actions), and Console (model/migrator methods)
52
80
  - Permission system enforces role-based access control (Viewer, Operator, Admin)