@chenmk/superflow 0.5.21 → 0.5.22

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 (82) hide show
  1. package/INSTALL.en.md +2 -0
  2. package/INSTALL.md +2 -0
  3. package/assets/scripts/superflow-delivery-check.sh +36 -6
  4. package/assets/scripts/superflow-review-coverage.mjs +34 -0
  5. package/assets/scripts/superflow-test-report-lint.py +125 -4
  6. package/assets/skill-registry.json +23 -8
  7. package/assets/skills/openspec-apply-change/SKILL.md +7 -0
  8. package/assets/skills/openspec-archive-change/SKILL.md +13 -1
  9. package/assets/skills/superflow-archive/SKILL.md +17 -0
  10. package/assets/skills/superflow-docs/SKILL.md +11 -0
  11. package/assets/skills/superflow-implement/SKILL.md +11 -0
  12. package/assets/skills/superflow-pipeline/SKILL.md +6 -1
  13. package/assets/skills/superflow-pipeline/references/architecture-design-template.md +4 -2
  14. package/assets/skills/superflow-pipeline/references/batch-prompt-template.md +6 -1
  15. package/assets/skills/superflow-pipeline/references/document-review-coverage.md +26 -0
  16. package/assets/skills/superflow-pipeline/references/document-templates.md +7 -0
  17. package/assets/skills/superflow-pipeline/references/implementation-prompt-template.md +41 -35
  18. package/assets/skills/superflow-pipeline/references/mock-strategy-guide.md +28 -74
  19. package/assets/skills/superflow-pipeline/references/orchestration.md +43 -101
  20. package/assets/skills/superflow-pipeline/references/quality-gate.md +8 -4
  21. package/assets/skills/superflow-pipeline/references/reviewer-checklist.md +99 -3
  22. package/assets/skills/superflow-pipeline/references/superpower-technical-design-template.md +17 -0
  23. package/assets/skills/superflow-pipeline/references/test-execution-template.md +16 -12
  24. package/assets/skills/superflow-pipeline/references/test-guide.md +82 -30
  25. package/assets/skills/superflow-pipeline/scripts/superflow-archive.sh +57 -10
  26. package/assets/skills/superflow-pipeline/scripts/superflow-guard.sh +23 -6
  27. package/assets/skills/superflow-quick-dev/SKILL.md +3 -3
  28. package/assets/skills/superflow-verify/SKILL.md +28 -12
  29. package/assets/skills-en/openspec-apply-change/SKILL.md +8 -0
  30. package/assets/skills-en/openspec-archive-change/SKILL.md +17 -1
  31. package/assets/skills-en/superflow-archive/SKILL.md +20 -0
  32. package/assets/skills-en/superflow-docs/SKILL.md +13 -0
  33. package/assets/skills-en/superflow-implement/SKILL.md +13 -0
  34. package/assets/skills-en/superflow-pipeline/SKILL.md +6 -0
  35. package/assets/skills-en/superflow-pipeline/references/architecture-design-template.md +3 -0
  36. package/assets/skills-en/superflow-pipeline/references/batch-prompt-template.md +7 -0
  37. package/assets/skills-en/superflow-pipeline/references/document-review-coverage.md +32 -0
  38. package/assets/skills-en/superflow-pipeline/references/document-templates.md +8 -0
  39. package/assets/skills-en/superflow-pipeline/references/implementation-prompt-template.md +11 -0
  40. package/assets/skills-en/superflow-pipeline/references/mock-strategy-guide.md +41 -11
  41. package/assets/skills-en/superflow-pipeline/references/orchestration.md +11 -0
  42. package/assets/skills-en/superflow-pipeline/references/quality-gate.md +9 -0
  43. package/assets/skills-en/superflow-pipeline/references/reviewer-checklist.md +122 -1
  44. package/assets/skills-en/superflow-pipeline/references/superpower-technical-design-template.md +21 -0
  45. package/assets/skills-en/superflow-pipeline/references/test-execution-template.md +5 -0
  46. package/assets/skills-en/superflow-pipeline/references/test-guide.md +106 -12
  47. package/assets/skills-en/superflow-pipeline/scripts/superflow-archive.sh +57 -10
  48. package/assets/skills-en/superflow-pipeline/scripts/superflow-guard.sh +23 -6
  49. package/assets/skills-en/superflow-quick-dev/SKILL.md +6 -3
  50. package/assets/skills-en/superflow-verify/SKILL.md +36 -12
  51. package/dist/app/cli.js +5 -5
  52. package/dist/app/cli.js.map +1 -1
  53. package/dist/app/commands/review-coverage.js +8 -3
  54. package/dist/app/commands/review-coverage.js.map +1 -1
  55. package/dist/app/commands/update.js +2 -0
  56. package/dist/app/commands/update.js.map +1 -1
  57. package/dist/build-info.json +1 -0
  58. package/dist/domains/config/cli-help.js +8 -0
  59. package/dist/domains/config/cli-help.js.map +1 -1
  60. package/dist/domains/managed-work/failure.js +9 -0
  61. package/dist/domains/managed-work/failure.js.map +1 -1
  62. package/dist/domains/managed-work/prompts.js +3 -0
  63. package/dist/domains/managed-work/prompts.js.map +1 -1
  64. package/dist/domains/managed-work/runner.js +29 -24
  65. package/dist/domains/managed-work/runner.js.map +1 -1
  66. package/dist/domains/managed-work/service.js +147 -19
  67. package/dist/domains/managed-work/service.js.map +1 -1
  68. package/dist/domains/review/coverage.js +12 -4
  69. package/dist/domains/review/coverage.js.map +1 -1
  70. package/dist/domains/review/report.js +67 -2
  71. package/dist/domains/review/report.js.map +1 -1
  72. package/dist/mcp/runtime-identity.js +19 -4
  73. package/dist/mcp/runtime-identity.js.map +1 -1
  74. package/dist/mcp/server.js +1 -1
  75. package/dist/mcp/server.js.map +1 -1
  76. package/dist/platform/agent-process.js +48 -9
  77. package/dist/platform/agent-process.js.map +1 -1
  78. package/dist/platform/process-liveness.js +46 -0
  79. package/dist/platform/process-liveness.js.map +1 -1
  80. package/package.json +2 -1
  81. package/scripts/ensure-bin-modes.js +37 -2
  82. package/scripts/verify-changed.mjs +321 -0
@@ -40,6 +40,26 @@ do not mark archived until the user confirms final closeout.
40
40
  ~/.codex/skills/superflow-pipeline/scripts/superflow-archive.sh <change-dir> --apply
41
41
  ```
42
42
 
43
+ ## Recovery after archive relocation
44
+
45
+ If OpenSpec moved the directory but annotation/state closeout failed, preserve
46
+ artifacts and raw errors. Identify the exact `openspec/changes/archive/<archive-name>`
47
+ from this archive's output or actual operation record. Never guess a historical
48
+ same-name directory or repeat archive from the missing old path. Use the helper:
49
+
50
+ ```bash
51
+ ~/.codex/skills/superflow-pipeline/scripts/superflow-archive.sh <explicit-archived-dir> --dry-run
52
+ # Check summary, original authorization, and remaining work; do not expand permission
53
+ ~/.codex/skills/superflow-pipeline/scripts/superflow-archive.sh <explicit-archived-dir> --apply
54
+ ```
55
+
56
+ Moved directories resume only remaining annotations and the original state
57
+ transition, retaining validate/guard. Correct done + archived state returns
58
+ read-only idempotently. Nonstandard tasks keep the existing state-only fallback.
59
+ Check actual state.yaml, technical/design/plan annotations, and output; missing
60
+ or conflicting facts remain blocked. No automatic commit/push/merge, repeated
61
+ OpenSpec merge, or second closeout state machine.
62
+
43
63
  ## Rules
44
64
 
45
65
  - Do not archive if verification failed or is only partially verified unless
@@ -5,6 +5,13 @@ description: Use when confirmed requirements or OpenSpec artifacts need SDD cont
5
5
 
6
6
  # SDD Docs
7
7
 
8
+ ## Test plan entry
9
+
10
+ Before writing tests.md, read the [test guide](../superflow-pipeline/references/test-guide.md).
11
+ Reuse project tests and environments, map affected behavior to signals, and freeze
12
+ cases, actual backends, mockBoundary, commands, and assertions here. Implementation
13
+ inherits the plan; required database verification is not an implementation-time choice.
14
+
8
15
  For full document delivery, read and apply
9
16
  [requirement × real-entry review](../superflow-pipeline/references/document-review-coverage.md).
10
17
  Extend the existing three-round receipt with original-source, real-caller,
@@ -16,6 +23,12 @@ created the base OpenSpec artifacts. This skill is an SDD contract-doc wrapper;
16
23
  it must not replace the installed OpenSpec skills for core artifact generation
17
24
  and must not generate implementation prompts.
18
25
 
26
+ For cross-round checks sensitive to commands/directories/invocation environment,
27
+ freeze argv, relative cwd, and selected non-secret keys under the
28
+ [executionContext contract](../superflow-pipeline/references/document-review-coverage.md#declared-execution-context-and-evidence-reuse).
29
+ Historical unbound proof does not automatically satisfy new-context completeness.
30
+
31
+
19
32
  ## OpenSpec First
20
33
 
21
34
  For new OpenSpec document generation, invoke `$openspec-propose` first. The
@@ -5,6 +5,19 @@ description: Use when SDD/OpenSpec contract docs and Superpowers technical desig
5
5
 
6
6
  # SuperFlow Implement
7
7
 
8
+ ## Verification contract inheritance
9
+
10
+ Before generating prompts, read the [test guide](../superflow-pipeline/references/test-guide.md).
11
+ Inherit frozen tests.md cases, commands, actual backends, and assertions; require
12
+ implementers to check them before editing, execute them, and record results. Missing
13
+ signals or real-environment obligations return to superflow-docs, not a second plan.
14
+
15
+ Prompts inherit frozen executionContext only. Execution entries generate actual
16
+ cwd/selected environment hashes for raw-event/receipt checks; Agents do not fill
17
+ expected observations. Missing bindings or changed contexts return to the document
18
+ owner or affected reruns without rewriting historical successful records.
19
+
20
+
8
21
  ## Role
9
22
 
10
23
  This phase turns frozen contracts and source-level technical design into safe
@@ -3,6 +3,12 @@ name: superflow-pipeline
3
3
  description: Use when a user asks for the SuperBridge Flow, SDD, OpenSpec, requirements clarification, contract docs, design docs, implementation prompts, verification, archive, or which SuperBridge Flow phase to run.
4
4
  ---
5
5
 
6
+ ## Canonical test guidance entry
7
+
8
+ Read [test-guide.md](references/test-guide.md) for test documentation, implementation
9
+ preparation, or delivery review. Documents freeze required signals; implementation
10
+ inherits and review verifies. Mock examples cannot override canonical DB contracts.
11
+
6
12
  # SuperBridge Flow Pipeline
7
13
 
8
14
  When maintaining Superflow CLI itself, first read repository-root
@@ -18,3 +18,6 @@ Use this when designing a new module or a cross-service change.
18
18
 
19
19
  Do not justify a design only because code can call another module. Prove that the
20
20
  call direction matches ownership and the existing architecture contract.
21
+
22
+ Freeze signals using [test-guide.md](test-guide.md) and declare isolation using
23
+ [mock-strategy-guide.md](mock-strategy-guide.md); substitute engines cannot close required real DB proof.
@@ -1,5 +1,12 @@
1
1
  # Batch Prompt Template
2
2
 
3
+ Inherit verification only from tests.md and read [test-guide.md](test-guide.md).
4
+ Apply startup, API, DB, and team checklists to frozen applicable cases; give source
5
+ reasons for inapplicability, keeping missing required environments blocked. Reuse
6
+ healthy instances matching the tested build; load new code/configuration before
7
+ verification. Independently inspect raw evidence; implementers rerun invalidated
8
+ or contract-required paths, not every environment merely because roles changed.
9
+
3
10
  ## Header
4
11
 
5
12
  - Batch: P{n} - {name}
@@ -176,3 +176,35 @@ boolean differs from number (true cannot prove one affected row), including nest
176
176
  arrays/objects. Documents and independent review choose business keys and fields.
177
177
 
178
178
  Git delivery compares normalized index objects for tracked report dependencies (receipts, raw events, builds, source, schema/contracts). A working-tree-only repair does not prove the commit snapshot. Private untracked evidence is not forced into Git; independent review still determines source/build applicability.
179
+
180
+ ## Declared execution context and evidence reuse
181
+
182
+ Reuse coverage/receipt v1. When reusing checks sensitive to commands, working
183
+ directories, or invocation environments, the document owner freezes tests.md and
184
+ its case `executionContext={argv:[arguments],cwd:directory relative to change,environmentKeys:[names]}`.
185
+ argv is nonempty and explicit; cwd is relative without drive prefixes or absolute
186
+ paths. Task permissions and source/contracts still define read scope: cwd grants
187
+ no additional access. Implementers cannot redesign this contract.
188
+
189
+ Supported keys are PATH, PATHEXT, NODE_ENV, NODE_OPTIONS, LANG, LC_ALL, TZ, JAVA_HOME.
190
+ Select only keys affecting this verification command. Passwords, tokens, account
191
+ credentials, and full environments never enter contracts/receipts. Use project
192
+ verification entries with runtime authentication; never put secrets in argv/docs.
193
+ Absent and empty differ: each digest is UTF-8 SHA-256(JSON.stringify(string or null)).
194
+ Receipts and raw events record
195
+ `executionContext={cwd:actual canonical absolute directory,environmentSha256:{selectedName:digest}}`.
196
+ Actual execution entries generate observations, not Agents filling expected values.
197
+
198
+ Existing lint compares actual command.argv with frozen argv, receipt/event context,
199
+ cwd with the frozen directory relative to the current change, and selected hashes
200
+ with its current invocation environment. Run lint in the tests.md invocation
201
+ context. Unselected environment changes do not invalidate proof; selected keys,
202
+ commands, directories, source, builds, or targets changing prevent old proof from
203
+ closing current complete PASS. This does not prove remote-service startup
204
+ environments: engines, production chains, and sufficiency need independent review.
205
+
206
+ Historical contracts without the field retain existing source/build/entry checks
207
+ and their conclusions, without claiming this new context verification. Declared
208
+ contracts with missing/malformed/mismatched observations need evidence, not editing
209
+ old observations to expectations. Contract changes return to the document owner
210
+ for renewed review rather than weakening execution checks.
@@ -63,3 +63,11 @@
63
63
  - DB/log evidence
64
64
  - Hook output
65
65
  - Blocked or skipped cases with reasons
66
+
67
+ ## tests.md: frozen verification signals
68
+
69
+ Select applicable signals using [test-guide.md](test-guide.md), keeping project level numbers.
70
+ Table: `Change/risk | Case ID | Signal | Actual environment/backend | Command | Assertion | Evidence path | Inapplicability reason/blocker`.
71
+ Database layers inherit only `testLayer` / `mockBoundary` from
72
+ [document-review-coverage.md](document-review-coverage.md). Reuse project scenario
73
+ regression assets for critical business flows and bug reproductions.
@@ -1,5 +1,16 @@
1
1
  # Implementation Prompt Template
2
2
 
3
+ For code-quality review read [reviewer-checklist.md](reviewer-checklist.md):
4
+ select depth from actual impact, use isolated independent views, and have the
5
+ main Agent verify and merge findings. Templates do not redefine risk or agent counts.
6
+
7
+ Inherit verification only from tests.md and read [test-guide.md](test-guide.md).
8
+ Apply startup, API, DB, and team checklists to frozen applicable cases; give source
9
+ reasons for inapplicability, keeping missing required environments blocked. Reuse
10
+ healthy instances matching the tested build; load new code/configuration before
11
+ verification. Independently inspect raw evidence; implementers rerun invalidated
12
+ or contract-required paths, not every environment merely because roles changed.
13
+
3
14
  Use this as the prefix for every implementation prompt.
4
15
 
5
16
  ## Context Drift And State Inheritance
@@ -1,16 +1,46 @@
1
- # Mock Strategy Guide
1
+ # Mock Strategy and Boundary Guide
2
2
 
3
- Mocks are allowed for isolation, not for claiming real integration.
3
+ ## Scope and source of truth
4
4
 
5
- ## Labels
5
+ Read for isolation design or substituted-evidence reporting. Select signals with
6
+ [test-guide.md](test-guide.md). Database layers, mockBoundary, and execution
7
+ receipts inherit only
8
+ [document-review-coverage.md](document-review-coverage.md#database-layer-contract).
9
+ This guide describes isolation, not permission to reduce frozen real acceptance.
6
10
 
7
- - Mock verification: dependency replaced or simulated.
8
- - Test endpoint verification: local helper endpoint or bypass path.
9
- - Real-entry verification: production-like user, device, callback, job, MQ,
10
- client, or third-party entry.
11
+ | Scenario | Isolatable boundary | Proven scope / remaining obligation |
12
+ |---|---|---|
13
+ | Pure logic unit test | Data-access/HTTP/MQ dependencies outside tested logic | Branches, parameters, failure handling; not real SQL or persistence |
14
+ | Required persistence/transaction/CAS | External clients in mockBoundary.allowed | Never mock production Service/Mapper; execute production statements on the actual same-engine DB |
15
+ | External payment/SMS/device | Contract-approved clients, sandboxes, simulated messages | Local handling; real capabilities need separate sandbox/real-entry proof or blockers |
16
+ | MQ/Redis/OSS | Interface boundaries for pure logic | Memory queues, local cache/files cannot close real protocol, locking, persistence, or external-chain requirements |
11
17
 
12
- ## Report Rule
18
+ Actual same-engine Docker/Testcontainers databases are not mocks. Reuse when the
19
+ frozen environment permits; never substitute for a required shared environment.
20
+ H2/SQLite cannot replace MySQL dialect, locking, transaction, or persistence
21
+ semantics. Without a DB preserve logic proof and mark required DB cases
22
+ BLOCKED/PARTIAL.
13
23
 
14
- Keep these labels separate in test-report.md. Mock-only evidence cannot close a
15
- requirement that tests.md marks as L3/L4, real-entry, third-party, DB, or log
16
- verified.
24
+ ## Declaration and reporting
25
+
26
+ Record actual capability, replacement object, mockBoundary, assumptions, proven
27
+ scope, unverified scope, real verification commands/blockers, and evidence paths
28
+ in existing tests.md / test-report.md. Separate `Mock verification`, `Test endpoint
29
+ verification`, and `Real-entry verification`. Auxiliary logic cases may pass;
30
+ mock-only cannot close required database or real-chain cases of the same entry.
31
+
32
+ ## Example: isolated payment client, actual persistence
33
+
34
+ When the contract permits isolating PaymentClient, return a fixed success response
35
+ to the **real** business Service and Mapper. On frozen MySQL, assert order-ID
36
+ before/after, amounts, state, and required side effects. This proves handling and
37
+ persistence, not actual gateway charging; verify charging separately or report a
38
+ blocker. A pure Service unit test may mock Mapper but reports logic only, never
39
+ successful database integration.
40
+
41
+ ## Prohibited
42
+
43
+ - Mocking the tested subject or production Service/Mapper in required DB cases.
44
+ - Replacing business/DB-value assertions with fixed success, counts, HTTP 200, or nonzero affected rows.
45
+ - Mixing substituted and real evidence or counting skipped/unexecuted cases as complete passes.
46
+ - Silently changing frozen backends, weakening assertions under delivery pressure, or leaving mocks in production.
@@ -1,5 +1,16 @@
1
1
  # Workflow Orchestration
2
2
 
3
+ For code-quality review read [reviewer-checklist.md](reviewer-checklist.md):
4
+ select depth from actual impact, use isolated independent views, and have the
5
+ main Agent verify and merge findings. Templates do not redefine risk or agent counts.
6
+
7
+ Inherit verification only from tests.md and read [test-guide.md](test-guide.md).
8
+ Apply startup, API, DB, and team checklists to frozen applicable cases; give source
9
+ reasons for inapplicability, keeping missing required environments blocked. Reuse
10
+ healthy instances matching the tested build; load new code/configuration before
11
+ verification. Independently inspect raw evidence; implementers rerun invalidated
12
+ or contract-required paths, not every environment merely because roles changed.
13
+
3
14
  SuperBridge Flow is a stateful orchestrator, not just a set of installed skills.
4
15
 
5
16
  ## Ownership
@@ -1,5 +1,14 @@
1
1
  # Quality Gate Checklist
2
2
 
3
+ For code-quality review read [reviewer-checklist.md](reviewer-checklist.md):
4
+ select depth from actual impact, use isolated independent views, and have the
5
+ main Agent verify and merge findings. Templates do not redefine risk or agent counts.
6
+
7
+ Check frozen signals and applicability using [test-guide.md](test-guide.md).
8
+ Missing required environments remain blocked; inapplicability cannot remove frozen
9
+ gates. Reuse healthy instances matching the tested build; independently inspect
10
+ raw evidence and have implementers rerun invalidated or contract-required paths.
11
+
3
12
  ## Documentation Gate
4
13
 
5
14
  - Requirements processed feature by feature and frozen.
@@ -1,5 +1,124 @@
1
1
  # Reviewer Checklist
2
2
 
3
+ ## Five-axis review and isolated context (canonical entry)
4
+
5
+ Use for ordinary code review, Quick verification, full SDD, and managed Host
6
+ review. Inputs are current changes, confirmed contracts, applicable path rules,
7
+ and raw evidence. Outputs reuse reviewer reports or existing Host review JSON.
8
+ This checklist owns axes, depth, isolation, and finding verification;
9
+ superflow-verify routes execution. Check requirement/design conformity against
10
+ existing contracts without creating another requirements-review entry. Scripts
11
+ check paths, state markers, and anchors, not review sufficiency. The main Agent /
12
+ Host owns actual risk and the final verdict.
13
+
14
+ ### Axis coverage
15
+
16
+ | Axis | Focus | Minimum evidence |
17
+ |---|---|---|
18
+ | security | Authentication/authorization, injection, sensitive information, external input | Actual entry, parameter binding, permission call path |
19
+ | performance | Query scope/N+1, scale, CPU/memory/I/O, resource limits | Execution path and scale; benchmarks only when risk warrants |
20
+ | correctness | Boundaries, recovery, state, transactions, concurrency, idempotence | Real call/write path, assertions, failure paths |
21
+ | maintainability | Duplication, naming, complexity, exception handling, test seams | Existing reuse points, source, test boundaries |
22
+ | architecture | Module ownership, call direction, contract compatibility, abstraction | Callers/consumers and ownership evidence |
23
+
24
+ Record CHECKED / NOT_APPLICABLE / BLOCKED and source/evidence per axis. CHECKED
25
+ means examined, not defect-free. One reviewer may cover all axes; do not require
26
+ five agents. Specialists cover assigned axes; the main Agent merges coverage and
27
+ fills gaps. Unassigned/unread is not inapplicable. Full SDD real acceptance remains.
28
+
29
+ ### Select depth from actual impact
30
+
31
+ `superflow review-coverage` emits `risk.basis=path-hint` and
32
+ `risk.requiresSemanticAssessment=true`. The main Agent reads changes, actual
33
+ callers, and write/consumer paths, recording hint tier, actual tier, source
34
+ anchors, and adjustment reasons. Names, line counts, and implementer claims do
35
+ not determine risk. Unknown risk gets at least medium investigation; inability
36
+ to judge means NEEDS_CONTEXT.
37
+
38
+ | Actual impact | Depth |
39
+ |---|---|
40
+ | Small scope with verified absence of contract/write/concurrency/security/cross-module effects | Low, inline allowed; still cover applicable axes |
41
+ | Other changes with known scope | Medium, one isolated independent reviewer |
42
+ | Evidenced public-contract break, migration/data consistency, locks/shared state, security boundary, or cross-module impact | High, independent review plus focused views for named risks; fan out only for independent risk clusters when the Host supports it |
43
+
44
+ Example: a parameterized SELECT filter with unchanged contract/schema/write path
45
+ and checked consumers can move from Mapper path hint high to actual medium. An
46
+ ordinary file adding atomic claims/shared-state writes moves from path hint low to
47
+ actual high. Confirm against current source rather than applying example labels.
48
+ High does not prescribe agent counts, model names, or providers; use native Host
49
+ configuration. Record user depth overrides without removing required scope,
50
+ contract obligations, or known risks.
51
+
52
+ ### Isolated bundle and dispatch
53
+
54
+ The main Agent prepares this bundle in a temporary directory and uses native
55
+ subagents without implementation chat history (`fork_turns=none` when supported).
56
+ If unavailable, prepare the same bundle for an independent reviewer and report
57
+ that independent review has not run. Self-review cannot be relabeled independent
58
+ or counted as complete independent coverage.
59
+
60
+ 1. Confirmed goal, scope, exclusions, actual contract paths, review questions;
61
+ label implementer claims unverified.
62
+ 2. Baseline/head or worktree state, exact diff, file inventory, related bundles;
63
+ diff statistics alone are insufficient.
64
+ 3. Applicable path rules, relevant source/caller/consumer paths, necessary
65
+ environment and raw test evidence paths.
66
+ 4. Actual risk assessment, assigned axes/files, this checklist, four-state and
67
+ anchored report requirements.
68
+
69
+ Include only necessary text/paths, not entire repositories, personal rule
70
+ folders, credentials, or chat history. Respect task read permissions. Start from
71
+ diff and expand to related callers only for named risks, recording why. Bundle /
72
+ source / contract drift yields NEEDS_CONTEXT rather than reviewing old context
73
+ against current code. Reviewers are read-only: no source edits, application
74
+ management, business DB operations, or nested supervision. New runtime evidence
75
+ returns to the implementer.
76
+
77
+ ### Main Agent verification and merge
78
+
79
+ Read all reports, coverage, findings, and concerns. Re-read each file:line, callers,
80
+ frozen contracts, and corresponding raw test evidence; attempt to disprove claims
81
+ with actual source. Green tests alone neither accept nor reject a finding.
82
+ Deduplicate by root cause + affected path + business consequence, keeping reviewer
83
+ provenance and full impact. Do not merge solely by line number, wording, or
84
+ severity. Resolve conflicting judgments from evidence, not majority vote.
85
+
86
+ Record accepted / rejected / needs-evidence with reasons. Unsupported claims remain
87
+ unconfirmed rather than receiving invented severity. Severity follows actual
88
+ impact; separate advice from blocking defects. Do not force generic abstractions
89
+ without another caller or contract requirement. Once every axis and included file
90
+ has coverage, submit all material findings together. Managed work retains existing
91
+ finding IDs / acceptanceContractRefs, protocols, budgets, and state owners.
92
+ Subagent reports do not directly promote pass; format checks do not prove code
93
+ correctness. Rerun only invalidated or contract-required evidence.
94
+
95
+ ### Reviewer report shape
96
+
97
+ Reuse the four-state report, not another machine protocol. Managed reviews keep
98
+ these records in temporary reports and project the result into existing Host
99
+ review JSON summary/findings/coverage. `--report` checks existing markers and
100
+ anchors only; the main Agent verifies axes, actual impact, and conclusions. Keep
101
+ historical reports without axis records, but do not call them complete under this
102
+ guide.
103
+
104
+ ```markdown
105
+ DONE
106
+ ## Impact
107
+ Path hint / actual depth / source evidence / adjustment / diff and contract version
108
+ ## Axes
109
+ Axis | CHECKED / NOT_APPLICABLE / BLOCKED | File scope and evidence
110
+ # Fill security / performance / correctness / maintainability / architecture
111
+ ## Findings
112
+ - src/example.ts:12: [axis][severity] cause, consequence, proof, repair and acceptance
113
+ # Use None without findings; never a placeholder bullet
114
+ ## Concerns
115
+ Unresolved questions and missing proof; required for DONE_WITH_CONCERNS
116
+ ```
117
+
118
+ Existing specialist checks remain path-scoped; inapplicable checks do not invent
119
+ runtime obligations or remove frozen requirements. They detail axes without
120
+ owning risk, dispatch, or final conclusions.
121
+
3
122
  ## Data Scale And Processing Cost
4
123
 
5
124
  - For data-intensive paths, are current/expected data scale and growth
@@ -12,7 +131,7 @@
12
131
 
13
132
  - Does the implementation match api.md, design.md, and tests.md?
14
133
  - Are all required files present and cross-linked?
15
- - Is handoff_hash current and repeated in prompts/report?
134
+ - Is the frozen handoff hash current in its canonical state file? Do not duplicate raw hashes in report bodies.
16
135
  - Did Superpowers technical design cover source-level HOW?
17
136
  - Were field/status and architecture-boundary risks checked?
18
137
  - For monetary changes, were calculation and settlement states separated, were
@@ -42,3 +161,5 @@
42
161
  - Are mock-only results clearly labeled?
43
162
  - Did workers stay inside allowed file boundaries?
44
163
  - Did hooks and guard scripts pass?
164
+
165
+ Use spaces and explicit closure for report container fences. Tab-delimited list/quote fences currently fail structural verification: normalize report formatting without using an earlier DONE/PASS to bypass it. Preserve tabs in original execution logs; do not rewrite evidence for formatting.
@@ -28,6 +28,27 @@ canonical_sources:
28
28
  - If this document conflicts with canonical sources, stop and return to
29
29
  `$superflow-docs`; do not let implementation prompts carry the conflict forward.
30
30
 
31
+ ## Directory Changes
32
+
33
+ List Created / Modified / Deleted / Not created modules and key files, with
34
+ responsibility and reuse evidence. Trees or lists are fine; annotate action,
35
+ owner, and reason rather than names alone. Use None for empty categories.
36
+ Not created records considered modules/helpers/caches/state/parallel entries and
37
+ why they were rejected. Record implementation-local helper/method edits without
38
+ automatically expanding business scope. Details within confirmed modules that
39
+ preserve contracts need no new requirement confirmation; frozen HOW repairs still
40
+ return to the document owner for handoff refresh and existing review. New owners,
41
+ cross-module dependencies, allowed path scope, or acceptance obligations return
42
+ to clarification/docs before coding. Runtime protections, source coverage, and
43
+ existing approval rules remain; this inventory creates no parallel state.
44
+
45
+ | Action | Module/file | Owner and responsibility | Reuse/evidence or rejection reason |
46
+ |---|---|---|---|
47
+ | Created | None / `<path>` | | |
48
+ | Modified | None / `<path>` | | |
49
+ | Deleted | None / `<path>` | | |
50
+ | Not created | None / `<candidate>` | | |
51
+
31
52
  ## Source-Level HOW
32
53
 
33
54
  | Requirement/Scenario | Code anchor | Current behavior | Target HOW | Files/methods | Risk |
@@ -1,5 +1,10 @@
1
1
  # Test Execution Template
2
2
 
3
+ Read [test-guide.md](test-guide.md) first and inherit frozen tests.md / Quick Spec
4
+ signals. Fill applicable cases; give source reasons for inapplicable fields and
5
+ BLOCKED/PARTIAL for unavailable required environments. Existing coverage/receipts
6
+ check facts; template examples never redesign tests or reduce frozen gates.
7
+
3
8
  Use the environment frozen in tests.md; do not substitute local containers or
4
9
  mocks for an explicitly required shared development environment. When the user
5
10
  requires every endpoint to be exercised, freeze an endpoint/role/scenario matrix,
@@ -1,16 +1,110 @@
1
- # Test Guide
1
+ # Test Selection and Verification Loop
2
2
 
3
- ## Levels
3
+ ## Scope and ownership
4
4
 
5
- - L0: unit test.
6
- - L1: component test.
7
- - L2: integration with real infrastructure such as Testcontainers.
8
- - L3: API or message contract test with executable command.
9
- - L4: real external entry such as callback, device, scheduler, client, or
10
- third-party sandbox.
5
+ Read when generating tests.md, starting implementation, repairing findings, or
6
+ verifying delivery. Inputs are confirmed requirements, source changes, existing
7
+ project tests, and frozen contracts. Write outputs into existing tests.md / Quick
8
+ Spec and test-report.md. Documentation-only work checks its contracts; pure
9
+ functions check their seam without inventing application or database requirements.
11
10
 
12
- ## Rule
11
+ superflow-docs freezes the plan; the implementer executes and records evidence;
12
+ superflow-verify / Host judges sufficiency and historical applicability. Existing
13
+ coverage/receipt/lint checks deterministic facts; the existing state machine owns
14
+ state. Database machine contracts come only from
15
+ [document-review-coverage.md](document-review-coverage.md#database-layer-contract).
16
+ Reuse testLayer, mockBoundary, and execution-receipt.v1, without another evidence
17
+ format or level system. Superflow distributes this guide; no ake verification
18
+ skill installation or .ake memory is required.
13
19
 
14
- When tests.md requires L3/L4, test-report.md must include real command,
15
- response, DB/log assertion, and final state evidence. Unit tests alone do not
16
- close the requirement.
20
+ ## Select signals before implementation
21
+
22
+ Search existing tests, build wiring, environment configuration, and project rules.
23
+ Reuse seams, commands, and tools. Before production edits, map each affected
24
+ behavior to these signals and freeze case IDs, commands, assertions, and evidence
25
+ paths. Give source reasons for inapplicable signals. Missing environments for
26
+ required cases mean BLOCKED/PARTIAL, never inapplicable. Implementers cannot
27
+ remove frozen obligations; omissions return to the document owner.
28
+
29
+ | Change/risk | Signals to freeze |
30
+ |---|---|
31
+ | Pure function or local algorithm | Narrow unit checks, boundaries/failures, applicable build and static checks |
32
+ | Component wiring or configuration | Above checks plus real application/context startup and readiness |
33
+ | SQL, Mapper, persistence, transactions, CAS, data-driven behavior | Logic checks plus production statements against the same database engine; full SDD also covers real consuming entries |
34
+ | API, public fields, authentication | Existing contract tests/snapshots plus affected real entries; establish new contract baselines |
35
+ | New capability spanning API, business logic, storage | Build, unit, wiring, real database, API contract, at least one real main flow |
36
+ | Bug fix | Same symptom RED → GREEN plus affected regression; environment failure is not business RED |
37
+ | MQ, devices, callbacks, cache, third-party semantics | Freeze real protocol/backend/entry verification and isolatable boundaries; missing environment remains blocked |
38
+ | Report format or test isolation only | Check affected contracts/evidence without automatically rerunning unrelated business flows |
39
+
40
+ Keep project case level numbering; do not import ake L1/L3/L5/L7/L8/L10 numbers.
41
+ Database testLayer and entry acceptance level are separate dimensions; a level
42
+ label cannot hide a missing real backend.
43
+
44
+ ## Mocks and environments
45
+
46
+ The [Mock guide](mock-strategy-guide.md) describes isolation boundaries. Logic
47
+ unit tests may mock data access, but cannot prove SQL, transactions, or persistence.
48
+ Required database cases cannot mock production Service/Mapper; mockBoundary
49
+ freezes allowed external clients. H2/SQLite cannot substitute for MySQL proof.
50
+ A real same-engine container database is not a mock. Freeze engine/major, schema
51
+ provenance, production statements, and cleanup. Use a required shared environment;
52
+ otherwise use existing container infrastructure when the contract approves it.
53
+ Without an executable environment, preserve logic evidence and mark real database
54
+ cases BLOCKED/PARTIAL rather than reducing acceptance.
55
+
56
+ ## Retained business scenario tests
57
+
58
+ Prefer repeatable project-native regression tests for critical business flows and
59
+ bug reproductions. Reuse directories, fixtures, authentication, DB helpers, and
60
+ execution scripts. Extend equivalent tests instead of building another scenario
61
+ framework or public helper. Keep pure logic at the lowest adequate layer. Java
62
+ may reuse existing JUnit/RestAssured/JdbcTemplate; other stacks use native tools,
63
+ without mandatory Java dependencies.
64
+
65
+ Assert concrete business response values, same-business-ID database state, and
66
+ contract-required messages/logs/side effects separately. Freeze before/after,
67
+ affected rows, and unchanged non-target records under the canonical contract.
68
+ HTTP 200, non-null values, invocation counts, or affectedRows=1 alone do not prove
69
+ correct persistence.
70
+
71
+ Make subjects unique per run/case; resolve stable base data by business key or
72
+ logical name and fail during setup when missing. Reuse project environment and
73
+ auth commands; record credential sources rather than passwords/tokens in source
74
+ or docs. Never automatically seed or delete shared base data. Freeze data creation
75
+ permissions, ownership, cleanup scope, and failure cleanup. Use existing tags,
76
+ profiles, or scripts to run environment-dependent scenarios separately from unit
77
+ checks. Grouping does not skip required delivery cases: explicitly run required
78
+ groups and check execution counts. Cases do not depend on order or share mutable
79
+ subjects.
80
+
81
+ ## Execute, review, and inherit evidence
82
+
83
+ Run narrow tests first, then frozen build/startup/real-entry commands. Read exit
84
+ codes, counts, and raw output; fill case evidence using the
85
+ [execution template](test-execution-template.md). Never fit frozen assertions to
86
+ wrong output. Passing conclusions cover only executed layers; zero cases, skipped,
87
+ and unexecuted checks cannot become PASS.
88
+
89
+ For repairs, map current changes → invalidated evidence → rerun commands.
90
+ Production code, SQL, configuration, authentication, public contracts, runtime
91
+ entries, or environment changes invalidate affected proof. Report formatting
92
+ alone does not automatically invalidate prior runtime results. Historical evidence
93
+ must match source/build, backend/entry, and contract; independent review judges
94
+ applicability. It cannot authorize another source version. Reuse healthy instances
95
+ matching the tested build; restart and reverify when code/configuration/identity
96
+ mismatches. Stop only through frozen owner verification and cleanup entry points,
97
+ never broad pkill/killall. Pure functions need no process; required real entries
98
+ cannot be waived. Reviewers inspect source and raw evidence read-only; implementers
99
+ own execution and cleanup. Independent review does not mean mechanical full reruns.
100
+
101
+ ## Repair failures
102
+
103
+ Reproduce case preconditions and inspect actual SQL/bindings, transaction
104
+ boundaries, responses, and logs. For DB failures first inspect production
105
+ statements, written fields, schema, and same-ID before/after values; do not blindly
106
+ add transaction annotations or replace Mapper methods. Run the same path and
107
+ affected regression after repair. Design changes first repair canonical contracts.
108
+ Do not skip failures, weaken assertions, or hide blockers.
109
+
110
+ For cross-round checks sensitive to commands/directories/invocation environments, freeze executionContext under [declared context](document-review-coverage.md#declared-execution-context-and-evidence-reuse). Keep historical proof without calling unbound records complete under a new context.