Skip to content

fix: align schema.json with official RDRA structure - #34

Open
tango238 wants to merge 1 commit into
mainfrom
fix/align-schema-with-official-rdra
Open

fix: align schema.json with official RDRA structure#34
tango238 wants to merge 1 commit into
mainfrom
fix/align-schema-with-official-rdra

Conversation

@tango238

Copy link
Copy Markdown
Owner

Summary

最新の公式RDRA文献(RDRA 3.0 ハンドブック / rdra.jp の表形式RDRA定義、およびRDRA 2.0のUC複合の定義)を正として、src/schema.json とモデル層の構造差分を解消する。

  • external_system の追加: 公式RDRAではシステム価値レイヤーの要素は「アクター(人)」と「外部システム」。コード内のエラーメッセージは既に「外部システム」だったが、スキーマのキーは external_actor のみだった。公式用語の external_system を追加し、external_actor は後方互換の非推奨エイリアスとして維持(解決時に両者をマージ)。
  • イベント起動UCの許可: 公式RDRAのUC複合はUCの起動契機として「画面(アクター経由)/タイマー/イベント(外部システム経由)」の3種を認めるが、スキーマの oneOf は view/timer の2分岐のみで、イベント起動UC(例: 外部システムからのWebhook受信)が定義できなかった。event起動の分岐を追加。
  • timer/event をモデル層に実装: schema.json では受理されるのに JsonSchemaUsecase / UsecaseInstance が timer/event を保持しておらず解決時に落ちていた(event はコメントアウト状態だった)。モデル層まで貫通させ、view/timer/event いずれも無いUCはエラーとする。
  • business.name の必須化: 公式RDRAでは業務(ビジネスコンテキストの最上位単位)は名前を持つ。TS型 JsonSchemaBusiness でも name は必須だったが、スキーマだけ main_actor のみ必須だった。

References

  • rdra.jp「表形式のRDRA定義」: アクター/外部システム/BUC/情報/状態/条件/バリエーションのシート構成、UC-画面-アクター / UC-イベント-外部システム / UC-情報 の接続関係
  • RDRA 3.0 ハンドブック(神崎善司): 最新版のRDRA定義
  • RDRA 2.0 ハンドブック ch4: UC複合(画面/イベント/情報/条件)とタイマー起動

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 がスキーマ検証で弾かれることを確認

- 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では業務は名前を持つ最上位単位)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +84 to +85
if (!instance._view && !instance._timer && !instance._event) {
instance._errors.push(`ユースケース[${instance._name}]には画面(view)、タイマー(timer)、イベント(event)のいずれかが必要です。`)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject empty trigger arrays

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 👍 / 👎.

Comment on lines +69 to +70
this._timer = timer
this._event = event

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant