openehr-rails 0.7.1 → 0.9.0

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 (45) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/bug_report.md +1 -1
  3. data/.github/workflows/release.yml +2 -0
  4. data/.rubocop_todo.yml +2 -2
  5. data/.ruby-version +1 -1
  6. data/CHANGELOG.md +134 -0
  7. data/CLAUDE.md +108 -2
  8. data/docs/backlog.md +13 -1
  9. data/docs/design/0.9.0-plan.md +284 -0
  10. data/docs/design/multi-leaf-non-observation-plan.md +8 -0
  11. data/docs/reports/0.9.0-log.md +165 -0
  12. data/docs/reports/referral-upstream-log.md +298 -0
  13. data/lib/generators/openehr/scaffold/scaffold_generator.rb +2 -0
  14. data/lib/openehr_rails/fhir/type_map.rb +2 -0
  15. data/lib/openehr_rails/fhir/unsupported_profile_error.rb +14 -3
  16. data/lib/openehr_rails/opt/field_extractor.rb +87 -26
  17. data/lib/openehr_rails/opt/parser.rb +2 -63
  18. data/lib/openehr_rails/rm/composition_committer.rb +5 -5
  19. data/lib/openehr_rails/rm/graph_builder.rb +13 -1
  20. data/lib/openehr_rails/rm/rm_object_builder.rb +129 -49
  21. data/lib/openehr_rails/storable/shape_guard.rb +71 -0
  22. data/lib/openehr_rails/storable.rb +3 -0
  23. data/lib/openehr_rails/version.rb +1 -1
  24. data/openehr-rails.gemspec +1 -1
  25. data/spec/generators/openehr/scaffold/opt_scaffold_generator_spec.rb +75 -0
  26. data/spec/openehr_rails/aql/dataset_adapter_spec.rb +16 -16
  27. data/spec/openehr_rails/aql/executor_execute_demo_queries_spec.rb +101 -0
  28. data/spec/openehr_rails/aql/executor_spec.rb +44 -4
  29. data/spec/openehr_rails/fhir/fsh_generator_spec.rb +39 -0
  30. data/spec/openehr_rails/fhir/profile_generator_spec.rb +39 -0
  31. data/spec/openehr_rails/fhir_instruction_skip_spec.rb +41 -0
  32. data/spec/openehr_rails/opt/field_extractor_binding_spec.rb +21 -1
  33. data/spec/openehr_rails/opt/field_extractor_embedded_archetype_spec.rb +1 -1
  34. data/spec/openehr_rails/opt/field_extractor_embedded_root_spec.rb +136 -0
  35. data/spec/openehr_rails/opt/field_extractor_instruction_spec.rb +123 -0
  36. data/spec/openehr_rails/opt/field_extractor_min_occurrences_spec.rb +43 -0
  37. data/spec/openehr_rails/opt/parser_repeated_root_bindings_spec.rb +33 -0
  38. data/spec/openehr_rails/opt/parser_term_bindings_spec.rb +2 -1
  39. data/spec/openehr_rails/rm/composition_committer_context_spec.rb +118 -0
  40. data/spec/openehr_rails/rm/rm_object_builder_spec.rb +84 -5
  41. data/spec/openehr_rails/storable_shape_guard_spec.rb +127 -0
  42. data/spec/support/synthetic_referral_canonical_hash.rb +80 -0
  43. data/spec/templates/bmi_calculation_repeated_root.opt +2244 -0
  44. data/spec/templates/jp_referral.opt +5554 -0
  45. metadata +17 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cf0122af26f620b3082c006c5d469fdf3710c5dd1647b856c9024c8e4e3f7c66
4
- data.tar.gz: b54d925956180cd9baffab027d42564ecd55864f839698952ed2bfbfdfb9356d
3
+ metadata.gz: 7cf3e47b16df6a577e52ade10ed4dfe9ccaecb6b5d3250831aa29bb17bf48b9c
4
+ data.tar.gz: 1de3151b7a663f9ccdc3cc5289d311937bbfb2e001f79d4d155dc82dcadfbe49
5
5
  SHA512:
6
- metadata.gz: 90fadabcf5f3215e6c24f4c75f5bef98e38b831286e0f0da33d6d67ae6743937d7958d286384c85042830452e47fe08e22eca6dce72541ab7bfb5395cc029ef2
7
- data.tar.gz: 700d4afc6e60805cc76c478035131d0aa62b5f0decc09d44c67f0ac1bb4e8181500de65ba56b40f2974a0e24259945fb26285a6b3eac0ebe3ca394656cdc1c56
6
+ metadata.gz: f78dbe2aa02f4209312b59182edcb9720cb7395cc518a1187463ebdc55d21ac464a35238e6dd8d4caa85325450b2ec9f71298d1eeca9c9866e408eea9b35fa1b
7
+ data.tar.gz: 12693cb3515233a9ad1c7e999bd5b9349587f59b983d47900f99167daa71247cb28a2b4c5ae09d85359fd2675717e6f65579f3f2fe1d186e49d1fbc9bc1d80c4
@@ -13,7 +13,7 @@ assignees: ''
13
13
  ## Environment
14
14
 
15
15
  - `openehr-rails` version: <!-- e.g. 0.4.1 -->
16
- - `openehr` version: <!-- e.g. ~> 2.3 -->
16
+ - `openehr` version: <!-- e.g. 2.5.0 -->
17
17
  - Rails version: <!-- e.g. 8.1 -->
18
18
  - Ruby version: <!-- e.g. 3.3, 3.4, 4.0 -->
19
19
  - If the report involves an OPT/ADL file: the generating tool and its
@@ -26,6 +26,8 @@ jobs:
26
26
  run: bundle exec rake release:check
27
27
  - name: Build gem
28
28
  run: bundle exec rake build
29
+ - name: Record sha256
30
+ run: sha256sum pkg/*.gem | tee pkg/SHA256SUMS
29
31
  - name: Upload gem artifact
30
32
  uses: actions/upload-artifact@v7
31
33
  with:
data/.rubocop_todo.yml CHANGED
@@ -160,7 +160,7 @@ Metrics/BlockLength:
160
160
  # Offense count: 6
161
161
  # Configuration parameters: CountComments, CountAsOne.
162
162
  Metrics/ClassLength:
163
- Max: 210
163
+ Max: 211
164
164
 
165
165
  # Offense count: 15
166
166
  # Configuration parameters: AllowedMethods, AllowedPatterns.
@@ -175,7 +175,7 @@ Metrics/MethodLength:
175
175
  # Offense count: 1
176
176
  # Configuration parameters: CountComments, CountAsOne.
177
177
  Metrics/ModuleLength:
178
- Max: 181
178
+ Max: 182
179
179
 
180
180
  # Offense count: 2
181
181
  # Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 4.0.6
1
+ 4.0.10
data/CHANGELOG.md CHANGED
@@ -7,6 +7,140 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.9.0] - 2026-11-24
11
+
12
+ > **Upgrade note.** Four things change for an existing host app.
13
+ > (1) Requires `openehr` `~> 2.5` (was `~> 2.3, >= 2.3.1`): a host app locked to
14
+ > openehr 2.4.x must update it together with this gem.
15
+ > (2) `FieldExtractor` output: a field under an embedded archetype root now has the
16
+ > root written `[archetype_id]` in its `path` and is named after its own archetype
17
+ > (`laboratory_test_analyte_at0001`, was `laboratory_test_result_at0001_2`); entries
18
+ > with `protocol` leaves and every `INSTRUCTION` extract more fields than before. A
19
+ > generated model keeps the `FIELD_MAP` it was generated with, so nothing moves until
20
+ > you re-scaffold; re-scaffolding such a template adds and renames columns. Code that
21
+ > reads `FieldExtractor#fields` at runtime sees the new paths and names immediately.
22
+ > (3) `Storable` now raises `OpenehrRails::Storable::UnsupportedTemplateShape` on save,
23
+ > and saves nothing, when a record holds a value for a field it cannot assemble into a
24
+ > valid composition (an entry nested in a `SECTION`, a field under an embedded root, an
25
+ > `INSTRUCTION`). Such saves used to succeed and store a malformed `rm_composition`.
26
+ > (4) FHIR `component` slice names follow the renamed fields.
27
+ > Also: a composition committed from canonical JSON **with** a `context` now answers
28
+ > `c/context/...` AQL paths with `unsupported path attribute` (as every
29
+ > `Storable`-saved composition already did) instead of a row holding `nil`; see Known
30
+ > limitations.
31
+
32
+ ### Added
33
+ - `FieldExtractor` descends `activities`, `description` and `protocol`, so an
34
+ `INSTRUCTION` entry has fields for the ELEMENTs under
35
+ `activities[...]/description[...]` and `protocol[...]`, including the embedded
36
+ CLUSTER roots there at any depth (a referral's `service_request`: 0 fields before,
37
+ 20 now). `ACTION.description` and every entry type's `protocol` come with the same
38
+ change. `narrative`, `timing` and `action_archetype_id` are not ELEMENTs and yield
39
+ no field (#47, anlage upstream 17).
40
+ - Fields carry `root_path` (path of the nearest embedded root, else of the entry) and
41
+ `instance_index` (0-based document-order ordinal among the template's fields sharing
42
+ the same `path`), so `[path, instance_index]` identifies a field even when the same
43
+ archetype is embedded twice side by side (a referral's requester / receiver
44
+ organisation) or an entry archetype repeats. Root names and name-predicate paths
45
+ wait for per-root terms upstream (openehr-ruby#58) (#57).
46
+ - DV_QUANTITY fields carry `units_list`, every unit the OPT allows in OPT order;
47
+ `units` stays the first one (#57).
48
+ - Fields carry `min_occurrences`, the ELEMENT's own occurrences lower bound (0 when
49
+ unconstrained). `required` keeps its meaning ("entry mandatory and element
50
+ mandatory"), so under an optional entry a 1..1 element is
51
+ `required: false, min_occurrences: 1`: mandatory if the entry is written at all.
52
+ Generated validations are unchanged; validating that conditional requirement is
53
+ #65 (#58, anlage upstream 20).
54
+
55
+ ### Changed
56
+ - `FieldExtractor` writes an embedded archetype root in a field's `path` by its
57
+ archetype id instead of its at-code, and names fields under such a root after their
58
+ own archetype: `<own concept>_<label slug, else at-code>` (never the bare concept).
59
+ For `lab_result_report_reduced.opt`: `.../items[at0010]/items[at0001]/value` becomes
60
+ `.../items[openEHR-EHR-CLUSTER.laboratory_test_analyte.v1]/items[at0001]/value`.
61
+ Paths now match RM data paths and AQL. Fields owned by the entry itself, and
62
+ templates without embedded roots, are unchanged (#57, anlage upstream 22).
63
+ - A template whose entries carry `protocol` leaves extracts more fields: e.g.
64
+ `problem_list.opt` gains `problem_diagnosis_at0070` (最終更新日, under
65
+ `protocol[at0032]`). The FHIR profile for `problem_diagnosis` is unchanged: at0070
66
+ has no row in `TypeMap::ENTRY_ELEMENT_MAPS` and is left out (#47).
67
+ - The FHIR generators report an `INSTRUCTION` that has leaves through `#skipped` as
68
+ "N leaves ... no row in `TypeMap::ENTRY_ELEMENT_MAPS`" instead of "no leaves";
69
+ still no `ServiceRequest` profile is emitted (mapping rows: #35) (#47).
70
+ - `openehr:scaffold` prints a warning listing the fields the generated model cannot
71
+ save yet (#60).
72
+ - Requires `openehr` `~> 2.5`. `OpenehrRails::Opt::Parser` no longer reads OPT
73
+ `term_bindings` itself: openehr 2.5.0 does (openehr-ruby#31), and the interim bypass
74
+ is removed (#59).
75
+
76
+ ### Fixed
77
+ - `OpenehrRails::Storable` no longer writes a malformed composition for the template
78
+ shapes it cannot assemble: saving a value for a field of an entry nested in a
79
+ `SECTION`, of an embedded archetype root or of an `INSTRUCTION` raises
80
+ `UnsupportedTemplateShape`, naming the shape, the fields and the tracking issue
81
+ (#62, #61, #69), and saves nothing. Records that leave those fields empty, and
82
+ models of templates without these shapes, save exactly as before. Models generated
83
+ before 0.9.0 are covered too (#60).
84
+ - An OPT embedding the same archetype more than once no longer yields each term
85
+ binding once per occurrence: `code_bindings` holds one entry per binding, so the
86
+ FHIR `code.coding` slices are not duplicated. Two behaviours follow upstream and
87
+ differ from the removed bypass: a binding item without a `terminology_id` is no
88
+ longer completed from the `term_bindings` element's `terminology` attribute, and
89
+ when roots of the same archetype carry *different* bindings the last root wins
90
+ instead of their union (#59).
91
+ - `CompositionCommitter` / `GraphBuilder` persist a canonical composition's
92
+ `context.start_time` (into `context_start_time`) and `context.setting` (into the
93
+ already-existing `setting_code` / `setting_value` columns); they were dropped unless
94
+ the caller passed `context_start_time:`. An explicit `context_start_time:` still
95
+ wins. `RmObjectBuilder` rebuilds the stored setting instead of always `other`
96
+ (#46, proposals 1-2; anlage upstream 16).
97
+
98
+ ### Known limitations
99
+ - `Storable` cannot yet write entries nested in a `SECTION` (#62), fields under an
100
+ embedded archetype root (#61) or `INSTRUCTION` entries (#69); it refuses them as
101
+ described above. Committing a canonical composition through
102
+ `Rm::CompositionCommitter` is unaffected.
103
+ - `SELECT c/context/start_time/value` (and `c/context/setting/...`) is not answerable
104
+ yet: the openehr AQL path evaluator (2.5.0 included) cannot navigate `EVENT_CONTEXT`
105
+ and raises `unsupported path attribute "start_time"` as soon as a composition has a
106
+ context. The values are stored and rebuilt by `to_rm`; querying them waits for an
107
+ openehr release.
108
+ - `context.other_context` is not persisted, and `CanonicalSerializer` does not emit
109
+ `context` yet (#46 stays open for both).
110
+
111
+ ## [0.8.0] - 2026-10-12
112
+
113
+ > **Upgrade note.** A stored Composition holding a `SECTION` or an `INSTRUCTION`
114
+ > (with its `ACTIVITY`s) now reads back through `to_rm` and AQL; the ones 0.7.1
115
+ > skipped with `openehr-rails AQL: skipping composition uid=...` are exactly the
116
+ > ones that become visible, so query row counts can grow. Two injected defaults
117
+ > are approximations until a later release persists them as columns: an
118
+ > INSTRUCTION without a stored narrative reads back with its node name as
119
+ > `narrative`, and every ACTIVITY with `action_archetype_id` `'/.*/'`.
120
+
121
+ ### Added
122
+ - `RmObjectBuilder` rebuilds `SECTION`, `INSTRUCTION` and `ACTIVITY` nodes (and
123
+ every CARE_ENTRY's `protocol`), so compositions holding them -- a referral's
124
+ `service_request` with its requester/receiver under `protocol[...]`, entries
125
+ nested in a `SECTION` -- become readable through `to_rm` and queryable by AQL
126
+ instead of being skipped with the 0.7.1 warning (#45). Two values are
127
+ **approximations** because the graph does not carry them yet: an INSTRUCTION
128
+ without a stored narrative gets its node name as `narrative`, and every
129
+ ACTIVITY gets `action_archetype_id` `'/.*/'` (any ACTION archetype). Both will
130
+ be persisted as columns in a later release. `ACTION`, `ITEM_SINGLE` and
131
+ `ITEM_TABLE` are still unsupported (skipped with the warning).
132
+ - `FieldExtractor` fields carry `rm_type_alternatives`: every value type the OPT
133
+ allows for the ELEMENT, in OPT order (e.g. `["DV_TEXT", "DV_CODED_TEXT"]` for
134
+ `problem_diagnosis` at0002). Additive; the chosen `rm_type` is unchanged. Lets a
135
+ host app tell an OR-constrained coded text (free text allowed) from a coded-only
136
+ one instead of rendering an empty select (#52, anlage #33).
137
+
138
+ ### Fixed
139
+ - An entry with no extracted leaves (today every `INSTRUCTION`, see #47) no
140
+ longer gets a profile consisting of the archetype `code` rules and an empty
141
+ `component` slicing header; it is skipped and reported through `#skipped`
142
+ with a message saying the entry has no leaves, whatever its resource (#49).
143
+
10
144
  ## [0.7.1] - 2026-09-25
11
145
 
12
146
  > **Upgrade note.** AQL now skips a stored composition that holds an RM type
data/CLAUDE.md CHANGED
@@ -43,7 +43,9 @@ diff, then commits, recording the implementer in a commit message trailer (e.g.
43
43
  ## Release convention
44
44
 
45
45
  Before tagging, make the final semver determination from the actual content of
46
- `[Unreleased]`, not from a pre-assigned version number. If the instructed version number
46
+ the release (the `changelog.d/` fragments consolidated into `CHANGELOG.md` at the
47
+ inventory, checked against `git diff <last tag>..master` - see 全開の進め方 below),
48
+ not from a pre-assigned version number. If the instructed version number
47
49
  contradicts the actual content, stop instead of tagging and ask for re-arbitration.
48
50
 
49
51
  **Publish only the CI artifact itself.** `gem push` takes the `.gem` downloaded
@@ -61,6 +63,13 @@ documentation files and `lib/` was byte-identical - but nothing in the release
61
63
  path caught it. Measurements in `docs/reports/fsh-generator-log.md` R8; the
62
64
  matching `release:check` guard is `skoba/openehr-rails#34`.)
63
65
 
66
+ **Local dev Ruby tracks the patch release CI builds with.** `.ruby-version`
67
+ moved 4.0.6 -> 4.0.7 (2026-10-12) so a local rebuild at the tag stamps the same
68
+ `rubygems_version` (4.0.20) as `ruby/setup-ruby`'s ruby 4.0 image did for 0.7.1,
69
+ whose `metadata.gz` differed from the local rebuild by that one line
70
+ (`docs/reports/referral-upstream-log.md` R2). The cross-check still judges by
71
+ `data.tar.gz`, not the whole-gem sha256: the two toolchains can drift apart again.
72
+
64
73
  **Confirm publication by checksum, not by version number.** RubyGems publishes
65
74
  the sha256 it recorded at push time (`/api/v1/gems/openehr-rails.json` `sha`, and
66
75
  the `checksum:` field in `https://index.rubygems.org/info/openehr-rails`). The
@@ -153,6 +162,103 @@ authorized for the task at hand. A matching line is planned for `anlage`'s own
153
162
  `CLAUDE.md` in a later batch - not yet added there as of this entry. Update
154
163
  2026-09-04: added there as 絶対規律 item 9.)
155
164
 
165
+ ## 裁定台帳(2026-11-20 導入)
166
+
167
+ - 統括の裁定の正典は `/home/skoba/src/anlage-ops/rulings.md`
168
+ (非公開リポジトリ `skoba/anlage-ops`)。チャットに貼られた本文は写しで、
169
+ 食い違ったら台帳が正
170
+ - 「裁定 R-… を読んで着手」と言われたら、最初に
171
+ `git -C /home/skoba/src/anlage-ops pull --ff-only` を実行し、
172
+ 台帳の該当行と本文を読む。読めなければ、着手せずに例外報告
173
+ - 着手したら、台帳の自分宛ての行の状態を 発行 → 着手 に書き換え、
174
+ anlage-ops に commit・push する(日付と、あれば最初の push SHA)。
175
+ anlage-ops に書いてよいのはこの 1 行だけ。ほかの行、本文、
176
+ ほかのファイルは変えない。これは越境ゲートの例外として認められている
177
+ - 完了に進めるのは統括か人間。セッションは「完了申請(SHA、CI run)」まで書いてよい
178
+ - 報告とコミットメッセージには裁定 ID を書く(例: `Refs R-20261120-1`)
179
+ - anlage-ops の内容(裁定の本文、ロードマップ)を、このリポジトリのコード、
180
+ Issue、PR、文書に写さない。参照は裁定 ID で行う
181
+
182
+ ## 依存の方針(2026-11-24 導入。裁定 R-20261124-2)
183
+
184
+ 要点だけを書く。正典は裁定台帳の R-20261124-2。
185
+
186
+ - 依存は最新のリリース版に追従する。`openehr-rails.gemspec` の下限と、手元・CI が
187
+ 解決する版を、理由なく古いままにしない
188
+ - 版を固定する、または上限を付けるときは、理由と解除の条件を、その行のコメントと
189
+ Issue の両方に残す
190
+ - 依存の不具合は上流で直す。このリポジトリに置く迂回はつなぎで、撤去の条件を
191
+ コードのコメントに書く(実例: `lib/openehr_rails/opt/parser.rb` にあった
192
+ `populate_term_bindings!`。openehr-ruby#31 が openehr 2.5.0 に入ったので、
193
+ 下限の引き上げと同じ PR で撤去した〔#59〕)
194
+ - 未リリースのコードには、上流に修正があり、リリースを待てないときだけ依存する。
195
+ SHA で固定し、リリースが出たら RubyGems の版に戻す
196
+ - 上流の Issue・PR への投稿は人間が行う。セッションは再現手順と文面の案を用意する
197
+ - 依存の更新は 1 件ずつ、CI の合否で決める。マージは人間
198
+
199
+ ## 作業ツリー規律(2026-11-24 導入。裁定 R-20261124-6)
200
+
201
+ anlage の `CLAUDE.md`「作業ツリー規律」と同旨。根拠と採らなかった案は、anlage の
202
+ `docs/design/session-isolation-plan.md`(承認済み、R-20261123-1)。
203
+
204
+ - 1 セッション = 1 リポジトリ。起動ディレクトリがこのリポジトリでなければ、
205
+ また宛先が別リポジトリの依頼なら、着手せずに止まる
206
+ - セッションの冒頭で `git fetch` と `git status --short` を実行する。
207
+ 未コミット物があれば、作業の前に一覧を報告の先頭に書く
208
+ - 実装は必ず git worktree で行う。置き場所は
209
+ `/home/skoba/src/openehr-rails-worktrees/<slug>`(1 ブランチ = 1 worktree)。
210
+ `/tmp` には作らない。本体の作業ツリーは `master` のまま動かさず、
211
+ docs のみの直接 push と fetch にだけ使う
212
+ - 着手時に同じ slug の worktree が既にあれば、止まって例外報告する
213
+ (worktree のパス、ブランチ、未コミット物の一覧を書く)。ログの記載だけを根拠に
214
+ 再開しない。例外は、裁定または人間の指示がその slug の再開を名指ししているときだけ
215
+ - セッションの終わりに作業ツリーを空にする。途中の作業は `wip/<slug>` ブランチに
216
+ コミットして push する(draft PR でよい)
217
+ - 未コミット物を捨てるのは削除にあたり、ゲート対象
218
+ - コミットはパスを明示して add する(`-A` と `.` を使わない)
219
+ - 合否はクリーンな checkout(CI)で決める。並行負荷のある手元の結果を合否に使わない
220
+ - `master` への直接 push が non-fast-forward で拒否されたら、fetch して rebase する。
221
+ force はしない
222
+ - 越境(読み取り)は、絶対パスと `git -C` で相手リポジトリの本体ツリーを読む
223
+ (`log`・`show`・`grep`・ファイルの閲覧)。報告に対象リポジトリと SHA を書く。
224
+ 相手のツリーでは `checkout`・`pull`・`bundle`・`rspec` を実行しない。
225
+ 依存する gem の挙動は、自分の worktree で解決された版に対して確かめる。
226
+ 未リリースのコミットの挙動は、gem 側に Issue を立てて頼む。`Gemfile` を
227
+ 相手のツリーへの path 指定に書き換えたものをコミットしない
228
+ - Codex の納品先は、当該 Issue の worktree。本体ツリーには納品させない。
229
+ 起動の直前に `pwd` を出力して worktree であることを確かめる。
230
+ `codex exec resume --last` は使わない。毎回あたらしく起動し、受け渡しは
231
+ commit 済みの計画書で行う(上の「Repository-context-dependent commands…」の
232
+ `codex exec resume` の扱いは、この項が上書きする)
233
+
234
+ ## 全開の進め方(2026-11-24 導入。裁定 R-20261124-8)
235
+
236
+ 要点だけを書く。正典は裁定台帳の R-20261124-8。これより前の記述と食い違うときは、この節が優先する。
237
+
238
+ - **止まらずに進める範囲**: 承認済みの計画書と、このリポジトリ宛ての作業列にある項目。
239
+ 計画書が要る項目は、計画書を push してそのまま実装に進む(確認は事後)
240
+ - **必ず止まってゲート報告を出す範囲**: 計画書に無い挙動の変更と公開 API の変更。
241
+ gem の追加と未リリースのコードへの依存。データの移行と削除、開発機の設定の変更。
242
+ 臨床の判断と人間の入力を待つもの。タグと publish。ほかのリポジトリへの書き込み
243
+ (台帳の自分宛ての行は除く)
244
+ - **セッションが自分でマージしてよい PR**: 自分で開いた、docs のみの PR と、
245
+ 止まらずに進める範囲の実装の PR。条件は、head の CI がすべて green、競合なし、
246
+ 1 Issue = 1 PR。マージのあと `master` の CI を確かめ、赤なら次に進まず例外報告。
247
+ `master` では force-push と履歴の書き換えをしない
248
+ - **人間がマージする PR**: 依存を変えるもの(`Gemfile`、gemspec、lock)、版番号を
249
+ 変えるもの、CI のワークフローを変えるもの、ファイルの削除が主な中身のもの、
250
+ 必ず止まる範囲に当たったもの。権限でマージが止められたら、回避せずに報告する
251
+ - **変更履歴は断片ファイル**: PR では `CHANGELOG.md` に触らない。
252
+ `changelog.d/<Issue 番号>-<slug>.md` を 1 PR につき 1 つ足し、変更履歴の文と
253
+ semver の判定・理由を書く。棚卸しで断片を `CHANGELOG.md` にまとめ、断片を消す
254
+ (タグの時点で `changelog.d/` に断片が残っていないこと)
255
+ - **公開はできた順**: 公開できる中身が `master` にそろったら棚卸しに進む。
256
+ 手順は Release convention のとおりで、変えない
257
+ - **報告**: ゲート・バンドル・例外の報告は `docs/reports/` に push し、台帳の自分宛ての
258
+ 行に PR 番号と SHA を書き足す。次の裁定を待たずに、作業列の次の項目に進む
259
+ - **変えないもの**: TDD(Red の出力を報告に載せる)、合否は CI、実測と推論の区別、
260
+ 越境は読み取りだけ、publish は CI artifact だけで `gem push` は人間
261
+
156
262
  ## Project Overview
157
263
 
158
264
  This is `openehr-rails`, a Rails engine gem that turns an openEHR Operational Template (`.opt`, ADL2/XML) into a working Rails resource in one command: `rails generate openehr:scaffold path/to/template.opt --fhir` emits a model, migration, controller, views, i18n locale, and (with `--fhir`) HL7 FHIR R5 `StructureDefinition` profiles. Generated models persist both as typed columns (for forms/search) and as full openEHR RM data (canonical JSON + a typed node graph with immutable-append versioning), and are queryable via a growing AQL surface. A mountable admin engine (`/openehr`) provides template upload/management, runtime scaffolding, and a FHIR R5 facade. Legacy ADL-archetype-only generators (model/controller/migration/helper/assets/i18n/template/template_model, based on `Openehr::Generators::ArchetypedBase`) have been removed — OPT is the only supported input format for scaffolding.
@@ -225,7 +331,7 @@ This is `openehr-rails`, a Rails engine gem that turns an openEHR Operational Te
225
331
 
226
332
  ## Development Notes
227
333
 
228
- - Ruby 3.3+ required (raised from 3.0 in 2026-08 to track the `openehr` gem dependency dropping Ruby 3.2 support at EOL); CI matrix covers 3.3/3.4/4.0, local dev pinned via `.ruby-version` (currently 4.0.6)
334
+ - Ruby 3.3+ required (raised from 3.0 in 2026-08 to track the `openehr` gem dependency dropping Ruby 3.2 support at EOL); CI matrix covers 3.3/3.4/4.0, local dev pinned via `.ruby-version` (currently 4.0.7)
229
335
  - Rails 7.0+ and Rails 8.x supported (CI matrix: `gemfiles/rails_{7_2,8_0,8_1}.gemfile`; demo app runs on Rails 8.1)
230
336
  - URI compatibility workaround implemented for Ruby 3.4
231
337
  - `ostruct` is an explicit development dependency — it left Ruby's default gems as of 4.0, and a couple of specs use `OpenStruct` as a lightweight test double
data/docs/backlog.md CHANGED
@@ -74,7 +74,10 @@ that verification is deferred to the next real release (>= 0.5.0), not simulated
74
74
 
75
75
  ## Release automation
76
76
 
77
- - **`release.yml` records no sha256 of the built `.gem`** (found at the 0.7.0
77
+ - **Done (2026-10-12, `1410274` via PR #51; first run at `v0.8.0`, run 38258179628,
78
+ `docs/reports/referral-upstream-log.md` R7 -- printed value == artifact ==
79
+ local rebuild).** Original entry kept for the rationale:
80
+ **`release.yml` records no sha256 of the built `.gem`** (found at the 0.7.0
78
81
  release, 2026-09-10, `docs/reports/fsh-generator-log.md` R14). The only digest in
79
82
  the run log is `actions/upload-artifact`'s "SHA256 digest of uploaded artifact",
80
83
  which hashes the uploaded archive, not the gem file, so `CLAUDE.md`'s "compare
@@ -82,6 +85,15 @@ that verification is deferred to the next real release (>= 0.5.0), not simulated
82
85
  tag-rebuild cross-check is what pins the bytes today. Add a "Record sha256" step
83
86
  after `rake build` (`sha256sum pkg/*.gem`), as openehr-ruby's `release.yml` has.
84
87
  CI-only change; needs a PR, no Issue.
88
+ - **The tag-rebuild cross-check compares `data.tar.gz`, not the whole `.gem`**
89
+ (0.7.1, 2026-09-25, `docs/reports/referral-upstream-log.md` R2). A `.gem` embeds
90
+ `rubygems_version` in `metadata.gz`, so a rebuild on a different ruby/rubygems
91
+ (local 4.0.6/4.0.16 vs CI 4.0.7/4.0.20) yields a different whole-gem sha256 with
92
+ byte-identical shipped files. Procedure: `tar xf` both gems, compare
93
+ `sha256sum data.tar.gz` (must match) and `diff` the gunzipped `metadata.gz`
94
+ (only `rubygems_version` may differ). 0.7.0's whole-gem match was a coincidence
95
+ of equal toolchains. Fold this into `CLAUDE.md`'s Release convention together
96
+ with the "Record sha256" step above.
85
97
 
86
98
  **Done (2026-08-23, PR #28)** — kept below for the original rationale; see the CI
87
99
  status entry above for verification details.