phasegate 0.229.0 → 0.264.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 +73 -1
- package/README.ja.md +31 -1
- package/README.md +30 -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/attestation-v2.schema.json +110 -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 +45 -0
- package/docs/guide/configuration.md +56 -0
- package/docs/templates/ci/aidlc-gate.yml +42 -2
- package/package.json +1 -1
- package/scripts/harness/agent-integration/application/dto/open-world-obligations-context-dto.ts +30 -0
- package/scripts/harness/agent-integration/application/ports/world-obligations-query-port.ts +30 -0
- package/scripts/harness/agent-integration/application/usecases/get-open-world-obligations-context-usecase.ts +66 -0
- package/scripts/harness/agent-integration/infrastructure/adapters/world-model-open-obligations-query-adapter.ts +58 -0
- package/scripts/harness/agent-integration/presentation/session-start-hook.ts +37 -1
- package/scripts/harness/agent-integration/presentation/world-obligations-session-context.ts +60 -0
- package/scripts/harness/attestation/application/dto/attestation-document.ts +17 -4
- package/scripts/harness/attestation/application/mappers/attestation-record-mapper.ts +55 -4
- package/scripts/harness/attestation/application/ports/sha256-capability.ts +25 -0
- package/scripts/harness/attestation/application/ports/world-snapshot-root-provider.ts +10 -0
- package/scripts/harness/attestation/application/usecases/produce-attestation-usecase.ts +33 -7
- package/scripts/harness/attestation/composition-root.ts +19 -4
- package/scripts/harness/attestation/domain/entities/attestation-record.ts +37 -2
- package/scripts/harness/attestation/index.ts +13 -2
- 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/attestation/presentation/handlers/attest-handler.ts +5 -2
- package/scripts/harness/config-foundation/application/mappers/validator-system-config-mapper.ts +35 -8
- package/scripts/harness/config-foundation/application/mappers/world-model-config-mapper.ts +15 -0
- package/scripts/harness/config-foundation/domain/harness-config.ts +67 -87
- package/scripts/harness/config-foundation/domain/services/preset-resolution-service.ts +77 -88
- package/scripts/harness/config-foundation/domain/value-objects/world-config.ts +198 -0
- package/scripts/harness/config-foundation/index.ts +14 -15
- package/scripts/harness/config-foundation/infrastructure/presets/minimal.json +24 -0
- package/scripts/harness/config-foundation/infrastructure/presets/standard.json +24 -0
- package/scripts/harness/config-foundation/infrastructure/presets/strict.json +24 -0
- package/scripts/harness/config-foundation/infrastructure/schemas/harness-config-v2.schema.json +83 -0
- package/scripts/harness/config-foundation/infrastructure/schemas/harness-config-v3.schema.json +83 -0
- package/scripts/harness/harness-api/domain/value-objects/ci-check-result.ts +18 -4
- package/scripts/harness/harness-api/domain/value-objects/known-harness-commands.ts +4 -1
- package/scripts/harness/integrations/pre-commit.ts +169 -27
- package/scripts/harness/main.ts +276 -126
- 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/changed-design-fragment-dto.ts +31 -0
- package/scripts/harness/traceability-model/application/dto/traceability-world-read-dto.ts +67 -0
- package/scripts/harness/traceability-model/application/facades/design-change-read-facade.ts +14 -0
- package/scripts/harness/traceability-model/application/facades/traceability-world-read-facade.ts +372 -0
- package/scripts/harness/traceability-model/application/ports/staged-design-change-source-port.ts +9 -0
- package/scripts/harness/traceability-model/application/ports/traceability-world-read-source-port.ts +61 -0
- package/scripts/harness/traceability-model/composition-root.ts +26 -5
- package/scripts/harness/traceability-model/index.ts +26 -6
- package/scripts/harness/traceability-model/infrastructure/adapters/file-system-traceability-world-read-adapter.ts +223 -0
- package/scripts/harness/traceability-model/infrastructure/adapters/git-staged-design-change-adapter.ts +155 -0
- package/scripts/harness/traceability-model/infrastructure/parsers/story-catalog-parser.ts +86 -8
- package/scripts/harness/validator-system/application/use-cases/run-l2-validators-usecase.ts +31 -0
- package/scripts/harness/validator-system/application/use-cases/run-l3-validators-usecase.ts +34 -0
- package/scripts/harness/validator-system/composition-root.ts +21 -6
- package/scripts/harness/validator-system/domain/ports/world-constraint-admission-policy-port.ts +28 -0
- package/scripts/harness/validator-system/domain/ports/world-constraint-rederivation-policy-port.ts +11 -0
- package/scripts/harness/validator-system/domain/services/design-change-declaration-policy.ts +75 -0
- package/scripts/harness/validator-system/domain/services/world-constraint-admission-service.ts +78 -0
- package/scripts/harness/validator-system/domain/services/world-constraint-rederivation-service.ts +76 -0
- package/scripts/harness/validator-system/domain/value-objects/validator-id.ts +4 -0
- package/scripts/harness/validator-system/infrastructure/adapters/harness-config-validator-config-adapter.ts +38 -16
- package/scripts/harness/validator-system/infrastructure/adapters/world-model-constraint-admission-adapter.ts +56 -0
- package/scripts/harness/validator-system/infrastructure/adapters/world-model-constraint-rederivation-adapter.ts +56 -0
- package/scripts/harness/world-model/application/dto/pinned-design-endpoint-dto.ts +19 -0
- 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 +127 -0
- package/scripts/harness/world-model/application/dto/world-snapshot-root-dto.ts +8 -0
- package/scripts/harness/world-model/application/facades/pinned-design-endpoint-facade.ts +63 -0
- package/scripts/harness/world-model/application/facades/world-snapshot-root-facade.ts +19 -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 +146 -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 +247 -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 +33 -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 +323 -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 +332 -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 +109 -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
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
---
|
|
2
|
+
adr_id: "034"
|
|
3
|
+
title: "World constraint semantics と endpoint-symmetric evaluation"
|
|
4
|
+
status: Proposed
|
|
5
|
+
date: 2026-07-16
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# World constraint semantics と endpoint-symmetric evaluation
|
|
9
|
+
|
|
10
|
+
<!-- @work-item-id WI-284 -->
|
|
11
|
+
|
|
12
|
+
## Context
|
|
13
|
+
|
|
14
|
+
World Modelは、canonical snapshot上の明示関係とcontent pinから構造違反を再現可能に導出する必要がある。その際、`claimant depends-on premise`のようなfactには意味方向がある一方、claimantだけでなくpremiseの変更でも同じconstraintを再評価しなければ、前提側のdriftを見落とす。
|
|
15
|
+
|
|
16
|
+
既存`GateGraph`は`dependsOn`を有向辺としてduplicate / unknown dependency / level order / cycleを検査する。L4-001 `DriftDetectionService`はdesign / codeの集合差分を`design→code` / `code→design`として報告し、`SemanticDriftService`は明示`behaviorId`を用いてdesign / code / testを比較する。これらは明示構造の検査という先例だが、stable World node ID、両endpoint digest pin、snapshot identityを持つWorld constraintではない。
|
|
17
|
+
|
|
18
|
+
ADR-031はworld-modelが事実組立とconstraint evaluation、validator-systemがgate / blocking policyを所有すると決定した。ADR-032は`pgw:v1` ID、DeclaredKey、no-winner duplicate、single-hop explicit aliasを決定した。ADR-033はleaf digestと`corpusRoot` / `constraintRoot` / `evaluationId`を分離し、pinned endpoint digestをconstraintRootへ含めると決定した。本ADRはそれらを前提に、v1 constraint semanticsと構造ruleの限界を固定する。
|
|
19
|
+
|
|
20
|
+
## Decision
|
|
21
|
+
|
|
22
|
+
### 1. Typed directed factとendpoint-symmetric evaluationを分離する
|
|
23
|
+
|
|
24
|
+
明示relationは次の順序を持つ。
|
|
25
|
+
|
|
26
|
+
```text
|
|
27
|
+
claimant --factType--> premise
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
- `claimant`は宣言を行い、その整合を主張する側である。
|
|
31
|
+
- `premise`はclaimantの主張が参照する前提側である。
|
|
32
|
+
- v1のconstraint fact typeはexplicit `references`、`depends-on`、`refines`、`content-equals`に限定する。
|
|
33
|
+
- factのreverse edgeを生成せず、fact directionから逆向きの意味を推論しない。
|
|
34
|
+
- `content-equals`のpredicateが数学的に対称でも、claimant / premise orderはdeclaration provenanceとして保持する。
|
|
35
|
+
|
|
36
|
+
evaluationはendpoint-symmetricとする。claimantまたはpremiseのどちらかがchanged candidateになれば同じConstraintを再評価し、両endpointをcurrent snapshotから解決して全applicable ruleを評価する。この対称性は再評価trigger / coverageの性質であり、fact directionを対称化するものではない。
|
|
37
|
+
|
|
38
|
+
incremental schedulingは許可するが、そのserialized evaluation resultは全Constraintを再評価した結果と一致しなければならない。
|
|
39
|
+
|
|
40
|
+
### 2. ConstraintRecordは両endpointをNodePinとして固定する
|
|
41
|
+
|
|
42
|
+
v1 `ConstraintRecord`は次を必須とする。
|
|
43
|
+
|
|
44
|
+
```text
|
|
45
|
+
ConstraintRecord {
|
|
46
|
+
constraintId: pgw:v1:constraint:<DeclaredKey>
|
|
47
|
+
schemaVersion
|
|
48
|
+
factType
|
|
49
|
+
claimant: {
|
|
50
|
+
nodeId: pgw:v1:<node-type>:...
|
|
51
|
+
contentDigest: sha256:<64 lowercase hex>
|
|
52
|
+
}
|
|
53
|
+
premise: {
|
|
54
|
+
nodeId: pgw:v1:<node-type>:...
|
|
55
|
+
contentDigest: sha256:<64 lowercase hex>
|
|
56
|
+
}
|
|
57
|
+
applicableRuleIds: sorted non-empty WCR ID set
|
|
58
|
+
declarationArtifactId
|
|
59
|
+
declarationLocator
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
- `constraintId`はADR-032のDeclaredKey規則に従う。
|
|
64
|
+
- 両NodePinはdeclaration採用時に一意に存在するnodeから作る。missing / duplicate endpointから新規pinを作らない。
|
|
65
|
+
- content digestはADR-033のowner-aware normalization後のleaf digestである。
|
|
66
|
+
- pinは期待値であり、evaluation時にcurrent digestへ自動更新しない。
|
|
67
|
+
- alias解決後のnode ID / locatorはevaluation evidenceへ記録し、ConstraintRecordをmutationしない。
|
|
68
|
+
- `applicableRuleIds`はcanonical ID順にsortする。
|
|
69
|
+
|
|
70
|
+
canonicalized ConstraintRecordとdeclaration diagnosticsはADR-033の`constraintRoot`へ入る。current corpus facts、finding、obligation、last-evaluated time、repayment / blocking stateはConstraintRecordへ入れない。
|
|
71
|
+
|
|
72
|
+
corpus-wide ID uniquenessは明示Constraintがなくても常時評価するimplicit structural invariantである。ADR-032の`duplicate-node-id` extraction diagnosticをwinnerなしで受け取り、後述`WCR-005` violationへ投影する。duplicate candidateを偽の別IDへ書き換えてNodePinにしない。
|
|
73
|
+
|
|
74
|
+
### 3. 機械ruleを5種類の構造判定に限定する
|
|
75
|
+
|
|
76
|
+
v1の機械判定categoryは次だけとする。
|
|
77
|
+
|
|
78
|
+
1. **existence** — endpointが一意に存在するか、baselineから削除されたか、明示alias targetが存在するか。
|
|
79
|
+
2. **ID uniqueness** — canonical IDが一つのcandidateだけへ解決するか。
|
|
80
|
+
3. **explicit reference** — 宣言されたstable ID reference / relationが解決するか。
|
|
81
|
+
4. **declared dependency** — 明示された`depends-on` relationとendpointが解決するか。
|
|
82
|
+
5. **digest equality** — 各current endpoint digestがrecorded pinと一致するか。明示`content-equals`では両current digestも一致するか。
|
|
83
|
+
|
|
84
|
+
prose similarity、heading similarity、naming convention、co-change、timestamp、LLM classification、暗黙のdomain knowledgeから新しいfactやviolationを生成しない。意味的妥当性、因果、改善度を機械ruleに含めない。
|
|
85
|
+
|
|
86
|
+
malformed declarationのschema / type admissionは、これらのruleを安全に適用する前段の構造検査である。malformed inputを部分的なConstraintRecordとして評価へ流さない。
|
|
87
|
+
|
|
88
|
+
### 4. World constraint rule IDを`WCR-NNN`で固定する
|
|
89
|
+
|
|
90
|
+
v1 rulesetのstable IDを次のとおり定義する。
|
|
91
|
+
|
|
92
|
+
| rule ID | name | category / decision |
|
|
93
|
+
|---|---|---|
|
|
94
|
+
| `WCR-001` | `declaration-well-formed` | required field、ID、digest、fact type、rule IDがmalformed / unsupported |
|
|
95
|
+
| `WCR-002` | `endpoint-exists` | current snapshotにendpointがなく、baselineにも同一IDの存在証拠がない |
|
|
96
|
+
| `WCR-003` | `endpoint-not-deleted` | baselineにはexact endpointが存在し、currentではmissing、かつvalid explicit aliasがない |
|
|
97
|
+
| `WCR-004` | `explicit-rename-resolves` | rename continuityを主張するexplicit aliasがsingle-hop / target / role / uniqueness条件を満たさない |
|
|
98
|
+
| `WCR-005` | `node-id-unique` | 一つのcanonical node IDが複数locator / candidateへ解決する |
|
|
99
|
+
| `WCR-006` | `explicit-reference-resolves` | explicit reference / `refines` targetまたは宣言relationが解決しない |
|
|
100
|
+
| `WCR-007` | `declared-dependency-resolves` | explicit `depends-on` endpointまたは依存relationが解決しない |
|
|
101
|
+
| `WCR-008` | `endpoint-digest-equals` | claimant / premise current digestがpinと不一致、またはexplicit `content-equals`の両current digestが不一致 |
|
|
102
|
+
|
|
103
|
+
`WCR-001`はdeclaration admission、`WCR-002`〜`WCR-004`はexistence / explicit resolution familyであり、§3の5 category外の意味推論を追加しない。
|
|
104
|
+
|
|
105
|
+
rule ID namespaceは次を混同しない。
|
|
106
|
+
|
|
107
|
+
- ADR-032 extraction diagnostics: `duplicate-node-id`, `invalid-node-id`, `missing-reflection-target`等のlowercase code
|
|
108
|
+
- World constraint evaluation rules: `WCR-NNN`
|
|
109
|
+
- validator-system validator IDs: registryに登録された`Lx-NNN`
|
|
110
|
+
|
|
111
|
+
extraction diagnosticはcorpus / declarationをlosslessly説明し、WCR violationはconstraint evaluation結果を説明する。同一のduplicate事象が両方へ現れても、互換aliasにはせず、evaluation evidenceでsource diagnosticを参照する。
|
|
112
|
+
|
|
113
|
+
### 5. Missing、deletion、renameを推論せず区別する
|
|
114
|
+
|
|
115
|
+
一つのendpointのresolutionは次のprecedenceを持つ。
|
|
116
|
+
|
|
117
|
+
1. declarationがmalformedなら`WCR-001`。ConstraintRecordを作らない。
|
|
118
|
+
2. exact IDまたはalias targetがduplicateなら`WCR-005`。winnerを選ばない。
|
|
119
|
+
3. exact IDがcurrent snapshotに一意に存在すればresolved。
|
|
120
|
+
4. exact IDがなくexplicit aliasがあれば`WCR-004`で検証する。validならcanonical targetへsingle-hop解決し、`resolved-via-alias` evidenceを残す。
|
|
121
|
+
5. exact IDがbaseline snapshotに存在したなら`WCR-003` deletion。
|
|
122
|
+
6. それ以外は`WCR-002` missing endpoint。
|
|
123
|
+
|
|
124
|
+
同じendpointへ`WCR-002`と`WCR-003`を同時に出さない。unresolved endpointへdigest mismatchを追加しない。
|
|
125
|
+
|
|
126
|
+
path-based Artifact / SourceFile renameはADR-032どおりold missing + new addedであり、digest一致してもrenameとは呼ばない。explicit aliasがvalidな場合だけrename continuityを認める。explicit Fragmentは同一corpus role / DeclaredKeyを維持するfile moveやheading renameでidentityが変わらないため、rename ruleではなく同一nodeのlocator / digest changeとして扱う。
|
|
127
|
+
|
|
128
|
+
### 6. `refines`は明示stable ID declarationだけを事実化する
|
|
129
|
+
|
|
130
|
+
`refines` factはdeclarationがclaimant / premise両方のstable World node IDを明示し、両endpointが一意に解決した場合だけ生成する。
|
|
131
|
+
|
|
132
|
+
- same DeclaredKey、heading text / level / order、path、WorkItem、content digest、prose similarityから推論しない。
|
|
133
|
+
- ADR-032の`@world-reflects`が作る`proposal --reflected-as--> canonical`を自動的に`refines`へ変換しない。
|
|
134
|
+
- target不在 / relation不在は`WCR-006`、構文 / node type不正は`WCR-001`。
|
|
135
|
+
- 「より詳細になった」「置換した」「意味を保った」という判定は行わない。
|
|
136
|
+
|
|
137
|
+
product canonicalとinception proposalはADR-031どおり別artifact / corpus roleのままであり、`refines`やdigest equalityによってdeduplicateしない。
|
|
138
|
+
|
|
139
|
+
### 7. Change provenanceをsnapshot差とchanged candidatesで表す
|
|
140
|
+
|
|
141
|
+
evaluation evidenceは次の非因果的`ChangeProvenance`を持てる。
|
|
142
|
+
|
|
143
|
+
```text
|
|
144
|
+
ChangeProvenance {
|
|
145
|
+
baselineSnapshotId: pgw:v1:snapshot:... | null
|
|
146
|
+
baselineCorpusRoot: sha256:... | null
|
|
147
|
+
currentSnapshotId: pgw:v1:snapshot:...
|
|
148
|
+
currentCorpusRoot: sha256:...
|
|
149
|
+
changedCandidates: [{
|
|
150
|
+
nodeId
|
|
151
|
+
changeKind: added | removed | modified | candidate-cardinality-changed
|
|
152
|
+
baselineDigest?
|
|
153
|
+
currentDigest?
|
|
154
|
+
baselineLocators[]
|
|
155
|
+
currentLocators[]
|
|
156
|
+
}]
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
- baseline / currentはADR-033のSnapshot ID / `corpusRoot`を参照する。
|
|
161
|
+
- initial evaluationはbaselineを`null`にできる。
|
|
162
|
+
- changed candidatesはNode ID、change kind、locatorのcanonical tupleでsortする。
|
|
163
|
+
- candidateは再評価対象を説明するevidenceであり、「candidate Aがfinding Bを引き起こした」という因果ではない。
|
|
164
|
+
- path-based renameはold `removed` + new `added`。valid explicit aliasがある場合だけrename continuityを別evidenceとして表示する。
|
|
165
|
+
- digest一致、類似heading、近接commit / timestampからsuccessorやcauseを推論しない。
|
|
166
|
+
|
|
167
|
+
baseline snapshotは比較対象のWorld snapshotであり、ADR-035が定義するadoption baselineとは別物である。前者はchange evidence、後者は既知violation fingerprintのpolicy inputである。
|
|
168
|
+
|
|
169
|
+
### 8. Evaluation outputはpolicyを持たない
|
|
170
|
+
|
|
171
|
+
world-modelのevaluation DTOは最低限、`evaluationId`、`constraintId`、`ruleId`、claimant / premiseのdeclared pinとcurrent resolution evidence、source diagnostic、ChangeProvenanceを返す。
|
|
172
|
+
|
|
173
|
+
severity、blocking、exit code、waived / adopted classificationをconstraint evaluatorへ入れない。validator-system adapterがWorld evaluation DTOをvalidation resultへ変換し、ADR-031のownershipどおりpolicyを適用する。obligation / fingerprint / adoption / waiverはADR-035で決める。
|
|
174
|
+
|
|
175
|
+
### 9. §10のvalidator ID未決事項はADR-037へ委譲する
|
|
176
|
+
|
|
177
|
+
`docs/inception/_cross/WI-280/delivery_plan.md` §10の「world-modelのconfig keyとvalidator ID」はADR-037で決定する。config discovery、CLI、validator registry、layer、default enablement、output / exit codeを一緒に決める必要があるためである。
|
|
178
|
+
|
|
179
|
+
本ADRが決定するのはWorld内部rulesetの`WCR-NNN`だけであり、`L2-NNN` / `L3-NNN`を先取りしない。validator-systemの現行`ValidatorId`はregistryに列挙されたIDだけを受理するため、実装時の新validator ID追加はADR-037の決定と対応する正式WIで行う。
|
|
180
|
+
|
|
181
|
+
## Consequences
|
|
182
|
+
|
|
183
|
+
### Positive
|
|
184
|
+
|
|
185
|
+
- fact directionを失わず、claimant / premiseどちらのdriftも検出できる。
|
|
186
|
+
- 両endpoint pinにより、前提側だけの編集も同じconstraintで再現可能に評価できる。
|
|
187
|
+
- missing、deletion、explicit rename failure、duplicate、digest driftをstable rule IDで区別できる。
|
|
188
|
+
- `refines`やrenameを意味推論せず、明示宣言の範囲だけを機械保証できる。
|
|
189
|
+
- snapshot comparisonとadoption baselineを別概念に保てる。
|
|
190
|
+
- World rule、extraction diagnostic、layer validatorのID衝突を避けられる。
|
|
191
|
+
|
|
192
|
+
### Negative / Trade-off
|
|
193
|
+
|
|
194
|
+
- declaration採用時に両endpointのID / digestを明示pinする作業が必要になる。
|
|
195
|
+
- endpointの正当な変更でもpin更新reviewが必要になる。
|
|
196
|
+
- aliasなしのfile renameは意図したrenameでもold removed + new addedとして見える。
|
|
197
|
+
- prose上明白なrefinementやcausal relationを自動認定しないため、人による明示宣言が必要になる。
|
|
198
|
+
- baselineなしのinitial evaluationではmissingとdeletionを区別できず、missingとして扱う。
|
|
199
|
+
|
|
200
|
+
## Alternatives
|
|
201
|
+
|
|
202
|
+
- **fact edge自体を双方向化する** — dependency / referenceの意味方向を失い、reverse relationを誤って主張するため不採用。
|
|
203
|
+
- **claimantだけをpinする** — premise側変更を見落とし、endpoint-symmetric evaluationにならないため不採用。
|
|
204
|
+
- **content digestをnode identityにする** —編集ごとにendpoint identityが変わり、ADR-032と矛盾するため不採用。
|
|
205
|
+
- **digest / heading similarityからrenameやrefinesを推論する** —意味的continuityを機械が過剰主張し、曖昧candidateのwinner選択を生むため不採用。
|
|
206
|
+
- **既存`Lx-NNN`をWorld rule IDに流用する** —validator単位と個別constraint ruleを混同し、validator-system ownershipを侵すため不採用。
|
|
207
|
+
- **ci-governanceのSHA-1 path baselineをWorld adoption baselineに流用する** —artifact lifecycle、identity、hash algorithm、policy purposeが異なるため不採用。
|
|
208
|
+
|
|
209
|
+
## 関連要件・文書
|
|
210
|
+
|
|
211
|
+
- `docs/inception/_cross/WI-280/delivery_plan.md` §1, §3 WM-04, §7 ADR-034, §10
|
|
212
|
+
- `docs/inception/_cross/WI-284/description.md`
|
|
213
|
+
- `docs/inception/_cross/WI-284/logical_design.md`
|
|
214
|
+
- ADR-031(World ownership / corpus lifecycle)
|
|
215
|
+
- ADR-032(World node identity / alias / reflection)
|
|
216
|
+
- ADR-033(canonical snapshot / constraintRoot / evaluationId)
|
|
217
|
+
- ADR-005(ヘキサゴナルアーキテクチャ)
|
|
218
|
+
- ADR-027(成果物駆動状態導出)
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
---
|
|
2
|
+
adr_id: "035"
|
|
3
|
+
title: "World adoption baseline、obligation、waiver"
|
|
4
|
+
status: Proposed
|
|
5
|
+
date: 2026-07-16
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# World adoption baseline、obligation、waiver
|
|
9
|
+
|
|
10
|
+
<!-- @work-item-id WI-284 -->
|
|
11
|
+
|
|
12
|
+
## Context
|
|
13
|
+
|
|
14
|
+
World Modelは、current corpusとconstraint declarationsから構造violationを毎回再導出する。一方、導入時点のrepositoryには既存violationがあり得るため、全件を即時blockingにするとWorld Model自体を導入できない。既存violationだけを可視 debtとしてadoptし、新規claim / pinと壊れたdeclarationは初日から検査するratchetが必要である。
|
|
15
|
+
|
|
16
|
+
既存PhaseGateにも`.phasegate/baseline.json`がある。実装を確認すると、ci-governance `CreateBaselineUseCase`が対象pathを列挙してSHA-1を保存し、agent-integration `CiGovernanceBaselineGrandfatherAdapter`が現在fileのSHA-1と一致するpathだけをphase-gate / full-mode / story-reflection hookでgrandfatherする。schemaは`version: "1.0"`, `createdAt`, `algorithm: "sha1"`, `files[{path, sha1}]`であり、World node、WCR rule、violation fingerprint、evaluation identityを持たない。
|
|
17
|
+
|
|
18
|
+
coverage attestationには別のlegacy patternがある。`<!-- @coverage-gating: ungated-legacy -->`を持つcoverage reportをL2-016がwarningとして可視化し、markerのない新規bare claimはfail-closedにする。ただしmarkerはfile全体のowner-specific exemptionであり、stable semantic debt IDではない。
|
|
19
|
+
|
|
20
|
+
ADR-031はadoption baseline、waiver、explicit debt declarationを、人がreviewして採用する`external-declaration`とした。ADR-033は`evaluationId`へ`policyInputsDigest`を含め、obligation reportとmutable repayment stateをrootから除外した。ADR-034はpolicy-free evaluation DTO、`WCR-NNN`、ChangeProvenanceを決定した。本ADRはこれらを接続し、structural obligationの同一性、adoption、waiver、返済、semantic debt importを決定する。
|
|
21
|
+
|
|
22
|
+
## Decision
|
|
23
|
+
|
|
24
|
+
### 1. Constraint、violation、obligationのidentityを分離する
|
|
25
|
+
|
|
26
|
+
- `constraintId`は`pgw:v1:constraint:<DeclaredKey>`であり、人が宣言したConstraintRecordの同一性を表す。
|
|
27
|
+
- `violationFingerprint`は特定rulesetが特定の構造不一致を観測した同一性を表す。同じconstraintから複数fingerprintが生じ得る。
|
|
28
|
+
- obligationはcurrent evaluation findingから導出する作業項目であり、保存されたEntity identityを持たない。structural obligationの照合keyは`violationFingerprint`である。
|
|
29
|
+
- `evaluationId`はcorpus / constraint / policy inputを含む一回の導出入力identityであり、violation identityではない。
|
|
30
|
+
|
|
31
|
+
constraintを修正せずpin、observed digest、endpoint cardinality、rule semanticsのいずれかが変われば、同じ`constraintId`でもfingerprintは変わり得る。逆にmessage、locator、表示順だけの変更ではfingerprintを変えない。
|
|
32
|
+
|
|
33
|
+
### 2. `violationFingerprint`をsemantic evidenceから構成する
|
|
34
|
+
|
|
35
|
+
外部形式を次とする。
|
|
36
|
+
|
|
37
|
+
```text
|
|
38
|
+
pgw:v1:violation-fingerprint:sha256:<64 lowercase hex>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
hexは次のcanonical JSONをADR-033のSHA-256 capabilityでhashした値である。
|
|
42
|
+
|
|
43
|
+
```text
|
|
44
|
+
{
|
|
45
|
+
schemaVersion: "phasegate-world-violation-fingerprint/v1",
|
|
46
|
+
rulesetVersion,
|
|
47
|
+
ruleId,
|
|
48
|
+
constraintId: string | null,
|
|
49
|
+
factType: string | null,
|
|
50
|
+
subject: {
|
|
51
|
+
endpointRole: "claimant" | "premise" | "both" | "declaration" | "global",
|
|
52
|
+
nodeIds: sorted stable World node IDs
|
|
53
|
+
},
|
|
54
|
+
claimantPin: { nodeId, contentDigest } | null,
|
|
55
|
+
premisePin: { nodeId, contentDigest } | null,
|
|
56
|
+
expected: rule-owned canonical evidence,
|
|
57
|
+
observed: rule-owned canonical evidence
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
各`WCR-NNN`は`expected` / `observed`のversioned projectionをruleset contractとして定義する。
|
|
62
|
+
|
|
63
|
+
- missing / deletionは対象endpoint ID、role、pinを含み、current contentがなければ`observed`を明示missing valueにする。
|
|
64
|
+
- invalid aliasはalias ID、declared target、resolution defectを含む。
|
|
65
|
+
- duplicate IDはcanonical node ID、candidate cardinality、sorted candidate content-digest multisetを含み、locatorは含めない。
|
|
66
|
+
- reference / dependencyはfact typeと両endpointのdeclared tupleを含む。
|
|
67
|
+
- digest mismatchはexpected pinとobserved current digestを含む。endpointがさらに編集されればnew fingerprintになる。
|
|
68
|
+
- malformed declarationはparse可能なdeclaration identity、field / diagnostic code、invalid value digestを含め得るが、後述のとおりadoption / waiver対象にはしない。
|
|
69
|
+
|
|
70
|
+
fingerprintへ含めないもの:
|
|
71
|
+
|
|
72
|
+
- `evaluationId`, `corpusRoot`, `constraintRoot`, `policyInputsDigest`
|
|
73
|
+
- baseline / waiver / blocking / severity / adopted / repaid status
|
|
74
|
+
- human message、suggestion、array index
|
|
75
|
+
- PathKey、line、column、heading text等のlocator
|
|
76
|
+
- ChangeProvenanceのbaseline/current Snapshot ID、changed candidate reason
|
|
77
|
+
- `generatedAt`、clock、git commit、package version
|
|
78
|
+
|
|
79
|
+
`rulesetVersion`を含めるため、異なるrulesetのfingerprintを同一violationとして自動比較しない。
|
|
80
|
+
|
|
81
|
+
### 3. Obligation reportをimmutable derived outputとする
|
|
82
|
+
|
|
83
|
+
obligation reportは次の入力だけから毎回導出する。
|
|
84
|
+
|
|
85
|
+
```text
|
|
86
|
+
World evaluation DTO
|
|
87
|
+
+ adoption baseline declaration
|
|
88
|
+
+ waiver declarations
|
|
89
|
+
+ explicit semantic debt declarations
|
|
90
|
+
+ resolved policy effective date
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
reportは最低限、`schemaVersion`, `evaluationId`, `rulesetVersion`, `policyInputsDigest`と次の別collectionを持つ。
|
|
94
|
+
|
|
95
|
+
1. `structuralObligations` — current WCR findings。fingerprint、rule ID、constraint ID、endpoint evidence、policy classificationを持つ。
|
|
96
|
+
2. `repaidBaselineEntries` — baselineにはあるがcurrent findingsにないfingerprint。
|
|
97
|
+
3. `declaredSemanticDebts` — external declarationからimportした既知の意味的負債。
|
|
98
|
+
4. `policyDiagnostics` — invalid / expired waiver、ruleset mismatch、stale baseline等。
|
|
99
|
+
|
|
100
|
+
全collectionはstable ID / fingerprintでsortし、summary countはcollectionから導出する。reportに`generatedAt`を入れず、同じ入力からbyte-identicalにserializeする。
|
|
101
|
+
|
|
102
|
+
persistしたreportはADR-031の`generated-artifact`であり、source / control inputではない。
|
|
103
|
+
|
|
104
|
+
- 手編集しても次のderiveで上書きされ、gate結果を変えない。
|
|
105
|
+
- L3は保存reportを信頼せず、clean corpusとexternal declarationsから再導出する。
|
|
106
|
+
- report自身をWorld ingestion / fingerprint / policy inputへ含めない。
|
|
107
|
+
- report path、Git tracking、human / JSON formatterはADR-037で決定する。
|
|
108
|
+
|
|
109
|
+
### 4. `repaid`をcurrent set differenceとして導出する
|
|
110
|
+
|
|
111
|
+
同一rulesetのvalid baseline fingerprint集合を`B`、current structural violation fingerprint集合を`V`とする。
|
|
112
|
+
|
|
113
|
+
```text
|
|
114
|
+
adopted = B ∩ V
|
|
115
|
+
repaid = B − V
|
|
116
|
+
new = V − B
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
`repaid`はreport上のderived classificationであり、baseline entryへ`repaid`, `repaidAt`, `status`, `remaining`を保存しない。current evaluationが変われば毎回再計算する。
|
|
120
|
+
|
|
121
|
+
`repaid` entryは同じ変更でbaselineから削除し、再deriveする。stale entryを残すと同じfingerprintの再発を再びlegacy扱いできるため、validator-systemは`repaidBaselineEntries`をbaseline cleanup requiredとしてblockingする。削除後の再deriveではentry自体がなくなり、返済履歴はbaselineのGit diffとWork-Item trailerに残る。
|
|
122
|
+
|
|
123
|
+
### 5. Adoption baselineをclosed、monotonic-shrink declarationとする
|
|
124
|
+
|
|
125
|
+
adoption baselineはversioned external declarationであり、少なくとも次を持つ。正式file nameはADR-037へ委譲する。
|
|
126
|
+
|
|
127
|
+
```text
|
|
128
|
+
AdoptionBaseline {
|
|
129
|
+
schemaVersion
|
|
130
|
+
rulesetVersion
|
|
131
|
+
sourceEvaluationId
|
|
132
|
+
sourceCorpusRoot
|
|
133
|
+
sourceConstraintRoot
|
|
134
|
+
adoptedByWorkItemId
|
|
135
|
+
adoptionReason
|
|
136
|
+
entries: sorted [{
|
|
137
|
+
violationFingerprint
|
|
138
|
+
ruleId
|
|
139
|
+
constraintId: string | null
|
|
140
|
+
}]
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
これはADR-034 `ChangeProvenance.baselineSnapshotId`の比較snapshotとは別概念である。comparison baselineはnode change evidence、adoption baselineはknown violation fingerprintのpolicy inputであり、相互変換しない。
|
|
145
|
+
|
|
146
|
+
- `sourceEvaluationId`はbaseline採用前のcandidate evaluationを指す。baseline自身を含むevaluationIdへのself-referenceを作らない。
|
|
147
|
+
- entryはsource evaluationに実在し、人がlegacy structural debtとしてreviewしたfingerprintだけにする。
|
|
148
|
+
- `WCR-001` malformed declaration、invalid policy declaration、新規claim / pinに由来するfindingはadoption対象外。
|
|
149
|
+
- 同一ruleset内でbaseline entryを追加しない。返済による削除だけを許可する。
|
|
150
|
+
- commandがcandidateを生成しても自動採用せず、version control reviewと`adoptedByWorkItemId`を必要とする。
|
|
151
|
+
- duplicate fingerprint / unsupported schema / source identity欠落はfail-closed policy diagnosticとする。
|
|
152
|
+
|
|
153
|
+
このclosed-set ratchetにより、adoption後に発生したviolationをbaselineへ追記して非blocking化することを禁止する。例外が必要ならbaselineを拡張せず、§8のtime-bounded waiverを使う。
|
|
154
|
+
|
|
155
|
+
### 6. Legacyと新規のblocking policyを固定する
|
|
156
|
+
|
|
157
|
+
world-modelはADR-034のpolicy-free evaluation DTOからclassificationを導出し、validator-systemが次のblocking mappingを所有・適用する。
|
|
158
|
+
|
|
159
|
+
| condition | classification | validator policy |
|
|
160
|
+
|---|---|---|
|
|
161
|
+
| valid current fingerprintがsame-ruleset baselineに存在 | `adopted-legacy` | non-blocking warning。常にreportへ表示 |
|
|
162
|
+
| current fingerprintがbaselineにない | `new-structural` | default blocking |
|
|
163
|
+
| new claim / pinが全ruleを通過 | findingなし | pass。新規であること自体はfailureにしない |
|
|
164
|
+
| new claim / pinにfindingあり | `new-structural` | 初日からblocking。baseline追加不可 |
|
|
165
|
+
| `WCR-001` malformed / unsupported declaration | `invalid-declaration` | blocking、non-adoptable、non-waivable |
|
|
166
|
+
| baseline entryがcurrent setにない | `repaid` | baseline cleanup requiredとしてblocking。entry削除後にpass |
|
|
167
|
+
| exact active waiverあり | `waived` | non-blockingだがreportへ理由・期限・WIを表示 |
|
|
168
|
+
| waiver expired / invalid | `new-structural`または元classification | waiverを適用せず、元のpolicyで判定 |
|
|
169
|
+
|
|
170
|
+
新規claim / pinをfail-closedにするとは、validな追加を無条件blockすることではない。新規追加をlegacy baselineで免除せず、parse / resolution / pin / reference / dependency / digest ruleを全て通過しなければblockingするという意味である。
|
|
171
|
+
|
|
172
|
+
新規violationには別review済みwaiverを適用できるが、baselineへ恒久追記しない。`WCR-001`とpolicy input自体のmalformed / unsupported状態にはwaiverを適用できない。
|
|
173
|
+
|
|
174
|
+
### 7. Ruleset migrationではbaselineを自動carryしない
|
|
175
|
+
|
|
176
|
+
baselineの`rulesetVersion`とruntime rulesetが一致しない場合:
|
|
177
|
+
|
|
178
|
+
- old fingerprintをmatch対象にしない。
|
|
179
|
+
- version string置換、old hashの再label、rule IDだけによる自動carryを禁止する。
|
|
180
|
+
- baseline suppressionを適用せず、`baseline-ruleset-mismatch` policy diagnosticとしてfail-closedにする。
|
|
181
|
+
|
|
182
|
+
migrationは次のreviewed workflowとする。
|
|
183
|
+
|
|
184
|
+
1. new rulesetでcurrent corpusを評価し、新fingerprint集合を生成する。
|
|
185
|
+
2. old baseline entryごとに`carried`, `repaid`, `split`, `merged`, `removed-rule`を人が確認する。
|
|
186
|
+
3. still-accepted legacy debtだけからnew baseline candidateを作る。new rulesetで初めて発見されたviolationを自動adoptしない。
|
|
187
|
+
4. migration WIのreviewでold baselineをnew declarationへ原子的に置換する。
|
|
188
|
+
5. new declarationを含めて再deriveし、fingerprint集合とserialized reportの再現性を確認する。
|
|
189
|
+
|
|
190
|
+
fingerprintにrulesetVersionを含め、baselineにもrulesetVersionをpinすることでfalse continuityより明示migrationを優先する。
|
|
191
|
+
|
|
192
|
+
### 8. Waiverをexact、time-bounded external declarationとする
|
|
193
|
+
|
|
194
|
+
Waiverは次の必須fieldを持つ。正式file nameはADR-037で決定する。
|
|
195
|
+
|
|
196
|
+
```text
|
|
197
|
+
Waiver {
|
|
198
|
+
schemaVersion
|
|
199
|
+
waiverId: pgw:v1:waiver:<DeclaredKey>
|
|
200
|
+
violationFingerprint
|
|
201
|
+
reason
|
|
202
|
+
expiresOn: YYYY-MM-DD
|
|
203
|
+
workItemId: WI-<digits>
|
|
204
|
+
renewalOf: waiverId | null
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
- targetはexact fingerprint一件。rule ID、constraint ID、path、Unit、globによるwildcard waiverを禁止する。
|
|
209
|
+
- `reason`はnon-emptyで、なぜ即時返済できないかと期限内のnext actionを記述する。
|
|
210
|
+
- `expiresOn`はUTC dateのexclusive boundaryとする。`policyAsOfDate < expiresOn`の間だけactiveで、同日以降はexpired。
|
|
211
|
+
- `workItemId`はinception全体で一意に解決するWorkItemでなければならない。
|
|
212
|
+
- waiver declarationの追加・変更はversion control review対象であり、runtime flagやreport手編集で生成しない。
|
|
213
|
+
- expired waiverは削除またはrenewするまでreportへ表示するが、violationを抑止しない。
|
|
214
|
+
|
|
215
|
+
renewalはexpiry fieldの無言延長ではなく、新しい`waiverId`とreview WIを持つrecordとして作る。`renewalOf`で直前waiverを参照し、reasonとexpiryを再評価する。旧recordは同じ変更でcurrent declaration集合から除き、履歴はGitと`renewalOf`で保持する。自動renewal、無期限expiry、predecessor scopeの暗黙継承を禁止する。
|
|
216
|
+
|
|
217
|
+
`renewalOf`は直前waiver IDへのaudit referenceであり、predecessorがcurrent declaration集合に残ることを要求しない。runtimeはrenewal chainを辿ってsuppression scopeを拡張せず、新record自身のexact fingerprint、expiry、WIだけを評価する。
|
|
218
|
+
|
|
219
|
+
### 9. Policy inputsを`evaluationId`へ結び付ける
|
|
220
|
+
|
|
221
|
+
ADR-033の`policyInputsDigest`を次で定義する。
|
|
222
|
+
|
|
223
|
+
```text
|
|
224
|
+
sha256(canonicalJson({
|
|
225
|
+
schemaVersion: "phasegate-world-policy-inputs/v1",
|
|
226
|
+
adoptionBaseline: canonical declaration | null,
|
|
227
|
+
waivers: sorted canonical declarations,
|
|
228
|
+
semanticDebts: sorted canonical declarations,
|
|
229
|
+
policyAsOfDate: YYYY-MM-DD | null
|
|
230
|
+
}))
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
- baseline / waiver / semantic debtは人が採用するimmutable evaluation inputとしてsemantic fieldを全て含める。
|
|
234
|
+
- `policyAsOfDate`はwaiverが一件以上ある場合だけUTC dateを含め、waiverがなければ`null`とする。
|
|
235
|
+
- `policyAsOfDate`はreport生成時刻ではなく、expiry判定を変える明示的なresolved policy inputである。同じderive中に一度だけ解決し、全waiverへ同じ値を使う。
|
|
236
|
+
- `generatedAt`, current timestamp、duration、mtimeは含めない。
|
|
237
|
+
- declaration file path、JSON formatting、array input orderは含めない。
|
|
238
|
+
|
|
239
|
+
したがってbaseline entry、waiver、semantic debt、waiver有効日の変更は`policyInputsDigest`と`evaluationId`を変える。一方、raw WCR findingと`violationFingerprint`はpolicyから独立し、同じ構造violationを維持する。
|
|
240
|
+
|
|
241
|
+
invalid / unsupported policy declarationはempty inputへfallbackしない。trustworthyな`policyInputsDigest` / obligation classificationを生成せず、validator-systemへfail-closed diagnosticを返す。
|
|
242
|
+
|
|
243
|
+
ADR-033が除外したclock metadataと矛盾させないため、`policyAsOfDate`を観測時刻metadataではなくwaiver semanticsの入力として限定する。CLIのdefault / override方法はADR-037、testではinjectable dateを使う。
|
|
244
|
+
|
|
245
|
+
### 10. Semantic debtをstructural obligationと分離する
|
|
246
|
+
|
|
247
|
+
explicit semantic debtは、人が既知の意味的不足を宣言しWorldへimportするexternal declarationである。機械がWCR factsから発見したとは表現しない。
|
|
248
|
+
|
|
249
|
+
```text
|
|
250
|
+
SemanticDebtDeclaration {
|
|
251
|
+
schemaVersion
|
|
252
|
+
debtId: pgw:v1:semantic-debt:<DeclaredKey>
|
|
253
|
+
kind: "semantic"
|
|
254
|
+
title
|
|
255
|
+
reason
|
|
256
|
+
ownerUnit
|
|
257
|
+
introducedByWorkItemId
|
|
258
|
+
references: sorted World node IDs
|
|
259
|
+
}
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
- `debtId`はADR-032のDeclaredKey syntaxを使い、`<unit>.<topic>`を推奨する。同一projectで一意とする。
|
|
263
|
+
- declarationがcurrent集合に存在することをactive debtとする。`repaid` / `resolvedAt` stateを保存しない。
|
|
264
|
+
- 返済時はresolution WIでdeclarationとsource annotationを削除する。履歴はGitとWork-Item trailerに残す。
|
|
265
|
+
- semantic debtは`violationFingerprint`を持たず、adoption baseline / waiver対象にしない。
|
|
266
|
+
- semantic debt declarationはstructural violationを抑止しない。同じ箇所にWCR findingがあれば別collectionに両方表示する。
|
|
267
|
+
- reportは`declaredSemanticDebts`を「declared/imported」と表示し、`detected`, `rediscovered`, `repaid structural obligation`という表現を使わない。
|
|
268
|
+
|
|
269
|
+
### 11. §10のsemantic debt ID / coverage report記法へ回答する
|
|
270
|
+
|
|
271
|
+
explicit semantic debt IDには`pgw:v1:semantic-debt:<DeclaredKey>`を採用する。既存coverage reportからexternal declarationを参照するfile-level annotationは次とする。
|
|
272
|
+
|
|
273
|
+
```markdown
|
|
274
|
+
<!-- @world-semantic-debt pgw:v1:semantic-debt:skill-quality.coverage-attestation-legacy -->
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
- optional YAML frontmatterとdocument H1の後、最初のprose / tableより前のfile-level metadata blockへ置く。
|
|
278
|
+
- repeatableとし、一commentにつき一debt IDを記述する。
|
|
279
|
+
- annotationはexternal declarationへのreferenceであり、debtのreason / owner / WIをMarkdownへ複製しない。
|
|
280
|
+
- `<!-- @coverage-gating: ungated-legacy -->`と併存できるが、置き換えない。owner-specific markerのL2-016 exemption semanticsを変更しない。
|
|
281
|
+
- `@world-semantic-debt`はattestation、waiver、adoption baselineではなく、bare claimをgreenにしない。
|
|
282
|
+
|
|
283
|
+
external declarationの正式file name / schema pathはADR-037へ委譲する。WM-17で実corpusをinventoryし、既知coverage gapをこのIDで宣言・annotation参照してからWorld reportへimportする。本ADRでは既存coverage reportを編集しない。
|
|
284
|
+
|
|
285
|
+
### 12. 既存PhaseGate baselineとは統合しない
|
|
286
|
+
|
|
287
|
+
既存`.phasegate/baseline.json`とWorld adoption baselineは別owner / schema / lifecycleを維持する。
|
|
288
|
+
|
|
289
|
+
| concern | existing PhaseGate baseline | World adoption baseline |
|
|
290
|
+
|---|---|---|
|
|
291
|
+
| owner / consumer | ci-governance + agent-integration hook | world-model evaluation、validator-system policy adapter |
|
|
292
|
+
| identity | project-relative path | `violationFingerprint` |
|
|
293
|
+
| digest | raw/current file SHA-1 | ADR-033 semantic SHA-256 evidence |
|
|
294
|
+
| purpose | unchanged legacy pathのhook grandfather | known structural violationのvisible non-blocking adoption |
|
|
295
|
+
| lifecycle | file bytes変更でgrandfather失効、`--force` overwriteあり | initial closed set、same-ruleset追加禁止、返済で削除 |
|
|
296
|
+
| config | current top-level `baseline.enabled/path` | ADR-037で別config / file discoveryを決定 |
|
|
297
|
+
|
|
298
|
+
World側から既存baseline fileをimport、upgrade、rewriteしない。同じpathに両者を保存せず、既存`baseline-reset` / `phasegate baseline` commandの意味も変更しない。
|
|
299
|
+
|
|
300
|
+
## Consequences
|
|
301
|
+
|
|
302
|
+
### Positive
|
|
303
|
+
|
|
304
|
+
- obligation reportを手編集可能なstateではなく、再現可能なderived outputにできる。
|
|
305
|
+
- legacy structural debtだけを導入時にadoptし、新規violationのbaseline launderingを防げる。
|
|
306
|
+
- 返済をcurrent set differenceで導出し、stale baselineによる再発の再免除を防げる。
|
|
307
|
+
- exact fingerprint / expiry / WIを持つwaiverにより、例外を局所的かつ期限付きにできる。
|
|
308
|
+
- ruleset変更時のfalse continuityを避け、人によるmigration reviewを要求できる。
|
|
309
|
+
- explicit semantic debtを機械検出したstructural obligationと混同せず表示できる。
|
|
310
|
+
- 既存path / SHA-1 hook baselineの互換性を維持できる。
|
|
311
|
+
|
|
312
|
+
### Negative / Trade-off
|
|
313
|
+
|
|
314
|
+
- baseline採用、ruleset migration、waiver renewalにreview WIが必要になる。
|
|
315
|
+
- repaid entryを削除するまでbaseline cleanupがblockingになる。
|
|
316
|
+
- observed digestやcandidate cardinalityが変わると、同じconstraintでもnew fingerprintとしてblockingになり得る。
|
|
317
|
+
- active waiverがある間はUTC policy dateがevaluation identityへ影響する。
|
|
318
|
+
- reportにstructural obligation、repaid entry、semantic debt、policy diagnosticの複数sectionが必要になる。
|
|
319
|
+
|
|
320
|
+
## Alternatives
|
|
321
|
+
|
|
322
|
+
- **obligation reportへ`repaid`を保存する** — report改竄やstale stateがcurrent evaluationを上書きするため不採用。
|
|
323
|
+
- **same-ruleset baselineへのentry追加を許可する** —新規violationを後からlegacy化でき、ratchetが成立しないため不採用。
|
|
324
|
+
- **fingerprintをconstraintIdだけにする** —一constraintの複数rule / endpoint driftを区別できないため不採用。
|
|
325
|
+
- **fingerprintへpath / line / messageを含める** —locator変更や文言修正だけでlegacy identityが壊れるため不採用。
|
|
326
|
+
- **ruleset versionを無視してold baselineを適用する** —rule semantics変更後にfalse matchを作るため不採用。
|
|
327
|
+
- **waiverをrule / path globで指定する** —将来の未知violationまで免除するため不採用。
|
|
328
|
+
- **既存`.phasegate/baseline.json`を拡張する** —path hook grandfatherとWorld violation adoptionのowner / identity / hash / lifecycleが異なるため不採用。
|
|
329
|
+
- **`ungated-legacy` markerをsemantic debt IDとして流用する** —file-wide booleanであり、project-global ID、reason、owner、WI traceabilityを持たないため不採用。
|
|
330
|
+
|
|
331
|
+
## 関連要件・文書
|
|
332
|
+
|
|
333
|
+
- `docs/inception/_cross/WI-280/delivery_plan.md` §1, §3 WM-04, §7 ADR-035, §10
|
|
334
|
+
- `docs/inception/_cross/WI-284/description.md`
|
|
335
|
+
- `docs/inception/_cross/WI-284/logical_design.md`
|
|
336
|
+
- ADR-031(external declaration / ownership)
|
|
337
|
+
- ADR-032(DeclaredKey / World node identity)
|
|
338
|
+
- ADR-033(evaluationId / policyInputsDigest / canonicalization)
|
|
339
|
+
- ADR-034(WCR rules / ChangeProvenance / policy-free evaluation DTO)
|
|
340
|
+
- ADR-027(成果物駆動状態導出)
|
|
341
|
+
- ADR-030(coverage attestation / ungated-legacy ratchet)
|