styxable 0.1.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 +7 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +10 -0
- data/LICENSE.txt +21 -0
- data/README.md +78 -0
- data/Rakefile +23 -0
- data/lib/styxable/version.rb +5 -0
- data/lib/styxable.rb +8 -0
- data/sig/styxable.rbs +4 -0
- metadata +215 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 8b5fff266f8b26a2e96d3d48cff4fbfb4bba7a804d3b3594e449794d1dd653a2
|
|
4
|
+
data.tar.gz: 4f93e3748e5629da335ec2e32466b0df390a0f7185ca18bc107105ea67057aa6
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: b38f9d703f88842a090b1efb4441427b8d51a0627036c3f7de684ba03a0d5159e9f2caf5fda941e34c0f9a995c4d66cad09cc30e9d641187828c5c781d28f024
|
|
7
|
+
data.tar.gz: 30f9ba47f9f659b27344f97a7330b90fcb29be27115ba8f50032a29bbb6c04ede134977e7db41a4baec13b95affda540fe665b98f4d5882e115b0db8e15a8961
|
data/CHANGELOG.md
ADDED
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Code of Conduct
|
|
2
|
+
|
|
3
|
+
"styxable" follows [The Ruby Community Conduct Guideline](https://www.ruby-lang.org/en/conduct) in all "collaborative space", which is defined as community communications channels (such as mailing lists, submitted patches, commit comments, etc.):
|
|
4
|
+
|
|
5
|
+
* Participants will **be tolerant** of opposing views.
|
|
6
|
+
* Participants must ensure that their language and actions are **free of personal attacks** and disparaging personal remarks.
|
|
7
|
+
* When interpreting the words and actions of others, participants should always **assume good intentions**.
|
|
8
|
+
* Behaviour which can be reasonably considered **harassment will not be tolerated**.
|
|
9
|
+
|
|
10
|
+
If you have any concerns about behaviour within this project, please contact a maintainer.
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Andreas Finger
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Styxable
|
|
2
|
+
|
|
3
|
+
Archivable ActiveRecords / immutable soft-delete, with (GDPR) data retention and permanent purging.
|
|
4
|
+
|
|
5
|
+
> THIS IS STILL WORK IN PROGRESS OR NOT FUNCTIONAL YET!
|
|
6
|
+
|
|
7
|
+
Styxable turns deletion into a three-stage lifecycle for ActiveRecord models: active, archived, purged. Calling styx_archive soft-deletes a record — it (optionally) vanishes from default scopes like being in a trash can or recycle bin, but the row survives, so foreign keys, joins, reports and audits keep working. Archived records can still be listed, counted and restored during a configurable grace or retention period, giving you an undo window or restore window instead of an irreversible destroy.
|
|
8
|
+
|
|
9
|
+
While a record sits in the archive it is immutable: writes are rejected, so nothing can be silently edited between archiving and erasure — like in a vault. styx_unarchive brings a record back, unless it cannot, for example when a newer record has claimed a unique attribute in the meantime. Archiving cascades along dependent: associations, so closing an account, deactivating a user or tearing down a tenant can archive everything it owns in a single call, with callbacks around each step.
|
|
10
|
+
|
|
11
|
+
Each model declares its own data retention period. A recurring background job then permanently destroys records whose retention window has expired, expressing your retention schedule, records disposition and automatic purge in code rather than in a runbook — useful for GDPR storage limitation and right to erasure ("right to be forgotten") obligations, or any policy with a TTL or expiry date. A before-purge callback lets you detach ActiveStorage blobs, delete remote files or notify external systems before a record crosses the Styx for good.
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
Install the gem and add to the application's Gemfile by executing:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
bundle add styxable
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
gem install styxable
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
TODO: Write usage instructions here
|
|
30
|
+
|
|
31
|
+
## Who or what is 'Styx'? Why 'Styxable'?
|
|
32
|
+
|
|
33
|
+
In greek mythology **Styx** is the river dividing the world of the living from the realm of the dead — and also a goddess, a daughter of Oceanus and Tethys. For being the first to side with Zeus in the war against the Titans, he made her waters the oath by which the gods themselves must swear, and an oath sworn on the Styx cannot be broken.
|
|
34
|
+
|
|
35
|
+
Four things about that story map onto what this gem does.
|
|
36
|
+
|
|
37
|
+
| In the myth | In Styxable |
|
|
38
|
+
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
39
|
+
| The Styx is a **boundary, not an ending**. Souls cross out of the living world; they do not stop existing | `styx_archive` moves a record out of your default scopes and out of the working set. The row survives, so foreign keys, joins, reports and audits still resolve |
|
|
40
|
+
| An oath sworn on the Styx is **unbreakable** | Archived records are `immutable`. Writes are rejected for as long as the record stays archived |
|
|
41
|
+
| The return is **possible, but conditional**. Orpheus crossed and was granted Eurydice back — on a condition he failed to keep, and lost her a second time | `styx_unarchive` can bring a record back, unless the world moved on and a newer record has claimed a unique attribute in the meantime |
|
|
42
|
+
| The unburied **wait on the shore** before the final crossing | The `retention period`. An archived record waits out its window, is then permanently destroyed, and nothing remembers it afterwards |
|
|
43
|
+
| Thetis dipped the infant Achilles into the Styx to make him **invulnerable**, holding him by the heel — the one spot the water never touched. _(Which sounds awefully familiar to the Germanic hero Siegfried of the Nibelungenlied.)_ | Styxable has a heel too. Immutability is enforced through ActiveRecord validations, so anything that bypasses validations bypasses the vault: `update_column`, `update_all`, `delete_all` and raw SQL will all happily change or destroy an archived record. The guard protects you from ordinary application code, not from deliberate circumvention. |
|
|
44
|
+
|
|
45
|
+
> And the obvious reason: the name `archivable` was already taken in all its mutations, so I needed an alternative / prefix.
|
|
46
|
+
|
|
47
|
+
## Development
|
|
48
|
+
|
|
49
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
50
|
+
|
|
51
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
52
|
+
|
|
53
|
+
## Maintainers and Contributors
|
|
54
|
+
|
|
55
|
+
### Issues
|
|
56
|
+
|
|
57
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/mediafinger/styxable. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/mediafinger/styxable/blob/main/CODE_OF_CONDUCT.md).
|
|
58
|
+
|
|
59
|
+
### Installation
|
|
60
|
+
|
|
61
|
+
After checking out the repo, run `bin/setup` and then `bundle execute rake ci` to run the **tests and rubocop**.
|
|
62
|
+
|
|
63
|
+
You can also run `bin/console` to open an irb session with the `Styxable` pre-loaded that will allow you to experiment.
|
|
64
|
+
|
|
65
|
+
To build and install this gem onto your local machine, run `bundle exec rake install`.
|
|
66
|
+
|
|
67
|
+
> **Maintainers only:**
|
|
68
|
+
>
|
|
69
|
+
> To release a new version, bump the version number in `version.rb`, commit this change, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org/gems/styxable).
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
## License
|
|
73
|
+
|
|
74
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
75
|
+
|
|
76
|
+
## Code of Conduct
|
|
77
|
+
|
|
78
|
+
Everyone interacting in the Styxable project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/mediafinger/styxable/blob/main/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "bundler/audit/task"
|
|
4
|
+
require "bundler/gem_tasks"
|
|
5
|
+
require "rspec/core/rake_task"
|
|
6
|
+
require "rubocop/rake_task"
|
|
7
|
+
|
|
8
|
+
# setup task bundle:audit
|
|
9
|
+
Bundler::Audit::Task.new
|
|
10
|
+
|
|
11
|
+
RSpec::Core::RakeTask.new(:rspec)
|
|
12
|
+
|
|
13
|
+
RuboCop::RakeTask.new
|
|
14
|
+
|
|
15
|
+
desc "Open a console with Styxable loaded"
|
|
16
|
+
task :console do
|
|
17
|
+
sh "bin/console"
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
desc "Run rubocop and the specs and check for known CVEs"
|
|
21
|
+
task ci: %i(rubocop rspec bundle:audit)
|
|
22
|
+
|
|
23
|
+
task default: :ci
|
data/lib/styxable.rb
ADDED
data/sig/styxable.rbs
ADDED
metadata
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: styxable
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Andreas Finger
|
|
8
|
+
bindir: exe
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: zeitwerk
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '2.6'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - ">="
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '2.6'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: amazing_print
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '1.8'
|
|
33
|
+
type: :development
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '1.8'
|
|
40
|
+
- !ruby/object:Gem::Dependency
|
|
41
|
+
name: bundler
|
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - ">="
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '2.2'
|
|
47
|
+
type: :development
|
|
48
|
+
prerelease: false
|
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - ">="
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '2.2'
|
|
54
|
+
- !ruby/object:Gem::Dependency
|
|
55
|
+
name: bundler-audit
|
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - ">="
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '0.9'
|
|
61
|
+
type: :development
|
|
62
|
+
prerelease: false
|
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - ">="
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '0.9'
|
|
68
|
+
- !ruby/object:Gem::Dependency
|
|
69
|
+
name: irb
|
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - ">="
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '1.15'
|
|
75
|
+
type: :development
|
|
76
|
+
prerelease: false
|
|
77
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - ">="
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '1.15'
|
|
82
|
+
- !ruby/object:Gem::Dependency
|
|
83
|
+
name: rake
|
|
84
|
+
requirement: !ruby/object:Gem::Requirement
|
|
85
|
+
requirements:
|
|
86
|
+
- - ">="
|
|
87
|
+
- !ruby/object:Gem::Version
|
|
88
|
+
version: '13.2'
|
|
89
|
+
type: :development
|
|
90
|
+
prerelease: false
|
|
91
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
92
|
+
requirements:
|
|
93
|
+
- - ">="
|
|
94
|
+
- !ruby/object:Gem::Version
|
|
95
|
+
version: '13.2'
|
|
96
|
+
- !ruby/object:Gem::Dependency
|
|
97
|
+
name: rspec
|
|
98
|
+
requirement: !ruby/object:Gem::Requirement
|
|
99
|
+
requirements:
|
|
100
|
+
- - "~>"
|
|
101
|
+
- !ruby/object:Gem::Version
|
|
102
|
+
version: '3.13'
|
|
103
|
+
type: :development
|
|
104
|
+
prerelease: false
|
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
106
|
+
requirements:
|
|
107
|
+
- - "~>"
|
|
108
|
+
- !ruby/object:Gem::Version
|
|
109
|
+
version: '3.13'
|
|
110
|
+
- !ruby/object:Gem::Dependency
|
|
111
|
+
name: rubocop
|
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
|
113
|
+
requirements:
|
|
114
|
+
- - "~>"
|
|
115
|
+
- !ruby/object:Gem::Version
|
|
116
|
+
version: '1.75'
|
|
117
|
+
type: :development
|
|
118
|
+
prerelease: false
|
|
119
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
120
|
+
requirements:
|
|
121
|
+
- - "~>"
|
|
122
|
+
- !ruby/object:Gem::Version
|
|
123
|
+
version: '1.75'
|
|
124
|
+
- !ruby/object:Gem::Dependency
|
|
125
|
+
name: rubocop-rake
|
|
126
|
+
requirement: !ruby/object:Gem::Requirement
|
|
127
|
+
requirements:
|
|
128
|
+
- - "~>"
|
|
129
|
+
- !ruby/object:Gem::Version
|
|
130
|
+
version: '0.7'
|
|
131
|
+
type: :development
|
|
132
|
+
prerelease: false
|
|
133
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
134
|
+
requirements:
|
|
135
|
+
- - "~>"
|
|
136
|
+
- !ruby/object:Gem::Version
|
|
137
|
+
version: '0.7'
|
|
138
|
+
- !ruby/object:Gem::Dependency
|
|
139
|
+
name: rubocop-rspec
|
|
140
|
+
requirement: !ruby/object:Gem::Requirement
|
|
141
|
+
requirements:
|
|
142
|
+
- - "~>"
|
|
143
|
+
- !ruby/object:Gem::Version
|
|
144
|
+
version: '3.10'
|
|
145
|
+
type: :development
|
|
146
|
+
prerelease: false
|
|
147
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
148
|
+
requirements:
|
|
149
|
+
- - "~>"
|
|
150
|
+
- !ruby/object:Gem::Version
|
|
151
|
+
version: '3.10'
|
|
152
|
+
description: |
|
|
153
|
+
Styxable turns deletion into a three-stage lifecycle for ActiveRecord models: active,
|
|
154
|
+
archived, purged. Calling styx_archive soft-deletes a record — it (optionally) vanishes
|
|
155
|
+
from default scopes like being in a trash can or recycle bin, but the row survives, so foreign
|
|
156
|
+
keys, joins, reports and audits keep working. Archived records can still be listed,
|
|
157
|
+
counted and restored during a configurable grace or retention period, giving you an undo window or
|
|
158
|
+
restore window instead of an irreversible destroy.
|
|
159
|
+
|
|
160
|
+
While a record sits in the archive it is immutable: writes are rejected, so nothing can
|
|
161
|
+
be silently edited between archiving and erasure — like in a vault.
|
|
162
|
+
styx_unarchive brings a record back, unless it cannot, for example when
|
|
163
|
+
a newer record has claimed a unique attribute in the meantime. Archiving cascades along
|
|
164
|
+
dependent: associations, so closing an account, deactivating a user or tearing down a
|
|
165
|
+
tenant can archive everything it owns in a single call, with callbacks around each step.
|
|
166
|
+
|
|
167
|
+
Each model declares its own data retention period. A recurring background job then permanently
|
|
168
|
+
destroys records whose retention window has expired, expressing your retention schedule,
|
|
169
|
+
records disposition and automatic purge in code rather than in a runbook — useful for
|
|
170
|
+
GDPR storage limitation and right to erasure ("right to be forgotten") obligations, or
|
|
171
|
+
any policy with a TTL or expiry date. A before-purge callback lets you detach
|
|
172
|
+
ActiveStorage blobs, delete remote files or notify external systems before a record
|
|
173
|
+
crosses the Styx for good.
|
|
174
|
+
email:
|
|
175
|
+
- webmaster@mediafinger.com
|
|
176
|
+
executables: []
|
|
177
|
+
extensions: []
|
|
178
|
+
extra_rdoc_files: []
|
|
179
|
+
files:
|
|
180
|
+
- CHANGELOG.md
|
|
181
|
+
- CODE_OF_CONDUCT.md
|
|
182
|
+
- LICENSE.txt
|
|
183
|
+
- README.md
|
|
184
|
+
- Rakefile
|
|
185
|
+
- lib/styxable.rb
|
|
186
|
+
- lib/styxable/version.rb
|
|
187
|
+
- sig/styxable.rbs
|
|
188
|
+
homepage: https://github.com/mediafinger/styxable
|
|
189
|
+
licenses:
|
|
190
|
+
- MIT
|
|
191
|
+
metadata:
|
|
192
|
+
allowed_push_host: https://rubygems.org
|
|
193
|
+
homepage_uri: https://github.com/mediafinger/styxable
|
|
194
|
+
source_code_uri: https://github.com/mediafinger/styxable
|
|
195
|
+
changelog_uri: https://github.com/mediafinger/styxable/blob/main/CHANGELOG.md
|
|
196
|
+
rubygems_mfa_required: 'true'
|
|
197
|
+
rdoc_options: []
|
|
198
|
+
require_paths:
|
|
199
|
+
- lib
|
|
200
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
201
|
+
requirements:
|
|
202
|
+
- - ">="
|
|
203
|
+
- !ruby/object:Gem::Version
|
|
204
|
+
version: 4.0.0
|
|
205
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
206
|
+
requirements:
|
|
207
|
+
- - ">="
|
|
208
|
+
- !ruby/object:Gem::Version
|
|
209
|
+
version: '0'
|
|
210
|
+
requirements: []
|
|
211
|
+
rubygems_version: 4.0.16
|
|
212
|
+
specification_version: 4
|
|
213
|
+
summary: Archivable ActiveRecords / immutable soft-delete, with (GDPR) data retention
|
|
214
|
+
and permanent purging.
|
|
215
|
+
test_files: []
|