prizmkit 1.1.120 → 1.1.121
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/bundled/VERSION.json +3 -3
- package/bundled/dev-pipeline/prizmkit_runtime/runner_classification.py +23 -25
- package/bundled/dev-pipeline/prizmkit_runtime/runner_models.py +8 -2
- package/bundled/dev-pipeline/prizmkit_runtime/runner_prompts.py +10 -1
- package/bundled/dev-pipeline/prizmkit_runtime/runners.py +43 -29
- package/bundled/dev-pipeline/scripts/continuation.py +51 -6
- package/bundled/dev-pipeline/scripts/update-bug-status.py +57 -14
- package/bundled/dev-pipeline/scripts/update-feature-status.py +54 -5
- package/bundled/dev-pipeline/scripts/update-refactor-status.py +57 -14
- package/bundled/dev-pipeline/templates/bootstrap-tier3.md +2 -2
- package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +2 -1
- package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +2 -2
- package/bundled/dev-pipeline/templates/sections/bugfix-phase-review.md +3 -3
- package/bundled/dev-pipeline/templates/sections/phase-review-agent.md +3 -3
- package/bundled/dev-pipeline/templates/sections/phase-review-full.md +4 -4
- package/bundled/dev-pipeline/templates/sections/refactor-phase-review.md +3 -3
- package/bundled/dev-pipeline/tests/test_auto_skip.py +5 -5
- package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +10 -3
- package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +9 -2
- package/bundled/dev-pipeline/tests/test_generate_refactor_prompt.py +9 -1
- package/bundled/dev-pipeline/tests/test_python_runner_parity.py +222 -18
- package/bundled/dev-pipeline/tests/test_unified_cli.py +14 -10
- package/bundled/skills/_metadata.json +4 -4
- package/bundled/skills/prizmkit-code-review/SKILL.md +49 -48
- package/bundled/skills/prizmkit-code-review/references/review-report-template.md +13 -8
- package/bundled/skills/prizmkit-code-review/references/reviewer-agent-prompt.md +46 -32
- package/bundled/skills/prizmkit-code-review/references/reviewer-workspace-protocol.md +90 -0
- package/bundled/skills/prizmkit-test/SKILL.md +159 -155
- package/bundled/skills/prizmkit-test/assets/authoritative-records.schema.json +420 -0
- package/bundled/skills/prizmkit-test/assets/behavior-risk-matrix.schema.json +116 -0
- package/bundled/skills/prizmkit-test/assets/evidence-manifest.schema.json +112 -0
- package/bundled/skills/prizmkit-test/assets/evidence-package-template.json +97 -0
- package/bundled/skills/prizmkit-test/references/boundary-coverage-protocol.md +76 -192
- package/bundled/skills/prizmkit-test/references/contract-mock-protocol.md +65 -0
- package/bundled/skills/prizmkit-test/references/evidence-protocol.md +194 -0
- package/bundled/skills/prizmkit-test/references/evidence-request-protocol.md +78 -0
- package/bundled/skills/prizmkit-test/references/examples.md +65 -108
- package/bundled/skills/prizmkit-test/references/service-boundary-test-catalog.md +10 -7
- package/bundled/skills/prizmkit-test/references/test-generation-steps.md +90 -82
- package/bundled/skills/prizmkit-test/references/test-report-template.md +77 -98
- package/bundled/skills/prizmkit-test/references/trusted-evidence-execution.md +97 -0
- package/bundled/skills/prizmkit-test/scripts/build_test_evidence.py +723 -0
- package/bundled/skills/prizmkit-test/scripts/validate_test_evidence.py +1426 -0
- package/package.json +1 -1
- package/bundled/skills/prizmkit-test/scripts/validate_boundary_report.py +0 -347
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
{
|
|
2
|
+
"protocol_version": "1.0",
|
|
3
|
+
"records": {
|
|
4
|
+
"change_classification": "change-classification.json",
|
|
5
|
+
"scope": "scope.json",
|
|
6
|
+
"target_inventory": "target-inventory.json",
|
|
7
|
+
"environment": "environment.json",
|
|
8
|
+
"behavior_risk_matrix": "behavior-risk-matrix.json",
|
|
9
|
+
"test_plan": "test-plan.json",
|
|
10
|
+
"infrastructure_changes": "infrastructure-changes.json",
|
|
11
|
+
"differential_proof": "differential-proof.json",
|
|
12
|
+
"executions": "executions.json",
|
|
13
|
+
"verdict": "verdict.json",
|
|
14
|
+
"validation": "validation.json",
|
|
15
|
+
"source_patch": "source-change.patch",
|
|
16
|
+
"derived_report": "test-report.md"
|
|
17
|
+
},
|
|
18
|
+
"directories": {
|
|
19
|
+
"requests": "requests/",
|
|
20
|
+
"receipts": "receipts/",
|
|
21
|
+
"raw_outputs": "raw/",
|
|
22
|
+
"generated_test_snapshots": "generated-tests/",
|
|
23
|
+
"contract_snapshots": "contracts/"
|
|
24
|
+
},
|
|
25
|
+
"stage_statuses": [
|
|
26
|
+
{
|
|
27
|
+
"name": "CHANGE_CLASSIFY",
|
|
28
|
+
"status": "pending",
|
|
29
|
+
"input_sha256": "<sha256>",
|
|
30
|
+
"outputs": []
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"name": "SCOPE_DISCOVER",
|
|
34
|
+
"status": "pending",
|
|
35
|
+
"input_sha256": "<sha256>",
|
|
36
|
+
"outputs": []
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"name": "CONTRACT_MODEL",
|
|
40
|
+
"status": "pending",
|
|
41
|
+
"input_sha256": "<sha256>",
|
|
42
|
+
"outputs": []
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"name": "TEST_PLAN",
|
|
46
|
+
"status": "pending",
|
|
47
|
+
"input_sha256": "<sha256>",
|
|
48
|
+
"outputs": []
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"name": "INFRA_READY",
|
|
52
|
+
"status": "pending",
|
|
53
|
+
"input_sha256": "<sha256>",
|
|
54
|
+
"outputs": []
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"name": "TEST_BUILD",
|
|
58
|
+
"status": "pending",
|
|
59
|
+
"input_sha256": "<sha256>",
|
|
60
|
+
"outputs": []
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"name": "EXECUTE_PROVE",
|
|
64
|
+
"status": "pending",
|
|
65
|
+
"input_sha256": "<sha256>",
|
|
66
|
+
"outputs": []
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"name": "EVIDENCE_PACKAGE",
|
|
70
|
+
"status": "pending",
|
|
71
|
+
"input_sha256": "<sha256>",
|
|
72
|
+
"outputs": []
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"name": "EVIDENCE_VALIDATE",
|
|
76
|
+
"status": "pending",
|
|
77
|
+
"input_sha256": "<sha256>",
|
|
78
|
+
"outputs": []
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
"resume": {
|
|
82
|
+
"last_valid_stage": null,
|
|
83
|
+
"current_target_hashes": {
|
|
84
|
+
"source": "<sha256>",
|
|
85
|
+
"tests": "<sha256>",
|
|
86
|
+
"contracts": "<sha256>",
|
|
87
|
+
"lockfiles": "<sha256>",
|
|
88
|
+
"environment": "<sha256>",
|
|
89
|
+
"plan": "<sha256>"
|
|
90
|
+
},
|
|
91
|
+
"preserve_prior_executions": true,
|
|
92
|
+
"invalidate_downstream_on_input_change": true,
|
|
93
|
+
"semantic_review_required": true
|
|
94
|
+
},
|
|
95
|
+
"required_notice": "Evidence contains complete project-controlled command, environment, and output values. The project owns access control, retention, and upload policy. Production credentials, production services, and destructive real-data operations are prohibited.",
|
|
96
|
+
"compatibility": "legacy-test-report-interface-not-supported"
|
|
97
|
+
}
|
|
@@ -1,220 +1,104 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Behavior-Risk Completeness Protocol
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This protocol replaces interface-count and line-coverage completion with observable behavior/risk evidence. The authoritative matrix is `behavior-risk-matrix.json`, validated against `${SKILL_DIR}/assets/behavior-risk-matrix.schema.json`.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Affected Module Boundary
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Use an explicit project module when available. Otherwise derive a cohesive boundary from files that jointly implement one observable responsibility. Record the boundary decision, every declared module root, and every discovered file. Every changed file must appear in inventory or an evidence-backed exclusion.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|--------|-----------|--------------|------------|--------------------|-------------------------------|-------------------|-------------------------|-------------|-------------------|-------------------|-------------------|-------------|--------------|
|
|
11
|
-
| auth | POST /auth/login | Auth / Session | covered | generated | N/A — public route | generated | N/A — no collection input | N/A — no date input | covered | skipped — password hasher not injectable | covered | ... | boundary-covered |
|
|
9
|
+
Inventory discovery is a guard against obvious omissions, not a deterministic proof of semantic completeness. Static patterns cannot fully resolve reflection, registration, generated code, runtime configuration, or business concepts spread across unexpected files; preserve those as model judgment or unresolved edges.
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
- **Primary Scope:** all observable behavior of the affected module.
|
|
12
|
+
- **Regression Ring:** direct callers, consumers, shared contracts, and state dependencies.
|
|
13
|
+
- **Unresolved Edges:** dynamic or unprovable coupling, each marked verdict-capable or informational.
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
Changed lines locate the module but do not define completeness. A verdict-capable unresolved edge prevents `TEST_PASS`.
|
|
16
16
|
|
|
17
|
-
-
|
|
18
|
-
- `generated` — this run generated a test and the test passed.
|
|
19
|
-
- `needs-review` — a generated test is valid, but production behavior mismatched the expected contract.
|
|
20
|
-
- `unresolved` — the test could not be made runnable after the allowed fix attempts.
|
|
21
|
-
- `skipped` — not applicable or not practical in this run, with a concrete reason in `N/A Reasons`.
|
|
22
|
-
- `boundary-missing` — applicable boundary exists but no test covers it yet.
|
|
17
|
+
## Behavior-Risk Matrix
|
|
23
18
|
|
|
24
|
-
|
|
19
|
+
For each public observable behavior, record:
|
|
25
20
|
|
|
26
|
-
|
|
21
|
+
| Dimension | Required Content |
|
|
22
|
+
|-----------|------------------|
|
|
23
|
+
| Public behavior | User/caller-observable capability or guarantee |
|
|
24
|
+
| Contract source | Specification, machine-readable contract, acceptance condition, trusted test, caller, or implementation |
|
|
25
|
+
| Preconditions | Required identity, state, configuration, or dependency state |
|
|
26
|
+
| Inputs | Valid classes, empty/null/type/format variants |
|
|
27
|
+
| Boundaries | Contract-defined min/max/exact transition values |
|
|
28
|
+
| Outputs | Values, errors, response shape, generated identifiers |
|
|
29
|
+
| Side effects | Writes, calls, events, files, messages, or absence of partial effects |
|
|
30
|
+
| State transitions | Before/after state and idempotent/retry semantics |
|
|
31
|
+
| Error behavior | Validation, authorization, dependency, timeout, and malformed-response outcomes |
|
|
32
|
+
| Risks | Functional, boundary, permission, concurrency, idempotency, time, dependency, consumer |
|
|
27
33
|
|
|
28
|
-
|
|
29
|
-
2. Every applicable boundary category is `covered`, `generated`, or `needs-review`.
|
|
30
|
-
3. Every non-applicable category has a concrete reason.
|
|
31
|
-
4. No applicable category remains `boundary-missing`.
|
|
32
|
-
5. The final status is one of:
|
|
33
|
-
- `boundary-covered`
|
|
34
|
-
- `generated-needs-review`
|
|
35
|
-
- `skipped-with-reason`
|
|
34
|
+
Every risk cell is:
|
|
36
35
|
|
|
37
|
-
|
|
36
|
+
- `applicable`: mapped to one or more actual test IDs and execution IDs;
|
|
37
|
+
- `not_applicable`: a structured decision containing behavior-specific rationale, typed evidence, considered signals, and explanations for every detected conflict;
|
|
38
|
+
- `unresolved`: missing truth, testability, execution, or proof.
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
The model decides applicability from project semantics. The validator checks the structure and obvious signal conflicts only: identity/role/tenant suggests permission risk; locks/shared mutable state/workers suggest concurrency; retry/dedup/idempotency keys suggest idempotency; timeout/TTL/expiry suggests time; clients/contracts/network/storage suggest dependency; callers/consumers/shared contracts suggest consumer risk. A detected signal does not force applicability when the structured conflict explanation and evidence establish why it is irrelevant.
|
|
40
41
|
|
|
41
|
-
|
|
42
|
+
“Covered by happy path,” “probably fine,” or bare “N/A” is invalid rationale.
|
|
42
43
|
|
|
43
|
-
|
|
44
|
-
- creates the boundary input, state, dependency failure, or authorization context,
|
|
45
|
-
- asserts the expected error code, exception, state change, response shape, or side effect,
|
|
46
|
-
- verifies behavior rather than only checking that the call returned a response.
|
|
44
|
+
## Truth Resolution
|
|
47
45
|
|
|
48
|
-
|
|
46
|
+
Use this precedence and record the consulted sources:
|
|
49
47
|
|
|
50
|
-
|
|
51
|
-
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
1. specification;
|
|
49
|
+
2. machine-readable contract;
|
|
50
|
+
3. acceptance condition;
|
|
51
|
+
4. trusted existing test;
|
|
52
|
+
5. caller/consumer;
|
|
53
|
+
6. current implementation.
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
Do not freeze a possible current implementation bug into a characterization test. Conflicting higher-precedence sources that cannot be resolved produce `TEST_BLOCKED`.
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
## Applicable Risk Guidance
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
### Functional and Boundary
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
- missing required fields,
|
|
63
|
-
- empty string / empty array / empty object,
|
|
64
|
-
- malformed JSON or wrong content type when the framework exposes that behavior,
|
|
65
|
-
- wrong type,
|
|
66
|
-
- unsupported enum,
|
|
67
|
-
- invalid numeric values: zero, negative, min/max, just above max,
|
|
68
|
-
- invalid string format: URL, email, phone, date, timestamp, UUID/ULID, object key.
|
|
61
|
+
Cover typical/minimal/complex valid inputs; null/empty/wrong type; numeric/string/collection limits; malformed formats; output/error shape; every contract-relevant branch. Do not mechanically test private branches with no observable effect.
|
|
69
62
|
|
|
70
|
-
###
|
|
63
|
+
### Permission
|
|
71
64
|
|
|
72
|
-
|
|
65
|
+
Apply for identity, role, tenant, ownership, policy, entitlement, secret, or protected-resource behavior. Include missing/invalid identity, wrong owner/tenant, insufficient grant, and default-deny behavior.
|
|
73
66
|
|
|
74
|
-
|
|
75
|
-
- missing auth,
|
|
76
|
-
- malformed auth header,
|
|
77
|
-
- invalid/expired/revoked token,
|
|
78
|
-
- authenticated user accessing another user's resource,
|
|
79
|
-
- missing role/permission/entitlement,
|
|
80
|
-
- default-deny when ownership cannot be proven.
|
|
67
|
+
### Concurrency
|
|
81
68
|
|
|
82
|
-
|
|
69
|
+
Apply when shared mutable state, locks, optimistic versions, duplicate workers/calls, race-prone caches, or transaction ordering can change observable results. Use deterministic coordination rather than timing sleeps.
|
|
83
70
|
|
|
84
|
-
|
|
71
|
+
### Idempotency
|
|
85
72
|
|
|
86
|
-
|
|
87
|
-
- ratios or totals that must sum to a value,
|
|
88
|
-
- start date before end date,
|
|
89
|
-
- calorie/weight/amount ranges,
|
|
90
|
-
- unsupported lifecycle status,
|
|
91
|
-
- duplicate unique identifiers,
|
|
92
|
-
- device binding requirements,
|
|
93
|
-
- token rotation/reuse semantics,
|
|
94
|
-
- image quality / provider classification rules,
|
|
95
|
-
- product-specific thresholds such as 90%-110% calorie hit boundaries.
|
|
73
|
+
Apply to retries, deduplication keys, create/update/delete repetition, webhook/job replay, token rotation, and state transitions. Assert both result and side-effect count.
|
|
96
74
|
|
|
97
|
-
###
|
|
75
|
+
### Time
|
|
98
76
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
Use when the interface creates, updates, deletes, confirms, unbinds, retries, logs out, refreshes, or changes status.
|
|
128
|
-
|
|
129
|
-
Generate applicable cases for:
|
|
130
|
-
- create then read,
|
|
131
|
-
- update sets expected derived fields,
|
|
132
|
-
- delete excludes from later reads,
|
|
133
|
-
- double delete / unbind idempotency when specified,
|
|
134
|
-
- refresh rotates token and rejects old token,
|
|
135
|
-
- batch operation with empty list vs explicit IDs,
|
|
136
|
-
- retry count below/at/above max,
|
|
137
|
-
- no partial writes when one operation fails.
|
|
138
|
-
|
|
139
|
-
### Dependency Failure
|
|
140
|
-
|
|
141
|
-
Use when collaborators are mockable or the test layer can safely simulate failures.
|
|
142
|
-
|
|
143
|
-
Generate applicable cases for:
|
|
144
|
-
- repository/database error,
|
|
145
|
-
- storage/signing provider failure,
|
|
146
|
-
- SMS/push/email provider failure,
|
|
147
|
-
- LLM/API client error,
|
|
148
|
-
- timeout/network failure,
|
|
149
|
-
- malformed provider response,
|
|
150
|
-
- ID/random/clock failure when injectable.
|
|
151
|
-
|
|
152
|
-
If a dependency cannot be mocked in the current test layer, mark it `skipped` with a reason and consider a lower-level unit test where it can be mocked.
|
|
153
|
-
|
|
154
|
-
### Response Contract
|
|
155
|
-
|
|
156
|
-
Use for API endpoints and public adapters.
|
|
157
|
-
|
|
158
|
-
Generate applicable cases for:
|
|
159
|
-
- unified envelope fields (`code`, `message`, `data`) or framework-specific response format,
|
|
160
|
-
- fixed business error codes,
|
|
161
|
-
- response field names and snake_case/camelCase contract,
|
|
162
|
-
- omitted vs empty data shape,
|
|
163
|
-
- generated IDs and derived fields,
|
|
164
|
-
- side-effect visibility in response.
|
|
165
|
-
|
|
166
|
-
## Endpoint and Interface Mapping
|
|
167
|
-
|
|
168
|
-
Use names, routes, methods, schemas, binding tags, repository calls, and service logic to choose categories. When names and behavior disagree, trust behavior.
|
|
169
|
-
|
|
170
|
-
| Pattern | Likely Categories |
|
|
171
|
-
|---------|-------------------|
|
|
172
|
-
| register / signup / create user | request validation, auth/session, domain invariants, dependency failure, response contract |
|
|
173
|
-
| login | request validation, auth/session, rate limit, token response, dependency failure |
|
|
174
|
-
| refresh / logout | token state, rotation/revocation, idempotency, dependency failure |
|
|
175
|
-
| get / detail | auth/ownership, not found, response contract, dependency failure |
|
|
176
|
-
| list / search / trends | auth, filters, pagination/empty result, date range, response contract, dependency failure |
|
|
177
|
-
| create | request validation, domain invariants, state transition, dependency failure, response contract |
|
|
178
|
-
| update / set goal / confirm | request validation, ownership, partial update semantics, domain invariants, state transition |
|
|
179
|
-
| delete / unbind | request validation, ownership, not found, soft delete, double operation behavior |
|
|
180
|
-
| upload / sign url | request validation, file/storage rules, provider failure, response contract |
|
|
181
|
-
| AI / provider / recognize | request validation, date/time, provider error mapping, quality classifications, async job state |
|
|
182
|
-
| stats / analytics | date range, empty data, boundary thresholds, response shape, dependency failure |
|
|
183
|
-
| achievement / streak | empty state, date continuity, threshold boundaries, state persistence |
|
|
184
|
-
|
|
185
|
-
## N/A Reason Rules
|
|
186
|
-
|
|
187
|
-
A skipped category must explain why it does not apply or why it cannot be exercised at this level.
|
|
188
|
-
|
|
189
|
-
Good reasons:
|
|
190
|
-
- `N/A — public route; no authenticated principal expected`
|
|
191
|
-
- `N/A — endpoint has no collection input or paginated response`
|
|
192
|
-
- `N/A — dependency is not injectable at handler level; covered by service unit test`
|
|
193
|
-
- `N/A — function is pure and has no stateful side effects`
|
|
194
|
-
- `N/A — E2E skipped because project has no UI layer`
|
|
195
|
-
|
|
196
|
-
Bad reasons:
|
|
197
|
-
- `N/A`
|
|
198
|
-
- `not tested`
|
|
199
|
-
- `probably fine`
|
|
200
|
-
- `covered by happy path`
|
|
201
|
-
|
|
202
|
-
## Report Requirements
|
|
203
|
-
|
|
204
|
-
The final report must include:
|
|
205
|
-
|
|
206
|
-
1. The Boundary Matrix.
|
|
207
|
-
2. A Completion Gate summary:
|
|
208
|
-
- interfaces total,
|
|
209
|
-
- boundary-covered count,
|
|
210
|
-
- generated-needs-review count,
|
|
211
|
-
- skipped-with-reason count,
|
|
212
|
-
- boundary-missing count,
|
|
213
|
-
- happy-path-only count.
|
|
214
|
-
3. A clear final status:
|
|
215
|
-
- `All tests passing and boundary coverage complete`, or
|
|
216
|
-
- `Tests passing, but boundary coverage incomplete`, or
|
|
217
|
-
- `Tests failing`, or
|
|
218
|
-
- `Needs human review`.
|
|
219
|
-
|
|
220
|
-
If any interface remains `boundary-missing` or `happy-path-only`, the final report must not say "ready for commit" without qualifying that boundary coverage is incomplete.
|
|
77
|
+
Apply to expiry, schedules, windows, date ranges, TTL, time zones, and clock-sensitive signatures. Control the clock and test exact boundary plus before/after.
|
|
78
|
+
|
|
79
|
+
### Dependency
|
|
80
|
+
|
|
81
|
+
Apply to databases, filesystems, queues, providers, clocks/randomness, cross-module adapters, and network clients. Use contract-driven doubles and assert failure mapping, no partial side effects, retry bounds, and cleanup.
|
|
82
|
+
|
|
83
|
+
### Consumer
|
|
84
|
+
|
|
85
|
+
Apply when callers depend on return shape, errors, side effects, ordering, generated assets, shared types/contracts, state, or invocation conventions. Regression Ring executions prove these assumptions.
|
|
86
|
+
|
|
87
|
+
## Completion Rule
|
|
88
|
+
|
|
89
|
+
The affected module is complete only when:
|
|
90
|
+
|
|
91
|
+
1. every observable behavior is represented;
|
|
92
|
+
2. every applicable risk has tests and reliable execution evidence;
|
|
93
|
+
3. every N/A cell has a concrete rationale;
|
|
94
|
+
4. every necessary new/changed test has differential proof;
|
|
95
|
+
5. complete affected-module regression passes;
|
|
96
|
+
6. Regression Ring verification passes;
|
|
97
|
+
7. no verdict-capable unresolved edge remains;
|
|
98
|
+
8. cleanup and deterministic package validation succeed.
|
|
99
|
+
|
|
100
|
+
Line, branch, and function coverage are diagnostic signals for possible omitted behavior. They never substitute for matrix evidence and no mechanical threshold is required.
|
|
101
|
+
|
|
102
|
+
## Derived Markdown
|
|
103
|
+
|
|
104
|
+
`test-report.md` may render a compact matrix summary, but it is not authoritative. The JSON matrix and hashed test/execution records control the verdict. Editing the report or any linked artifact without regenerating hashes must fail deterministic validation.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Contract-Driven Mock Protocol
|
|
2
|
+
|
|
3
|
+
Use this protocol for external databases, queues, filesystems, SaaS APIs, browser-facing backends, generated clients, and cross-module endpoints. Code-level evidence is mock-first; linking a real test database or deployed environment is outside `/prizmkit-test`.
|
|
4
|
+
|
|
5
|
+
## Contract Source Precedence
|
|
6
|
+
|
|
7
|
+
Use the highest available source:
|
|
8
|
+
|
|
9
|
+
1. Shared machine-readable contract used by producer and consumer: OpenAPI, JSON Schema, Protocol Buffers, GraphQL schema, database schema, AsyncAPI, shared language types, or generated client model.
|
|
10
|
+
2. Versioned contract fixture already stored by the target project.
|
|
11
|
+
3. Locally derived contract fixture built from a named source such as public adapter types, caller expectations, migration schema, provider documentation snapshot, or captured non-production example already authorized for the project.
|
|
12
|
+
|
|
13
|
+
Never invent request/response fields independently when a shared source exists. Never derive expected behavior only from the changed implementation when a higher-precedence source disagrees.
|
|
14
|
+
|
|
15
|
+
## Required Contract Snapshot
|
|
16
|
+
|
|
17
|
+
Copy the exact contract input into `contracts/` and record:
|
|
18
|
+
|
|
19
|
+
- contract ID and version when available;
|
|
20
|
+
- source path or derivation source;
|
|
21
|
+
- SHA-256;
|
|
22
|
+
- producer and consumer/module names;
|
|
23
|
+
- derivation command or steps;
|
|
24
|
+
- unsupported or ambiguous fields;
|
|
25
|
+
- whether it represents an external provider, local module, or persistence boundary.
|
|
26
|
+
|
|
27
|
+
If derivation is not reproducible or sources conflict, add an Unresolved Edge and issue `TEST_BLOCKED` when it can affect the verdict.
|
|
28
|
+
|
|
29
|
+
## Building Doubles
|
|
30
|
+
|
|
31
|
+
Generate or configure fakes, mocks, fixtures, and mock servers from the contract snapshot. Verify both request and response directions where applicable:
|
|
32
|
+
|
|
33
|
+
- required/optional fields and nullability;
|
|
34
|
+
- field names, types, enums, formats, and bounds;
|
|
35
|
+
- status/error variants;
|
|
36
|
+
- stateful sequence or transition rules;
|
|
37
|
+
- pagination/cursor semantics;
|
|
38
|
+
- idempotency, time, and concurrency behavior;
|
|
39
|
+
- malformed, timeout, and dependency-failure variants.
|
|
40
|
+
|
|
41
|
+
A mock-success-only double is insufficient. Record the matrix behavior/risk cells each double supports and the tests/executions that exercised them.
|
|
42
|
+
|
|
43
|
+
## Databases and Stateful Services
|
|
44
|
+
|
|
45
|
+
Prefer an in-memory fake or isolated disposable service only when it preserves the contract being tested. Do not point code-level tests at production or a user-linked deployed test database. For database adapters, derive the fixture from schema/migrations/shared models and test transaction, constraint, rollback, and error behavior relevant to the affected module.
|
|
46
|
+
|
|
47
|
+
Any isolated resource must have a unique identifier, bounded lifetime, and verified cleanup. Cleanup failure produces `TEST_BLOCKED`.
|
|
48
|
+
|
|
49
|
+
## Real-Environment Separation
|
|
50
|
+
|
|
51
|
+
Every package and report must state:
|
|
52
|
+
|
|
53
|
+
- `environment_claim=mocked-code-level-only`
|
|
54
|
+
- Mocked code-level evidence does not verify a real deployed environment.
|
|
55
|
+
- Real test-environment, production, credential, network policy, data migration, and operational validation require a separate authorized process.
|
|
56
|
+
|
|
57
|
+
Reject a package that claims deployment/environment verification from contract mocks, local fakes, containers, or isolated services.
|
|
58
|
+
|
|
59
|
+
## Prohibitions
|
|
60
|
+
|
|
61
|
+
- No production credentials, databases, queues, APIs, object storage, or real user data.
|
|
62
|
+
- No destructive operation against external data.
|
|
63
|
+
- No independently invented incompatible mock contract.
|
|
64
|
+
- No silent contract drift.
|
|
65
|
+
- No automatic upload of complete raw evidence; the project owns access, retention, and upload policy.
|