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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 781a303d10e42b7e3337381b7d167aaeb227a5cf538e4122f1b37c2143216f8f
4
- data.tar.gz: b6c2d6ca19ccc6d097ea30ddc644f2f58144d6fc9d6a74722e2f625c7502ba18
3
+ metadata.gz: 7725f32aead889e14acc5cb3df2f91b8add8e478248244b1dc8b7893565d8b34
4
+ data.tar.gz: 746f4d57b3e11aaa9252e089568981baa90ddab26fd41d27757a7db3f987227d
5
5
  SHA512:
6
- metadata.gz: 9d42855d9257d25cb193423c6864db7451006ae2b07fe9b013442b2cf3c3c1e8f1ceca6208e5e23b1a8f60d1d57b5502ea31e5859e81734dd3a1412f0e8accd4
7
- data.tar.gz: 156a565d0e8ab2b8f8f51dbb335c0410f60484da523ba9a1de6fd216bf3377f720cc3909722bed78f3854b5a836ea126a89106831e57c7c3ac9fa160802731f9
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
@@ -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
- self.table_name = "jazari_anchors"
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
- self.table_name = "jazari_recipes"
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
 
@@ -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
- self.table_name = "jazari_runs"
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
- self.table_name = "jazari_runbooks"
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
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Jazari
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.1"
5
5
  end
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
- # A host may adopt these tables under existing names rather than renaming
74
- # live tables in the same deploy as the cut-over.
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jazari
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nauman Tariq