phasegate 0.229.0 → 0.254.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.
- package/CHANGELOG.md +51 -1
- package/README.ja.md +28 -1
- package/README.md +27 -0
- package/docs/ADR/031-world-model-ownership-and-corpus-lifecycle.md +155 -0
- package/docs/ADR/032-world-node-identity.md +198 -0
- package/docs/ADR/033-world-snapshot-canonicalization.md +246 -0
- package/docs/ADR/034-world-constraint-semantics.md +218 -0
- package/docs/ADR/035-world-adoption-baseline-and-waiver.md +341 -0
- package/docs/ADR/036-world-model-and-doc-freshness.md +169 -0
- package/docs/ADR/037-world-cli-and-output-contract.md +398 -0
- package/docs/contracts/requirement-test-matrix.schema.json +15 -0
- package/docs/contracts/world-baseline.schema.json +35 -0
- package/docs/contracts/world-constraints.schema.json +56 -0
- package/docs/contracts/world-debts.schema.json +32 -0
- package/docs/contracts/world-obligation-report.schema.json +259 -0
- package/docs/contracts/world-waivers.schema.json +32 -0
- package/docs/guide/cli-reference.md +34 -0
- package/package.json +1 -1
- package/scripts/harness/attestation/application/ports/sha256-capability.ts +25 -0
- package/scripts/harness/attestation/composition-root.ts +14 -4
- package/scripts/harness/attestation/index.ts +6 -1
- package/scripts/harness/attestation/infrastructure/adapters/node-crypto-content-hasher-adapter.ts +6 -6
- package/scripts/harness/attestation/infrastructure/adapters/node-crypto-sha256-capability.ts +19 -0
- package/scripts/harness/harness-api/domain/value-objects/known-harness-commands.ts +4 -1
- package/scripts/harness/main.ts +107 -1
- package/scripts/harness/nyquist-validation/application/dto/generate-matrix-output.ts +11 -0
- package/scripts/harness/nyquist-validation/application/usecases/check-ac-coverage-gate-usecase.ts +6 -0
- package/scripts/harness/nyquist-validation/application/usecases/generate-requirement-test-matrix-usecase.ts +8 -4
- package/scripts/harness/nyquist-validation/domain/entities/story-mapping.ts +29 -2
- package/scripts/harness/nyquist-validation/domain/services/ac-coverage-gate-policy.ts +28 -0
- package/scripts/harness/nyquist-validation/infrastructure/adapters/markdown-requirement-source-adapter.ts +71 -4
- package/scripts/harness/nyquist-validation/infrastructure/schema/matrix-schema-loader.ts +4 -0
- package/scripts/harness/traceability-model/application/dto/traceability-world-read-dto.ts +67 -0
- package/scripts/harness/traceability-model/application/facades/traceability-world-read-facade.ts +372 -0
- package/scripts/harness/traceability-model/application/ports/traceability-world-read-source-port.ts +61 -0
- package/scripts/harness/traceability-model/composition-root.ts +21 -5
- package/scripts/harness/traceability-model/index.ts +17 -6
- package/scripts/harness/traceability-model/infrastructure/adapters/file-system-traceability-world-read-adapter.ts +223 -0
- package/scripts/harness/traceability-model/infrastructure/parsers/story-catalog-parser.ts +86 -8
- package/scripts/harness/world-model/application/dto/world-inspection-dto.ts +43 -0
- package/scripts/harness/world-model/application/dto/world-obligation-report-dto.ts +54 -0
- package/scripts/harness/world-model/application/dto/world-resolved-config-input.ts +62 -0
- package/scripts/harness/world-model/application/ports/obligation-report-writer-port.ts +7 -0
- package/scripts/harness/world-model/application/ports/world-control-declaration-repository-port.ts +57 -0
- package/scripts/harness/world-model/application/ports/world-fact-source-port.ts +17 -0
- package/scripts/harness/world-model/application/usecases/build-snapshot-use-case.ts +111 -0
- package/scripts/harness/world-model/application/usecases/derive-obligations-use-case.ts +155 -0
- package/scripts/harness/world-model/application/usecases/derive-world-obligations-use-case.ts +144 -0
- package/scripts/harness/world-model/application/usecases/inspect-world-use-case.ts +74 -0
- package/scripts/harness/world-model/application/usecases/pin-constraint-endpoint-use-case.ts +139 -0
- package/scripts/harness/world-model/composition-root.ts +218 -0
- package/scripts/harness/world-model/domain/entities/constraint-record.ts +148 -0
- package/scripts/harness/world-model/domain/entities/control-declarations.ts +274 -0
- package/scripts/harness/world-model/domain/entities/edge.ts +41 -0
- package/scripts/harness/world-model/domain/entities/extraction-diagnostic.ts +60 -0
- package/scripts/harness/world-model/domain/entities/snapshot.ts +75 -0
- package/scripts/harness/world-model/domain/entities/world-node.ts +210 -0
- package/scripts/harness/world-model/domain/ports/world-hashing-port.ts +8 -0
- package/scripts/harness/world-model/domain/services/canonical-json-serializer.ts +113 -0
- package/scripts/harness/world-model/domain/services/constraint-evaluator.ts +486 -0
- package/scripts/harness/world-model/domain/services/obligation-derivation-service.ts +199 -0
- package/scripts/harness/world-model/domain/services/policy-inputs-digest-deriver.ts +66 -0
- package/scripts/harness/world-model/domain/services/snapshot-root-deriver.ts +218 -0
- package/scripts/harness/world-model/domain/services/text-content-normalizer.ts +30 -0
- package/scripts/harness/world-model/domain/services/violation-fingerprint-deriver.ts +183 -0
- package/scripts/harness/world-model/domain/value-objects/artifact-kind.ts +58 -0
- package/scripts/harness/world-model/domain/value-objects/change-provenance.ts +137 -0
- package/scripts/harness/world-model/domain/value-objects/corpus-role.ts +57 -0
- package/scripts/harness/world-model/domain/value-objects/declared-key.ts +35 -0
- package/scripts/harness/world-model/domain/value-objects/evaluation-id.ts +41 -0
- package/scripts/harness/world-model/domain/value-objects/explicit-constraint-relation.ts +53 -0
- package/scripts/harness/world-model/domain/value-objects/explicit-node-alias.ts +30 -0
- package/scripts/harness/world-model/domain/value-objects/node-pin.ts +34 -0
- package/scripts/harness/world-model/domain/value-objects/path-key.ts +103 -0
- package/scripts/harness/world-model/domain/value-objects/sha256-digest.ts +39 -0
- package/scripts/harness/world-model/domain/value-objects/violation-fingerprint.ts +36 -0
- package/scripts/harness/world-model/domain/value-objects/wcr-rule-id.ts +59 -0
- package/scripts/harness/world-model/domain/value-objects/world-node-id.ts +222 -0
- package/scripts/harness/world-model/index.ts +22 -0
- package/scripts/harness/world-model/infrastructure/adapters/adr-fact-extractor.ts +27 -0
- package/scripts/harness/world-model/infrastructure/adapters/assembled-world-fact-source.ts +17 -0
- package/scripts/harness/world-model/infrastructure/adapters/attestation-fact-extractor.ts +288 -0
- package/scripts/harness/world-model/infrastructure/adapters/attestation-sha256-world-hashing-adapter.ts +15 -0
- package/scripts/harness/world-model/infrastructure/adapters/composite-design-fact-source.ts +23 -0
- package/scripts/harness/world-model/infrastructure/adapters/design-corpus-fact-extractor.ts +285 -0
- package/scripts/harness/world-model/infrastructure/adapters/design-fact-extraction.ts +63 -0
- package/scripts/harness/world-model/infrastructure/adapters/file-system-obligation-report-writer-adapter.ts +37 -0
- package/scripts/harness/world-model/infrastructure/adapters/file-system-world-control-repository-adapters.ts +330 -0
- package/scripts/harness/world-model/infrastructure/adapters/integrity-manifest-fact-extractor.ts +101 -0
- package/scripts/harness/world-model/infrastructure/adapters/json-fact-extractor-support.ts +151 -0
- package/scripts/harness/world-model/infrastructure/adapters/markdown-design-fact-extractor.ts +493 -0
- package/scripts/harness/world-model/infrastructure/adapters/matrix-fact-extractor.ts +283 -0
- package/scripts/harness/world-model/infrastructure/adapters/product-fact-extractor.ts +29 -0
- package/scripts/harness/world-model/infrastructure/adapters/proposal-fact-extractor.ts +29 -0
- package/scripts/harness/world-model/infrastructure/adapters/runtime-fact-extraction.ts +19 -0
- package/scripts/harness/world-model/infrastructure/adapters/source-metadata-fact-extractor.ts +22 -0
- package/scripts/harness/world-model/infrastructure/adapters/test-reference-source-fact-extractor.ts +22 -0
- package/scripts/harness/world-model/infrastructure/adapters/traceability-design-fact-adapter.ts +112 -0
- package/scripts/harness/world-model/infrastructure/adapters/traceability-world-read-facade-merger.ts +38 -0
- package/scripts/harness/world-model/infrastructure/adapters/type-script-source-fact-extractor.ts +236 -0
- package/scripts/harness/world-model/infrastructure/adapters/unit-fact-extractor.ts +71 -0
- package/scripts/harness/world-model/infrastructure/adapters/world-control-declaration-mapper.ts +383 -0
- package/scripts/harness/world-model/presentation/cli/world-command-support.ts +60 -0
- package/scripts/harness/world-model/presentation/cli/world-derive-command-handler.ts +105 -0
- package/scripts/harness/world-model/presentation/cli/world-inspect-command-handler.ts +194 -0
- package/scripts/harness/world-model/presentation/cli/world-pin-command-handler.ts +100 -0
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,56 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
9
9
|
|
|
10
10
|
### Added
|
|
11
11
|
|
|
12
|
+
- **WI-299 — World Model のユーザー向けドキュメント反映** — README.md / README.ja.md に World Model 節(端点対称な制約再評価、`world:inspect` / `world:pin` / `world:derive`、immutable obligation report、adoption baseline、fail-closed 新規違反、CLI-only の現状スコープ)と Core Capabilities 行・CLI 表エントリを追加。`docs/guide/cli-reference.md` に World Model 節(options / exit code 0-1-2 / 制御ファイル 4 種 + `.harness/world-obligations.json` / `phasegate-world-cli/v1` envelope / `world.enabled` 既定 false と L2-017 / L3-008 予約の明記)を新設。README.ja footer の版表記を現行へ更新。
|
|
13
|
+
|
|
14
|
+
- **WI-298 / H17-12 — Self-repo World adoption baseline と dogfood smoke(WM-17)** — final tracked corpus、H17-12 AC-bound smoke、再生成matrix、skill-quality semantic debt reflectionを含むcheckoutをbaselineなしで二重deriveし、serialized bytesとunique fingerprint集合の一致を確認。initial structural violationは実測604件で、全件implicit global TestReference ID duplicateの`WCR-005`、WCR-001 / explicit constraint finding / waiver / malformed policy inputは0件だった。candidate evaluation / corpus / constraint rootsをprovenanceに持つ604-entry closed `phasegate.world-baseline.json`を`adoptedByWorkItemId: WI-298`で採用し、same-ruleset追記禁止・返済削除onlyを明記。skill-quality coverage reportのungated attestation gapを`pgw:v1:semantic-debt:skill-quality.coverage-attestation-legacy`として`phasegate.world-debts.json`へ一件宣言し、既存`@coverage-gating`と`@world-semantic-debt`を併存させてL2-016を変更せず別collectionへimportした。self-repo smokeはmatrix再生成後の`world:derive --json`二重実行をbyte-identical、baseline=current fingerprint集合、604件全て`adopted-legacy`、new / repaid / policy diagnostic 0、semantic debt 1、exit 0として固定。H17-12を`planned -> required`へ進め、Phase B機能MVPを完成した。
|
|
15
|
+
|
|
16
|
+
- **WI-297 / H17-11 — Synthetic World mutation E2E(WM-16)** — repository-shaped base corpusと14 scenarioのgolden manifestを追加し、missing endpoint、claimant / premise content drift、legacy Fragment deletion / aliasなしrename、valid / invalid alias、duplicate ID、stale matrix reference、supported malformed / unknown schema / new constraint、new unpinned claimを実filesystem・extractor・repository・WCR・obligation・CLI presentation境界で検証。各blocking caseのexact `WCR-NNN`、violation fingerprint、classification、exit 1、unknown schemaのexit 2を固定し、valid aliasは`resolved-via-alias` / exit 0の非違反controlとして保持した。`DeriveWorldObligationsUseCase`へoptional comparison Snapshotを追加し、通常CLIのinitial WCR-002 semanticsを変えずfixture pairでWCR-003を再現。compositionへinjectable `PolicyDatePort`を公開してwaiverのexclusive expiry(前日active / 当日expired)を固定日で検証した。同一mutation二重実行、clean / stale `.harness`、report手編集・削除でpure JSON bytesとexit codeが不変であることを証明し、H17-11を`planned -> required`へ進めた。
|
|
17
|
+
|
|
18
|
+
- **WI-296 / H17-10 — `world:pin` / `world:derive` CLI 統合(WM-15)** — ADR-037のcontrol mutation / generated report境界をtop-level CLIへ実装。`world:pin`はconstraint IDとclaimant / premiseを明示するpreview-onlyを既定とし、exactまたは明示single-hop aliasで一意解決できるendpointだけをcandidate化、`--apply`時だけschema再検証後に`phasegate.world-constraints.json`をatomic replaceする。missing / duplicate / ambiguous endpointやmalformed declarationではconstraintsおよびbaseline / waiver / debt / reportを更新しない。`world:derive`はSnapshot・WCR evaluation・policy inputsからimmutable obligation reportをpureに再導出し、`--write`時だけ既定`.harness/world-obligations.json`(`--out`指定可)へatomic保存する。human / JSON、`phasegate-world-cli/v1` envelope、generatedAtなし、stdout / stderr、exit 0 / 1 / 2を実装し、`--apply`と`--write`を分離。main dispatch / helpとsorted known command registryを同時更新し、H17-10をAC-bound CLI E2Eと同じ着地で`planned -> required`へ進めた。
|
|
19
|
+
|
|
20
|
+
- **WI-295 / H17-09 — Deterministic violation fingerprint and immutable obligation derivation(WM-14)** — ADR-035の10-field canonical preimageから`pgw:v1:violation-fingerprint:sha256:*`を導出し、locator / message / evaluation / policy stateを除外しつつ、WCR-005のsorted candidate digest multisetやWCR-008 observed digestをsemantic evidenceとして保持する。baseline / waiver / semantic debt / effective dateから`phasegate-world-policy-inputs/v1` digestを作り、waiver 0件ではdateをnullへ正規化、policy差を`phasegate-world-evaluation/v1` evaluation IDへ反映する。same-ruleset baselineとの集合差で`adopted-legacy` / `new-structural` / `repaid + cleanup-required`を毎回導出し、WCR-001をnon-adoptable / non-waivableな`invalid-declaration`、active exact waiverを`waived`、exclusive expiryとruleset mismatchをpolicy diagnosticに分類する。4 collectionの`phasegate-world-obligation-report/v1` schema、generatedAtなしのbyte-identical report、pure / optional writeを分離した`DeriveObligationsUseCase`、`.harness/world-obligations.json` atomic writerを追加し、composition-rootへ配線した。persisted reportはreadせず、write failureはderived reportを変えないpersistence resultとして分離。H17-09をAC-bound testsと同じ着地で`planned -> required`へ進めた。
|
|
21
|
+
|
|
22
|
+
- **WI-294 / H17-08 — Versioned World control schemas and repositories(WM-13)** — `phasegate.world-constraints.json`、`phasegate.world-baseline.json`、`phasegate.world-waivers.json`、`phasegate.world-debts.json`のpublished JSON Schemaを`docs/contracts/world-*.schema.json`へ追加し、application-owned repository portとfilesystem adapterを実装。file不在だけをcanonical emptyとし、schemaVersion欠落・unknown schema・parse / UTF-8 / I/O failureをvalueなしのinvalid resultとしてfail-closedに保持する。supported constraints envelope内のmalformed / duplicate recordはpartial `ConstraintRecord`を作らずWCR-001入力へ隔離し、duplicate alias sourceもno-winnerとする。adoption baseline、waiver、semantic debtはADR-035のprovenance / exact fingerprint / expiry / WI / renewal / owner / reference contractを検証してcanonical sortし、duplicate ID / fingerprintを拒否する。review済みmutation用にschema admission後のsame-directory temp file + atomic renameをport contractとして提供するが、CLI / `--apply`判断はWM-15へ残す。ci-governanceのpath / SHA-1 baselineは暗黙importせず、H17-08をAC-bound testsと同じ着地で`planned -> required`へ進めた。
|
|
23
|
+
|
|
24
|
+
- **WI-293 / H17-07 — ConstraintRecord と endpoint-symmetric WCR evaluator(WM-12)** — World pure domainへ`ConstraintRecord`、両endpointのimmutable `NodePin`、non-causal `ChangeProvenance`、`WCR-001`〜`WCR-008` evaluatorを追加。typed directed fact(`references` / `depends-on` / `refines` / `content-equals`)の方向を保持しつつclaimant / premise双方を再評価triggerにし、malformed → duplicate → exact → explicit single-hop alias → deletion → missingのresolution precedence、WCR-002 / 003排他、unresolved endpointへのdigest検査禁止、duplicate no-winnerを実装した。`refines`はconstraint declaration由来の明示relationだけを受理し、同一digestや`@world-reflects`から推論しない。incremental評価はaffected recordを再評価してunaffected evidenceとcanonical mergeし、full evaluationとbyte-identicalなsemantic resultを返す。findingはendpoint evidenceとchange provenanceを保持するがseverity / blocking / exit code / waiver等のpolicyを含まない。H17-07は同一着地のAC-bound testsとともに`planned -> required`へ進めた。
|
|
25
|
+
|
|
26
|
+
- **WI-292 — Story coverage lifecycle と L3-004 planned/required ratchet** — `user_stories.md` のStoryにGit-trackedな`Coverage status: planned | required`と`Coverage lifecycle`を導入し、省略時はfail-closedの`required`へ正規化。matrix schema 1.2がstatus / lifecycleを全Storyへ伝搬し、planned Storyと未カバーACを生成matrix上に残したままL3-004のblocking対象からのみ除外する。planned Storyにtest referenceが存在する遷移漏れ、`required -> planned`を含む逆方向履歴、status / lifecycle終端不一致、未知値はL3-004または抽出時にfail-closed。H17-07〜H17-12を`planned`、実装済みH17-01〜H17-06を`required`として明示し、WM-12〜17ではテスト追加と同じ着地で該当Storyを`planned -> required`へ一方向に進める運用を確定。legacy matrix 1.0/1.1は`required / [required]`として後方互換で読み取り、World owner-aware projectionはmatrix 1.2 fieldsをcanonical digestへ含める。
|
|
27
|
+
|
|
28
|
+
- **WI-291 / H17-06 — World graph assembly と `world:inspect`(WM-11)** — WM-09 / 10の全extractorをapplication `BuildSnapshotUseCase`へ統合し、global duplicate node IDをno-winner、duplicate edgeをcanonical dedup、missing endpoint edgeをlossless diagnosticとしてadmitする決定的Snapshot assemblyを追加。attestation public SHA-256 capabilityをconsumer-owned `WorldHashingPort`へ接続するadapter、world-model composition root / public index、plain `WorldInspectionDto`、`InspectWorldUseCase`を公開した。read-only top-level `world:inspect`はhuman / JSON、`phasegate-world-cli/v1`単一envelope、exit 0 / 1 / 2、stdout / stderr分離、config不在canonical defaults、既存resolved design / inception / matrix path、invalid config fail-closedを実装し、`world:pin` / `world:derive`は未登録のまま維持。main help / dispatchとsorted `KNOWN_HARNESS_COMMANDS`を同時更新し、unit / composition / CLI E2E、実corpus counts / root、二重実行byte一致、large stdout flushを検証した。
|
|
29
|
+
|
|
30
|
+
- **WI-290 / H17-05 — World runtime / evidence extractor群(WM-10)** — `world-model/infrastructure/adapters`へsource metadata、test source、requirement-test matrix、attestation、integrity manifestのowner-aware extractorを追加。`scripts/harness/**/*.ts`のheader metadataをimplementation / test SourceFile factへ分離し、matrixは`generatedAt`を除外してStory / AC / TestReference tupleを安定sortし、duplicate IDはwinnerを選ばない。attestationはpublic DTO / verification handlerだけをACL越しに観測し、`producedAt`、git commit、signature、self digestとそれらを含み得るderived input digestを除外する一方、verification statusを保持。integrityはraw-byte digest contractを変更せずexternal declarationとして投影する。optional artifact不在は`not-present` observation、unsupported schema / parse failure / malformed metadataはExtractionDiagnosticとして保持し、provider source、composition-root、world-model indexは変更していない。repository fixtureとunit / integration testを追加した。
|
|
31
|
+
|
|
32
|
+
- **WI-289 / H17-04 — World design corpus extractor群(WM-09)** — `world-model/infrastructure/adapters`へproduct / inception proposal / ADR / canonical Unit definitionの専用filesystem extractor、共通Markdown parser、traceability public facade ACL、cross-corpus coordinatorを追加。design document Artifactを`product / inception / adr` role別の`pgw:v1` identityへ変換し、同一bytesでもcanonical / proposalをdeduplicateしない。`@world-fragment-id`のcontiguous metadata prelude、whole-file / mixed / explicit migration、completion marker、`@world-reflects`、HTML / bare `@work-item-id`を解釈し、Fragment locatorとrole方向の`proposed-by` / `reflected-in` / `traces-to` / `reflected-as` edgeを生成する。duplicate node IDとcase-fold collisionはno-winner、malformed / orphan marker、missing / ambiguous endpoint、unknown WorkItem、provider diagnostic、symlink / unsupported file、read / UTF-8 failureはsilent omissionせずExtractionDiagnosticへ保持。traceability-modelはpublic `index.ts`のplain DTOだけを消費し、WorkItem node、Unit owner、Story catalog属性へ投影する。repository-shaped fixtureとunit / integration testを追加し、composition-root / index / CLIはWM-11まで変更していない。
|
|
33
|
+
|
|
34
|
+
- **WI-288 / H17-03 — traceability-model plain DTO read facade(WM-08)** — traceability-modelのpublic surfaceへversioned `phasegate-traceability-world-read/v1` facadeを追加し、Unit / Story / AC / canonical WorkItem / file-level TestReferenceとprovider diagnosticをdomain型を漏らさないplain DTOで公開。structured Story catalog parserがStory heading、`旧US` alias、AC locatorを保持し、filesystem adapterがcanonical Unit definition、inception frontmatter、`@story` test provenanceを既存parser / gateway経由で収集する。WorkItemはdirectory / frontmatterが一致する`WI-\d+`だけをadmitして`legacy_id`を別配列で返し、duplicate owner、ID不一致、unknown referenceはwinnerを選ばずdiagnosticへ隔離。全collectionをlocale非依存に安定sortし、`@story`は各ACへ`binding:"file"` / `testName:null`で射影する一方、case-level test identity / `@ac` binding / matrix dedupはnyquist-validation所有のまま維持。public composition root、plain-object / canonical alias / deterministic order / no-winner unit contract、実filesystem integrationを追加した。
|
|
35
|
+
|
|
36
|
+
- **WI-287 / H17-02 — World domain primitives と canonical Snapshot(WM-07)** — `scripts/harness/world-model/`の初sourceとしてpure domain sliceを追加。ADR-032全形式の`pgw:v1` WorldNodeId codec、PathKey / DeclaredKey / SHA-256 / corpus role / artifact kind、Artifact / SourceFile / explicit・legacy Fragmentを表すWorldNode、directed Edge、ExtractionDiagnostic、immutable Snapshotを実装した。canonical JSONはrecursive key sort、ordered array保持、unsupported JSON値のfail-closed rejectionを行い、textはfatal UTF-8 decode後にCRLF / lone CRだけをLFへ正規化してUnicode / BOM / whitespaceを保持する。`WorldHashingPort`越しにsorted corpus factsの`corpusRoot`、plain declaration projectionの`constraintRoot`、six-field preimageの`evaluationId`を分離導出し、filesystem・`node:crypto`・他Unit import、index / composition-rootを追加していない。identity / canonicalization / normalization / three-root determinismをdomain unit testで検証。
|
|
37
|
+
|
|
38
|
+
- **WI-281〜WI-284 — World Model Phase 0 product reflection debt repair** — ADR-031〜037で`affects`に列挙された24のUnit×WIについて、各Unitの`docs/product/construction/<unit>/logical_design.md`へ実質的なownership / integration contractを累積反映。traceability plain DTO、validator gate policy、attestation evidence projection、matrix TestReference identity、integrity raw digest、resolved config、canonical Unit filename、L4-004 coexistence、`world:*` dispatch等をowner別に固定し、World側には`pgw:v1` identity、three roots、WCR / obligation / CLI contractをWI単位で記録した。全24ペアは将来設計・実装を拘束するため`affects`を維持し、honest baselineへの追記は行わない。
|
|
39
|
+
|
|
40
|
+
- **WI-286 / H17-01 — Unit非依存SHA-256 public capability(WM-06)** — attestation public facadeに`Sha256Capability.hashBytes(Uint8Array)`、plain `Sha256DigestString`、Unicode normalizationを行わない`hashUtf8` helper、`createSha256Capability()` factoryを追加。既存`NodeCryptoContentHasherAdapter`の`createHash("sha256")` primitiveを新しいinternal `NodeCryptoSha256Capability`へ移動し、adapterはpublic plain digestからattestation-local `Digest`へ変換するconsumerに縮退した。root barrelはinterface / scalar / helper / factoryだけを公開し、`ContentHasherPort`、`Digest`、concrete crypto classを非公開のまま維持。known bytes、non-ASCII UTF-8、既存adapter同値性、internal type非公開をunit / integration testで検証し、World導入による`node:crypto` SHA-256 call siteを増やしていない。
|
|
41
|
+
|
|
42
|
+
- **WI-285 — World Model product catalog / Unit / Construction設計(WM-05 Step B)** — World Model capabilityをproduct overviewへ反映し、Epic H17の12 Story(H17-01〜12)をPhase A/BのWM-06〜17へ1対1でbinding。canonical `world-model_unit.md`とintegration contractで、federated read model、consumer-owned adapter、provider plain DTO、validator-systemのgate ownership、`world:*` CLI / control declaration / generated report境界を確定した。`docs/product/construction/world-model/`にdomain / logical / unit test / integration test設計を新設し、`pgw:v1` identity、3 root canonicalization、WCR-001〜008、baseline / waiver / obligation、CLI exit 0/1/2、determinism / mutation fixtureを実装予定contractとして記録。WI-283の`UT-WM283-*`全caseをUnit test設計へ包含し、L2-017 / L3-008はPhase Cまで予約のままとする。
|
|
43
|
+
|
|
44
|
+
- **WI-285 — Unit definition corpus の物理 canonical 化(WM-05 Step A)** — ADR-031 の lifecycle 決定を執行し、`docs/product/units/` の hyphen / underscore 重複13ペアを `<kebab-case Unit ID>_unit.md` の単一正本へ lossless に統合。legacy variant 固有の traceability(validator-system WI-168、config-foundation WI-219、harness-api H09-01 など)と詳細要件を canonical 側へ保持し、13個の non-canonical fileを削除した。adr-foundation / regression-suite も Unit ID と一致する filename へ移行し、docs / CHANGELOG の旧 path 参照を canonical path へ更新。World snapshot の入力 corpus を一 Unit 一 artifact に収束させた。WM-05 Step B の product catalog / world-model Unit 設計は本着地点に含めない。
|
|
45
|
+
|
|
46
|
+
- **WI-284 — `world:*` CLI と output/persistence contract(ADR-037)** — `world:inspect`(read-only snapshot)、`world:pin`(preview、`--apply`のみconstraints更新)、`world:derive`(pure default、`--write`のみreport保存)をcanonical top-level commandとして確定。human / JSONはprimary resultをstdout、usage / process failureをstderrへ分離し、exit 0=non-blocking success、1=domain / gate finding、2=trustworthy resultを作れないconfig / schema / I/O等とする。Git-tracked control inputをrootの`phasegate.world-constraints.json`, `phasegate.world-baseline.json`, `phasegate.world-waivers.json`, `phasegate.world-debts.json`へ置き、generated obligation reportは非追跡`.harness/world-obligations.json`へatomic writeする。config keyは`world`、automatic integrationはdefault disabled、明示commandはconfig不在でも`docs/product`, `docs/inception`, `docs/ADR`, `scripts/harness`等のcanonical defaultsで実行し、存在するinvalid / unknown config・declaration schemaはfail-closed。Phase C用に`L2-017 world-constraint-admission`と`L3-008 world-constraint-rederivation`を予約するがregistry登録はWM-19/20へ残す。session-startは5件 / 2000文字(schema上限20 / 8000)でblocking-firstに省略し、free text / report全文をinjectしない。attestation v2 schema / coexistenceはWM-23へ明示委譲する。
|
|
47
|
+
|
|
48
|
+
- **WI-284 — World constraints と L4-004 doc freshness の共存(ADR-036)** — 現役L4-004がdocument自身のlatest Git timestamp(取得不能時はmtime)をwarn / error日数閾値で評価するtemporal heuristicである一方、World WCRはstable ID、explicit reference / dependency、pinned digestを検査する構造ruleであると責務分離。age thresholdはphase2-extensions / L4-004、explicit structural driftはworld-model WCR、severity / blocking / executionはvalidator-systemをcanonical ownerとする。同一documentで両方を検出してもraw signalを保持し、WCRをprimary structural remediation、L4-004をsupporting temporal signalとして相関するが、L4 findingをWorld fingerprint / baseline / waiverへ混ぜない。L4-004は現役product capabilityとして維持し、WM-20後からWM-24完了・一warn-threshold期間・2回以上のdual-runを満たすcompatibility periodを設定。time-only valueやL4-only findingがあれば維持し、World coverage completeかつunique valueなし等を満たすdocument patternだけを別WIで縮退対象とする。self-repoのL4 disabledはdogfood policyであり廃止根拠にせず、明示L4実行、strict preset、registry / composition wiringを維持する。
|
|
49
|
+
|
|
50
|
+
- **WI-284 — World adoption baseline、obligation、waiver(ADR-035)** — `violationFingerprint`をrulesetVersion、WCR rule、constraint / endpoint pin、rule-owned expected / observed evidenceのcanonical SHA-256として定義し、constraint declaration identityとは分離。obligation reportはcurrent evaluation、external policy declarations、resolved waiver dateから毎回byte-deterministicに再導出し、保存`repaid` stateや手編集reportを判定入力にしない。adoption baselineは採用時の既存fingerprintだけを持つclosed setとし、同一rulesetでは追加禁止・返済削除のみ、ruleset変更時は自動carryせずreviewed migrationを必須とする。新規claim / pinの違反とmalformed declarationはbaseline化せず、legacy entryだけをvisible non-blocking debtにする。waiverはexact fingerprint、reason、exclusive UTC expiry、WI、stable IDを必須とし、自動renewal / wildcardを禁止。baseline / waiver / semantic debtとwaiver評価日を`policyInputsDigest`へ含めつつ、raw WCR finding / fingerprintはpolicyから独立させる。semantic debtは`pgw:v1:semantic-debt:<DeclaredKey>`とfile-level `@world-semantic-debt` referenceで明示importし、structural obligationや「再発見」として扱わない。既存`.phasegate/baseline.json`のpath / SHA-1 hook grandfatherとは統合しない。
|
|
51
|
+
|
|
52
|
+
- **WI-284 — World constraint semantics と endpoint-symmetric evaluation(ADR-034)** — `references` / `depends-on` / `refines` / `content-equals`のtyped directed factを維持しながら、claimant / premiseどちらの変更でも同じconstraintを再評価する方針を採用。ConstraintRecordは`pgw:v1:constraint:<DeclaredKey>`と両endpointのstable node ID / pinned SHA-256 digestを持ち、機械ruleをexistence、ID uniqueness、explicit reference、declared dependency、digest equalityへ限定する。`WCR-001`〜`WCR-008`でmalformed declaration、missing、baselineからのdeletion、invalid explicit rename alias、duplicate、broken reference / dependency、digest driftを区別し、ADR-032 diagnostic codeやvalidator-system `Lx-NNN`とは別namespaceにする。`refines`とrename continuityは明示stable ID / single-hop aliasだけを受理し、similarityから推論しない。change provenanceはbaseline / current Snapshot IDとsorted changed candidatesだけを記録し、因果を主張しない。config keyとlayer validator IDはCLI / registry contractとともにADR-037で決定する。
|
|
53
|
+
|
|
54
|
+
- **WI-283 — World snapshot canonicalization、version roots、hashing(ADR-033)** — Worldの`corpusRoot` / `constraintRoot` / `evaluationId`を別preimageとして定義し、recursive object-key sort、semantic setのstable-ID sort、ordered array保持、空白なしUTF-8 JSONによる決定的canonicalizationを採用。textはstrict UTF-8としてCRLF / CRをLFへ揃える一方、Unicode normalization、BOM / whitespace / final newlineの隠れた同一化は行わない。matrix `generatedAt`、absolute root、clock、git / deployment stamp、obligation report、self digestはowner-aware projectionで除外し、schema / extractor / ruleset versionとscope別relevant resolved config digestはrootへ含める。symlinkはfollowせず、pathはcase-sensitive、collisionはno-winner diagnosticとする。SHA-256は既存attestation `NodeCryptoContentHasherAdapter`をplain public capability化し、world-model / attestationが各consumer-owned portとlocal Digestへadaptすることで、World用の新規`node:crypto` call siteを増やさない。
|
|
55
|
+
|
|
56
|
+
- **WI-282 — World node identity と fragment locator(ADR-032)** — World node に versioned `pgw:v1:*` ID schemaを定義し、path-based Artifact / SourceFile identityと、path・heading text・order・line number・content digestに依存しない明示 Fragment identityを分離。Markdown markerは`<!-- @world-fragment-id <DeclaredKey> -->`をATX heading直前のmetadata preludeへ置き、duplicate IDはwinnerを選ばないdiagnosticとする。legacy文書はwhole-file fallbackから開始し、explicit marker導入後はcompatibility fallbackを併存、旧constraint / pinのretarget完了後に`<!-- @world-fragment-migration complete -->`でfallbackをretireするratchetを採用。rename / move / deleteをdigestから推論せず、continuityはsingle-hop explicit aliasだけで表す。product / inceptionは別identityのままWorkItem hubと`@world-reflects`で接続し、既存`@work-item-id` / `@attestation`のline occurrenceをstable claim IDに偽装しない。
|
|
57
|
+
|
|
58
|
+
- **WI-281 — World Model ownership と corpus lifecycle(ADR-031)** — World Model を既存 Unit の上位正本ではなく federated read model と位置づけ、traceability-model の ID / Unit / WorkItem / Story は plain DTO / public facade から観測する方針を確定。world-model は事実組立と制約評価、validator-system は gate 実行と blocking policy、attestation は gate-run evidence、nyquist-validation matrix は Story / AC / TestReference index、ci-governance integrity は instruction corpus を所有する。product は canonical、inception は proposal / delta として同一内容でも別 artifact に保ち、consumer-owned anti-corruption adapter で Unit 境界を隔離する。`docs/product/units/` の実 inventory で確認した hyphen / underscore 重複13ペアは `<kebab-case Unit ID>_unit.md` を canonical とし、WM-05 の正式 WI で lossless 統合・参照更新・旧名削除を行って WM-06 前に収束させる。initial structural violation fingerprint は推測せず、versioned ruleset 固定後の WM-17 で clean checkout から決定的に実測する。
|
|
59
|
+
|
|
60
|
+
- **WI-280 — World Model 導入の実行計画** — phasegate を「一方向の phase gate」から「世界(Unit/ドメイン/論理設計/Story/AC/テスト/ADR)の端点対称な制約再評価環境」へ対称化する World Model 構想の delivery plan を `docs/inception/_cross/WI-280/delivery_plan.md` として策定(計画のみ、実装なし)。Phase 0 = ADR-031〜037 + world-model unit 設計、Phase A = read-only snapshot + `world:inspect`、Phase B = constraint/obligation 導出 + `world:derive`(WM-17 = 機能 MVP)、Phase C = L2/L3/attestation v2/CI 統合。obligation report は immutable derived output、新規 claim は初日から fail-closed、既存違反は adoption baseline(violationFingerprint)で可視負債化、という裁定を含む。Claude ドラフト + GPT-5.6 sol(Codex CLI)敵対的レビュー 2 ラウンドの共同成果物。
|
|
61
|
+
|
|
12
62
|
- **WI-264 — `reconcile` prunes bundled skills that left the catalog** — `phasegate reconcile` (and its `update-skills` alias) now detects **manifest-managed** skills that are no longer in the current bundle catalog (`getBundledSkillsForSet("all")`) and prunes them: the on-disk skill directory is removed and the manifest entry is dropped. This closes the WI-256 orphan gap — the removed `implementation-planner` / `doc-freshness-checker` / `pointer-validator` directories are now cleaned up automatically on the next `reconcile --apply` (shared installs under `skills/`, personal installs under `.claude/skills/` and `.codex/skills/`). Pruning is **manifest-scoped**: user-owned skill directories that PhaseGate never recorded are never touched, and `.harness-version` is never pruned. `--dry-run` reports each prune (`action: "prune"`) without mutating disk or manifest, and the operation is idempotent.
|
|
13
63
|
|
|
14
64
|
### Changed
|
|
@@ -1068,7 +1118,7 @@ Wave 1 成果物を批判的にレビューし、以下の穴を修正:
|
|
|
1068
1118
|
- `scripts/harness/` 配下に実装コードは一切存在せず、他 Unit からの import / 参照もなかった(Future Phase / v1 スコープ外として設計段階で凍結されていた Unit)。
|
|
1069
1119
|
- `docs/product/user_stories.md` から HF1-01 〜 HF1-05 の 5 ストーリーセクションと `H-F1` Epic 行を削除。v1 合計を 54 維持、全体(Future 含む)を 62 → 57 に更新。
|
|
1070
1120
|
- `docs/product/units/integration_contract.md` の依存図・Wave 実行計画・Validator ID Registry / CLI Command Registry の `fuse-hooks-engine` 参照を削除。L0 拡張ポイント(6.1 / 6.3)は「OS-level enforcement」の抽象概念として残置。
|
|
1071
|
-
- `docs/product/units/
|
|
1121
|
+
- `docs/product/units/agent-integration_unit.md` Stop Hook Adapter 行の `fuse-hooks-engine(Future: FUSE完了ゲートの参照実装)` 参照を `—` に変更。
|
|
1072
1122
|
- `docs/product/construction/agent-integration/unit_test_design.md` UT-WTS-I021 のサンプルパスを `fuse-hooks-engine/HF1-06` → `some-unit/HF1-06` に変更(WORK_ITEM_ID_PATTERN 後方互換テストは維持)。
|
|
1073
1123
|
|
|
1074
1124
|
### Fixed
|
package/README.ja.md
CHANGED
|
@@ -189,6 +189,7 @@ npx phasegate reconcile --apply
|
|
|
189
189
|
| **HarnessError 形式** | 全エラーに ADR 参照 + 修正例が含まれ、AI が自己修正できる |
|
|
190
190
|
| **Baseline (retrofit)** | 既存リポジトリ導入時、`baseline` snapshot に登録した既存ファイルは構造的に編集されるまで gate 対象外 |
|
|
191
191
|
| **カスタム gate** | AIDLC 以外のプロジェクトでも schema-first など独自の前提条件を設定できる |
|
|
192
|
+
| **World Model (CLI)** | 設計文書・ソース・テスト・matrix・attestation を型付き事実グラフに抽出し、制約の両端点を pin して義務を決定的に再導出(`world:inspect` / `world:pin` / `world:derive`) |
|
|
192
193
|
|
|
193
194
|
---
|
|
194
195
|
|
|
@@ -255,6 +256,29 @@ Phasegate はプロンプトインジェクションを独立した新規脅威
|
|
|
255
256
|
|
|
256
257
|
---
|
|
257
258
|
|
|
259
|
+
## World Model
|
|
260
|
+
|
|
261
|
+
phasegate のゲートは従来一方向でした: 書き込み時にコードを設計と照合する。**World Model**([ADR-031](docs/ADR/031-world-model-ownership-and-corpus-lifecycle.md)〜[037](docs/ADR/037-world-cli-and-output-contract.md))はこの制約面を**端点対称**にします。設計文書・ソースメタデータ・テスト・requirement-test matrix・attestation を型付き・content-addressed な事実グラフとして抽出し、pin された制約は**どちらの端点が変わっても**再評価されます — 設計文書を編集すれば、それを根拠として主張していたコード側に可視の義務が生まれます(逆方向だけではなく)。
|
|
262
|
+
|
|
263
|
+
3 コマンドを提供します(明示実行は常に可能。`phasegate.config.json` の `world.enabled` は既定 `false` で、将来のゲート統合のみを制御します):
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
npx phasegate world:inspect --json # 決定的な read-only snapshot: node / edge / 抽出 diagnostics
|
|
267
|
+
npx phasegate world:pin --constraint <id> --endpoint <claimant|premise> --apply
|
|
268
|
+
npx phasegate world:derive --json # 制約評価から obligation report を再導出
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
正直さを保つための設計上のコミットメント:
|
|
272
|
+
|
|
273
|
+
- **obligation report は immutable な導出結果。** `world:derive --write` は `.harness/world-obligations.json` に report を永続化しますが、判定は常に corpus から再導出されます — 永続 report を手編集・削除しても結果は変わりません。
|
|
274
|
+
- **新規違反は初日から fail-closed。** 既存違反は閉じた・人間レビュー可能な baseline(`phasegate.world-baseline.json`)として採用され、縮小のみ許されます(同一 ruleset での追加は拒否)。
|
|
275
|
+
- **既知の意味的ギャップは宣言するもので「再発見」しない。** explicit debt は `phasegate.world-debts.json` に宣言し import として表示。waiver(`phasegate.world-waivers.json`)は fingerprint / 理由 / 期限 / Work Item が必須です。
|
|
276
|
+
- **決定性は契約。** 同一 checkout での 2 回実行は byte-identical な JSON を出力します。
|
|
277
|
+
|
|
278
|
+
現在のスコープは **CLI のみ**です: validator ID L2-017 / L3-008 は予約済みですが pre-commit / CI ゲートへの登録は未実施で、将来フェーズとして管理しています。
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
258
282
|
## 29 スキル
|
|
259
283
|
|
|
260
284
|
AIDLC (AI-Driven Development Life Cycle) は **要求定義 → 設計 → テスト設計 → TDD 実装** の順序を強制するプロセスです。各スキルは前のレベルの成果物を入力にします。
|
|
@@ -390,6 +414,9 @@ npx phasegate <command> [options]
|
|
|
390
414
|
| `config:plan --intent <intent>` | 安全な設定変更 intent を対象ファイル / コマンド / risk / rollback / validation にマップ |
|
|
391
415
|
| `integrity:pin` | 指示搭載ファイルの SHA-256 manifest(`phasegate.integrity.json`)を生成 / 更新(意図的変更を記録。`--dry-run`, `--json`) |
|
|
392
416
|
| `integrity:verify` | manifest と実ファイルを照合。drift 検出時は exit 2、クリーン時は exit 0(`--json`)。ローカルは advisory、CI が authoritative |
|
|
417
|
+
| `world:inspect` | 決定的な read-only World snapshot を構築・表示(`--format human\|json`, `--json`)。抽出 diagnostics があれば exit 1 |
|
|
418
|
+
| `world:pin --constraint <id> --endpoint <claimant\|premise>` | 制約端点の digest をプレビュー。`--apply` で `phasegate.world-constraints.json` を atomic に更新 |
|
|
419
|
+
| `world:derive` | World 制約評価から obligation report を再導出(`--write` で `.harness/world-obligations.json` へ永続化、`--out <path>`, `--json`)。blocking obligation で exit 1、未知 schema 等の契約エラーで exit 2 |
|
|
393
420
|
| `lint` | L1 Biome AST チェック |
|
|
394
421
|
| `validate --layer <L1\|L2\|L3\|L4\|all>` | 指定レイヤーのバリデータ実行(`--format human\|agent\|ci`) |
|
|
395
422
|
| `ci-check` | CI フルチェック(L2-L4)。`--quick` で Quick Mode |
|
|
@@ -597,4 +624,4 @@ phasegate 自体の開発: [DEVELOPMENT.ja.md](DEVELOPMENT.ja.md)
|
|
|
597
624
|
|
|
598
625
|
---
|
|
599
626
|
|
|
600
|
-
*Last updated: 2026-07-
|
|
627
|
+
*Last updated: 2026-07-17 — v0.254.0*
|
package/README.md
CHANGED
|
@@ -173,6 +173,7 @@ npx phasegate reconcile --apply
|
|
|
173
173
|
| **Agent-readable HarnessError output** | Gives AI agents the reason, missing artifacts, references, and examples needed to self-correct |
|
|
174
174
|
| **Retrofit baseline** | Lets existing repositories adopt Phasegate gradually by grandfathering unchanged files |
|
|
175
175
|
| **Configurable gates** | Supports AIDLC defaults or custom gates such as schema-first API development |
|
|
176
|
+
| **World Model (CLI)** | Extracts design docs, source, tests, matrices, and attestations into a typed fact graph, pins constraints between endpoints, and deterministically re-derives obligations (`world:inspect` / `world:pin` / `world:derive`) |
|
|
176
177
|
|
|
177
178
|
---
|
|
178
179
|
|
|
@@ -235,6 +236,29 @@ Five components implement this posture:
|
|
|
235
236
|
|
|
236
237
|
---
|
|
237
238
|
|
|
239
|
+
## World Model
|
|
240
|
+
|
|
241
|
+
Phasegate's gates historically pointed one way: code is checked against design at write time. The **World Model** (per [ADR-031](docs/ADR/031-world-model-ownership-and-corpus-lifecycle.md)–[037](docs/ADR/037-world-cli-and-output-contract.md)) makes that constraint surface **endpoint-symmetric**: design documents, source metadata, tests, the requirement-test matrix, and attestations are extracted into a typed, content-addressed fact graph, and a pinned constraint is re-evaluated whenever *either* endpoint changes — so editing a design document creates visible obligations on the code that claimed it, not just the other way around.
|
|
242
|
+
|
|
243
|
+
Three commands (always runnable explicitly; `world.enabled` in `phasegate.config.json` defaults to `false` and only governs future gate integration):
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
npx phasegate world:inspect --json # deterministic read-only snapshot: nodes, edges, extraction diagnostics
|
|
247
|
+
npx phasegate world:pin --constraint <id> --endpoint <claimant|premise> --apply
|
|
248
|
+
npx phasegate world:derive --json # re-derive the obligation report from constraint evaluation
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
Design commitments that keep it honest:
|
|
252
|
+
|
|
253
|
+
- **The obligation report is immutable derived output.** `world:derive --write` persists a report to `.harness/world-obligations.json`, but the verdict is always re-derived from the corpus — hand-editing or deleting the persisted report never changes the result.
|
|
254
|
+
- **New violations fail closed from day one.** Pre-existing violations are adopted into a closed, human-reviewable baseline (`phasegate.world-baseline.json`) that can only shrink; same-ruleset additions are rejected.
|
|
255
|
+
- **Known semantic gaps are declared, never "rediscovered."** Explicit debts live in `phasegate.world-debts.json` and are displayed as imports; waivers (`phasegate.world-waivers.json`) require a fingerprint, reason, expiry, and Work Item.
|
|
256
|
+
- **Determinism is a contract.** Double runs over the same checkout produce byte-identical JSON output.
|
|
257
|
+
|
|
258
|
+
Current scope is **CLI-only**: validator IDs L2-017 / L3-008 are reserved but not yet registered into pre-commit/CI gating, which is tracked as a future phase.
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
238
262
|
## 29 Skills
|
|
239
263
|
|
|
240
264
|
Skills cover the full **AIDLC (AI-Driven Development Life Cycle)**: product definition, design, test design, and TDD implementation. Each skill consumes the artifacts from the previous phase.
|
|
@@ -570,6 +594,9 @@ README keeps only the entry points most users need. The full public/compatibilit
|
|
|
570
594
|
| `config:plan --intent <intent>` | Map a safe configuration-change intent to target files, commands, risks, rollback, and validation. |
|
|
571
595
|
| `integrity:pin` | Generate/update the SHA-256 manifest (`phasegate.integrity.json`) over instruction-carrying files. Records intentional edits (`--dry-run`, `--json`). |
|
|
572
596
|
| `integrity:verify` | Recompute and compare against the manifest. Exit 2 on drift (mismatch/added/missing/manifest-absent), exit 0 when clean (`--json`). Locally advisory; CI is authoritative. |
|
|
597
|
+
| `world:inspect` | Build and inspect the deterministic read-only World snapshot (`--format human\|json`, `--json`). Exit 1 when extraction diagnostics exist. |
|
|
598
|
+
| `world:pin --constraint <id> --endpoint <claimant\|premise>` | Preview a constraint endpoint digest; `--apply` atomically updates `phasegate.world-constraints.json`. |
|
|
599
|
+
| `world:derive` | Re-derive the obligation report from World constraint evaluation (`--write` persists to `.harness/world-obligations.json`, `--out <path>`, `--json`). Exit 1 on blocking obligations, exit 2 on contract errors such as unknown control-file schemas. |
|
|
573
600
|
| `list-adrs` | List ADRs, optionally filtered by `--status <Proposed\|Accepted\|...>`. |
|
|
574
601
|
| `validate-adr` | Validate ADR structure (`--all` or a single `<adrRef>`). |
|
|
575
602
|
| `lint` / `phasegate:lint` | Run L1 Biome AST checks. The `phasegate:*` form is a binary subcommand, not an npm script unless `package.json` defines it locally. |
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
---
|
|
2
|
+
adr_id: "031"
|
|
3
|
+
title: "World Model の ownership と corpus lifecycle"
|
|
4
|
+
status: Proposed
|
|
5
|
+
date: 2026-07-16
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# World Model の ownership と corpus lifecycle
|
|
9
|
+
|
|
10
|
+
<!-- @work-item-id WI-281 -->
|
|
11
|
+
|
|
12
|
+
## Context
|
|
13
|
+
|
|
14
|
+
World Model は Unit、WorkItem、Story、AC、test、ADR、source、design document、generated evidence を型付き事実として観測し、明示制約を評価する。しかし既存の traceability-model、validator-system、attestation、nyquist-validation、ci-governance は既にそれぞれの domain model と lifecycle を所有している。world-model がそれらを複製すると、同じ ID や policy に複数の正本が生じる。
|
|
15
|
+
|
|
16
|
+
また、canonical design である `docs/product/` と proposal / delta である `docs/inception/` は同一 WI や同一内容を持ち得る。content digest だけで統合すると、確定設計と提案の provenance を失う。
|
|
17
|
+
|
|
18
|
+
`docs/product/units/` の実 inventory では、具体 Unit 定義29ファイルが論理 Unit 16個を表し、hyphen / underscore の重複が13ペア存在した。全ペアは内容が byte-identical ではなく、alias と full definition、または異なる時点の full definition が併存している。World snapshot がこの corpus を無条件に読むと、一つの Unit を複数 artifact として観測するか、一方の固有情報を失う。
|
|
19
|
+
|
|
20
|
+
本 ADR は World node identity、hash canonicalization、constraint semantics、CLI contract より先に、ownership、import、corpus role と Unit 定義の lifecycle を決める。
|
|
21
|
+
|
|
22
|
+
## Decision
|
|
23
|
+
|
|
24
|
+
### 1. World Model は federated read model とする
|
|
25
|
+
|
|
26
|
+
world-model は他 Unit の上位正本ではない。各 owner が公開する plain DTO / public read facade を consumer-owned anti-corruption adapter で World-local fact へ変換し、事実を組み立てる。
|
|
27
|
+
|
|
28
|
+
- traceability-model は ID、Unit、WorkItem、Story の model / parsing / status lifecycle を所有する。
|
|
29
|
+
- world-model は traceability-model の `StoryId`、WorkItem Entity、frontmatter model を複製せず、plain DTO から観測する。
|
|
30
|
+
- world-model は artifact / fact / edge / extraction diagnostic と constraint evaluation を所有する。
|
|
31
|
+
- provider の domain object は World の public / internal contractへ漏らさない。
|
|
32
|
+
|
|
33
|
+
### 2. Gate と evaluation の ownership を分離する
|
|
34
|
+
|
|
35
|
+
- validator-system は validator registry、layer execution、severity、exit code、blocking policy を所有する。
|
|
36
|
+
- world-model は corpus からの事実組立と、宣言された構造制約の評価を所有する。
|
|
37
|
+
- world-model は `blocking: true` のような gate policy を決めず、violation / diagnostic を plain evaluation DTO として返す。
|
|
38
|
+
- validator-system infrastructure の adapter が evaluation DTO を validation result へ変換し、validator-system の policy を適用する。
|
|
39
|
+
- world-model から validator-system への import は禁止する。
|
|
40
|
+
|
|
41
|
+
### 3. Evidence / integrity / matrix の owner を維持する
|
|
42
|
+
|
|
43
|
+
- attestation は gate-run evidence、produce / verify、record schema と evidence lifecycle を所有する。
|
|
44
|
+
- ci-governance の integrity capability は instruction corpus、integrity manifest、pin / verify lifecycle を所有する。
|
|
45
|
+
- nyquist-validation の matrix capability は Story / AC / TestReference index、matrix schema、generation と coverage semantics を所有する。
|
|
46
|
+
- traceability-model が Story identity を所有し、matrix はその ID を参照する index を所有する。matrix と world-model は Story identity を再定義しない。
|
|
47
|
+
- world-model は各 public plain DTO または versioned projection を観測するだけで、attestation / integrity / matrix の schema を自 Unit の schema として複製しない。
|
|
48
|
+
|
|
49
|
+
### 4. Product と inception を別 corpus role とする
|
|
50
|
+
|
|
51
|
+
- `docs/product/**` は canonical design corpus とする。
|
|
52
|
+
- `docs/inception/**` は proposal / delta corpus とする。
|
|
53
|
+
- 同じ明示 ID、path fragment、heading、content digest を持っても同一 artifact として deduplicate しない。
|
|
54
|
+
- inception から product への反映は `@work-item-id` による明示 relation で接続する。
|
|
55
|
+
- product 反映後の inception は provenance として残り得るが、canonical product の代替にはならない。
|
|
56
|
+
- archive と fragment identity の詳細は ADR-032 で決める。本 ADR は corpus role の非同一性を固定する。
|
|
57
|
+
|
|
58
|
+
### 5. Artifact kind を lifecycle で分類する
|
|
59
|
+
|
|
60
|
+
World ingestion は artifact を次の4種類に分ける。
|
|
61
|
+
|
|
62
|
+
1. **design document** — product、inception、ADR。人がレビューする設計意図であり、product / inception の corpus role を保持する。
|
|
63
|
+
2. **source** — 実装 source と test source。test source と matrix の TestReference index は別 artifact である。
|
|
64
|
+
3. **generated artifact** — matrix projection、attestation record、snapshot、obligation report。producer から再生成可能な projection / evidence / report であり、保存物だけを一次正本として信頼しない。
|
|
65
|
+
4. **external declaration** — integrity manifest と将来の World constraint / adoption baseline / waiver / explicit debt declaration。生成コマンドで下書きできても、人が review して採用した後は versioned control input として扱う。
|
|
66
|
+
|
|
67
|
+
種類が異なる artifact は content digest が同じでも統合しない。関係が必要なら明示 reference または `derived-from` 相当の fact で接続する。
|
|
68
|
+
|
|
69
|
+
### 6. Import と anti-corruption adapter の方向を固定する
|
|
70
|
+
|
|
71
|
+
compile-time import は次を許可する。
|
|
72
|
+
|
|
73
|
+
- `world-model/infrastructure -> traceability-model public facade / plain DTO`
|
|
74
|
+
- `world-model/infrastructure -> nyquist-validation public matrix facade / plain DTO`
|
|
75
|
+
- `world-model/infrastructure -> attestation public evidence facade / plain DTO`
|
|
76
|
+
- `world-model/infrastructure -> ci-governance integrity public facade / plain DTO`
|
|
77
|
+
- `validator-system/infrastructure -> world-model public evaluation facade / plain DTO`
|
|
78
|
+
- `harness-api / top-level composition -> 各 Unit の public handler / DTO`
|
|
79
|
+
|
|
80
|
+
anti-corruption adapter は provider ではなく consumer に置く。world-model の domain / application は consumer-owned port のみに依存し、他 Unit の domain / infrastructure / composition-root を import しない。provider に public read facade がなければ provider Unit で追加し、deep import で代替しない。
|
|
81
|
+
|
|
82
|
+
attestation v2 へ `worldSnapshotRoot` を渡す将来統合は top-level composition が primitive / input DTO を注入する。attestation から world-model を import させず、循環依存を作らない。
|
|
83
|
+
|
|
84
|
+
### 7. Unit 定義の canonical filename を kebab Unit ID に統一する
|
|
85
|
+
|
|
86
|
+
canonical filename は `<kebab-case Unit ID>_unit.md` とする。Unit ID、source / construction directory、phase dependency の `{unit}_unit.md` 解決を同じ文字列へ揃える。
|
|
87
|
+
|
|
88
|
+
inventory で確認した全13ペアの canonical は次のとおり。
|
|
89
|
+
|
|
90
|
+
| Unit ID | canonical |
|
|
91
|
+
|---|---|
|
|
92
|
+
| agent-integration | `agent-integration_unit.md` |
|
|
93
|
+
| biome-ast-engine | `biome-ast-engine_unit.md` |
|
|
94
|
+
| ci-governance | `ci-governance_unit.md` |
|
|
95
|
+
| config-foundation | `config-foundation_unit.md` |
|
|
96
|
+
| harness-api | `harness-api_unit.md` |
|
|
97
|
+
| harness-error | `harness-error_unit.md` |
|
|
98
|
+
| nyquist-validation | `nyquist-validation_unit.md` |
|
|
99
|
+
| phase-dependency-model | `phase-dependency-model_unit.md` |
|
|
100
|
+
| phase2-extensions | `phase2-extensions_unit.md` |
|
|
101
|
+
| quick-mode | `quick-mode_unit.md` |
|
|
102
|
+
| skill-quality | `skill-quality_unit.md` |
|
|
103
|
+
| traceability-model | `traceability-model_unit.md` |
|
|
104
|
+
| validator-system | `validator-system_unit.md` |
|
|
105
|
+
|
|
106
|
+
non-canonical 側は恒久 alias にしない。WM-05 に割り当てる正式 WI が固有内容と traceability annotation を canonical 側へ lossless に統合し、repository 内参照を更新した後、同じ WI 内で削除する。WM-05 の正式 WI ID は開始時に採番し、WM-06 の snapshot 実装開始前に移行を完了する。
|
|
107
|
+
|
|
108
|
+
重複相手がない adr-foundation と regression-suite も同じ WM-05 WI で、それぞれ `adr-foundation_unit.md` と `regression-suite_unit.md` を canonical filename とする。`installation_unit.md` は規則に適合する。WI-281 では削除・移動を行わない。
|
|
109
|
+
|
|
110
|
+
### 8. Initial structural violation fingerprint は ruleset 固定後に実測する
|
|
111
|
+
|
|
112
|
+
現時点の numeric estimate は採用しない。node identity、ruleset、fingerprint 形式が未決定であり、13重複ペアをそのまま fingerprint 数へ換算すると事実でない精度を作るためである。
|
|
113
|
+
|
|
114
|
+
WM-17 で、WM-05 canonical 化後の clean checkout、承認済み `schemaVersion` / `extractorVersion` / `rulesetVersion` / relevant config を入力に全構造 rule を実行する。`violationFingerprint` で一意化し、総数と `ruleId` / corpus kind / Unit 別内訳を決定的順序で記録する。同一 checkout で2回実行して fingerprint 集合と serialized bytes が一致した集合だけを initial structural violation baseline とする。
|
|
115
|
+
|
|
116
|
+
ExtractionDiagnostic、explicit semantic debt、waiver は structural violation 数に混ぜない。ruleset version が変われば version ごとに再計数し、旧総数と単純比較しない。
|
|
117
|
+
|
|
118
|
+
### 9. ADR-031 外の未決事項を先取りしない
|
|
119
|
+
|
|
120
|
+
fragment ID / legacy whole-file migration は ADR-032、Unicode / hashing capability / snapshot root は ADR-033、constraint fingerprint / semantic debt / waiver は ADR-034〜035、declaration filename / report path / CLI / config は ADR-037、attestation v2 と session-start 表示は各後続 WI で決める。
|
|
121
|
+
|
|
122
|
+
## Consequences
|
|
123
|
+
|
|
124
|
+
### Positive
|
|
125
|
+
|
|
126
|
+
- ID、Story、WorkItem、gate policy、evidence、matrix に二つ目の正本を作らずに World を構築できる。
|
|
127
|
+
- consumer-owned adapter が provider schema の変化を局所化し、domain 間の循環依存を防ぐ。
|
|
128
|
+
- product と inception の provenance を失わず、proposal を canonical truth と誤認しない。
|
|
129
|
+
- Unit corpus が一 Unit 一 canonical artifact へ収束し、snapshot の重複入力を事前に除去できる。
|
|
130
|
+
- initial baseline の件数を再現可能な ruleset と結び付けられる。
|
|
131
|
+
|
|
132
|
+
### Negative / Trade-off
|
|
133
|
+
|
|
134
|
+
- provider ごとに public read facade / plain DTO の追加が必要になる。
|
|
135
|
+
- WM-05 では13ペアの内容差分と repository 内参照を lossless に統合する作業が発生する。
|
|
136
|
+
- inception と product を別 artifact とするため node 数は増える。
|
|
137
|
+
- fingerprint の初期件数は WM-17 まで確定しない。
|
|
138
|
+
|
|
139
|
+
## Alternatives
|
|
140
|
+
|
|
141
|
+
- **world-model に Story / WorkItem model を複製する** — ownership が分裂し、traceability-model の parsing / lifecycle 変更と drift するため不採用。
|
|
142
|
+
- **validator-system に constraint evaluation も置く** — gate policy と corpus facts が結合し、read-only inspection や endpoint-symmetric evaluation を再利用しにくいため不採用。
|
|
143
|
+
- **product / inception を ID または digest で統合する** — canonical と proposal の provenance を失うため不採用。
|
|
144
|
+
- **underscore 側を canonical とする** — Unit ID、source / construction directory、`{unit}_unit.md` placeholder の kebab-case と一致しないため不採用。
|
|
145
|
+
- **hyphen alias を恒久保持する** — extractor ごとの alias 解釈を必要にし、一 Unit 一 artifact の invariant を壊すため不採用。
|
|
146
|
+
|
|
147
|
+
## 関連要件・文書
|
|
148
|
+
|
|
149
|
+
- `docs/inception/_cross/WI-280/delivery_plan.md` §1, §3 WM-01, §7 ADR-031, §10
|
|
150
|
+
- `docs/inception/_cross/WI-281/description.md`
|
|
151
|
+
- `docs/inception/_cross/WI-281/logical_design.md`
|
|
152
|
+
- `docs/folder_management_rules.md`
|
|
153
|
+
- ADR-005(ヘキサゴナルアーキテクチャ)
|
|
154
|
+
- ADR-027(成果物駆動状態導出)
|
|
155
|
+
- ADR-030(gate-run evidence、instruction integrity、L3 再導出)
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
---
|
|
2
|
+
adr_id: "032"
|
|
3
|
+
title: "World node identity と fragment locator"
|
|
4
|
+
status: Proposed
|
|
5
|
+
date: 2026-07-16
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# World node identity と fragment locator
|
|
9
|
+
|
|
10
|
+
<!-- @work-item-id WI-282 -->
|
|
11
|
+
|
|
12
|
+
## Context
|
|
13
|
+
|
|
14
|
+
World Model は snapshot 間で同じ node を追跡し、constraint endpoint の missing / changed / duplicate を区別する必要がある。content digest をidentityにすると編集のたびにnodeが入れ替わり、line numberやheading textをidentityにすると文書の並べ替えや見出し修正がrenameとして誤検出される。
|
|
15
|
+
|
|
16
|
+
現行実装には複数のidentity / locator慣行がある。
|
|
17
|
+
|
|
18
|
+
- traceability-modelは`WI-\d+` directoryとdescription frontmatter `id` の一致、inception全体の重複を検証し、`legacy_id`を保持する。
|
|
19
|
+
- StoryIdは`HXX-XX` / `HF\d+-XX`、WorkItem frontmatter parserはmigration互換IDも読む。
|
|
20
|
+
- `ProjectRelativePath`はproject-relative POSIX pathを表し、absolute path、backslash、`..`を拒否する。
|
|
21
|
+
- matrixのTestReferenceは`filePath`, `testType`, optional `testName`, optional `binding`を持ち、dedup時にmissing bindingを`file`へ正規化する。
|
|
22
|
+
- `@work-item-id`はカンマ / 空白区切りの複数参照を表し、`@attestation`はcoverage_reportのStory scope参照をline locator付きで表すが、いずれもannotation occurrence自身のstable IDを持たない。
|
|
23
|
+
- integrity manifestはproject-relative pathをSHA-256へpinし、include / exclude globでtargetを宣言する。
|
|
24
|
+
|
|
25
|
+
ADR-031はproductをcanonical、inceptionをproposal / deltaとして別artifactに保ち、design document / source / generated artifact / external declarationのkindを分離すると決めた。本ADRはこの非同一性を保ったまま、node identity、fragment locator、migrationを決める。
|
|
26
|
+
|
|
27
|
+
## Decision
|
|
28
|
+
|
|
29
|
+
### 1. Versioned World Node ID schemaを採用する
|
|
30
|
+
|
|
31
|
+
全World IDは`pgw:v1:` prefixを持つ。ID schema versionはextractor / ruleset / snapshot schema versionとは独立に管理する。
|
|
32
|
+
|
|
33
|
+
可変componentはURI percent-encoded UTF-8を使う。pathはexisting `ProjectRelativePath`と同じlexical contractで正規化し、各segmentをencodeして`/`を保持する。case folding、Unicode normalization、symlink resolutionはidentity生成では行わない。
|
|
34
|
+
|
|
35
|
+
ID形式:
|
|
36
|
+
|
|
37
|
+
| node | ID |
|
|
38
|
+
|---|---|
|
|
39
|
+
| Artifact | `pgw:v1:artifact:<artifact-kind>:<corpus-role>:<path-key>` |
|
|
40
|
+
| SourceFile | `pgw:v1:source-file:<path-key>` |
|
|
41
|
+
| explicit Fragment | `pgw:v1:fragment:<corpus-role>:<declared-key>` |
|
|
42
|
+
| legacy whole-file Fragment | `pgw:v1:fragment:legacy:<artifact-kind>:<corpus-role>:<path-key>` |
|
|
43
|
+
| WorkItem | `pgw:v1:work-item:<WI-ID>` |
|
|
44
|
+
| TestReference | `pgw:v1:test-reference:<story-id>:<ac-id>:<binding>:<test-type>:<path-key>:name:<name-key>` |
|
|
45
|
+
| ExplicitClaim | `pgw:v1:explicit-claim:<declared-key>` |
|
|
46
|
+
| Constraint | `pgw:v1:constraint:<declared-key>` |
|
|
47
|
+
| Snapshot | `pgw:v1:snapshot:sha256:<64-lowercase-hex>` |
|
|
48
|
+
|
|
49
|
+
`DeclaredKey`は`[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*`とし、人が明示する。headingやpathから自動slug化しない。
|
|
50
|
+
|
|
51
|
+
Artifact kind / corpus roleはADR-031に従う。SourceFileはsource kind Artifactのspecializationであり、同じfileにgeneric Artifact nodeを二重生成しない。Snapshot hashの入力bytesはADR-033が決める。
|
|
52
|
+
|
|
53
|
+
### 2. File identityとFragment identityを分離する
|
|
54
|
+
|
|
55
|
+
Artifact / SourceFile IDはproject-relative pathをidentityに含む。rename / moveはold nodeのmissingとnew nodeのaddedとして観測し、同じdigestからrenameを推論しない。
|
|
56
|
+
|
|
57
|
+
explicit Fragment IDは`corpus-role + DeclaredKey`であり、artifact path、heading text、heading level、document order、line number、content digestを含まない。同じcorpus role内でmarker keyが維持されれば、file move、heading rename、level変更、並べ替え後も同じFragmentである。
|
|
58
|
+
|
|
59
|
+
Fragment locatorはartifact ID、marker / heading / start / end line、heading level、表示用heading textを持つ。locatorはsnapshotごとに変化でき、identityではない。
|
|
60
|
+
|
|
61
|
+
### 3. Markdown fragment markerを定義する
|
|
62
|
+
|
|
63
|
+
```markdown
|
|
64
|
+
<!-- @world-fragment-id world-model.ownership -->
|
|
65
|
+
## Ownership
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
- markerは対象ATX heading直前のcontiguous metadata preludeに置く。preludeは`@world-fragment-id` / `@world-reflects` / `@work-item-id`の単独HTML comment行だけで構成し、空行やproseを挟まない。headingはpreludeの直後に置く。
|
|
69
|
+
- fenced code / inline code / example comment内部は抽出しない。
|
|
70
|
+
- 一つのheadingにmarkerは1件。
|
|
71
|
+
- fragment rangeはheadingから次のmarker-bound heading直前、またはEOFまで。
|
|
72
|
+
- heading text / orderはlocatorでありidentityに使わない。
|
|
73
|
+
- 同じcorpus role内のduplicate keyはhard extraction diagnosticとし、winnerを選ばない。
|
|
74
|
+
|
|
75
|
+
markerより前のunmarked contentもArtifact全体として観測する。Fragmentがないことをcontent omissionにはしない。
|
|
76
|
+
|
|
77
|
+
### 4. Legacy whole-file fallbackを段階移行する
|
|
78
|
+
|
|
79
|
+
明示markerを持たないMarkdown Artifactには、Artifact tupleから導出したlegacy whole-file Fragmentを1件生成する。
|
|
80
|
+
|
|
81
|
+
移行state:
|
|
82
|
+
|
|
83
|
+
1. **whole-file** — markerなし。fallbackを互換targetとして観測する。
|
|
84
|
+
2. **mixed** — marker導入後、completion markerがない間はexplicit fragmentsとcompatibility fallbackを併存させる。新規declarationからfallbackへの参照は禁止する。
|
|
85
|
+
3. **explicit** — legacy inbound referenceが0であることをmigration gateで確認し、YAML frontmatterがあればその直後、なければ最初のheadingより前に`<!-- @world-fragment-migration complete -->`を追加する。次snapshotからfallbackを除外する。
|
|
86
|
+
|
|
87
|
+
whole-file constraintをone fragmentへ自動aliasしない。どの意味境界へ分割するかは機械では判断できないため、人が一つ以上のexplicit Fragment IDへretargetする。
|
|
88
|
+
|
|
89
|
+
completion markerがexplicit fragmentなしで宣言された場合、またはlegacy inbound referenceが残る場合はdiagnosticとする。fallback emissionはcorpus上のmarkerだけで決め、constraint declarationの有無に依存させない。
|
|
90
|
+
|
|
91
|
+
### 5. 既存owner IDとannotationをそのまま尊重する
|
|
92
|
+
|
|
93
|
+
- WorkItem nodeはtraceability-modelが解決したcanonical `WI-\d+`をpayloadにする。`legacy_id`はaliasであり別nodeを作らない。
|
|
94
|
+
- TestReference IDはmatrix ownerのtuple `(storyId, acId, binding ?? "file", testType, filePath, testName)`から作る。`generatedAt`、array index、line numberを含めない。
|
|
95
|
+
- `@work-item-id`はWorkItem provenance / reflection reference factへ一IDずつ展開する。
|
|
96
|
+
- `@attestation`はStory scope evidence reference factとして観測する。
|
|
97
|
+
- annotation line / occurrence ordinalからstable ExplicitClaim IDを生成しない。future ExplicitClaimはexternal declarationにrequired `claimId`を持つ。
|
|
98
|
+
- Constraintもrequired `constraintId`からidentityを作り、violation fingerprintとは分離する。
|
|
99
|
+
- integrity manifestのpath / glob / digestはtarget / claim payloadであり、node identityにはしない。
|
|
100
|
+
|
|
101
|
+
### 6. Rename / move / deleteを明示的に扱う
|
|
102
|
+
|
|
103
|
+
- path-based Artifact / SourceFile、matrix-derived TestReferenceのkey componentが変わればold missing + new added。
|
|
104
|
+
- explicit Fragmentは同じcorpus roleとDeclaredKeyを保つmove / heading変更ではidentityを維持する。
|
|
105
|
+
- productからinception、またはinceptionからproductへのrole変更は別identity。
|
|
106
|
+
- deleteされたnodeはcurrent snapshotから消え、参照endpointはmissingになる。
|
|
107
|
+
- content digest一致、類似heading、同じtest bodyからsuccessorを推論しない。
|
|
108
|
+
|
|
109
|
+
continuityが必要ならexplicit alias declarationを使う。
|
|
110
|
+
|
|
111
|
+
### 7. Aliasはidentityでなくsingle-hop resolution ruleとする
|
|
112
|
+
|
|
113
|
+
Alias declarationは`aliasId`, `canonicalId`, `reason`, `workItemId`を必須とする。正式file name / schemaはADR-037で決める。
|
|
114
|
+
|
|
115
|
+
- aliasは新nodeを作らず、reference resolutionをcanonical nodeへ導く。
|
|
116
|
+
- targetはcanonical IDでなければならず、alias chain / cycleを禁止する。
|
|
117
|
+
- 一つのaliasIdから複数targetを禁止する。
|
|
118
|
+
- resolutionは`resolved-via-alias` factを残し、renameを不可視化しない。
|
|
119
|
+
- Fragment aliasは同じcorpus role内だけ。product / inceptionをaliasで同一化しない。
|
|
120
|
+
- traceability-model `legacy_id`はprovider-owned aliasとして投影する。
|
|
121
|
+
- digest一致からaliasを自動生成しない。
|
|
122
|
+
|
|
123
|
+
### 8. Duplicate IDはno-winnerで扱う
|
|
124
|
+
|
|
125
|
+
WorkItem、Fragment、ExplicitClaim、Constraint、TestReferenceなど同一canonical IDが複数locatorへ解決した場合、extractorはどれかを採用せず`duplicate-node-id` diagnosticを返す。array orderやfilesystem列挙順でwinnerを選ばない。
|
|
126
|
+
|
|
127
|
+
duplicateを含むsnapshotはidentity-completeではない。どのlayerでblockingするかはvalidator-system所有であり、ADR-034以降で決める。
|
|
128
|
+
|
|
129
|
+
### 9. ProposalとcanonicalをWorkItem hubと明示relationで接続する
|
|
130
|
+
|
|
131
|
+
現行`@work-item-id`からartifact-level provenanceを作る。
|
|
132
|
+
|
|
133
|
+
```text
|
|
134
|
+
inception proposal Artifact ──proposed-by──> WorkItem
|
|
135
|
+
WorkItem ──reflected-in──> product canonical Artifact / Fragment
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
これは同じWIのprovenanceであり、fragment-to-fragment exact mappingではない。
|
|
139
|
+
|
|
140
|
+
exact mappingが必要なcanonical headingでは次を記述する。
|
|
141
|
+
|
|
142
|
+
```markdown
|
|
143
|
+
<!-- @world-fragment-id world-model.ownership -->
|
|
144
|
+
<!-- @world-reflects inception:world-model.ownership -->
|
|
145
|
+
<!-- @work-item-id WI-282 -->
|
|
146
|
+
## Ownership
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
`@world-reflects`はrepeatableで、targetは`<corpus-role>:<declared-key>`。v1 source roleは`inception`、current fragmentは`product`でなければならない。World edgeは`proposal --reflected-as--> canonical`方向に作る。
|
|
150
|
+
|
|
151
|
+
same key、heading、order、digestからreflectionを推論しない。target不在、role不正、duplicate targetはdiagnosticとする。
|
|
152
|
+
|
|
153
|
+
### 10. ADR-032 scopeの未決事項へ回答する
|
|
154
|
+
|
|
155
|
+
#### 明示fragment IDのMarkdown記法
|
|
156
|
+
|
|
157
|
+
`<!-- @world-fragment-id <DeclaredKey> -->`を採用し、ATX heading直前のcontiguous metadata preludeからbindする。HTML commentにすることでrendered proseを汚さず、既存`@work-item-id` / `@attestation`と同じ機械可読annotation慣行に合わせる。heading text / orderはidentityにしない。
|
|
158
|
+
|
|
159
|
+
#### legacy whole-fileからfragmentへのmigration
|
|
160
|
+
|
|
161
|
+
whole-file → mixed → explicitのratchetを採用する。marker導入時にfallbackを即削除せず、completion markerがない間はcompatibility nodeとして残す。新規fallback参照を禁止し、人がconstraint / pinを明示fragmentへretargetする。inbound reference 0を確認後に`<!-- @world-fragment-migration complete -->`を追加し、次snapshotでfallbackを除去する。一対一aliasや意味的自動分割は行わない。
|
|
162
|
+
|
|
163
|
+
## Consequences
|
|
164
|
+
|
|
165
|
+
### Positive
|
|
166
|
+
|
|
167
|
+
- prose編集やheading並べ替えでconstraint endpoint identityが不要に変わらない。
|
|
168
|
+
- path-based file eventとlogical fragment continuityを区別できる。
|
|
169
|
+
- product / inceptionのprovenanceを維持し、reflectionだけを明示factにできる。
|
|
170
|
+
- current annotationのlocatorをstable identityに偽装しない。
|
|
171
|
+
- legacy corpusを一括marker化せず段階導入できる。
|
|
172
|
+
|
|
173
|
+
### Negative / Trade-off
|
|
174
|
+
|
|
175
|
+
- marker keyのproject-wide管理とduplicate検出が必要になる。
|
|
176
|
+
- path-based Artifact / SourceFileはrename時にidentityが変わり、continuityにはalias declarationが必要。
|
|
177
|
+
- mixed migration中はexplicit fragmentとcompatibility whole-file fragmentが併存する。
|
|
178
|
+
- existing annotationだけではfragment-level exact reflectionやstable ExplicitClaimを表せない。
|
|
179
|
+
|
|
180
|
+
## Alternatives
|
|
181
|
+
|
|
182
|
+
- **content digestをnode IDにする** — 内容変更がdelete + addになりstalenessを追えないため不採用。
|
|
183
|
+
- **heading text / heading pathをFragment IDにする** — rename / reorderでidentityが変わり、同名headingも衝突するため不採用。
|
|
184
|
+
- **line number / occurrence ordinalをannotation claim IDにする** — 無関係な行挿入でidentityが変わるため不採用。
|
|
185
|
+
- **same key / digestでproposalとcanonicalを自動接続する** — ADR-031のcorpus role分離と「意味的伝播を機械で主張しない」原則に反するため不採用。
|
|
186
|
+
- **marker導入時にlegacy fallbackを即削除する** — existing constraint endpointを一斉にmissingへするため不採用。
|
|
187
|
+
- **whole-file fallbackを一つのfragmentへ自動aliasする** — one-to-manyの意味分割を機械が決めることになるため不採用。
|
|
188
|
+
|
|
189
|
+
## 関連要件・文書
|
|
190
|
+
|
|
191
|
+
- `docs/inception/_cross/WI-280/delivery_plan.md` §1, §3 WM-02, §7 ADR-032, §10
|
|
192
|
+
- `docs/inception/_cross/WI-281/logical_design.md`
|
|
193
|
+
- `docs/inception/_cross/WI-282/description.md`
|
|
194
|
+
- `docs/inception/_cross/WI-282/domain_model.md`
|
|
195
|
+
- `docs/inception/_cross/WI-282/logical_design.md`
|
|
196
|
+
- ADR-027(成果物駆動の状態導出)
|
|
197
|
+
- ADR-030(明示参照と再導出)
|
|
198
|
+
- ADR-031(ownership、artifact kind、product / inception corpus role)
|