grain 0.0.2 → 0.0.3

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: 5cad390077ec6feb274d0c3331f77a00c1f0766cf2edcff03460b9f3f1fb85e6
4
- data.tar.gz: 73d1b7338f8e0ea57e9448ae4f246b17eeae2525cd45854205ed2634a4d631c9
3
+ metadata.gz: 2bef8d3a722d2241abb6bc04ed91d129879f623c3649e9cf24fbcd2cb1064513
4
+ data.tar.gz: 404159a851fd37121235e0f4339b27b71706fd13fda285336502bfbcaf15384a
5
5
  SHA512:
6
- metadata.gz: 96f65b733a5d74dd8d7bea62d6f89f3dc7250a2364352e877f4ac95fbf0be5c4612adf65f6ea9a0c13e1285afe66f361d497963667e0f2cb1638cf2a980fdfb3
7
- data.tar.gz: 5b0be5e034a803da62a573991ba4dd058b94e7e890b7785095536e59e26954836345d10c11641e2fb7c12a4a0c7047949f44e0781c5d9ac35f7f36243369c798
6
+ metadata.gz: 347e30664fa16280bdae9cb1df3dd1c4fd3d4b33857f90ee539ccc5646856ce63a0c73ebd0c7ff2a55aa83ff6b3f8efc0565feb8821b1c9c13204cb6e0a0eb20
7
+ data.tar.gz: 337d6e981b43a9471427a6069823d114fd535f9d0a5fac1bb5efe303cc7c164de1997eed8c5d3754f5c76649569b84c2ba8b17672b837357a5786723a49ea7cd
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.0.3] - 2026-08-21
4
+
5
+ ### Fixed
6
+
7
+ - **Generated migrations tripped the linter of the app they landed in.** They
8
+ wrote `[ :a, :b ]` as `[:a, :b]`, and `rubocop-rails-omakase` — which ships with
9
+ every `rails new` on Rails 8 — wants the inner spaces. It lints `db/migrate`;
10
+ `db/schema.rb` is the excluded one. So installing Grain put an application's
11
+ linter in the red over a file it had not written, and regenerating the migration
12
+ after a definition changed, which Grain asks for, brought the offence back.
13
+
3
14
  ## [0.0.2] - 2026-08-21
4
15
 
5
16
  Everything here came out of using Grain in two real applications: a football
data/CLAUDE.md CHANGED
@@ -22,8 +22,11 @@ matar el proyecto), `../ideas-negocio.md`, `../ekklesia/CLAUDE.md` (integración
22
22
  Detalle en `../ekklesia/CLAUDE.md`.
23
23
  - **Hay cambios sin commitear** en grain y en golbet (DrainJob, Installer, README). Los commits
24
24
  los hace el usuario; yo redacto los mensajes y no ejecuto `git commit`.
25
- - Versión en `lib/grain/version.rb` = 0.0.1. Pendiente publicar 0.0.2 con los nueve arreglos que
26
- salieron del dogfooding.
25
+ - **0.0.2 publicada.** 0.0.3 lista para publicar, sin publicar: un arreglo, que las migraciones
26
+ generadas pasen `rubocop-rails-omakase`.
27
+ - (histórico) **0.0.2 lista para publicar, sin publicar.** Versión bumpeada, CHANGELOG escrito con sección de
28
+ Upgrading, descripción del gemspec corregida, bloque de estado del README al día, y
29
+ `grain-0.0.2.gem` construida. Falta `git push` y `gem push`, que los hace el usuario.
27
30
 
28
31
  ## Cómo trabajar aquí
29
32
 
@@ -112,6 +115,10 @@ API: `Rollup.for(...).between(...).by(...)`, `.verify(repair:)`, `.backfill(from
112
115
  - **`FULL OUTER JOIN` en Postgres no acepta `IS NOT DISTINCT FROM`.** `verify` usa `UNION ALL` +
113
116
  `GROUP BY`, que además ya trata los nulos como iguales.
114
117
  - **Afirmar sobre números sin afirmar el tipo.** `assert_equal 1400, BigDecimal(1400)` pasa.
118
+ - **El código que Grain emite tiene que pasar el linter de la app donde cae.** Las migraciones
119
+ escribían `[:a, :b]` y `rubocop-rails-omakase` —el default de todo `rails new` en Rails 8, y que
120
+ sí linea `db/migrate`— quiere `[ :a, :b ]`. Instalar la gema dejaba el linter en rojo por un
121
+ archivo que la app no escribió. El `.rubocop.yml` de Grain no usa omakase, por eso no se veía.
115
122
  - **`[nil].any?` es `false`, y `[false].any?` también.** Preguntar por verdadez si una lista de
116
123
  valores trae algo tira justo los valores que hay que tratar. Va con `empty?`. Recién mordió al
117
124
  arreglar los filtros de lista: el `IS NULL` no se agregaba nunca y el `nil` de la lista
@@ -132,12 +139,14 @@ throttling adaptativo por lag de replicación. Un rollup con modelo roto se salt
132
139
 
133
140
  ## Lo que sigue
134
141
 
135
- 1. Actualizar el bloque de estado del README (ya está probada en una app real) y publicar 0.0.2.
136
- Ojo: 0.0.2 ya lleva **un cambio incompatible** (el tenant obligatorio en las lecturas). Está en
137
- el CHANGELOG bajo `Unreleased`. golbet no se rompe su única lectura ya pasaba el tenant, y su
138
- suite corre verde contra la gema parcheada.
139
- 2. La descripción publicada en RubyGems dice "maintains it with deltas", que **es falso** y
140
- contradice al propio README. Los metadatos no se editan; se corrige en 0.0.2.
142
+ 1. ~~Bloque de estado del README, descripción del gemspec, CHANGELOG, versión~~ **hecho**. Falta
143
+ `git push`, `gem push grain-0.0.2.gem` y el tag `v0.0.2`. Ojo con el tag: **`v0.0.1` quedó en un
144
+ commit donde `version.rb` todavía decía 0.0.0**, así que no marca lo que se publicó. Poner
145
+ `v0.0.2` en el commit del bump, no antes.
146
+ 2. 0.0.2 lleva **tres cambios incompatibles**: tenant obligatorio en las lecturas, alias de joins
147
+ `g_<camino>` en vez de `j0`, y triggers nuevos en las tablas que leen las medidas (hay que
148
+ regenerar las migraciones de tabla). Están en el CHANGELOG con su sección de Upgrading. Ni
149
+ golbet ni ekklesia se rompen: las dos corren verdes contra 0.0.2.
141
150
  3. El artículo fundacional: *"Cómo matamos nuestras vistas materializadas"*, con los números de
142
151
  golbet. Según `../proyecto-grain.md` es todo el mercadeo del primer año.
143
152
  4. **Las 5-10 conversaciones con equipos Rails que tengan dashboards pesados.** Sigue sin hacerse,
@@ -43,6 +43,15 @@ module Grain
43
43
 
44
44
  private
45
45
 
46
+ # Array#inspect renders [:a, :b], and rubocop-rails-omakase wants the inner
47
+ # spaces. That matters because omakase ships with every `rails new` on Rails 8
48
+ # and lints db/migrate — db/schema.rb is excluded, migrations are not. Without
49
+ # this, installing Grain puts an application's linter in the red over a file it
50
+ # did not write, and regenerating the migration brings the offence back.
51
+ def symbol_list(names)
52
+ "[ #{names.map(&:inspect).join(", ")} ]"
53
+ end
54
+
46
55
  def create_table
47
56
  lines = ["create_table :#{table_name}#{primary_key_option} do |t|"]
48
57
  lines.concat(key_column_lines)
@@ -58,7 +67,7 @@ module Grain
58
67
  def primary_key_option
59
68
  return ", id: :bigint" if surrogate_key?
60
69
 
61
- ", primary_key: #{schema.primary_key.inspect}"
70
+ ", primary_key: #{symbol_list(schema.primary_key)}"
62
71
  end
63
72
 
64
73
  def key_column_lines
@@ -80,7 +89,7 @@ module Grain
80
89
  def uniqueness_index
81
90
  return nil unless surrogate_key?
82
91
 
83
- "add_index :#{table_name}, #{schema.key_columns.inspect}, unique: true,\n" \
92
+ "add_index :#{table_name}, #{symbol_list(schema.key_columns)}, unique: true,\n" \
84
93
  " nulls_not_distinct: true, name: #{uniqueness_index_name.inspect}"
85
94
  end
86
95
 
data/lib/grain/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Grain
4
- VERSION = "0.0.2"
4
+ VERSION = "0.0.3"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grain
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oscar Ortega