jazari 0.2.0 → 0.2.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 +11 -0
- data/app/models/jazari/anchor.rb +8 -1
- data/app/models/jazari/recipe_record.rb +8 -1
- data/app/models/jazari/run.rb +8 -1
- data/app/models/jazari/runbook.rb +8 -1
- data/lib/jazari/version.rb +1 -1
- data/lib/jazari.rb +3 -17
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7725f32aead889e14acc5cb3df2f91b8add8e478248244b1dc8b7893565d8b34
|
|
4
|
+
data.tar.gz: 746f4d57b3e11aaa9252e089568981baa90ddab26fd41d27757a7db3f987227d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b6ece9105ac8612a32c329d2581590132874a558f502580dc6d62af6df050c258468d011b7be99b9cf5abc1b7a56561ecd383993fe91f4467d15d211086fe927
|
|
7
|
+
data.tar.gz: 84ac29347f6349d21e102ff66acf21387de68a95f149adf7267ccc77a2416fe3b1d7534fe0242b80cc8aec6aff36cf94f849597e12bd802aa18c59135144d66f
|
data/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,17 @@ codes, the resolved-value shape, how revisions are computed, and the schema the
|
|
|
8
8
|
generator emits — changes to any of those are breaking even when the method
|
|
9
9
|
signatures do not move.
|
|
10
10
|
|
|
11
|
+
## [0.2.1] - 2026-08-10
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- **Table names are resolved lazily, not assigned at class-definition time.**
|
|
16
|
+
The binding previously depended on load order: under Zeitwerk a host's
|
|
17
|
+
`Jazari.configure` runs before the model constants autoload, so the
|
|
18
|
+
assignment never happened and the models silently kept the gem's default
|
|
19
|
+
names. A host that had adopted *existing* tables then queried tables that did
|
|
20
|
+
not exist. Found by a third host adoption.
|
|
21
|
+
|
|
11
22
|
## [0.2.0] - 2026-08-10
|
|
12
23
|
|
|
13
24
|
### Added
|
data/app/models/jazari/anchor.rb
CHANGED
|
@@ -5,7 +5,14 @@ module Jazari
|
|
|
5
5
|
# a JSON-tree node, a file path, a DNS zone, a document. The scope is
|
|
6
6
|
# host-registered; the gem ships no default scope naming any real model.
|
|
7
7
|
class Anchor < ApplicationRecord
|
|
8
|
-
|
|
8
|
+
# Resolved on EVERY call, not assigned at class-definition time.
|
|
9
|
+
#
|
|
10
|
+
# Assigning it eagerly made the binding depend on load order: under Zeitwerk
|
|
11
|
+
# a host's `configure` runs before these constants autoload, so the
|
|
12
|
+
# assignment never happened and the model silently kept the gem's default
|
|
13
|
+
# name. A host adopting existing tables then queried tables that do not
|
|
14
|
+
# exist. Reading config here removes the ordering question entirely.
|
|
15
|
+
def self.table_name = Jazari.table_name_for(:anchors)
|
|
9
16
|
|
|
10
17
|
has_one :runbook, as: :runbookable, dependent: :destroy
|
|
11
18
|
|
|
@@ -5,7 +5,14 @@ module Jazari
|
|
|
5
5
|
# is the immutable value the domain passes around, and letting an ActiveRecord
|
|
6
6
|
# object wear that name is how unsaved records leak into return values.
|
|
7
7
|
class RecipeRecord < ApplicationRecord
|
|
8
|
-
|
|
8
|
+
# Resolved on EVERY call, not assigned at class-definition time.
|
|
9
|
+
#
|
|
10
|
+
# Assigning it eagerly made the binding depend on load order: under Zeitwerk
|
|
11
|
+
# a host's `configure` runs before these constants autoload, so the
|
|
12
|
+
# assignment never happened and the model silently kept the gem's default
|
|
13
|
+
# name. A host adopting existing tables then queried tables that do not
|
|
14
|
+
# exist. Reading config here removes the ordering question entirely.
|
|
15
|
+
def self.table_name = Jazari.table_name_for(:recipes)
|
|
9
16
|
|
|
10
17
|
POLICIES = Jazari::RunPolicy::ALL
|
|
11
18
|
|
data/app/models/jazari/run.rb
CHANGED
|
@@ -8,7 +8,14 @@ module Jazari
|
|
|
8
8
|
# that separation is the whole point: `reset` on a runbook must not be able to
|
|
9
9
|
# destroy the record that the ritual ever ran.
|
|
10
10
|
class Run < ApplicationRecord
|
|
11
|
-
|
|
11
|
+
# Resolved on EVERY call, not assigned at class-definition time.
|
|
12
|
+
#
|
|
13
|
+
# Assigning it eagerly made the binding depend on load order: under Zeitwerk
|
|
14
|
+
# a host's `configure` runs before these constants autoload, so the
|
|
15
|
+
# assignment never happened and the model silently kept the gem's default
|
|
16
|
+
# name. A host adopting existing tables then queried tables that do not
|
|
17
|
+
# exist. Reading config here removes the ordering question entirely.
|
|
18
|
+
def self.table_name = Jazari.table_name_for(:runs)
|
|
12
19
|
|
|
13
20
|
belongs_to :subject, polymorphic: true, optional: true
|
|
14
21
|
|
|
@@ -4,7 +4,14 @@ module Jazari
|
|
|
4
4
|
# One subject's override of the canon. Materialized on first customization —
|
|
5
5
|
# never on read.
|
|
6
6
|
class Runbook < ApplicationRecord
|
|
7
|
-
|
|
7
|
+
# Resolved on EVERY call, not assigned at class-definition time.
|
|
8
|
+
#
|
|
9
|
+
# Assigning it eagerly made the binding depend on load order: under Zeitwerk
|
|
10
|
+
# a host's `configure` runs before these constants autoload, so the
|
|
11
|
+
# assignment never happened and the model silently kept the gem's default
|
|
12
|
+
# name. A host adopting existing tables then queried tables that do not
|
|
13
|
+
# exist. Reading config here removes the ordering question entirely.
|
|
14
|
+
def self.table_name = Jazari.table_name_for(:runbooks)
|
|
8
15
|
|
|
9
16
|
belongs_to :runbookable, polymorphic: true
|
|
10
17
|
|
data/lib/jazari/version.rb
CHANGED
data/lib/jazari.rb
CHANGED
|
@@ -70,25 +70,11 @@ module Jazari
|
|
|
70
70
|
config.table_names[key]&.to_s || "#{config.table_prefix}#{TABLES.fetch(key)}"
|
|
71
71
|
end
|
|
72
72
|
|
|
73
|
-
#
|
|
74
|
-
#
|
|
75
|
-
#
|
|
76
|
-
# CONSTRAINT: ActiveRecord table names are process-global class state, so the
|
|
77
|
-
# prefix is a BOOT-TIME setting for the whole process. It is not per-request,
|
|
78
|
-
# per-thread, or per-tenant, and two hosts in one process cannot hold
|
|
79
|
-
# different prefixes. Call `configure` once, at boot, after the models are
|
|
80
|
-
# loaded; `models_loaded?` reports whether the binding actually took effect
|
|
81
|
-
# so a host can assert it instead of silently running on default names.
|
|
73
|
+
# Kept for hosts that call it explicitly; the models now resolve their own
|
|
74
|
+
# names on every call, so nothing depends on this having run.
|
|
82
75
|
def self.models_loaded? = const_defined?(:RecipeRecord)
|
|
83
76
|
|
|
84
|
-
def self.apply_table_names!
|
|
85
|
-
return false unless models_loaded?
|
|
86
|
-
|
|
87
|
-
{ RecipeRecord: :recipes, Runbook: :runbooks, Anchor: :anchors, Run: :runs }.each do |klass, key|
|
|
88
|
-
const_get(klass).table_name = table_name_for(key)
|
|
89
|
-
end
|
|
90
|
-
true
|
|
91
|
-
end
|
|
77
|
+
def self.apply_table_names! = models_loaded?
|
|
92
78
|
|
|
93
79
|
def self.config = configuration || configure
|
|
94
80
|
|