Generated contract manifest¶
参考訳(非正本): この文書は英語版
docs/architecture/generated-contract-manifest.mdの日本語参考訳です。正本は英語版であり、内容または解釈に相違がある場合は英語版が優先されます。
問題¶
legacy Webapp template は contracts/manifest.json を、Webapp domain contract と lifecycle contract の両方を含む1つの static file として保持していました。composition では、どの component も別 component の destination を部分的に own または patch できません。この static manifest を artifact.webapp-core に割り当てると、他の artifact でも再利用される lifecycle registration に対して Webapp が authority を持つことにもなります。
決定¶
contract metadata は、その真の source authority である component.json の contract_registrations に分散して保持します。lifecycle.contract-evolution だけが、bounded declarative generator ID contract-manifest-v1 を使用する generated material として contracts/manifest.json を宣言します。
generated material は executable code や command ではなく generator ID を指定します。composer は supported generator ID に対する allowlisted implementation を保持し、未知の production generator ID は reject します。これにより hook-free execution boundary が保持されます。
resolved component set に対し、contract-manifest-v1 generator は次を行います。
- すべての
contract_registrationsを収集する - duplicate ID/document path/schema path を reject する
- source の snake_case registration field を consumer manifest contract に変換する
- active contract を contract ID の lexical order で sort する
- bootstrap schema version 1 で manifest を deterministic に serialize する
component source は pre-rendered production manifest を保持しません。
Authority¶
registered contract document/schema/migration は、それを register した component が引き続き own します。manifest は、それら authority の generated closed registry にすぎません。generated manifest を edit しても、authority が component metadata から移ることはありません。
Consumer independence¶
composition 後は、generated manifest と managed lifecycle validator があれば、source checkout から component descriptor を読み取らずに contract/schema/migration closure を validate できます。composition lock は別途、generated bytes を exact source revision と selected component set に bind します。
Versioning¶
composition-era manifest bootstrap は schema version 1 から開始します。authority/generation model が新しいためです。個々の domain contract history は独立しており、以前の version を保持できます。import 済み Webapp route と UI-state contract history は、それぞれの v1→v2 domain evolution を保持します。