@agent-delivery-harness/conformance 0.1.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.
Files changed (101) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +5 -0
  3. package/README.md +159 -0
  4. package/fixtures/repo-config-adapter.ts +250 -0
  5. package/package.json +24 -0
  6. package/src/generate.ts +1013 -0
  7. package/src/index.ts +36 -0
  8. package/src/json-schema.ts +222 -0
  9. package/src/runner.ts +687 -0
  10. package/vectors/context/environment.json +21 -0
  11. package/vectors/context/repo-config.json +22 -0
  12. package/vectors/kit.json +1250 -0
  13. package/vectors/vectors/accept/a-completed-order-differs.json +112 -0
  14. package/vectors/vectors/accept/a-cost-fractional.json +116 -0
  15. package/vectors/vectors/accept/a-cost-tokens.json +120 -0
  16. package/vectors/vectors/accept/a-deferred-expansion.json +124 -0
  17. package/vectors/vectors/accept/a-idempotent-resubmission.json +115 -0
  18. package/vectors/vectors/accept/a-minimal-green.json +97 -0
  19. package/vectors/vectors/accept/a-resolved-and-advisory.json +129 -0
  20. package/vectors/vectors/accept/a-three-reviewers.json +113 -0
  21. package/vectors/vectors/reject/env-1-unregistered-provider.json +114 -0
  22. package/vectors/vectors/reject/env-10-artifact-duplicate.json +103 -0
  23. package/vectors/vectors/reject/env-10-artifact-missing-file.json +104 -0
  24. package/vectors/vectors/reject/env-10-artifact-traversal.json +99 -0
  25. package/vectors/vectors/reject/env-11-artifact-digest-mismatch.json +98 -0
  26. package/vectors/vectors/reject/env-12-unknown-attestation-level.json +114 -0
  27. package/vectors/vectors/reject/env-13-nonempty-signatures.json +118 -0
  28. package/vectors/vectors/reject/env-14-duplicate-claim.json +149 -0
  29. package/vectors/vectors/reject/env-14-no-claims.json +78 -0
  30. package/vectors/vectors/reject/env-14-unconfigured-obligation.json +114 -0
  31. package/vectors/vectors/reject/env-14-unsupported-payload-spec.json +114 -0
  32. package/vectors/vectors/reject/env-2-run-id-1.json +114 -0
  33. package/vectors/vectors/reject/env-2-run-id-2.json +114 -0
  34. package/vectors/vectors/reject/env-2-run-id-3.json +114 -0
  35. package/vectors/vectors/reject/env-2-run-id-4.json +114 -0
  36. package/vectors/vectors/reject/env-2-run-id-5.json +114 -0
  37. package/vectors/vectors/reject/env-4-unsupported-vcs.json +114 -0
  38. package/vectors/vectors/reject/env-5-malformed-object-id.json +114 -0
  39. package/vectors/vectors/reject/env-6-missing-identity.json +111 -0
  40. package/vectors/vectors/reject/env-6-unknown-identity-version.json +114 -0
  41. package/vectors/vectors/reject/env-8-repository-required.json +116 -0
  42. package/vectors/vectors/reject/env-9-empty-run-history.json +107 -0
  43. package/vectors/vectors/reject/env-9-final-pass-mismatch.json +110 -0
  44. package/vectors/vectors/reject/env-9-final-tree-mismatch.json +110 -0
  45. package/vectors/vectors/reject/gen-1-legacy-count-field.json +115 -0
  46. package/vectors/vectors/reject/gen-1-unknown-envelope-member.json +117 -0
  47. package/vectors/vectors/reject/gen-2-unsupported-spec.json +114 -0
  48. package/vectors/vectors/reject/rg-1-edited-after-final-pass.json +114 -0
  49. package/vectors/vectors/reject/rg-1-not-finalized.json +114 -0
  50. package/vectors/vectors/reject/rg-1-verdict-not-green.json +114 -0
  51. package/vectors/vectors/reject/rg-10-cost-by-reviewer-exceeds-total.json +115 -0
  52. package/vectors/vectors/reject/rg-10-cost-empty-reported-by.json +111 -0
  53. package/vectors/vectors/reject/rg-10-cost-empty-unit.json +111 -0
  54. package/vectors/vectors/reject/rg-10-cost-missing-unit.json +110 -0
  55. package/vectors/vectors/reject/rg-10-cost-negative-by-reviewer.json +114 -0
  56. package/vectors/vectors/reject/rg-10-cost-negative-total.json +111 -0
  57. package/vectors/vectors/reject/rg-10-cost-null-total.json +111 -0
  58. package/vectors/vectors/reject/rg-10-cost-unknown-reviewer-in-breakdown.json +114 -0
  59. package/vectors/vectors/reject/rg-2-duplicate-selected.json +99 -0
  60. package/vectors/vectors/reject/rg-3-completed-missing.json +96 -0
  61. package/vectors/vectors/reject/rg-3-completed-unrelated.json +99 -0
  62. package/vectors/vectors/reject/rg-3-failed-reviewer.json +100 -0
  63. package/vectors/vectors/reject/rg-3-timed-out-reviewer.json +100 -0
  64. package/vectors/vectors/reject/rg-4-approval-extra.json +104 -0
  65. package/vectors/vectors/reject/rg-4-approval-malformed.json +98 -0
  66. package/vectors/vectors/reject/rg-4-approval-missing.json +100 -0
  67. package/vectors/vectors/reject/rg-4-approval-not-approved.json +98 -0
  68. package/vectors/vectors/reject/rg-4-approval-wrong-candidate.json +98 -0
  69. package/vectors/vectors/reject/rg-4-approval-wrong-pass.json +98 -0
  70. package/vectors/vectors/reject/rg-4-approval-wrong-provider.json +98 -0
  71. package/vectors/vectors/reject/rg-4-approval-wrong-reviewer.json +98 -0
  72. package/vectors/vectors/reject/rg-4-approval-wrong-run.json +98 -0
  73. package/vectors/vectors/reject/rg-4-approval-wrong-workspace.json +98 -0
  74. package/vectors/vectors/reject/rg-5-duplicate-finding-id.json +131 -0
  75. package/vectors/vectors/reject/rg-5-unknown-disposition.json +123 -0
  76. package/vectors/vectors/reject/rg-5-unknown-scope.json +123 -0
  77. package/vectors/vectors/reject/rg-5-unknown-severity.json +123 -0
  78. package/vectors/vectors/reject/rg-6-actionable-ignored.json +123 -0
  79. package/vectors/vectors/reject/rg-6-actionable-unresolved.json +123 -0
  80. package/vectors/vectors/reject/rg-6-blocking-finding.json +123 -0
  81. package/vectors/vectors/reject/rg-7-defer-adjacent.json +126 -0
  82. package/vectors/vectors/reject/rg-7-defer-blocking.json +126 -0
  83. package/vectors/vectors/reject/rg-7-defer-in-contract.json +126 -0
  84. package/vectors/vectors/reject/rg-7-defer-lowercase-issue-id.json +126 -0
  85. package/vectors/vectors/reject/rg-7-defer-missing-issue-id.json +125 -0
  86. package/vectors/vectors/reject/rg-7-defer-non-actionable.json +126 -0
  87. package/vectors/vectors/reject/rg-7-defer-p0.json +126 -0
  88. package/vectors/vectors/reject/rg-7-defer-p1.json +126 -0
  89. package/vectors/vectors/reject/rg-7-defer-placeholder-issue-id.json +126 -0
  90. package/vectors/vectors/reject/rg-7-issue-id-on-resolved.json +124 -0
  91. package/vectors/vectors/reject/rg-8-counts-contradict-findings.json +126 -0
  92. package/vectors/vectors/reject/rg-8-deferral-count-disagrees.json +124 -0
  93. package/vectors/vectors/reject/rg-8-deferral-ids-disagree.json +126 -0
  94. package/vectors/vectors/reject/rg-9-iteration-count-mismatch.json +114 -0
  95. package/vectors/vectors/reject/sub-1-base-tip-moved.json +131 -0
  96. package/vectors/vectors/reject/sub-1-deliverable-changed.json +131 -0
  97. package/vectors/vectors/reject/sub-1-merge-base-moved.json +131 -0
  98. package/vectors/vectors/reject/sub-1-raw-tree-changed.json +131 -0
  99. package/vectors/vectors/reject/sub-2-unprepared.json +117 -0
  100. package/vectors/vectors/reject/sub-3-manifest-outside-run-root.json +117 -0
  101. package/vectors/vectors/reject/sub-4-record-conflict.json +220 -0
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,5 @@
1
+ delivery-harness
2
+ Copyright the delivery-harness authors
3
+
4
+ This product includes software developed by the delivery-harness authors
5
+ (https://github.com/kwam1na/agent-delivery-harness).
package/README.md ADDED
@@ -0,0 +1,159 @@
1
+ # Delivery Evidence Conformance Kit
2
+
3
+ Golden vectors for validators of the **delivery-evidence/1** specification
4
+ (envelope) and the **review.green/1** payload. A validator implementation that
5
+ produces the expected outcome for every vector conforms to the machine-checkable
6
+ core of the spec.
7
+
8
+ The corpus is derived from a production recorder's test suite
9
+ (`athena:scripts/harness-review-evidence.test.ts`, ~1,000 lines) that has gated
10
+ agent-delivered merges since mid-2026, restated against the generalized
11
+ envelope. Provenance is recorded per vector.
12
+
13
+ ## Layout
14
+
15
+ ```
16
+ kit.json index: every vector with id, file, rules, expectation
17
+ context/repo-config.json the repository gate configuration vectors assume
18
+ context/environment.json the submission-time state the harness must establish
19
+ vectors/accept/*.json manifests a conforming validator MUST accept
20
+ vectors/reject/*.json manifests a conforming validator MUST reject
21
+ generate.ts regenerates everything above (bun generate.ts <outDir>)
22
+ ```
23
+
24
+ ## Vector format
25
+
26
+ Each vector is self-contained:
27
+
28
+ ```jsonc
29
+ {
30
+ "vectorVersion": 1,
31
+ "id": "rg-7-defer-p0",
32
+ "title": "Illegal deferral: p0",
33
+ "rules": ["RG-7"], // spec rule ids this vector exercises
34
+ "provenance": "athena:… | new in spec | spec-tightened",
35
+ "expect": { "result": "rejected", "codes": ["illegal_deferral"] },
36
+ "environment": { … }, // optional overrides of context/environment.json
37
+ "extra": { … }, // optional protocol notes (multi-step vectors)
38
+ "artifacts": { "reviewers/correctness.json": "<exact file bytes>" },
39
+ "manifest": { … } // the delivery-evidence/1 manifest to submit
40
+ }
41
+ ```
42
+
43
+ ## Running a vector
44
+
45
+ For each vector, the harness under test:
46
+
47
+ 1. Loads `context/repo-config.json` as the repository's gate configuration.
48
+ 2. Establishes the submission environment from `context/environment.json`,
49
+ merged with the vector's `environment` overrides:
50
+ - `currentCandidate` is what the recorder's candidate capture returns at
51
+ submission time.
52
+ - `prepared: false` means preparation is absent/failed (the capture reports
53
+ an unprepared state).
54
+ - `manifestLocation: "outside-run-root"` means the harness places the
55
+ manifest file somewhere other than the allocated run root.
56
+ 3. Allocates a run root for `manifest.provider.runId` and materializes each
57
+ entry of `artifacts` at its path (exact bytes) relative to that root. An
58
+ artifact path that is itself invalid (e.g. `../outside.json`) is part of the
59
+ vector's point; materialize it where the path indicates, or skip
60
+ materialization if the validator rejects on path shape before file access.
61
+ 4. Submits the manifest through the recorder.
62
+ 5. Compares the outcome to `expect`.
63
+
64
+ ### Multi-step vectors
65
+
66
+ - `a-idempotent-resubmission` (`extra.submitTwice`): submit the same manifest
67
+ twice. Both submissions succeed and the record ids are identical.
68
+ - `sub-4-record-conflict` (`extra.submitFirst`): submit `extra.submitFirst`
69
+ (accepted), then the vector's `manifest`. Same record identity, different
70
+ content — the second submission is rejected with `record_conflict`.
71
+
72
+ ## Expectation semantics
73
+
74
+ - `result: "accepted"` — the submission MUST be accepted and one evidence
75
+ record written per claim. No rejection codes.
76
+ - `result: "rejected"` — the submission MUST be rejected, no record written,
77
+ and the response MUST include **every** code listed in `expect.codes`.
78
+ Additional codes are permitted: several vectors violate more than one rule by
79
+ construction (SUB-5 requires reporting all violations), and the kit does not
80
+ over-specify cascade behavior. The listed codes are the floor, not the
81
+ ceiling.
82
+
83
+ ## Provenance markers
84
+
85
+ - `athena:…` — restates a case from the production test corpus.
86
+ - `new in spec; no Athena antecedent` — covers spec surface the production
87
+ contract did not have (claims array, artifact digests, attestation levels,
88
+ strict unknown-member parsing, repository requirement).
89
+ - `spec-tightened; Athena accepted a looser form` — the spec is deliberately
90
+ stricter here; the production recorder accepted this shape. Two cases:
91
+ - `env-9-empty-run-history` — Athena accepted an empty mutation sequence;
92
+ the spec requires a non-empty `runHistory` whose final entry names the
93
+ candidate tree and final pass.
94
+ - `rg-9-iteration-count-mismatch` — Athena accepted an explicit
95
+ `iterationCount` that disagreed with the mutation sequence; the spec
96
+ requires `iterationCount == runHistory.length`.
97
+
98
+ ## Known divergences from the production contract
99
+
100
+ Beyond the two tightenings above, the spec-shaped manifest differs from the
101
+ production manifest in ways the kit reflects:
102
+
103
+ 1. **Claims array.** Production bound one manifest to one obligation; the
104
+ envelope carries `claims[]` and the recorder writes one record per claim.
105
+ 2. **Artifact digests.** Production validated artifacts at record time but did
106
+ not hash them into the manifest; the envelope requires per-artifact
107
+ `sha256` (`env-11-artifact-digest-mismatch` is new surface).
108
+ 3. **Strict parsing.** Production tolerated some unknown members; the spec
109
+ rejects any (`gen-1-*`). Production's summary-count fields
110
+ (`unresolvedActionableCount`, `blockingCount`) were removed as pure
111
+ derivations — their presence now trips `unknown_member`
112
+ (`gen-1-legacy-count-field`).
113
+ 4. **40-hex object ids.** Production fixtures used symbolic ids
114
+ (`"tree-a"`); the spec requires real git object-id shapes, so all kit ids
115
+ are deterministic hex derived in `generate.ts`.
116
+ 5. **Approval stamp shape.** Production stamps carried flat
117
+ `providerId`/`runId` fields; the spec nests them under `provider` and
118
+ renames `worktreeId` to `workspaceId` (§9.2).
119
+
120
+ ## Coverage
121
+
122
+ 89 vectors: 8 accept, 81 reject. Every rule in spec §8 (GEN, ENV, SUB) and §9.3
123
+ (RG) is exercised by at least one vector except: GEN-3 and SUB-5 (meta rules
124
+ about validator behavior, observable through the multi-code vectors), GEN-5
125
+ (prohibition on time-based decisions — not observable from a single
126
+ submission), and ENV-3/ENV-7 (subsumed by schema-shape vectors). The signing
127
+ profile, additional payload specs, and gate-policy behavior (freshness at gate
128
+ time, waivers, delegation) are out of the kit's scope, as they are out of the
129
+ spec's.
130
+
131
+ ## Regenerating
132
+
133
+ ```
134
+ bun generate.ts <outDir>
135
+ ```
136
+
137
+ The generator is table-driven — one entry per vector, mirroring the structure
138
+ of the source test corpus. Accept-vector artifact digests are computed from the
139
+ emitted bytes, so edits to artifact content stay internally consistent
140
+ automatically.
141
+
142
+ ---
143
+
144
+ ## Vendored layout in this repo
145
+
146
+ This README is the kit's own, carried verbatim. Two paths differ from the layout
147
+ above because the kit is vendored into an npm workspace:
148
+
149
+ | Kit path | Path here |
150
+ |---|---|
151
+ | kit root (`kit.json`, `context/`, `vectors/`) | `packages/conformance/vectors/` |
152
+ | `generate.ts` | `packages/conformance/src/generate.ts` |
153
+
154
+ Regenerate with `npm run kit:generate` (the generator is also runnable directly
155
+ under either runtime: `node --import tsx packages/conformance/src/generate.ts <outDir>`
156
+ or `bun packages/conformance/src/generate.ts <outDir>`). The vendored tree is
157
+ guarded against drift by `packages/conformance/src/generate.test.ts`, which
158
+ regenerates into a temp directory and requires byte-identical output — so the
159
+ vectors are never hand-edited, only regenerated.
@@ -0,0 +1,250 @@
1
+ /**
2
+ * The conformance kit's `context/repo-config.json`, adapted into a harness
3
+ * config.
4
+ *
5
+ * The kit declares the repository policy a validator needs to judge its
6
+ * vectors, and nothing else: a gate id, the envelope specs and identity
7
+ * versions it accepts, and one obligation with its payload specs, providers and
8
+ * minimum attestation level. A harness config is a much wider surface, so the
9
+ * adapter does three separable things, and the test beside it checks each one:
10
+ *
11
+ * MAPS the fields the kit declares. These are the dimensions the vectors are
12
+ * bound to — a vector that expects `unregistered_provider` is expecting it
13
+ * against *this* provider list — so they are carried across verbatim.
14
+ *
15
+ * STRIPS `configVersion`. It versions the kit's own file format and has no
16
+ * counterpart in a harness config; carrying it would fail the closed grammar.
17
+ *
18
+ * DEFAULTS every remaining dimension. Each default is either vector-
19
+ * independent (no vector's expectation can turn on it) or forced by a config
20
+ * invariant. There is exactly one of the latter, and it is named below.
21
+ *
22
+ * THE ONE CONSTRAINED DEFAULT. The kit declares `deliverable-tree/v1` as its
23
+ * identity version, and the config invariants bind that token to its narration
24
+ * set in both directions. So `reviewNeutral` is not free here: it must be the
25
+ * `deliverable-tree/v1` narration set or the config will not load. This is
26
+ * harmless for kit runs, which stub candidate capture with each vector's own
27
+ * values and never recompute an identity from a real tree — but it is a
28
+ * constraint rather than a free choice, and pretending otherwise would hide the
29
+ * one place the adapter's hands are tied.
30
+ *
31
+ * NEGATIVE SPACE. Four tokens must stay *absent* from this config, because four
32
+ * reject vectors expect a rejection that only happens while they are absent:
33
+ * the obligation `qa.exercised`, the payload spec `review.green/0`, the provider
34
+ * `unknown.provider`, and the identity version `deliverable-tree/v0`. A default
35
+ * that quietly widened the config to include one of them would turn a reject
36
+ * vector green without changing a single expectation. `negativeSpaceViolations`
37
+ * exists so that widening is caught rather than discovered.
38
+ */
39
+ import { readFileSync } from "node:fs";
40
+ import path from "node:path";
41
+ import { fileURLToPath } from "node:url";
42
+ import {
43
+ DELIVERABLE_TREE_V1_NARRATION_SET,
44
+ defineHarnessConfig,
45
+ type HarnessConfig,
46
+ type HarnessConfigInput,
47
+ } from "@agent-delivery-harness/kernel";
48
+
49
+ /** The kit's own file format, as declared in `context/repo-config.json`. */
50
+ export interface KitRepoConfig {
51
+ readonly configVersion: number;
52
+ readonly gateId: string;
53
+ readonly acceptedEnvelopeSpecs: readonly string[];
54
+ readonly identityVersions: readonly string[];
55
+ readonly obligations: Readonly<
56
+ Record<
57
+ string,
58
+ {
59
+ readonly acceptedPayloadSpecs: readonly string[];
60
+ readonly providers: readonly string[];
61
+ readonly minimumAttestationLevel: string;
62
+ }
63
+ >
64
+ >;
65
+ }
66
+
67
+ /** Dimensions carried across from the kit's declaration. */
68
+ export const KIT_MAPPED_DIMENSIONS: readonly string[] = [
69
+ "gateId",
70
+ "acceptedEnvelopeSpecs",
71
+ "identityVersions",
72
+ // Derived from the declaration: the kit names exactly one identity version,
73
+ // and a recorder must accept the identity it computes.
74
+ "computingIdentityVersion",
75
+ "providers.ids",
76
+ "obligations.ids",
77
+ "obligations.providers",
78
+ "obligations.acceptedPayloadSpecs",
79
+ "obligations.minimumAttestationLevel",
80
+ ];
81
+
82
+ /**
83
+ * Dimensions the kit does not declare, each with the reason its default is safe.
84
+ * `invariant-constrained` means the value is not a free choice; every other
85
+ * entry is a dimension no vector expectation can turn on.
86
+ */
87
+ export const KIT_DEFAULTED_DIMENSIONS: Readonly<Record<string, "vector-independent" | "invariant-constrained">> = {
88
+ baseRef: "vector-independent",
89
+ storageNamespace: "vector-independent",
90
+ reviewNeutral: "invariant-constrained",
91
+ recordNeutral: "vector-independent",
92
+ pathClassification: "vector-independent",
93
+ sensitivePaths: "vector-independent",
94
+ activationThreshold: "vector-independent",
95
+ agentEnvSignals: "vector-independent",
96
+ ciPolicies: "vector-independent",
97
+ ciPolicyEnvKey: "vector-independent",
98
+ preparationWiringPaths: "vector-independent",
99
+ deliveryRecordPath: "vector-independent",
100
+ deliveryRecordVerification: "vector-independent",
101
+ "providers.findingCodes": "vector-independent",
102
+ "obligations.activation.kind": "vector-independent",
103
+ "obligations.activation.sensitiveGroupIds": "vector-independent",
104
+ "obligations.activation.relevantBinaryChangeActivates": "vector-independent",
105
+ "obligations.activation.relevantZeroLineChangeActivates": "vector-independent",
106
+ "obligations.freshness": "vector-independent",
107
+ "obligations.providerPolicy": "vector-independent",
108
+ "obligations.allowedResolutionKinds": "vector-independent",
109
+ "obligations.humanWaiverAllowed": "vector-independent",
110
+ "obligations.ciDelegationPolicyIds": "vector-independent",
111
+ "obligations.remediation": "vector-independent",
112
+ "obligations.waivableCodes": "vector-independent",
113
+ "obligations.nonWaivableCodes": "vector-independent",
114
+ };
115
+
116
+ /** Tokens whose absence four reject vectors depend on. */
117
+ export const KIT_NEGATIVE_SPACE: readonly string[] = [
118
+ "qa.exercised",
119
+ "review.green/0",
120
+ "unknown.provider",
121
+ "deliverable-tree/v0",
122
+ ];
123
+
124
+ /**
125
+ * The gate's structural finding codes, restated so the adapter's classification
126
+ * is a decision this file makes rather than a set it inherits. A structural code
127
+ * added to the contract shows up here as an unclassified-code finding at load
128
+ * time, which is the intended way to learn about it.
129
+ */
130
+ const STRUCTURAL_CODES: readonly string[] = [
131
+ "review_evidence_missing",
132
+ "stale_evidence",
133
+ "evidence_not_green",
134
+ "unresolved_actionable_findings",
135
+ "ambiguous_records",
136
+ "malformed_record",
137
+ "unknown_provider",
138
+ "live_provider_missing",
139
+ "ambiguous_live_provider",
140
+ "live_provider_failed",
141
+ "resolution_not_allowed",
142
+ ];
143
+
144
+ function requireRecord(value: unknown, label: string): Record<string, unknown> {
145
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
146
+ throw new Error(`${label} must be an object.`);
147
+ }
148
+ return value as Record<string, unknown>;
149
+ }
150
+
151
+ /**
152
+ * Maps a parsed kit repo-config into a harness config. Pure: the caller supplies
153
+ * the parsed value, so the mapping is testable against a synthetic declaration
154
+ * without touching the vendored kit.
155
+ */
156
+ export function adaptKitRepoConfig(raw: unknown): HarnessConfig {
157
+ const declared = requireRecord(raw, "kit repo-config");
158
+ const obligations = requireRecord(declared["obligations"], "kit repo-config obligations");
159
+
160
+ const identityVersions = declared["identityVersions"] as readonly string[];
161
+ const providerIds = [
162
+ ...new Set(
163
+ Object.values(obligations).flatMap((obligation) => (requireRecord(obligation, "kit obligation")["providers"] as readonly string[]) ?? []),
164
+ ),
165
+ ];
166
+
167
+ const input: HarnessConfigInput = {
168
+ // ── Mapped ──
169
+ gateId: declared["gateId"] as string,
170
+ acceptedEnvelopeSpecs: declared["acceptedEnvelopeSpecs"] as readonly string[],
171
+ identityVersions,
172
+ // The kit declares one identity version; a recorder must accept the identity
173
+ // it computes, so the sole declared version is the computing one.
174
+ computingIdentityVersion: identityVersions[0] as string,
175
+ // The kit registers providers per obligation and declares no finding codes
176
+ // for them, so the registry is their union with an empty code surface. That
177
+ // leaves the emittable universe equal to the structural registry, which is
178
+ // what the classification below partitions.
179
+ providers: providerIds.map((id) => ({ id, findingCodes: [] })),
180
+ obligations: Object.entries(obligations).map(([id, declaredObligation]) => {
181
+ const obligation = requireRecord(declaredObligation, `kit obligation ${id}`);
182
+ return {
183
+ id,
184
+ acceptedPayloadSpecs: obligation["acceptedPayloadSpecs"] as readonly string[],
185
+ providers: obligation["providers"] as readonly string[],
186
+ minimumAttestationLevel: obligation["minimumAttestationLevel"] as "self",
187
+ // ── Defaulted, per obligation ──
188
+ activation: { kind: "relevant_change" },
189
+ freshness: "exact_candidate",
190
+ allowedResolutionKinds: ["satisfied_evidence", "not_applicable"],
191
+ humanWaiverAllowed: false,
192
+ ciDelegationPolicyIds: [],
193
+ remediation: {
194
+ default: [
195
+ {
196
+ id: "submit-evidence",
197
+ kind: "manual_action",
198
+ summary: `Submit a manifest claiming ${id} for the current candidate.`,
199
+ },
200
+ ],
201
+ },
202
+ waivableCodes: [],
203
+ nonWaivableCodes: STRUCTURAL_CODES,
204
+ };
205
+ }),
206
+ // ── Defaulted ──
207
+ baseRef: "origin/main",
208
+ storageNamespace: "delivery-harness/",
209
+ reviewNeutral: [...DELIVERABLE_TREE_V1_NARRATION_SET],
210
+ recordNeutral: [{ prefix: "docs/reports/" }],
211
+ pathClassification: {
212
+ generated: [{ kind: "prefix", value: "generated/" }],
213
+ test: [{ kind: "glob", value: "**/*.test.ts" }],
214
+ lockfile: [{ kind: "glob", value: "**/package-lock.json" }],
215
+ },
216
+ sensitivePaths: [],
217
+ activationThreshold: 1,
218
+ agentEnvSignals: [],
219
+ ciPolicies: [],
220
+ ciPolicyEnvKey: "DELIVERY_HARNESS_CI_POLICY",
221
+ preparationWiringPaths: ["harness.config.ts"],
222
+ deliveryRecordPath: "docs/reports/delivery-record.json",
223
+ deliveryRecordVerification: { baseMovement: "stale" },
224
+ };
225
+
226
+ return defineHarnessConfig(input);
227
+ }
228
+
229
+ /** Repo-relative path of the vendored declaration this adapter reads. */
230
+ export const KIT_REPO_CONFIG_PATH = "packages/conformance/vectors/context/repo-config.json";
231
+
232
+ export function readKitRepoConfig(): KitRepoConfig {
233
+ const here = path.dirname(fileURLToPath(import.meta.url));
234
+ const file = path.join(here, "..", "vectors", "context", "repo-config.json");
235
+ return JSON.parse(readFileSync(file, "utf8")) as KitRepoConfig;
236
+ }
237
+
238
+ /** The kit's own configuration, loaded and validated. */
239
+ export function loadKitRepoConfig(): HarnessConfig {
240
+ return adaptKitRepoConfig(readKitRepoConfig());
241
+ }
242
+
243
+ /**
244
+ * Which negative-space tokens a config has let in. Empty is the only correct
245
+ * answer for a config the kit is evaluated under.
246
+ */
247
+ export function negativeSpaceViolations(config: HarnessConfig): readonly string[] {
248
+ const declared = JSON.stringify(config);
249
+ return KIT_NEGATIVE_SPACE.filter((token) => declared.includes(token));
250
+ }
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@agent-delivery-harness/conformance",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "description": "delivery-evidence/1 conformance kit (89 golden vectors) and its generator",
6
+ "license": "Apache-2.0",
7
+ "engines": {
8
+ "node": ">=22"
9
+ },
10
+ "dependencies": {
11
+ "@agent-delivery-harness/kernel": "0.1.0"
12
+ },
13
+ "exports": {
14
+ ".": "./src/index.ts"
15
+ },
16
+ "files": [
17
+ "src",
18
+ "!src/**/*.test.ts",
19
+ "vectors",
20
+ "fixtures/repo-config-adapter.ts",
21
+ "LICENSE",
22
+ "NOTICE"
23
+ ]
24
+ }