fix: align schema.json with official RDRA structure - #34
Conversation
- Add external_system as the official RDRA term for システム価値レイヤーの 外部システム; external_actor is kept as a deprecated alias and both are merged when resolving the model - Allow event-triggered usecases (UC複合のイベント起動) in addition to view/timer triggers, and carry timer/event through the model layer (previously accepted by the schema but dropped on resolve) - Require business name (公式RDRAでは業務は名前を持つ最上位単位)
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c4f47bb3b8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (!instance._view && !instance._timer && !instance._event) { | ||
| instance._errors.push(`ユースケース[${instance._name}]には画面(view)、タイマー(timer)、イベント(event)のいずれかが必要です。`) |
There was a problem hiding this comment.
When a use case contains view: [], timer: [], or event: [], the array is truthy, so this check accepts it even though the use case has no actual trigger; the new schema also permits these empty arrays. Check the arrays' lengths (and add minItems in the schema) so the intended view/timer/event requirement cannot be bypassed.
Useful? React with 👍 / 👎.
| this._timer = timer | ||
| this._event = event |
There was a problem hiding this comment.
Propagate new triggers into use-case renderers
For use cases triggered only by a timer or event, these values are now retained but every user-facing consumer still reads only view: src/cmd/output/usecase.ts prints 画面: -, and src/cmd/graph.ts emits no trigger node or edge. Thus valid newly supported use cases produce incomplete CLI reports and workflow diagrams; update both renderers to represent timer and event.
Useful? React with 👍 / 👎.
Summary
最新の公式RDRA文献(RDRA 3.0 ハンドブック / rdra.jp の表形式RDRA定義、およびRDRA 2.0のUC複合の定義)を正として、
src/schema.jsonとモデル層の構造差分を解消する。external_actorのみだった。公式用語のexternal_systemを追加し、external_actorは後方互換の非推奨エイリアスとして維持(解決時に両者をマージ)。oneOfは view/timer の2分岐のみで、イベント起動UC(例: 外部システムからのWebhook受信)が定義できなかった。event起動の分岐を追加。JsonSchemaUsecase/UsecaseInstanceが timer/event を保持しておらず解決時に落ちていた(eventはコメントアウト状態だった)。モデル層まで貫通させ、view/timer/event いずれも無いUCはエラーとする。JsonSchemaBusinessでもnameは必須だったが、スキーマだけmain_actorのみ必須だった。References
Test plan
npx jest— 66 tests pass(external_system/external_actorマージ、timer/event UC、起動契機なしUCのエラーを新規テストで担保)example/simple,example/bnb,example/library,example/hostyが引き続きスキーマ・モデル両方の検証を通過(後方互換)external_system+ イベント起動UCを含むYAMLが受理されることをAjv+モデル解決で確認nameを欠いたbusinessがスキーマ検証で弾かれることを確認