openehr-rails 0.8.0 → 0.10.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 (46) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/bug_report.md +1 -1
  3. data/.rubocop_todo.yml +2 -2
  4. data/.ruby-version +1 -1
  5. data/CHANGELOG.md +130 -0
  6. data/CLAUDE.md +109 -3
  7. data/docs/backlog.md +5 -4
  8. data/docs/design/0.9.0-plan.md +284 -0
  9. data/docs/design/0.9.x-plan.md +146 -0
  10. data/docs/design/multi-leaf-non-observation-plan.md +8 -0
  11. data/docs/reports/0.9.0-log.md +193 -0
  12. data/docs/reports/0.9.x-log.md +78 -0
  13. data/docs/reports/referral-upstream-log.md +59 -0
  14. data/lib/generators/openehr/scaffold/scaffold_generator.rb +2 -0
  15. data/lib/openehr_rails/fhir/fsh_generator.rb +9 -32
  16. data/lib/openehr_rails/fhir/profile_generator.rb +7 -9
  17. data/lib/openehr_rails/fhir/profile_identity.rb +61 -0
  18. data/lib/openehr_rails/opt/field_extractor.rb +77 -24
  19. data/lib/openehr_rails/opt/parser.rb +2 -63
  20. data/lib/openehr_rails/rm/composition_committer.rb +5 -5
  21. data/lib/openehr_rails/rm/graph_builder.rb +13 -1
  22. data/lib/openehr_rails/rm/rm_object_builder.rb +3 -1
  23. data/lib/openehr_rails/storable/shape_guard.rb +71 -0
  24. data/lib/openehr_rails/storable.rb +3 -0
  25. data/lib/openehr_rails/version.rb +1 -1
  26. data/lib/openehr_rails.rb +1 -0
  27. data/openehr-rails.gemspec +1 -1
  28. data/spec/fixtures/fsh/{openehr-evaluation-problem-diagnosis-v1.fsh → openehr-problemlist-evaluation-problem-diagnosis-v1.fsh} +3 -3
  29. data/spec/generators/openehr/fhir_profile/fhir_profile_generator_spec.rb +4 -4
  30. data/spec/generators/openehr/fhir_profile/remote_fhir_profile_generator_spec.rb +1 -1
  31. data/spec/generators/openehr/scaffold/opt_scaffold_generator_spec.rb +75 -0
  32. data/spec/openehr_rails/fhir/fsh_generator_spec.rb +15 -15
  33. data/spec/openehr_rails/fhir/profile_generator_spec.rb +12 -12
  34. data/spec/openehr_rails/fhir/profile_identity_spec.rb +88 -0
  35. data/spec/openehr_rails/fhir_instruction_skip_spec.rb +41 -0
  36. data/spec/openehr_rails/opt/field_extractor_embedded_archetype_spec.rb +1 -1
  37. data/spec/openehr_rails/opt/field_extractor_embedded_root_spec.rb +136 -0
  38. data/spec/openehr_rails/opt/field_extractor_instruction_spec.rb +123 -0
  39. data/spec/openehr_rails/opt/field_extractor_min_occurrences_spec.rb +43 -0
  40. data/spec/openehr_rails/opt/parser_repeated_root_bindings_spec.rb +33 -0
  41. data/spec/openehr_rails/opt/parser_term_bindings_spec.rb +2 -1
  42. data/spec/openehr_rails/rm/composition_committer_context_spec.rb +124 -0
  43. data/spec/openehr_rails/storable_shape_guard_spec.rb +127 -0
  44. data/spec/templates/bmi_calculation_repeated_root.opt +2244 -0
  45. data/spec/templates/jp_referral.opt +5554 -0
  46. metadata +20 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a30bd4a561f8193c0603c1e43e1873e1c8835d2e7c418b95c429ac6e2b397e83
4
- data.tar.gz: 180145cf2e294cc68ae84ddc35b147e07e6fb52f99062d14f8df3cb0e306108e
3
+ metadata.gz: 9ed0f84c56e26f5ddc27a5e0ee5f0645d00ed9733ab0e1a21c3aeabd84b6bbdf
4
+ data.tar.gz: 964a88f7dd7cf29b3e68ac4275da65606df431e1d02ebce900c317ab67dc4c5b
5
5
  SHA512:
6
- metadata.gz: 46b84468c263139208e522562831d103cd43d8d3c865aa274fe7cf6db7ebe486fa67329b4e175564a9fc0f94d0a0a4454d679f3d42735ac4c7214b739fa7ba3a
7
- data.tar.gz: dc189063ef16d43253287e9fed472bdc7d69b0b0c72fb5f393f772cf9adbe596ebd24b6dbea57514435c3a6afe8cdba048fd4b1c3c2e73e39b4a17315ad03b6d
6
+ metadata.gz: e1390271d15a1fc2c82106ee61fdb1bea232a2a127d65788144f8b5764b12af420d4c44b108511f1c8d29b4572cbbb6479fcb03a708d275215e58450ba56b0a9
7
+ data.tar.gz: af8768d334a02a6d7963f95d20ffdd5f2659d75ee470a609a88383aed867ac43026a596134954eec8e864c6a0326ee867fd48ca8599616e8a805425c4c844be7
@@ -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
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.7
1
+ 4.0.10
data/CHANGELOG.md CHANGED
@@ -7,6 +7,136 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.10.0] - 2026-11-25
11
+
12
+ ### Changed
13
+ - **Upgrade note.** FHIR StructureDefinitions are qualified by their template, so two
14
+ templates that use the same archetype with different constraints no longer produce
15
+ the same profile: `id` is `openehr-<template slug>-<archetype slug>` (e.g.
16
+ `openehr-bmi-calculation-observation-height-v2`, was
17
+ `openehr-observation-height-v2`; an id longer than 64 characters keeps a prefix and
18
+ ends in 8 hex digits of its sha256), `url` is
19
+ `urn:openehr:<template_id>:<archetype_id>`, `name` is the id camelized
20
+ (`OpenehrBmiCalculationObservationHeightV2`; the JSON `name` used to be the bare
21
+ concept, `Height`, and disagreed with the FSH `Profile:` name) and `title` names the
22
+ template. Files written by `--fhir` / `openehr:fhir_profile` under
23
+ `app/fhir/profiles/` take the new ids as file names: regenerate them. Anything that
24
+ references a profile by its old id or url must be updated. The constraints inside
25
+ each profile are unchanged (#55, anlage upstream 23).
26
+ - `ProfileGenerator` (JSON) and `FshGenerator` take id, url, name and title from one
27
+ place, `OpenehrRails::Fhir::ProfileIdentity`, so the two outputs cannot disagree
28
+ (#55).
29
+
30
+ ### Known limitations
31
+ - FHIR Observation *instance* ids still use the archetype-only slug, so two models
32
+ sharing an archetype can produce the same instance id (#76).
33
+ - With openehr 2.6.0 or later (allowed by the unchanged `~> 2.5`), AQL reaches the
34
+ composition context: `SELECT c/context/start_time/value` and a `WHERE` on it are
35
+ answered, lifting the 0.9.0 limitation below. With openehr 2.5.x it still applies.
36
+ `SELECT c/uid/value` is not answered yet under 2.6.0 (`unsupported path attribute
37
+ "uid"`) (#46).
38
+
39
+ ## [0.9.0] - 2026-11-24
40
+
41
+ > **Upgrade note.** Four things change for an existing host app.
42
+ > (1) Requires `openehr` `~> 2.5` (was `~> 2.3, >= 2.3.1`): a host app locked to
43
+ > openehr 2.4.x must update it together with this gem.
44
+ > (2) `FieldExtractor` output: a field under an embedded archetype root now has the
45
+ > root written `[archetype_id]` in its `path` and is named after its own archetype
46
+ > (`laboratory_test_analyte_at0001`, was `laboratory_test_result_at0001_2`); entries
47
+ > with `protocol` leaves and every `INSTRUCTION` extract more fields than before. A
48
+ > generated model keeps the `FIELD_MAP` it was generated with, so nothing moves until
49
+ > you re-scaffold; re-scaffolding such a template adds and renames columns. Code that
50
+ > reads `FieldExtractor#fields` at runtime sees the new paths and names immediately.
51
+ > (3) `Storable` now raises `OpenehrRails::Storable::UnsupportedTemplateShape` on save,
52
+ > and saves nothing, when a record holds a value for a field it cannot assemble into a
53
+ > valid composition (an entry nested in a `SECTION`, a field under an embedded root, an
54
+ > `INSTRUCTION`). Such saves used to succeed and store a malformed `rm_composition`.
55
+ > (4) FHIR `component` slice names follow the renamed fields.
56
+ > Also: a composition committed from canonical JSON **with** a `context` now answers
57
+ > `c/context/...` AQL paths with `unsupported path attribute` (as every
58
+ > `Storable`-saved composition already did) instead of a row holding `nil`; see Known
59
+ > limitations.
60
+
61
+ ### Added
62
+ - `FieldExtractor` descends `activities`, `description` and `protocol`, so an
63
+ `INSTRUCTION` entry has fields for the ELEMENTs under
64
+ `activities[...]/description[...]` and `protocol[...]`, including the embedded
65
+ CLUSTER roots there at any depth (a referral's `service_request`: 0 fields before,
66
+ 20 now). `ACTION.description` and every entry type's `protocol` come with the same
67
+ change. `narrative`, `timing` and `action_archetype_id` are not ELEMENTs and yield
68
+ no field (#47, anlage upstream 17).
69
+ - Fields carry `root_path` (path of the nearest embedded root, else of the entry) and
70
+ `instance_index` (0-based document-order ordinal among the template's fields sharing
71
+ the same `path`), so `[path, instance_index]` identifies a field even when the same
72
+ archetype is embedded twice side by side (a referral's requester / receiver
73
+ organisation) or an entry archetype repeats. Root names and name-predicate paths
74
+ wait for per-root terms upstream (openehr-ruby#58) (#57).
75
+ - DV_QUANTITY fields carry `units_list`, every unit the OPT allows in OPT order;
76
+ `units` stays the first one (#57).
77
+ - Fields carry `min_occurrences`, the ELEMENT's own occurrences lower bound (0 when
78
+ unconstrained). `required` keeps its meaning ("entry mandatory and element
79
+ mandatory"), so under an optional entry a 1..1 element is
80
+ `required: false, min_occurrences: 1`: mandatory if the entry is written at all.
81
+ Generated validations are unchanged; validating that conditional requirement is
82
+ #65 (#58, anlage upstream 20).
83
+
84
+ ### Changed
85
+ - `FieldExtractor` writes an embedded archetype root in a field's `path` by its
86
+ archetype id instead of its at-code, and names fields under such a root after their
87
+ own archetype: `<own concept>_<label slug, else at-code>` (never the bare concept).
88
+ For `lab_result_report_reduced.opt`: `.../items[at0010]/items[at0001]/value` becomes
89
+ `.../items[openEHR-EHR-CLUSTER.laboratory_test_analyte.v1]/items[at0001]/value`.
90
+ Paths now match RM data paths and AQL. Fields owned by the entry itself, and
91
+ templates without embedded roots, are unchanged (#57, anlage upstream 22).
92
+ - A template whose entries carry `protocol` leaves extracts more fields: e.g.
93
+ `problem_list.opt` gains `problem_diagnosis_at0070` (最終更新日, under
94
+ `protocol[at0032]`). The FHIR profile for `problem_diagnosis` is unchanged: at0070
95
+ has no row in `TypeMap::ENTRY_ELEMENT_MAPS` and is left out (#47).
96
+ - The FHIR generators report an `INSTRUCTION` that has leaves through `#skipped` as
97
+ "N leaves ... no row in `TypeMap::ENTRY_ELEMENT_MAPS`" instead of "no leaves";
98
+ still no `ServiceRequest` profile is emitted (mapping rows: #35) (#47).
99
+ - `openehr:scaffold` prints a warning listing the fields the generated model cannot
100
+ save yet (#60).
101
+ - Requires `openehr` `~> 2.5`. `OpenehrRails::Opt::Parser` no longer reads OPT
102
+ `term_bindings` itself: openehr 2.5.0 does (openehr-ruby#31), and the interim bypass
103
+ is removed (#59).
104
+
105
+ ### Fixed
106
+ - `OpenehrRails::Storable` no longer writes a malformed composition for the template
107
+ shapes it cannot assemble: saving a value for a field of an entry nested in a
108
+ `SECTION`, of an embedded archetype root or of an `INSTRUCTION` raises
109
+ `UnsupportedTemplateShape`, naming the shape, the fields and the tracking issue
110
+ (#62, #61, #69), and saves nothing. Records that leave those fields empty, and
111
+ models of templates without these shapes, save exactly as before. Models generated
112
+ before 0.9.0 are covered too (#60).
113
+ - An OPT embedding the same archetype more than once no longer yields each term
114
+ binding once per occurrence: `code_bindings` holds one entry per binding, so the
115
+ FHIR `code.coding` slices are not duplicated. Two behaviours follow upstream and
116
+ differ from the removed bypass: a binding item without a `terminology_id` is no
117
+ longer completed from the `term_bindings` element's `terminology` attribute, and
118
+ when roots of the same archetype carry *different* bindings the last root wins
119
+ instead of their union (#59).
120
+ - `CompositionCommitter` / `GraphBuilder` persist a canonical composition's
121
+ `context.start_time` (into `context_start_time`) and `context.setting` (into the
122
+ already-existing `setting_code` / `setting_value` columns); they were dropped unless
123
+ the caller passed `context_start_time:`. An explicit `context_start_time:` still
124
+ wins. `RmObjectBuilder` rebuilds the stored setting instead of always `other`
125
+ (#46, proposals 1-2; anlage upstream 16).
126
+
127
+ ### Known limitations
128
+ - `Storable` cannot yet write entries nested in a `SECTION` (#62), fields under an
129
+ embedded archetype root (#61) or `INSTRUCTION` entries (#69); it refuses them as
130
+ described above. Committing a canonical composition through
131
+ `Rm::CompositionCommitter` is unaffected.
132
+ - `SELECT c/context/start_time/value` (and `c/context/setting/...`) is not answerable
133
+ yet: the openehr AQL path evaluator (2.5.0 included) cannot navigate `EVENT_CONTEXT`
134
+ and raises `unsupported path attribute "start_time"` as soon as a composition has a
135
+ context. The values are stored and rebuilt by `to_rm`; querying them waits for an
136
+ openehr release. (openehr 2.6.0 lifts this for `start_time`; see 0.10.0.)
137
+ - `context.other_context` is not persisted, and `CanonicalSerializer` does not emit
138
+ `context` yet (#46 stays open for both).
139
+
10
140
  ## [0.8.0] - 2026-10-12
11
141
 
12
142
  > **Upgrade note.** A stored Composition holding a `SECTION` or an `INSTRUCTION`
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
@@ -65,7 +67,11 @@ matching `release:check` guard is `skoba/openehr-rails#34`.)
65
67
  moved 4.0.6 -> 4.0.7 (2026-10-12) so a local rebuild at the tag stamps the same
66
68
  `rubygems_version` (4.0.20) as `ruby/setup-ruby`'s ruby 4.0 image did for 0.7.1,
67
69
  whose `metadata.gz` differed from the local rebuild by that one line
68
- (`docs/reports/referral-upstream-log.md` R2). The cross-check still judges by
70
+ (`docs/reports/referral-upstream-log.md` R2), and 4.0.7 -> 4.0.10 (2026-11-19,
71
+ PR #56) once CI's `'4.0'` resolved to 4.0.10. Confirm the CI side from a run log
72
+ before moving the pin. For 0.9.0 (ruby 4.0.10 / rubygems 4.0.20 on both sides)
73
+ the local rebuild matched the CI artifact down to the whole-gem sha256
74
+ (`docs/reports/0.9.0-log.md` R9). The cross-check still judges by
69
75
  `data.tar.gz`, not the whole-gem sha256: the two toolchains can drift apart again.
70
76
 
71
77
  **Confirm publication by checksum, not by version number.** RubyGems publishes
@@ -160,6 +166,106 @@ authorized for the task at hand. A matching line is planned for `anlage`'s own
160
166
  `CLAUDE.md` in a later batch - not yet added there as of this entry. Update
161
167
  2026-09-04: added there as 絶対規律 item 9.)
162
168
 
169
+ ## 裁定台帳(2026-11-20 導入、2026-11-24 改定)
170
+
171
+ - 統括の裁定の正典は `/home/skoba/src/anlage-ops/rulings.md`
172
+ (非公開リポジトリ `skoba/anlage-ops`)。チャットに貼られた本文は写しで、
173
+ 食い違ったら台帳が正
174
+ - 「裁定 R-… を読んで着手」と言われたら、最初に
175
+ `git -C /home/skoba/src/anlage-ops pull --ff-only` を実行し、
176
+ 台帳の該当行と本文を読む。読めなければ、着手せずに例外報告
177
+ - `rulings.md` は統括だけが書く。セッションは書き換えない
178
+ - 進み具合は `/home/skoba/src/anlage-ops/status/openehr-rails.md` に書く。
179
+ 裁定 ID の見出しの下に、日付つきの行を書き足す(着手、PR 番号、SHA、CI run、
180
+ ゲート報告の提出、完了申請)。古い行は消さない。書いたら commit・push する
181
+ - anlage-ops に書いてよいのは、自分のレーンのこの 1 ファイルだけ。
182
+ これは越境ゲートの例外として認められている
183
+ - 完了に進めるのは統括か人間。セッションは完了申請まで
184
+ - 報告とコミットメッセージには裁定 ID を書く(例: `Refs R-20261120-1`)
185
+ - anlage-ops の内容(裁定の本文、ロードマップ)を、このリポジトリのコード、
186
+ Issue、PR、文書に写さない。参照は裁定 ID で行う
187
+
188
+ ## 依存の方針(2026-11-24 導入。裁定 R-20261124-2)
189
+
190
+ 要点だけを書く。正典は裁定台帳の R-20261124-2。
191
+
192
+ - 依存は最新のリリース版に追従する。`openehr-rails.gemspec` の下限と、手元・CI が
193
+ 解決する版を、理由なく古いままにしない
194
+ - 版を固定する、または上限を付けるときは、理由と解除の条件を、その行のコメントと
195
+ Issue の両方に残す
196
+ - 依存の不具合は上流で直す。このリポジトリに置く迂回はつなぎで、撤去の条件を
197
+ コードのコメントに書く(実例: `lib/openehr_rails/opt/parser.rb` にあった
198
+ `populate_term_bindings!`。openehr-ruby#31 が openehr 2.5.0 に入ったので、
199
+ 下限の引き上げと同じ PR で撤去した〔#59〕)
200
+ - 未リリースのコードには、上流に修正があり、リリースを待てないときだけ依存する。
201
+ SHA で固定し、リリースが出たら RubyGems の版に戻す
202
+ - 上流の Issue・PR への投稿は人間が行う。セッションは再現手順と文面の案を用意する
203
+ - 依存の更新は 1 件ずつ、CI の合否で決める。マージは人間
204
+
205
+ ## 作業ツリー規律(2026-11-24 導入。裁定 R-20261124-6)
206
+
207
+ anlage の `CLAUDE.md`「作業ツリー規律」と同旨。根拠と採らなかった案は、anlage の
208
+ `docs/design/session-isolation-plan.md`(承認済み、R-20261123-1)。
209
+
210
+ - 1 セッション = 1 リポジトリ。起動ディレクトリがこのリポジトリでなければ、
211
+ また宛先が別リポジトリの依頼なら、着手せずに止まる
212
+ - セッションの冒頭で `git fetch` と `git status --short` を実行する。
213
+ 未コミット物があれば、作業の前に一覧を報告の先頭に書く
214
+ - 実装は必ず git worktree で行う。置き場所は
215
+ `/home/skoba/src/openehr-rails-worktrees/<slug>`(1 ブランチ = 1 worktree)。
216
+ `/tmp` には作らない。本体の作業ツリーは `master` のまま動かさず、
217
+ docs のみの直接 push と fetch にだけ使う
218
+ - 着手時に同じ slug の worktree が既にあれば、止まって例外報告する
219
+ (worktree のパス、ブランチ、未コミット物の一覧を書く)。ログの記載だけを根拠に
220
+ 再開しない。例外は、裁定または人間の指示がその slug の再開を名指ししているときだけ
221
+ - セッションの終わりに作業ツリーを空にする。途中の作業は `wip/<slug>` ブランチに
222
+ コミットして push する(draft PR でよい)
223
+ - 未コミット物を捨てるのは削除にあたり、ゲート対象
224
+ - コミットはパスを明示して add する(`-A` と `.` を使わない)
225
+ - 合否はクリーンな checkout(CI)で決める。並行負荷のある手元の結果を合否に使わない
226
+ - `master` への直接 push が non-fast-forward で拒否されたら、fetch して rebase する。
227
+ force はしない
228
+ - 越境(読み取り)は、絶対パスと `git -C` で相手リポジトリの本体ツリーを読む
229
+ (`log`・`show`・`grep`・ファイルの閲覧)。報告に対象リポジトリと SHA を書く。
230
+ 相手のツリーでは `checkout`・`pull`・`bundle`・`rspec` を実行しない。
231
+ 依存する gem の挙動は、自分の worktree で解決された版に対して確かめる。
232
+ 未リリースのコミットの挙動は、gem 側に Issue を立てて頼む。`Gemfile` を
233
+ 相手のツリーへの path 指定に書き換えたものをコミットしない
234
+ - Codex の納品先は、当該 Issue の worktree。本体ツリーには納品させない。
235
+ 起動の直前に `pwd` を出力して worktree であることを確かめる。
236
+ `codex exec resume --last` は使わない。毎回あたらしく起動し、受け渡しは
237
+ commit 済みの計画書で行う(上の「Repository-context-dependent commands…」の
238
+ `codex exec resume` の扱いは、この項が上書きする)
239
+
240
+ ## 全開の進め方(2026-11-24 導入。裁定 R-20261124-8)
241
+
242
+ 要点だけを書く。正典は裁定台帳の R-20261124-8。これより前の記述と食い違うときは、この節が優先する。
243
+
244
+ - **止まらずに進める範囲**: 承認済みの計画書と、このリポジトリ宛ての作業列にある項目。
245
+ 計画書が要る項目は、計画書を push してそのまま実装に進む(確認は事後)
246
+ - **必ず止まってゲート報告を出す範囲**: 計画書に無い挙動の変更と公開 API の変更。
247
+ gem の追加と未リリースのコードへの依存。データの移行と削除、開発機の設定の変更。
248
+ 臨床の判断と人間の入力を待つもの。タグと publish。ほかのリポジトリへの書き込み
249
+ (`anlage-ops` の `status/openehr-rails.md` は除く)
250
+ - **セッションが自分でマージしてよい PR**: 自分で開いた、docs のみの PR と、
251
+ 止まらずに進める範囲の実装の PR。条件は、head の CI がすべて green、競合なし、
252
+ 1 Issue = 1 PR。マージのあと `master` の CI を確かめ、赤なら次に進まず例外報告。
253
+ `master` では force-push と履歴の書き換えをしない
254
+ - **人間がマージする PR**: 依存を変えるもの(`Gemfile`、gemspec、lock)、版番号を
255
+ 変えるもの、CI のワークフローを変えるもの、ファイルの削除が主な中身のもの、
256
+ 必ず止まる範囲に当たったもの。権限でマージが止められたら、回避せずに報告する
257
+ - **変更履歴は断片ファイル**: PR では `CHANGELOG.md` に触らない。
258
+ `changelog.d/<Issue 番号>-<slug>.md` を 1 PR につき 1 つ足し、変更履歴の文と
259
+ semver の判定・理由を書く。棚卸しで断片を `CHANGELOG.md` にまとめ、断片を消す
260
+ (タグの時点で `changelog.d/` に断片が残っていないこと)
261
+ - **公開はできた順**: 公開できる中身が `master` にそろったら棚卸しに進む。
262
+ 手順は Release convention のとおりで、変えない
263
+ - **報告**: ゲート・バンドル・例外の報告は `docs/reports/` に push し、
264
+ `status/openehr-rails.md` に PR 番号と SHA を書き足す(R-20261124-18)。
265
+ 次の裁定を待たずに、作業列の次の項目に進む
266
+ - **変えないもの**: TDD(Red の出力を報告に載せる)、合否は CI、実測と推論の区別、
267
+ 越境は読み取りだけ、publish は CI artifact だけで `gem push` は人間
268
+
163
269
  ## Project Overview
164
270
 
165
271
  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.
@@ -232,7 +338,7 @@ This is `openehr-rails`, a Rails engine gem that turns an openEHR Operational Te
232
338
 
233
339
  ## Development Notes
234
340
 
235
- - 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)
341
+ - 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.10)
236
342
  - 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)
237
343
  - URI compatibility workaround implemented for Ruby 3.4
238
344
  - `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,16 +74,17 @@ 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
81
84
  against the value recorded for that run" cannot be followed literally; the
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
- CI-only change; needs a PR, no Issue. **In PR #51 as `1410274` (2026-10-12,
85
- `docs/reports/referral-upstream-log.md` R5)**; first run that prints it will be
86
- the `v0.8.0` tag's.
87
+ CI-only change; needs a PR, no Issue.
87
88
  - **The tag-rebuild cross-check compares `data.tar.gz`, not the whole `.gem`**
88
89
  (0.7.1, 2026-09-25, `docs/reports/referral-upstream-log.md` R2). A `.gem` embeds
89
90
  `rubygems_version` in `metadata.gz`, so a rebuild on a different ruby/rubygems