prizmkit 1.1.140 → 1.1.142

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 (83) hide show
  1. package/bundled/VERSION.json +3 -3
  2. package/bundled/dev-pipeline/README.md +1 -1
  3. package/bundled/dev-pipeline/prizmkit_runtime/checkpoint_state.py +165 -125
  4. package/bundled/dev-pipeline/prizmkit_runtime/runner_classification.py +13 -1
  5. package/bundled/dev-pipeline/prizmkit_runtime/runner_models.py +0 -6
  6. package/bundled/dev-pipeline/prizmkit_runtime/runners.py +5 -3
  7. package/bundled/dev-pipeline/prizmkit_runtime/test_result.py +160 -0
  8. package/bundled/dev-pipeline/scripts/check-session-status.py +11 -1
  9. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +23 -806
  10. package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +6 -8
  11. package/bundled/dev-pipeline/scripts/generate-recovery-prompt.py +1 -1
  12. package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +6 -8
  13. package/bundled/dev-pipeline/scripts/prompt_framework.py +68 -56
  14. package/bundled/dev-pipeline/scripts/update-bug-status.py +21 -2
  15. package/bundled/dev-pipeline/scripts/update-checkpoint.py +52 -131
  16. package/bundled/dev-pipeline/scripts/update-feature-status.py +21 -2
  17. package/bundled/dev-pipeline/scripts/update-refactor-status.py +21 -2
  18. package/bundled/dev-pipeline/templates/bootstrap-prompt.md +3 -3
  19. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +8 -19
  20. package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +6 -6
  21. package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +5 -5
  22. package/bundled/dev-pipeline/templates/sections/bugfix-phase-commit-report.md +1 -1
  23. package/bundled/dev-pipeline/templates/sections/bugfix-phase-diagnose-plan.md +1 -1
  24. package/bundled/dev-pipeline/templates/sections/bugfix-phase-manual-verification.md +1 -1
  25. package/bundled/dev-pipeline/templates/sections/bugfix-phase-review.md +1 -1
  26. package/bundled/dev-pipeline/templates/sections/bugfix-phase-test.md +13 -10
  27. package/bundled/dev-pipeline/templates/sections/bugfix-reminders.md +1 -1
  28. package/bundled/dev-pipeline/templates/sections/checkpoint-system.md +18 -9
  29. package/bundled/dev-pipeline/templates/sections/headless-commit-authorization.md +1 -1
  30. package/bundled/dev-pipeline/templates/sections/phase-commit-full.md +1 -1
  31. package/bundled/dev-pipeline/templates/sections/phase-commit.md +1 -1
  32. package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-agent-suffix.md +2 -2
  33. package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-base.md +1 -1
  34. package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-lite-suffix.md +1 -1
  35. package/bundled/dev-pipeline/templates/sections/phase-implement-lite.md +1 -1
  36. package/bundled/dev-pipeline/templates/sections/phase-prizmkit-test.md +14 -26
  37. package/bundled/dev-pipeline/templates/sections/phase-review-full.md +2 -2
  38. package/bundled/dev-pipeline/templates/sections/phase-specify-plan-full.md +3 -3
  39. package/bundled/dev-pipeline/templates/sections/refactor-phase-review.md +1 -1
  40. package/bundled/dev-pipeline/templates/sections/refactor-phase-test.md +13 -10
  41. package/bundled/dev-pipeline/templates/sections/refactor-reminders.md +1 -1
  42. package/bundled/dev-pipeline/templates/session-status-schema.json +1 -1
  43. package/bundled/dev-pipeline/tests/test_checkpoint_state.py +494 -413
  44. package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +144 -684
  45. package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +20 -41
  46. package/bundled/dev-pipeline/tests/test_generate_refactor_prompt.py +24 -24
  47. package/bundled/dev-pipeline/tests/test_python_runner_parity.py +176 -36
  48. package/bundled/skills/_metadata.json +6 -6
  49. package/bundled/skills/prizmkit/SKILL.md +13 -18
  50. package/bundled/skills/prizmkit/references/workflow-state-protocol.md +73 -80
  51. package/bundled/skills/prizmkit-code-review/SKILL.md +7 -7
  52. package/bundled/skills/prizmkit-code-review/references/workflow-state-protocol.md +73 -80
  53. package/bundled/skills/prizmkit-committer/SKILL.md +8 -7
  54. package/bundled/skills/prizmkit-committer/references/workflow-state-protocol.md +73 -80
  55. package/bundled/skills/prizmkit-implement/SKILL.md +3 -2
  56. package/bundled/skills/prizmkit-implement/references/workflow-state-protocol.md +73 -80
  57. package/bundled/skills/prizmkit-plan/SKILL.md +2 -1
  58. package/bundled/skills/prizmkit-plan/references/workflow-state-protocol.md +73 -80
  59. package/bundled/skills/prizmkit-retrospective/SKILL.md +8 -6
  60. package/bundled/skills/prizmkit-retrospective/references/workflow-state-protocol.md +73 -80
  61. package/bundled/skills/prizmkit-test/SKILL.md +217 -189
  62. package/bundled/skills/prizmkit-test/references/external-contract-mock-guidance.md +119 -0
  63. package/bundled/skills/prizmkit-test/references/independent-test-review.md +269 -0
  64. package/bundled/skills/prizmkit-test/references/test-coverage-model.md +193 -0
  65. package/bundled/skills/prizmkit-test/references/test-report-template.md +164 -79
  66. package/bundled/skills/prizmkit-workflow/SKILL.md +28 -36
  67. package/bundled/skills/prizmkit-workflow/references/workflow-state-protocol.md +73 -80
  68. package/package.json +1 -1
  69. package/bundled/skills/prizmkit-test/assets/authoritative-records.schema.json +0 -477
  70. package/bundled/skills/prizmkit-test/assets/behavior-risk-matrix.schema.json +0 -116
  71. package/bundled/skills/prizmkit-test/assets/evidence-manifest.schema.json +0 -111
  72. package/bundled/skills/prizmkit-test/assets/evidence-package-template.json +0 -66
  73. package/bundled/skills/prizmkit-test/references/boundary-coverage-protocol.md +0 -104
  74. package/bundled/skills/prizmkit-test/references/contract-mock-protocol.md +0 -65
  75. package/bundled/skills/prizmkit-test/references/evidence-protocol.md +0 -208
  76. package/bundled/skills/prizmkit-test/references/evidence-request-protocol.md +0 -80
  77. package/bundled/skills/prizmkit-test/references/examples.md +0 -100
  78. package/bundled/skills/prizmkit-test/references/service-boundary-test-catalog.md +0 -228
  79. package/bundled/skills/prizmkit-test/references/test-generation-steps.md +0 -118
  80. package/bundled/skills/prizmkit-test/references/trusted-evidence-execution.md +0 -107
  81. package/bundled/skills/prizmkit-test/references/workflow-state-protocol.md +0 -181
  82. package/bundled/skills/prizmkit-test/scripts/build_test_evidence.py +0 -1930
  83. package/bundled/skills/prizmkit-test/scripts/validate_test_evidence.py +0 -1847
@@ -0,0 +1,119 @@
1
+ # External Contract Mock Guidance
2
+
3
+ ## Purpose
4
+
5
+ Use traceable contracts to model external services, persistence, filesystems, queues, generated clients, browser-facing backends, and cross-module endpoints without connecting tests to production targets or inventing provider behavior.
6
+
7
+ Mocks are test tools, not proof of a deployed environment.
8
+
9
+ ## Contract Source Order
10
+
11
+ Use the highest available source:
12
+
13
+ 1. project-owned OpenAPI, JSON Schema, Protocol Buffers, GraphQL, AsyncAPI, database schema, generated types, SDK interfaces, fixtures, and documentation;
14
+ 2. vendored or lock-version-matched dependency documentation;
15
+ 3. public official service documentation obtained through approved read-only web retrieval;
16
+ 4. observed non-production behavior only when explicitly authorized and safely isolated.
17
+
18
+ Use the current locked/provider version when behavior differs by version. Record the source path, public URL, document/version identifier, or generated type used in `test-report.md`.
19
+
20
+ Never invent fields, statuses, error shapes, retry rules, pagination behavior, ordering, or timing guarantees without a traceable source.
21
+
22
+ ## Safe Documentation Retrieval
23
+
24
+ Public official documentation retrieval may be used only to read the minimum contract material needed for tests.
25
+
26
+ - Do not send source code, repository-private content, proprietary payloads, secrets, credentials, or user data to a public endpoint.
27
+ - Prefer a project-local or vendored source when it is authoritative.
28
+ - Distinguish official provider documentation from blogs, examples, forum answers, and third-party tutorials.
29
+ - When official sources conflict with the project's pinned generated client or schema, apply the skill's truth precedence and report the conflict.
30
+ - If the required contract cannot be established, return `TEST_BLOCKED` when it prevents a safe verdict.
31
+
32
+ ## Build the Smallest Faithful Double
33
+
34
+ Use the target project's existing fake, fixture, mock library, mock server, container, or isolated service when adequate. Model only behavior relevant to the affected module, but preserve the contract property being tested.
35
+
36
+ Applicable variants include:
37
+
38
+ - normal success;
39
+ - empty success;
40
+ - minimum, maximum, pagination, cursor, or size boundary;
41
+ - malformed or contract-invalid response;
42
+ - timeout or cancellation;
43
+ - rate limiting or quota rejection;
44
+ - authentication or authorization rejection;
45
+ - transient service failure;
46
+ - permanent service failure;
47
+ - partial response or interrupted stream;
48
+ - retry, replay, and idempotency behavior;
49
+ - transaction, constraint, rollback, or conflict behavior for stateful services.
50
+
51
+ Do not require every variant mechanically. Select variants from the actual behavior/risk model and explain material omissions.
52
+
53
+ ## Assertions
54
+
55
+ Assert the application's observable handling of the contract:
56
+
57
+ - outbound request shape, required headers or metadata, and serialization;
58
+ - response mapping, nullability, enum and format handling;
59
+ - retry count and retryable versus permanent classification;
60
+ - timeout and cancellation propagation;
61
+ - pagination and cursor behavior;
62
+ - idempotency and side-effect counts;
63
+ - state transition, rollback, cleanup, and absence of partial effects;
64
+ - consumer-visible error type or result.
65
+
66
+ A mock-success-only test is insufficient when dependency failure can change observable behavior.
67
+
68
+ ## Avoid Over-Mocking
69
+
70
+ Keep production composition real when that composition is the property under test. Mock at a stable external boundary rather than mocking the method being verified or every internal collaborator.
71
+
72
+ Reject a double when it:
73
+
74
+ - repeats the current implementation instead of the external contract;
75
+ - bypasses serialization, mapping, retries, or state transitions under test;
76
+ - returns impossible provider behavior;
77
+ - asserts only that a mock was called without proving the business result;
78
+ - silently drifts from the project or official contract.
79
+
80
+ Use contract/integration or isolated infrastructure tests when a mock cannot preserve the relevant transaction, protocol, or composition property.
81
+
82
+ ## Databases and Stateful Services
83
+
84
+ Prefer project-provided isolated infrastructure, a faithful local fake, or a disposable service. Derive structure and constraints from schemas, migrations, models, or official protocol contracts.
85
+
86
+ Any disposable resource must have:
87
+
88
+ - a unique non-production identity;
89
+ - bounded lifetime;
90
+ - deterministic setup;
91
+ - verified cleanup;
92
+ - no dependency on production credentials or data.
93
+
94
+ Test relevant constraints, transactions, rollback, concurrency, idempotency, and failure mapping. Cleanup failure that undermines reliability produces `TEST_BLOCKED`.
95
+
96
+ ## Production and Data Prohibitions
97
+
98
+ Never use:
99
+
100
+ - production credentials or tokens;
101
+ - production databases, APIs, queues, object storage, caches, or services;
102
+ - real customer or user data;
103
+ - a target whose non-production status cannot be established;
104
+ - destructive operations against external data.
105
+
106
+ Project configuration may be reused only when it demonstrably selects a safe isolated test target. If safety cannot be proven, do not connect; report the unexecuted check and return `TEST_BLOCKED` when it is necessary for the verdict.
107
+
108
+ ## Reporting
109
+
110
+ For every material external contract, record:
111
+
112
+ - dependency and behavior under test;
113
+ - contract source and version when available;
114
+ - mock/fake/isolated-service strategy;
115
+ - variants exercised;
116
+ - production resources used: `no`;
117
+ - unresolved fidelity or deployed-environment risk.
118
+
119
+ Do not claim that a local mock, fake, contract snapshot, container, or isolated service verifies a deployed production environment.
@@ -0,0 +1,269 @@
1
+ # Independent Test Review
2
+
3
+ ## Purpose
4
+
5
+ Run one optional independent semantic review after mandatory Main-Agent test construction, execution, and review have converged. The Reviewer determines whether the complete current tests credibly prove the affected business module and Regression Ring and whether the tests themselves are valid.
6
+
7
+ The Reviewer is not required to disagree. It returns `NO_CORRECTION_NEEDED` when no evidence-backed correction is justified.
8
+
9
+ This reference is complete within `prizmkit-test`. Do not depend on another skill's prompt or a platform-generated Reviewer role.
10
+
11
+ ## Required Ordering and Budget
12
+
13
+ ```text
14
+ Main Agent builds and executes project-native tests
15
+ → mandatory Main-Agent test review: maximum ten completed rounds
16
+ → optional independent Test Reviewer: maximum five responses
17
+ → final native regression
18
+ → TEST_PASS | TEST_NEEDS_FIXES | TEST_BLOCKED
19
+ ```
20
+
21
+ Create at most one Reviewer for this invocation. Reuse the exact same Reviewer through native continuation. Never reuse a Reviewer from another lifecycle stage and never create a replacement with a summary to simulate continuation.
22
+
23
+ ## Host Capability Gate
24
+
25
+ The gate is all-or-nothing. Before creating a Reviewer, the host must prove this semantic execution contract:
26
+
27
+ ```yaml
28
+ execution_unit:
29
+ count: 1
30
+ access: read-only
31
+ mutation: unavailable
32
+ arbitrary_command_execution: unavailable
33
+ downstream_execution: structurally-unavailable
34
+ context_continuation: same-unit-native-resume
35
+ workspace_observation: bounded-active-checkout-input
36
+ model_configuration: inherit-current-session
37
+ ```
38
+
39
+ Rules:
40
+
41
+ - Prompt instructions cannot satisfy a missing structural capability.
42
+ - Do not branch on platform identity, tool name, execution-unit type name, adapter output, or an allowlist.
43
+ - A general execution unit that merely promises not to mutate, execute commands, or delegate is ineligible while those capabilities remain available.
44
+ - The Reviewer inherits the current session's model configuration.
45
+ - If any capability is missing or unproven, create no Reviewer and use Strict Downgrade.
46
+
47
+ ## Bounded Immutable Review Input
48
+
49
+ Before every response, the Main Agent captures a complete input that remains immutable for that response:
50
+
51
+ ```text
52
+ test-review-input
53
+ ├── manifest
54
+ │ ├── response number and input identity
55
+ │ ├── exact changed production and test paths
56
+ │ ├── relevant unchanged path inventory
57
+ │ └── consistency markers
58
+ ├── change context
59
+ │ ├── requirement and acceptance criteria
60
+ │ ├── current production change
61
+ │ └── applicable project rules
62
+ ├── coverage context
63
+ │ ├── affected business module
64
+ │ ├── observable behaviors
65
+ │ ├── risk and boundary assessment
66
+ │ └── Regression Ring
67
+ ├── test context
68
+ │ ├── existing, added, and modified tests
69
+ │ ├── fixtures, mocks, and contracts
70
+ │ ├── selected test layers
71
+ │ └── native execution results
72
+ └── targeted supporting context
73
+ ├── relevant callers and consumers
74
+ ├── shared schemas and contracts
75
+ └── necessary public official contract excerpts
76
+ ```
77
+
78
+ The Reviewer does not run Git, tests, builds, network calls, or broad repository discovery. The Main Agent captures authoritative current state. Do not include secrets, credentials, production data, or unrelated private repository content.
79
+
80
+ Before ordinary review, the Reviewer verifies that manifest and content agree. Missing paths, unexplained changed files, stale content, or mixed-response input produces `REVIEW_BLOCKED`, never partial success.
81
+
82
+ ## Initial Reviewer Prompt
83
+
84
+ Instantiate bracketed fields and retain every execution boundary.
85
+
86
+ ```text
87
+ You are the sole independent Test Reviewer for this PrizmKit Test invocation.
88
+
89
+ Purpose:
90
+ Objectively determine whether the complete current project-native tests credibly prove the affected business module and Regression Ring and whether the tests themselves are valid. You are not an adversary and are not required to disagree. Return NO_CORRECTION_NEEDED when no evidence-backed correction is justified.
91
+
92
+ Response:
93
+ This is response [RESPONSE_NUMBER] of a maximum five responses.
94
+ Review-input identity: [INPUT_ID]
95
+ Manifest: [MANIFEST]
96
+ Change context: [CHANGE_CONTEXT]
97
+ Coverage context: [COVERAGE_CONTEXT]
98
+ Test context: [TEST_CONTEXT]
99
+ Targeted supporting context: [SUPPORTING_CONTEXT]
100
+
101
+ Execution boundaries:
102
+ - Complete this review personally.
103
+ - Do not create, schedule, resume, continue, request, or coordinate another execution unit.
104
+ - Do not ask the Main Agent to create a helper.
105
+ - Do not re-enter orchestration, delegation, another review workflow, or an equivalent process.
106
+ - Do not modify, create, delete, rename, stage, commit, or otherwise mutate files.
107
+ - Do not execute commands, tests, builds, network calls, or any operation that can change state.
108
+ - Read only the bounded review input and explicitly represented targeted supporting material.
109
+ - Do not perform broad repository discovery or a full repository scan.
110
+ - Report only corrections supported by a concrete target and evidence.
111
+ - Do not invent an issue merely to return feedback.
112
+ - Return REVIEW_BLOCKED rather than delegate or provide an incomplete success result.
113
+ - Do not expose private reasoning traces. Return only the required output.
114
+
115
+ First validate input consistency. Then review:
116
+ - requirement and acceptance-criteria coverage;
117
+ - complete observable behavior of the affected module;
118
+ - critical low-level logic and exact boundaries;
119
+ - functional, boundary, error, state, side-effect, permission, concurrency, idempotency, time, dependency, and consumer risks;
120
+ - Regression Ring completeness;
121
+ - selection of focused, module, contract/integration, applicable E2E, module-regression, and Regression Ring layers;
122
+ - assertion strength and observable effect;
123
+ - vacuous or false-positive tests and tests that cannot fail for the intended defect;
124
+ - over-mocking or removal of production composition;
125
+ - mock fidelity to project or public official contracts;
126
+ - nondeterminism and flakiness risk;
127
+ - native execution results matching the declared scope;
128
+ - production repairs that require delta Code Review;
129
+ - remaining risks being stated honestly.
130
+
131
+ Do not rewrite the requirement, modify code, execute tests, or perform broad exploration.
132
+ Return exactly one result using the Reviewer Output Protocol.
133
+ ```
134
+
135
+ ## Resume Prompt
136
+
137
+ Resume the exact same Reviewer. Do not create a new Reviewer with this prompt.
138
+
139
+ ```text
140
+ Continue as the same independent Test Reviewer.
141
+
142
+ Response:
143
+ This is response [RESPONSE_NUMBER] of a maximum five responses.
144
+ New review-input identity: [INPUT_ID]
145
+ New manifest: [MANIFEST]
146
+ Current change context: [CHANGE_CONTEXT]
147
+ Current coverage context: [COVERAGE_CONTEXT]
148
+ Current test context: [TEST_CONTEXT]
149
+ Current supporting context: [SUPPORTING_CONTEXT]
150
+ Previously accepted corrections: [ACCEPTED_CORRECTIONS_OR_NONE]
151
+ Repairs actually made: [REPAIRS_OR_NONE]
152
+ Main-Agent native verification: [VERIFICATION]
153
+ Previously rejected corrections and rejection evidence: [REJECTIONS_OR_NONE]
154
+ Unresolved items: [UNRESOLVED_OR_NONE]
155
+
156
+ All initial execution boundaries and the Reviewer Output Protocol remain mandatory. Review the complete current state, not only the repair and not the superseded input. Do not repeat a rejected correction unless the new state invalidates its rejection evidence. Validate the new input before ordinary review and return exactly one result.
157
+ ```
158
+
159
+ ## Reviewer Output Protocol
160
+
161
+ Return exactly one form. Do not add severity, confidence, dimension, workflow routing, or acceptance fields.
162
+
163
+ ### No Correction Needed
164
+
165
+ ```markdown
166
+ ### Result: NO_CORRECTION_NEEDED
167
+
168
+ ### Corrections
169
+ None.
170
+
171
+ ### Summary
172
+ <one or two sentences confirming the reviewed coverage and test validity>
173
+ ```
174
+
175
+ ### Correction Needed
176
+
177
+ ```markdown
178
+ ### Result: CORRECTION_NEEDED
179
+
180
+ ### Corrections
181
+
182
+ #### Correction 1
183
+ - Target: <behavior, risk, test, contract, caller, or execution>
184
+ - Problem: <what is missing or invalid>
185
+ - Evidence: <concrete basis or reproducible scenario>
186
+ - Correction: <required test or coverage correction>
187
+
188
+ ### Summary
189
+ <one or two sentences describing the current state>
190
+ ```
191
+
192
+ Every correction contains only `Target`, `Problem`, `Evidence`, and `Correction`.
193
+
194
+ ### Review Blocked
195
+
196
+ ```markdown
197
+ ### Result: REVIEW_BLOCKED
198
+
199
+ ### Blocker
200
+ - Target: <missing or inconsistent review input>
201
+ - Problem: <why complete review cannot be performed>
202
+ - Evidence: <concrete mismatch or missing fact>
203
+ - Correction: <what would unblock review>
204
+
205
+ ### Summary
206
+ No review verdict was produced.
207
+ ```
208
+
209
+ `REVIEW_BLOCKED` is an internal Reviewer result, not the final testing result.
210
+
211
+ ## Main-Agent Adjudication
212
+
213
+ The Main Agent verifies every proposed correction and records exactly one decision:
214
+
215
+ | Decision | Meaning | Action |
216
+ |---|---|---|
217
+ | `accepted` | Evidence proves an in-scope correction is required. | Repair tests or permitted production code, execute targeted and required regression tests, and perform a complete Main-Agent review round. |
218
+ | `rejected` | Code, contracts, tests, execution output, or rules disprove the problem. | Record concrete rejection evidence and make no change. |
219
+ | `unresolved` | Truth, correctness, input completeness, or safe repair cannot be established. | Return `TEST_BLOCKED`, or `TEST_NEEDS_FIXES` only when a known correction remains. |
220
+
221
+ The Reviewer never mutates files and cannot overrule adjudication.
222
+
223
+ Independent review converges when:
224
+
225
+ 1. the Reviewer returns `NO_CORRECTION_NEEDED`; or
226
+ 2. every correction in the current response is rejected with concrete evidence and no unresolved item remains.
227
+
228
+ ## Response Algorithm
229
+
230
+ 1. Run only after mandatory Main-Agent review converges with no unresolved finding.
231
+ 2. Apply the Host Capability Gate.
232
+ 3. If eligible, capture response-one input and create exactly one Reviewer with the Initial Reviewer Prompt.
233
+ 4. Validate the response against the output protocol and record it in the report.
234
+ 5. Adjudicate every correction and record accepted, rejected, or unresolved with evidence.
235
+ 6. For accepted corrections, the Main Agent repairs the current workspace, executes focused and required regressions, then performs a complete Main-Agent review round over the new state within its ten-round budget.
236
+ 7. If responses remain, capture the complete fresh input and natively resume the exact same Reviewer. Never create a replacement.
237
+ 8. If response five contains an accepted correction, do not repair and claim pass without independent recheck. Return `TEST_NEEDS_FIXES` with the known correction.
238
+ 9. If response five contains an unresolved correction or `REVIEW_BLOCKED` that cannot be corrected safely, return `TEST_BLOCKED`.
239
+ 10. Stop sending messages when the review converges, reaches its limit, or becomes blocked. Explicitly terminate the unit only when the host safely supports it.
240
+
241
+ ## Strict Downgrade
242
+
243
+ Use Strict Downgrade when:
244
+
245
+ - required capability is unavailable or unproven before creation;
246
+ - creation fails before a valid response;
247
+ - a required structural capability disappears;
248
+ - exact native resume fails after mutation.
249
+
250
+ Behavior:
251
+
252
+ 1. Never create a weaker or replacement Reviewer.
253
+ 2. Never create a fresh Reviewer with a summary; summary context is not native continuation.
254
+ 3. Before creation or before any valid response, record the downgrade and preserve the converged mandatory Main-Agent review.
255
+ 4. When resume fails after mutation, the old independent result no longer describes the final state. Rerun mandatory Main-Agent review over the mutation within its remaining budget, record the downgrade, and set `final_state_rechecked=false` for independent review.
256
+ 5. A semantic `REVIEW_BLOCKED` caused by incomplete or inconsistent required input is not silently downgraded. Correct the input and resume the same Reviewer within budget, or return `TEST_BLOCKED`.
257
+ 6. Strict Downgrade is visible reduced assurance, not a new testing result and not permission to weaken Main-Agent review or native test execution.
258
+
259
+ ## Report Recording
260
+
261
+ Record:
262
+
263
+ - capability gate outcome and downgrade reason;
264
+ - each response number `1..5`, input identity, result, and correction count;
265
+ - every Main-Agent adjudication and its evidence;
266
+ - actual repair and native verification;
267
+ - whether the exact final state was independently rechecked.
268
+
269
+ The report remains the human-readable test artifact. Do not create a separate Reviewer state machine or evidence package.
@@ -0,0 +1,193 @@
1
+ # Test Coverage Model
2
+
3
+ ## Purpose
4
+
5
+ Use this model to determine whether project-native tests adequately prove the complete affected business module and its concrete Regression Ring. It is a semantic working model and report input, not a persisted state machine or machine-attested evidence package.
6
+
7
+ ## Outside-In Scope
8
+
9
+ Start with behavior observable by a user, caller, consumer, or external contract. Trace each behavior inward:
10
+
11
+ ```text
12
+ business capability or acceptance criterion
13
+ ├── public entry point
14
+ ├── business rules and invariants
15
+ ├── state transitions and side effects
16
+ ├── critical low-level logic
17
+ ├── dependency and external contracts
18
+ └── callers, consumers, shared contracts, and shared state
19
+ ```
20
+
21
+ Changed lines locate possible impact. They do not define completeness.
22
+
23
+ ## Affected Business Module
24
+
25
+ Prefer an explicit project module. If none exists, derive one cohesive boundary from files that jointly implement one observable responsibility.
26
+
27
+ Primary Scope includes every discoverable observable behavior in that module, including relevant pre-existing behavior whose tests are incomplete. Do not expand into unrelated modules merely to increase coverage.
28
+
29
+ ## Regression Ring
30
+
31
+ Include only evidenced coupling:
32
+
33
+ - direct callers;
34
+ - consumers of return values, errors, events, files, or ordering;
35
+ - shared schemas, types, protocols, generated artifacts, and adapters;
36
+ - persistence, cache, lock, queue, transaction, or other shared state;
37
+ - registrations, configuration, or runtime discovery that concretely connects behavior.
38
+
39
+ Record dynamic or unprovable coupling as a remaining edge. An edge that can change the testing verdict prevents `TEST_PASS` until resolved.
40
+
41
+ ## Truth Precedence
42
+
43
+ Resolve expected behavior in this order:
44
+
45
+ 1. confirmed specification;
46
+ 2. machine-readable contract;
47
+ 3. acceptance criteria;
48
+ 4. trusted existing tests;
49
+ 5. callers and consumers;
50
+ 6. current implementation.
51
+
52
+ Do not encode a possible implementation defect as expected behavior. Conflicting higher-precedence truth that cannot be resolved produces `TEST_BLOCKED`.
53
+
54
+ ## Behavior Inventory
55
+
56
+ For each observable behavior, capture enough working context to answer:
57
+
58
+ | Concern | Questions |
59
+ |---|---|
60
+ | Preconditions | Which identity, state, configuration, or dependency state is required? |
61
+ | Inputs | Which valid, minimal, complex, empty, null, malformed, type, and format classes matter? |
62
+ | Boundaries | What happens before, at, and after exact contract limits or transitions? |
63
+ | Outputs | Which values, errors, response shapes, ordering, and identifiers are observable? |
64
+ | Side effects | Which writes, calls, events, files, messages, counts, ordering, or absences are required? |
65
+ | State | What are the valid and invalid transitions, retry behavior, and repeated-call outcomes? |
66
+ | Dependencies | Which success, empty, malformed, timeout, rate-limit, and failure responses matter? |
67
+ | Consumers | Which return shapes, errors, events, ordering, shared contracts, and invocation assumptions must remain stable? |
68
+
69
+ Working notes may be lightweight. The final report summarizes the model; no JSON matrix, IDs, hashes, or attestation records are required.
70
+
71
+ ## Risk Dimensions
72
+
73
+ Assess every dimension for every behavior. A dimension can be inapplicable, but the report must give a concise behavior-specific reason when omission would otherwise be surprising.
74
+
75
+ ### Functional
76
+
77
+ Cover normal, minimal, and complex valid inputs and every contract-relevant observable branch.
78
+
79
+ ### Boundary
80
+
81
+ Cover empty/null, exact minimum and maximum, before/at/after transitions, malformed formats, collection limits, overflow, and truncation where relevant.
82
+
83
+ ### Error
84
+
85
+ Cover validation, dependency, malformed-response, timeout, cancellation, cleanup, and partial-failure mapping. Assert both the error and the absence of forbidden partial effects.
86
+
87
+ ### State and Side Effects
88
+
89
+ Cover valid and invalid transitions, retries, repeated calls, writes, events, call counts, ordering, rollback, and cleanup.
90
+
91
+ ### Permission
92
+
93
+ Apply to identity, role, tenant, ownership, policy, entitlement, secret, or protected-resource behavior. Include missing/invalid identity, wrong owner or tenant, insufficient grants, and default-deny behavior.
94
+
95
+ ### Concurrency
96
+
97
+ Apply when shared mutable state, locks, optimistic versions, duplicate workers or calls, race-prone caches, or transaction ordering can affect observable results. Use deterministic barriers, fakes, or synchronization; do not rely on timing sleeps.
98
+
99
+ ### Idempotency
100
+
101
+ Apply to retries, deduplication keys, create/update/delete repetition, webhook or job replay, token rotation, and repeated transitions. Assert result and side-effect count.
102
+
103
+ ### Time
104
+
105
+ Apply to expiry, schedules, windows, date ranges, TTL, time zones, and clock-sensitive signatures. Control the clock and test exact boundaries plus before and after.
106
+
107
+ ### Dependency
108
+
109
+ Apply to databases, filesystems, queues, providers, clocks/randomness, cross-module adapters, and network clients. Assert failure mapping, retry bounds, cleanup, and absence of partial effects.
110
+
111
+ ### Consumer
112
+
113
+ Apply when callers depend on return shape, errors, side effects, ordering, generated assets, shared types, contracts, state, or invocation conventions.
114
+
115
+ ## Layer Selection
116
+
117
+ Use the lowest layer that proves a property without removing relevant composition.
118
+
119
+ | Layer | Use For |
120
+ |---|---|
121
+ | Focused/unit | Critical pure logic, exact boundaries, deterministic errors, fast localization. |
122
+ | Module/component | Public module behavior with internal collaborators composed as production uses them. |
123
+ | Contract/integration | Shared protocol compatibility or isolated infrastructure that mocks cannot adequately prove. |
124
+ | Code-level E2E | User-visible CLI, API, or UI composition when an applicable native harness exists. |
125
+ | Affected-module regression | Every required test for the complete affected module. |
126
+ | Regression Ring | Concrete callers, consumers, contracts, adapters, and shared state dependencies. |
127
+
128
+ Not every behavior needs every layer. Record a concise reason for omitted higher layers, such as a pure library having no process or UI boundary.
129
+
130
+ ## Critical Low-Level Logic
131
+
132
+ Do not require one test per private function. Add a direct focused test when a helper has one or more of these properties:
133
+
134
+ - nontrivial business rule or algorithm;
135
+ - exact boundary or numerical behavior;
136
+ - security, permission, data-integrity, time, or concurrency risk;
137
+ - many public paths depend on it and failure localization matters;
138
+ - public-only tests would require over-mocking or would not reliably exercise the property.
139
+
140
+ Otherwise prove private logic through stable public behavior to avoid brittle implementation-coupled tests.
141
+
142
+ ## Assertion Quality
143
+
144
+ A useful test can fail for the intended defect. It should:
145
+
146
+ - assert observable outcomes rather than merely that code ran;
147
+ - verify error type and relevant message or contract fields without overspecifying incidental text;
148
+ - assert state and side effects, including forbidden partial effects;
149
+ - keep the behavior under test real while isolating irrelevant dependencies;
150
+ - use deterministic time, randomness, concurrency, and fixtures;
151
+ - provide useful failure diagnostics;
152
+ - follow native test organization and naming.
153
+
154
+ Reject snapshot-only or mock-call-only tests when those assertions do not prove the behavior. Reject a mock that duplicates the implementation or bypasses the composition being tested.
155
+
156
+ ## Existing-Test-First Construction
157
+
158
+ Before adding tests:
159
+
160
+ 1. Inspect manifests, native commands, runner configuration, and CI conventions.
161
+ 2. Read existing test assertions rather than relying on names.
162
+ 3. Reuse project fixtures, fakes, helpers, mock servers, and coverage tooling.
163
+ 4. Run the smallest relevant existing tests.
164
+ 5. Add or update tests only for concrete behavior/risk gaps.
165
+ 6. Add only the smallest native infrastructure needed for a necessary layer.
166
+
167
+ Never add a second framework when the existing one is adequate. Never delete or weaken a valid test just to make the suite pass.
168
+
169
+ ## Coverage Metrics
170
+
171
+ Use existing line, branch, or function coverage to locate possibly omitted behavior. Do not:
172
+
173
+ - use a percentage as the business-completeness verdict;
174
+ - force direct tests for irrelevant private lines;
175
+ - weaken assertions to increase percentages;
176
+ - exclude difficult business behavior merely to improve a metric.
177
+
178
+ ## Completion Review
179
+
180
+ Coverage is complete enough for `TEST_PASS` only when:
181
+
182
+ 1. every discoverable observable behavior is represented;
183
+ 2. every applicable risk has a credible project-native test;
184
+ 3. critical low-level logic has direct focused coverage when justified;
185
+ 4. selected layers preserve the property being proved;
186
+ 5. complete affected-module regression passes;
187
+ 6. Regression Ring verification passes;
188
+ 7. concrete unresolved coupling no longer affects the verdict;
189
+ 8. Main-Agent review converges;
190
+ 9. applicable independent review converges or is strictly downgraded;
191
+ 10. no mutation follows final review and execution.
192
+
193
+ Absolute completeness cannot be guaranteed. State remaining informational risks honestly without presenting them as proven behavior.