peaks-loop 4.1.4 → 4.1.6
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/.claude-plugin/marketplace.json +7 -2
- package/CHANGELOG.md +148 -0
- package/README-en.md +47 -183
- package/README.md +24 -188
- package/dist/cli/cli-helpers.d.ts +20 -0
- package/dist/cli/cli-helpers.js +34 -0
- package/dist/cli/commands/_register.js +2 -0
- package/dist/cli/commands/best-practice-scan-command.d.ts +11 -6
- package/dist/cli/commands/best-practice-scan-command.js +35 -20
- package/dist/cli/commands/best-practice-scan-helpers.d.ts +47 -0
- package/dist/cli/commands/best-practice-scan-helpers.js +88 -5
- package/dist/cli/commands/best-practice-scan-lookup-results.d.ts +13 -0
- package/dist/cli/commands/best-practice-scan-lookup-results.js +237 -0
- package/dist/cli/commands/code-commands.d.ts +6 -4
- package/dist/cli/commands/code-commands.js +6 -4
- package/dist/cli/commands/code-gate-command.d.ts +5 -5
- package/dist/cli/commands/code-gate-command.js +49 -9
- package/dist/cli/commands/code-mode-gate-plan-command.d.ts +1 -1
- package/dist/cli/commands/code-mode-gate-plan-command.js +2 -2
- package/dist/cli/commands/core/memory-extract-command.js +10 -5
- package/dist/cli/commands/dispatch-cli-invocation-check.d.ts +108 -0
- package/dist/cli/commands/dispatch-cli-invocation-check.js +87 -0
- package/dist/cli/commands/dispatch-cli-invocation-scan.d.ts +66 -0
- package/dist/cli/commands/dispatch-cli-invocation-scan.js +162 -0
- package/dist/cli/commands/dispatch-command-spec.js +1 -1
- package/dist/cli/commands/dispatch-commands.js +12 -5
- package/dist/cli/commands/dispatch-isolation-lease.d.ts +1 -1
- package/dist/cli/commands/dispatch-isolation-lease.js +6 -53
- package/dist/cli/commands/dispatch-preflight.js +46 -0
- package/dist/cli/commands/dispatch-prompt-blocks.d.ts +1 -1
- package/dist/cli/commands/dispatch-prompt-composition.d.ts +7 -1
- package/dist/cli/commands/dispatch-prompt-composition.js +29 -7
- package/dist/cli/commands/dispatch-record-write.d.ts +1 -1
- package/dist/cli/commands/dispatch-tool-call.d.ts +1 -1
- package/dist/cli/commands/doc-commands.js +1 -1
- package/dist/cli/commands/feedback-commands-helpers.js +1 -1
- package/dist/cli/commands/final-review-prepare-command.js +22 -1
- package/dist/cli/commands/gate-commands-enforce.js +3 -3
- package/dist/cli/commands/hook-handle.js +41 -20
- package/dist/cli/commands/lint-commands.js +3 -1
- package/dist/cli/commands/loop-eval-capture-index.js +2 -4
- package/dist/cli/commands/openspec-command-shared.js +2 -2
- package/dist/cli/commands/perf-audit-commands.js +15 -5
- package/dist/cli/commands/project-commands.js +9 -6
- package/dist/cli/commands/race-commands.d.ts +15 -0
- package/dist/cli/commands/race-commands.js +65 -0
- package/dist/cli/commands/race-pilot-gate-record-command.d.ts +3 -0
- package/dist/cli/commands/race-pilot-gate-record-command.js +81 -0
- package/dist/cli/commands/request-command-options.d.ts +8 -0
- package/dist/cli/commands/request-commands.js +2 -0
- package/dist/cli/commands/request-init-command.js +67 -12
- package/dist/cli/commands/{vm-status-command.d.ts → request-retag-command.d.ts} +1 -1
- package/dist/cli/commands/request-retag-command.js +50 -0
- package/dist/cli/commands/request-show-command.d.ts +8 -0
- package/dist/cli/commands/request-show-command.js +14 -1
- package/dist/cli/commands/request-transition-command.js +12 -4
- package/dist/cli/commands/request-transition-failures.d.ts +14 -0
- package/dist/cli/commands/request-transition-failures.js +76 -7
- package/dist/cli/commands/request-transition-preflight.js +1 -1
- package/dist/cli/commands/scan-scope-commands.js +2 -2
- package/dist/cli/commands/security-audit-commands.js +26 -6
- package/dist/cli/commands/slice-decompose-artifacts.js +2 -1
- package/dist/cli/commands/verdict-aggregate-command.js +2 -1
- package/dist/cli/commands/workflow-gate-commands.js +4 -4
- package/dist/cli/commands/worktree-lease-gc-command.js +1 -1
- package/dist/cli/program.js +0 -2
- package/dist/services/artifacts/artifact-contract-block.d.ts +53 -0
- package/dist/services/artifacts/artifact-contract-block.js +231 -0
- package/dist/services/artifacts/artifact-prerequisites.d.ts +27 -19
- package/dist/services/artifacts/artifact-prerequisites.js +65 -135
- package/dist/services/artifacts/artifact-templates.d.ts +1 -1
- package/dist/services/artifacts/artifact-templates.js +17 -10
- package/dist/services/artifacts/prerequisite-checks.d.ts +87 -0
- package/dist/services/artifacts/prerequisite-checks.js +198 -0
- package/dist/services/artifacts/prerequisite-transition-event.d.ts +20 -0
- package/dist/services/artifacts/prerequisite-transition-event.js +27 -0
- package/dist/services/artifacts/rd-transition-gates.d.ts +33 -0
- package/dist/services/artifacts/rd-transition-gates.js +71 -0
- package/dist/services/artifacts/request-artifact-metadata.d.ts +31 -0
- package/dist/services/artifacts/request-artifact-metadata.js +44 -0
- package/dist/services/artifacts/request-artifact-service.d.ts +5 -0
- package/dist/services/artifacts/request-artifact-service.js +43 -69
- package/dist/services/artifacts/request-artifact-state-helpers.d.ts +21 -1
- package/dist/services/artifacts/request-artifact-state-helpers.js +34 -8
- package/dist/services/artifacts/request-retag-service.d.ts +68 -0
- package/dist/services/artifacts/request-retag-service.js +125 -0
- package/dist/services/artifacts/request-state-order.d.ts +38 -0
- package/dist/services/artifacts/request-state-order.js +99 -0
- package/dist/services/artifacts/request-type-demand.d.ts +44 -0
- package/dist/services/artifacts/request-type-demand.js +71 -0
- package/dist/services/audit/audit-goal-service.d.ts +7 -0
- package/dist/services/audit/enforcers/active-skill-resolver.d.ts +18 -0
- package/dist/services/audit/enforcers/active-skill-resolver.js +48 -1
- package/dist/services/audit/enforcers/code-ban.d.ts +11 -2
- package/dist/services/audit/enforcers/code-ban.js +21 -1
- package/dist/services/audit/red-line-catalog-p2-a-bee-runtime.d.ts +17 -0
- package/dist/services/audit/red-line-catalog-p2-a-bee-runtime.js +24 -7
- package/dist/services/audit-independent/handoff-missing-refusal.d.ts +26 -0
- package/dist/services/audit-independent/handoff-missing-refusal.js +109 -0
- package/dist/services/audit-independent/handoff-readers.d.ts +37 -0
- package/dist/services/audit-independent/handoff-readers.js +81 -0
- package/dist/services/audit-independent/index.d.ts +6 -1
- package/dist/services/audit-independent/index.js +6 -1
- package/dist/services/audit-independent/judged-declaration-build.d.ts +48 -0
- package/dist/services/audit-independent/judged-declaration-build.js +73 -0
- package/dist/services/audit-independent/judged-declaration-check.d.ts +80 -0
- package/dist/services/audit-independent/judged-declaration-check.js +216 -0
- package/dist/services/audit-independent/judged-declaration.d.ts +94 -0
- package/dist/services/audit-independent/judged-declaration.js +218 -0
- package/dist/services/audit-independent/perf-audit-service.js +12 -14
- package/dist/services/audit-independent/security-audit-artifact.d.ts +28 -0
- package/dist/services/audit-independent/security-audit-artifact.js +90 -0
- package/dist/services/audit-independent/security-audit-service.d.ts +6 -53
- package/dist/services/audit-independent/security-audit-service.js +34 -178
- package/dist/services/capability-guard-runner/contracts/J05.js +60 -14
- package/dist/services/codegraph/codegraph-index-integrity.js +2 -0
- package/dist/services/context/build-dispatch-system-prompt.d.ts +8 -12
- package/dist/services/context/build-dispatch-system-prompt.js +18 -18
- package/dist/services/context/collector.js +5 -1
- package/dist/services/context/post-compact-reinjection.js +1 -1
- package/dist/services/dispatch/active-dispatch-index.d.ts +36 -0
- package/dist/services/dispatch/active-dispatch-index.js +118 -0
- package/dist/services/dispatch/batch-counter.js +1 -2
- package/dist/services/dispatch/dispatch-record-writer.d.ts +29 -16
- package/dist/services/dispatch/dispatch-record-writer.js +58 -100
- package/dist/services/dispatch/dispatch-sub-agent.js +1 -1
- package/dist/services/dispatch/karpathy-block.d.ts +55 -0
- package/dist/services/dispatch/karpathy-block.js +101 -0
- package/dist/services/dispatch/ledger-reaper.d.ts +80 -0
- package/dist/services/dispatch/ledger-reaper.js +131 -0
- package/dist/services/dispatch/test-tool-detection.d.ts +17 -1
- package/dist/services/dispatch/test-tool-detection.js +12 -1
- package/dist/services/evidence/evidence-generator.js +23 -12
- package/dist/services/feedback/feedback-promotion-service.d.ts +8 -11
- package/dist/services/feedback/feedback-promotion-service.js +30 -35
- package/dist/services/feedback/promotion-artifact-json-evidence.d.ts +18 -0
- package/dist/services/feedback/promotion-artifact-missing.d.ts +22 -0
- package/dist/services/feedback/promotion-artifact-missing.js +63 -0
- package/dist/services/final-review/final-review-contract.d.ts +95 -4
- package/dist/services/final-review/final-review-contract.js +64 -0
- package/dist/services/final-review/final-review-delivery.d.ts +13 -0
- package/dist/services/final-review/final-review-delivery.js +26 -12
- package/dist/services/final-review/final-review-evidence-collect.js +8 -53
- package/dist/services/final-review/final-review-evidence-records.d.ts +21 -0
- package/dist/services/final-review/final-review-evidence-records.js +67 -0
- package/dist/services/final-review/final-review-evidence-sources.d.ts +22 -0
- package/dist/services/final-review/final-review-evidence-sources.js +28 -4
- package/dist/services/final-review/final-review-prompt.js +19 -6
- package/dist/services/final-review/final-review-runner.js +5 -0
- package/dist/services/final-review/final-review-service.d.ts +2 -2
- package/dist/services/final-review/index.d.ts +1 -1
- package/dist/services/final-review/pre-post-diff.d.ts +2 -75
- package/dist/services/final-review/pre-post-diff.js +60 -59
- package/dist/services/hooks/pre-tool-code-gate.d.ts +7 -1
- package/dist/services/hooks/pre-tool-code-gate.js +21 -2
- package/dist/services/hooks/worktree-authorization-gate.js +6 -31
- package/dist/services/hooks/worktree-refusal-messages.d.ts +74 -0
- package/dist/services/hooks/worktree-refusal-messages.js +102 -0
- package/dist/services/lint/eslint-runner-support.d.ts +1 -1
- package/dist/services/lint/eslint-runner-support.js +2 -1
- package/dist/services/lint/eslint-runner-types.d.ts +8 -0
- package/dist/services/lint/eslint-runner.js +17 -4
- package/dist/services/llm/anthropic-runner.js +24 -7
- package/dist/services/loop/loop-observability.d.ts +39 -0
- package/dist/services/loop/loop-observability.js +55 -0
- package/dist/services/loop/monotonic-guard.js +6 -9
- package/dist/services/loop/monotonic-runner.js +8 -7
- package/dist/services/loop/run-driver.js +18 -22
- package/dist/services/memory/project-memory-service/index/kind-dispatch.js +14 -1
- package/dist/services/memory/project-memory-service/index/project-memory-plan-exec.js +13 -2
- package/dist/services/memory/project-memory-service/index.d.ts +2 -2
- package/dist/services/memory/project-memory-service/index.js +1 -1
- package/dist/services/memory/project-memory-service/parsers/frontmatter-parse.d.ts +36 -0
- package/dist/services/memory/project-memory-service/parsers/frontmatter-parse.js +48 -2
- package/dist/services/memory/project-memory-service/parsers/markdown-pure.d.ts +23 -1
- package/dist/services/memory/project-memory-service/parsers/markdown-pure.js +37 -0
- package/dist/services/memory/project-memory-service/types.d.ts +32 -0
- package/dist/services/observability/observability-service.d.ts +7 -0
- package/dist/services/observability/observability-service.js +2 -1
- package/dist/services/openspec/coverage-evidence-reader.d.ts +9 -9
- package/dist/services/openspec/coverage-evidence-reader.js +8 -8
- package/dist/services/openspec/openspec-archive-service.d.ts +1 -1
- package/dist/services/openspec/openspec-archive-service.js +6 -6
- package/dist/services/prd/gate-evidence-derivation.d.ts +4 -3
- package/dist/services/prd/gate-evidence-derivation.js +4 -3
- package/dist/services/qa/bdd-test-style-verifier.js +22 -8
- package/dist/services/race/gate2-evaluator.d.ts +58 -0
- package/dist/services/race/gate2-evaluator.js +111 -0
- package/dist/services/race/gate2-policy.d.ts +17 -0
- package/dist/services/race/gate2-policy.js +31 -0
- package/dist/services/race/lane-phase.d.ts +19 -0
- package/dist/services/race/lane-phase.js +113 -0
- package/dist/services/race/pilot-gate-store.d.ts +67 -0
- package/dist/services/race/pilot-gate-store.js +227 -0
- package/dist/services/scan/file-size-baseline.d.ts +33 -0
- package/dist/services/scan/file-size-baseline.js +173 -0
- package/dist/services/scan/file-size-scan.d.ts +35 -3
- package/dist/services/scan/file-size-scan.js +63 -42
- package/dist/services/scan/type-corroboration.d.ts +32 -0
- package/dist/services/scan/type-corroboration.js +51 -0
- package/dist/services/scan/type-sanity-service.d.ts +14 -0
- package/dist/services/scan/type-sanity-service.js +23 -22
- package/dist/services/security/safe-settings-path.d.ts +5 -0
- package/dist/services/security/safe-settings-path.js +64 -8
- package/dist/services/skill/resume-detector.js +11 -11
- package/dist/services/skills/hooks-codegate-superpowers.d.ts +5 -6
- package/dist/services/skills/hooks-codegate-superpowers.js +7 -8
- package/dist/services/skills/hooks-settings-service.d.ts +1 -1
- package/dist/services/skills/hooks-settings-service.js +1 -1
- package/dist/services/skills/presence-lease-order.d.ts +13 -0
- package/dist/services/skills/presence-lease-order.js +24 -0
- package/dist/services/skills/skill-conformance-service.js +1 -0
- package/dist/services/skills/skill-statusline-service.js +4 -7
- package/dist/services/slice/slice-check-service.js +8 -8
- package/dist/services/workflow/pipeline-verify-gate-support.d.ts +24 -8
- package/dist/services/workflow/pipeline-verify-gate-support.js +34 -39
- package/dist/services/workflow/pipeline-verify-qa-phase.d.ts +102 -0
- package/dist/services/workflow/pipeline-verify-qa-phase.js +176 -0
- package/dist/services/workflow/pipeline-verify-service.js +27 -28
- package/dist/services/workflow/request-type-resolution.d.ts +99 -0
- package/dist/services/workflow/request-type-resolution.js +130 -0
- package/dist/services/workflow/workflow-skip-service.d.ts +1 -20
- package/dist/services/workflow/workflow-skip-service.js +22 -25
- package/dist/services/workflow/workflow-state-store.d.ts +9 -0
- package/dist/services/workflow/workflow-state-store.js +26 -1
- package/dist/services/workspace/claude-settings-retirements.d.ts +54 -0
- package/dist/services/workspace/claude-settings-retirements.js +112 -0
- package/dist/services/workspace/claude-settings-template-merge.d.ts +35 -15
- package/dist/services/workspace/claude-settings-template-merge.js +33 -53
- package/dist/services/workspace/claude-settings-template.d.ts +62 -12
- package/dist/services/workspace/claude-settings-template.js +58 -58
- package/dist/services/workspace/migrate-1-4-1-service.js +3 -0
- package/dist/services/workspace/reconcile-service.js +0 -1
- package/dist/shared/incrementing-number.d.ts +33 -2
- package/dist/shared/incrementing-number.js +72 -3
- package/package.json +5 -7
- package/skills/bee/peaks-perf-audit/SKILL.md +1 -1
- package/skills/bee/peaks-prd/SKILL.md +4 -3
- package/skills/bee/peaks-qa/SKILL.md +1 -1
- package/skills/bee/peaks-qa/references/qa-sub-agent-dispatch.md +2 -2
- package/skills/bee/peaks-qa/references/qa-transition-gates.md +1 -1
- package/skills/bee/peaks-rd/SKILL.md +2 -2
- package/skills/bee/peaks-rd/references/rd-fanout-contracts.md +1 -1
- package/skills/bee/peaks-rd/references/rd-sub-agent-dispatch.md +8 -4
- package/skills/bee/peaks-rd/references/rd-transition-gates.md +3 -3
- package/skills/bee/peaks-rd/references/v2-12-fanout-collapse.md +2 -2
- package/skills/bee/peaks-rd/references/writing-handoff-frontmatter.md +1 -1
- package/skills/bee/peaks-reviewer/SKILL.md +1 -1
- package/skills/bee/peaks-sc/SKILL.md +1 -1
- package/skills/bee/peaks-security-audit/SKILL.md +10 -2
- package/skills/bee/peaks-txt/SKILL.md +4 -3
- package/skills/bee/peaks-ui/SKILL.md +3 -3
- package/skills/peaks-audit/SKILL.md +29 -1
- package/skills/peaks-code/SKILL.md +37 -17
- package/skills/peaks-code/references/fast-lane-norm.md +42 -0
- package/skills/peaks-code/references/fast-mode.md +3 -2
- package/skills/peaks-code/references/local-artifact-workspace.md +3 -3
- package/skills/peaks-code/references/micro-cycle.md +3 -3
- package/skills/peaks-code/references/resume-detection.md +1 -1
- package/skills/peaks-code/references/runbook.md +12 -6
- package/skills/peaks-code/references/step-11-memory-sediment.md +4 -0
- package/skills/peaks-code/references/sub-agent-dispatch.md +1 -1
- package/skills/peaks-code/references/swarm-dispatch-contract.md +40 -16
- package/skills/peaks-code/references/workflow-gates-and-types.md +6 -6
- package/skills/peaks-code/references/worktree-governance.md +4 -4
- package/skills/peaks-content/SKILL.md +1 -1
- package/skills/peaks-doctor/SKILL.md +1 -1
- package/skills/peaks-final-review/SKILL.md +31 -11
- package/skills/peaks-ide/SKILL.md +1 -1
- package/skills/peaks-issue-fix-orchestrator/SKILL.md +1 -1
- package/skills/peaks-race-code/SKILL.md +185 -0
- package/skills/peaks-resume/SKILL.md +1 -1
- package/skills/peaks-slice-decompose/SKILL.md +1 -1
- package/skills/peaks-solo/SKILL.md +1 -1
- package/skills/peaks-sop/SKILL.md +1 -1
- package/skills/peaks-status/SKILL.md +1 -1
- package/skills/peaks-test/SKILL.md +7 -4
- package/dist/cli/commands/vm-command-shared.d.ts +0 -23
- package/dist/cli/commands/vm-command-shared.js +0 -23
- package/dist/cli/commands/vm-commands.d.ts +0 -3
- package/dist/cli/commands/vm-commands.js +0 -45
- package/dist/cli/commands/vm-hypervisor-probe.d.ts +0 -27
- package/dist/cli/commands/vm-hypervisor-probe.js +0 -78
- package/dist/cli/commands/vm-hypervisor-runtime.d.ts +0 -15
- package/dist/cli/commands/vm-hypervisor-runtime.js +0 -64
- package/dist/cli/commands/vm-release-command.d.ts +0 -5
- package/dist/cli/commands/vm-release-command.js +0 -101
- package/dist/cli/commands/vm-spawn-command.d.ts +0 -5
- package/dist/cli/commands/vm-spawn-command.js +0 -177
- package/dist/cli/commands/vm-status-command.js +0 -50
- package/dist/services/audit/enforcers/lint-peaks-skill-runtime.d.ts +0 -23
- package/dist/services/audit/enforcers/lint-peaks-skill-runtime.js +0 -64
- package/dist/services/vm/vm-lease.d.ts +0 -40
- package/dist/services/vm/vm-lease.js +0 -160
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Shared ordering for a peaks session's presence leases.
|
|
2
|
+
//
|
|
3
|
+
// Lives on its own because the three readers that need it — the resolver, the
|
|
4
|
+
// statusline projection, and the per-caller legacy read — sit in three modules
|
|
5
|
+
// and none of them owns the other. They used to order the same lease set three
|
|
6
|
+
// ways (two by heartbeat alone, one with a tie-break), so they could name
|
|
7
|
+
// different leases as "who is driving".
|
|
8
|
+
/**
|
|
9
|
+
* Most recent lease first: `lastHeartbeat` desc, `startedAt` desc as the
|
|
10
|
+
* tie-break.
|
|
11
|
+
*
|
|
12
|
+
* The tie-break is not decorative. Nothing refreshes the on-disk heartbeat
|
|
13
|
+
* today — no caller runs `setPresenceLease` on a cadence — so `lastHeartbeat`
|
|
14
|
+
* frequently equals `startedAt`, and two leases written in the same millisecond
|
|
15
|
+
* tie on heartbeat alone. That tie then falls through to `Array.prototype.sort`
|
|
16
|
+
* stability, i.e. `readdirSync` order, which is the input this ordering exists
|
|
17
|
+
* to stop depending on.
|
|
18
|
+
*/
|
|
19
|
+
export function comparePresenceLeases(a, b) {
|
|
20
|
+
const byHeartbeat = (b.lastHeartbeat ?? '').localeCompare(a.lastHeartbeat ?? '');
|
|
21
|
+
if (byHeartbeat !== 0)
|
|
22
|
+
return byHeartbeat;
|
|
23
|
+
return (b.startedAt ?? '').localeCompare(a.startedAt ?? '');
|
|
24
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { findProjectRoot } from '../config/config-safety.js';
|
|
2
2
|
import { getSessionIdCanonical } from '../session/session-manager.js';
|
|
3
3
|
import { resolveActiveSkillForCaller } from '../audit/enforcers/active-skill-resolver.js';
|
|
4
|
+
import { comparePresenceLeases } from './presence-lease-order.js';
|
|
4
5
|
import { listPresenceLeases } from './presence-lease-service.js';
|
|
5
6
|
import { read24hOverlay, readActiveLeaf, readCompactState, resolveCallerId, resolveCwdFromStdin } from './skill-statusline-model.js';
|
|
6
7
|
export { parseStatusLineStdin, read24hOverlay } from './skill-statusline-model.js';
|
|
@@ -101,13 +102,9 @@ function readPresenceReadOnly(projectRoot, callerId) {
|
|
|
101
102
|
if (inFlight.length === 0) {
|
|
102
103
|
return { presence: null, invalid: false };
|
|
103
104
|
}
|
|
104
|
-
// Most recent wins
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
if (hb !== 0)
|
|
108
|
-
return hb;
|
|
109
|
-
return b.startedAt.localeCompare(a.startedAt);
|
|
110
|
-
});
|
|
105
|
+
// Most recent wins, through the shared comparator so every reader of one
|
|
106
|
+
// lease set names the same lease.
|
|
107
|
+
const sorted = inFlight.slice().sort(comparePresenceLeases);
|
|
111
108
|
const latest = sorted[0];
|
|
112
109
|
if (latest === undefined || typeof latest.skill !== 'string' || latest.skill.length === 0) {
|
|
113
110
|
return { presence: null, invalid: false };
|
|
@@ -243,22 +243,22 @@ async function runUnitTests(projectRoot, runTests) {
|
|
|
243
243
|
}
|
|
244
244
|
};
|
|
245
245
|
}
|
|
246
|
-
//
|
|
247
|
-
//
|
|
248
|
-
// in, so this boundary gate and the transition gate agree on which file is
|
|
249
|
-
// a slice's evidence. `<rid>` is substituted at probe time.
|
|
246
|
+
// Candidate order is canonical-first, then the back-compat tiers, mirroring
|
|
247
|
+
// `artifact-prerequisites.ts` (v2.12.0 moved security + perf to audit skills).
|
|
250
248
|
const REVIEW_FILES = [
|
|
251
249
|
{
|
|
252
250
|
name: 'code-review',
|
|
253
251
|
paths: ['rd/code-review-<rid>.md', 'rd/code-review.md'],
|
|
254
252
|
label: 'code-review'
|
|
255
253
|
},
|
|
256
|
-
// v2.12.0 collapse: security + perf moved to standalone audit skills.
|
|
257
|
-
// OR the v2.11.x legacy path during the 1-minor-release back-compat
|
|
258
|
-
// window (v2.13.0 hard-deletes the legacy paths — see CHANGELOG [2.12.0]).
|
|
259
254
|
{
|
|
260
255
|
name: 'security-review',
|
|
261
|
-
paths: [
|
|
256
|
+
paths: [
|
|
257
|
+
'audit/security-<rid>.md',
|
|
258
|
+
'audit/security.md',
|
|
259
|
+
'rd/security-review-<rid>.md',
|
|
260
|
+
'rd/security-review.md'
|
|
261
|
+
],
|
|
262
262
|
label: 'security-review'
|
|
263
263
|
},
|
|
264
264
|
{
|
|
@@ -10,14 +10,11 @@ import { type ArtifactPrerequisite, type RequestType } from '../artifacts/artifa
|
|
|
10
10
|
import type { RequestArtifactRole, RequestArtifactState } from '../artifacts/request-artifact-service.js';
|
|
11
11
|
import type { PipelineGate } from './pipeline-verify-types.js';
|
|
12
12
|
export declare function extractState(markdown: string): string;
|
|
13
|
-
/**
|
|
14
|
-
* scope
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
|
|
18
|
-
* `.peaks/_runtime/<sessionId>/<role>/requests/`.
|
|
19
|
-
*/
|
|
20
|
-
export declare function findRequestFile(projectRoot: string, role: string, rid: string): Promise<{
|
|
13
|
+
/** The rid's artifact file, read from ONE session: `sessionId` is required, and
|
|
14
|
+
* `null` — no resolvable scope — means NO CARRIER, never a scan (that branch
|
|
15
|
+
* reads every directory under `.peaks/_runtime/` and takes the first name that
|
|
16
|
+
* sorts). The dir the file was FOUND in comes back as `sessionId`. */
|
|
17
|
+
export declare function findRequestFile(projectRoot: string, role: string, rid: string, sessionId: string | null): Promise<{
|
|
21
18
|
path: string;
|
|
22
19
|
content: string;
|
|
23
20
|
sessionId: string;
|
|
@@ -54,6 +51,25 @@ export declare function findRequestFile(projectRoot: string, role: string, rid:
|
|
|
54
51
|
export declare function contractPrerequisite(role: RequestArtifactRole, state: RequestArtifactState, requestType: RequestType, probeName: string): ArtifactPrerequisite | null;
|
|
55
52
|
export declare function contractEvidencePaths(role: RequestArtifactRole, state: RequestArtifactState, requestType: RequestType, probeName: string): string[] | null;
|
|
56
53
|
export declare function rdGatesForType(requestType: RequestType): PipelineGate[];
|
|
54
|
+
/**
|
|
55
|
+
* The QA phase's gate list for one type.
|
|
56
|
+
*
|
|
57
|
+
* Both halves are read off the type's own table. WHICH EVIDENCE the phase owes is
|
|
58
|
+
* the type's `qa:` row, resolved through the same contract accessor
|
|
59
|
+
* `rdGatesForType` uses — a row the contract carries builds its gate, a row it
|
|
60
|
+
* does not carry builds none. WHETHER the phase exists at all is
|
|
61
|
+
* `typeRequiresQaPhase`, the same call the checker makes, which is the part that
|
|
62
|
+
* used to be a list of three request types named here. The derivation and the
|
|
63
|
+
* arming that keeps it total are `pipeline-verify-qa-phase.ts`.
|
|
64
|
+
*
|
|
65
|
+
* Two of the six types are why this reads the table instead of naming its
|
|
66
|
+
* members. The minimal table — docs and chore — carries no `qa:` row, so those
|
|
67
|
+
* types owe no QA evidence and get an empty list; that is how both the checker
|
|
68
|
+
* and the commit-time carrier learn there is no phase to report. Config carries
|
|
69
|
+
* exactly one QA row instead: a test report, and no test cases. The member list
|
|
70
|
+
* was wrong about both, in opposite directions: one type was asked for a phase it
|
|
71
|
+
* does not owe, and the other never for the evidence its transition requires.
|
|
72
|
+
*/
|
|
57
73
|
export declare function qaGatesForType(requestType: RequestType): PipelineGate[];
|
|
58
74
|
export declare const RD_QA_HANDOFF_STATES: Set<string>;
|
|
59
75
|
export declare const QA_COMPLETE_STATES: Set<string>;
|
|
@@ -8,24 +8,26 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { existsSync, readFileSync } from 'node:fs';
|
|
10
10
|
import { join } from 'node:path';
|
|
11
|
-
import { getPrerequisitesFor
|
|
11
|
+
import { getPrerequisitesFor } from '../artifacts/artifact-prerequisites.js';
|
|
12
|
+
import * as qaPhase from './pipeline-verify-qa-phase.js';
|
|
13
|
+
import { prerequisiteBodyViolations } from '../artifacts/prerequisite-checks.js';
|
|
12
14
|
import { showRequestArtifact } from '../artifacts/request-artifact-service.js';
|
|
13
15
|
import { readArtifactState } from '../artifacts/request-artifact-state-helpers.js';
|
|
14
16
|
export function extractState(markdown) {
|
|
15
17
|
return readArtifactState(markdown) ?? 'unknown';
|
|
16
18
|
}
|
|
17
|
-
/**
|
|
18
|
-
* scope
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
export async function findRequestFile(projectRoot, role, rid) {
|
|
19
|
+
/** The rid's artifact file, read from ONE session: `sessionId` is required, and
|
|
20
|
+
* `null` — no resolvable scope — means NO CARRIER, never a scan (that branch
|
|
21
|
+
* reads every directory under `.peaks/_runtime/` and takes the first name that
|
|
22
|
+
* sorts). The dir the file was FOUND in comes back as `sessionId`. */
|
|
23
|
+
export async function findRequestFile(projectRoot, role, rid, sessionId) {
|
|
24
|
+
if (sessionId === null)
|
|
25
|
+
return null;
|
|
25
26
|
const artifact = await showRequestArtifact({
|
|
26
27
|
projectRoot,
|
|
27
28
|
role: role,
|
|
28
|
-
requestId: rid
|
|
29
|
+
requestId: rid,
|
|
30
|
+
sessionId
|
|
29
31
|
});
|
|
30
32
|
if (artifact === null)
|
|
31
33
|
return null;
|
|
@@ -176,32 +178,27 @@ export function rdGatesForType(requestType) {
|
|
|
176
178
|
}
|
|
177
179
|
return gates;
|
|
178
180
|
}
|
|
181
|
+
/**
|
|
182
|
+
* The QA phase's gate list for one type.
|
|
183
|
+
*
|
|
184
|
+
* Both halves are read off the type's own table. WHICH EVIDENCE the phase owes is
|
|
185
|
+
* the type's `qa:` row, resolved through the same contract accessor
|
|
186
|
+
* `rdGatesForType` uses — a row the contract carries builds its gate, a row it
|
|
187
|
+
* does not carry builds none. WHETHER the phase exists at all is
|
|
188
|
+
* `typeRequiresQaPhase`, the same call the checker makes, which is the part that
|
|
189
|
+
* used to be a list of three request types named here. The derivation and the
|
|
190
|
+
* arming that keeps it total are `pipeline-verify-qa-phase.ts`.
|
|
191
|
+
*
|
|
192
|
+
* Two of the six types are why this reads the table instead of naming its
|
|
193
|
+
* members. The minimal table — docs and chore — carries no `qa:` row, so those
|
|
194
|
+
* types owe no QA evidence and get an empty list; that is how both the checker
|
|
195
|
+
* and the commit-time carrier learn there is no phase to report. Config carries
|
|
196
|
+
* exactly one QA row instead: a test report, and no test cases. The member list
|
|
197
|
+
* was wrong about both, in opposite directions: one type was asked for a phase it
|
|
198
|
+
* does not owe, and the other never for the evidence its transition requires.
|
|
199
|
+
*/
|
|
179
200
|
export function qaGatesForType(requestType) {
|
|
180
|
-
|
|
181
|
-
{
|
|
182
|
-
name: 'qa-request-exists',
|
|
183
|
-
description: 'QA request artifact created',
|
|
184
|
-
passed: false,
|
|
185
|
-
detail: ''
|
|
186
|
-
}
|
|
187
|
-
];
|
|
188
|
-
if (requestType === 'feature' || requestType === 'refactor' || requestType === 'bugfix') {
|
|
189
|
-
gates.push({ name: 'test-cases', description: 'QA test cases', passed: false, detail: '' });
|
|
190
|
-
gates.push({
|
|
191
|
-
name: 'test-report',
|
|
192
|
-
description: 'QA test report with execution results',
|
|
193
|
-
passed: false,
|
|
194
|
-
detail: ''
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
// The `security-findings` / `performance-findings` gates were removed here
|
|
198
|
-
// security review or performance review — `peaks-qa/SKILL.md` says so, and
|
|
199
|
-
// the v2.11.0 D1/D4 trim dropped both from every `qa:verdict-issued` table.
|
|
200
|
-
// The evidence they used to demand is now checked on the RD side, at the
|
|
201
|
-
// paths the contract actually names (`audit/security-<rid>.md`,
|
|
202
|
-
// `audit/perf.md` and `rd/security-review.md` / `rd/perf-baseline.md` as the
|
|
203
|
-
// declared legacy tiers behind them).
|
|
204
|
-
return gates;
|
|
201
|
+
return qaPhase.qaPhaseGates(qaPhase.typeRequiresQaPhase(requestType), qaPhase.QA_EVIDENCE_GATES.filter((gate) => qaPhase.QA_STATES.some((state) => contractEvidencePaths('qa', state, requestType, gate.relativePath) !== null)));
|
|
205
202
|
}
|
|
206
203
|
export const RD_QA_HANDOFF_STATES = new Set(['qa-handoff', 'handed-off', 'implemented']);
|
|
207
204
|
export const QA_COMPLETE_STATES = new Set(['verdict-issued']);
|
|
@@ -292,10 +289,8 @@ export function resolveRdEvidencePaths(gates, rdEvidenceDir, projectRoot, rid, r
|
|
|
292
289
|
* at the contract's own paths (`audit/security-<rid>.md`,
|
|
293
290
|
* `audit/perf-<rid>.md`). */
|
|
294
291
|
export function resolveQaEvidencePaths(gates, projectRoot, rdEvidenceDir, requestType, rid, violations, nextActions, tracker) {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
'test-report': 'qa/test-reports/<rid>.md'
|
|
298
|
-
};
|
|
292
|
+
// Derived from the declared gates — a restatement could resolve a renamed path.
|
|
293
|
+
const QA_EVIDENCE_PROBE = Object.fromEntries(qaPhase.QA_EVIDENCE_GATES.map((gate) => [gate.name, gate.relativePath]));
|
|
299
294
|
let anyEvidenceResolved = tracker.anyEvidenceResolved;
|
|
300
295
|
let allResolvedPathsCanonical = tracker.allResolvedPathsCanonical;
|
|
301
296
|
for (const gate of gates.slice(1)) {
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* peaks-workflow — the QA phase, derived from the type tables.
|
|
3
|
+
*
|
|
4
|
+
* WHY THIS IS A MODULE OF ITS OWN. A measured budget, not taste: the file-size
|
|
5
|
+
* census records the gated excess by EQUALITY, and `pipeline-verify-gate-support`
|
|
6
|
+
* already carries its share of that sum. A file under its cap adds nothing to it,
|
|
7
|
+
* so the reasoning below — which a contributor has to be able to find — is paid
|
|
8
|
+
* for here, at zero census cost.
|
|
9
|
+
*
|
|
10
|
+
* WHY A DERIVATION AT ALL. Two layers answered one question — *does this request
|
|
11
|
+
* need a QA phase?* — and gave different answers, because neither read the answer
|
|
12
|
+
* off the type tables that define the contract. One named three request types;
|
|
13
|
+
* the other asked unconditionally. A request whose table carries no QA row at all
|
|
14
|
+
* therefore satisfied every prerequisite its own contract lists and was then
|
|
15
|
+
* refused at commit time for a phase that contract never asked for.
|
|
16
|
+
*
|
|
17
|
+
* The tables are the authority. `MINIMAL_TABLE` carries no `qa:` row, which is
|
|
18
|
+
* what "these types have no QA phase" has always meant, and what
|
|
19
|
+
* `request transition --role qa --state verdict-issued` has always enforced
|
|
20
|
+
* against the same table.
|
|
21
|
+
*
|
|
22
|
+
* WHY IT IS ARMED. A derivation nobody checks is a restatement with better
|
|
23
|
+
* manners. A table row can name a QA artifact no gate stands for, and that row
|
|
24
|
+
* would then build no gate and say nothing about it — the same drift, one layer
|
|
25
|
+
* down. So the declared gate list is reconciled against every type's QA rows once
|
|
26
|
+
* per process, and a mismatch THROWS. The cost is deliberate and wider than it
|
|
27
|
+
* looks: the CLI registers every command eagerly, so an unrepresentable row does
|
|
28
|
+
* not merely fail `verify-pipeline` — it fails EVERY `peaks` invocation that
|
|
29
|
+
* reaches this module, the commit leg and `workflow verdict-aggregate` included.
|
|
30
|
+
* That is the fail-closed
|
|
31
|
+
* direction, and naming the row keeps the repair one line.
|
|
32
|
+
*/
|
|
33
|
+
import { type RequestType } from '../artifacts/artifact-prerequisites.js';
|
|
34
|
+
import type { PipelineGate } from './pipeline-verify-types.js';
|
|
35
|
+
/**
|
|
36
|
+
* Every state the QA role can be in, taken from the repository's own state model
|
|
37
|
+
* rather than restated here.
|
|
38
|
+
*
|
|
39
|
+
* WHY IT IS NOT JUST `verdict-issued`. The terminal state is the one the phase's
|
|
40
|
+
* evidence is resolved at, so an earlier version keyed both the derivation and the
|
|
41
|
+
* reconciliation to it alone — which left the `qa:running` row a feature's table
|
|
42
|
+
* already carries outside the arming. A row at any other state would have been
|
|
43
|
+
* silently unrepresentable. The arming is total over the state axis instead.
|
|
44
|
+
*/
|
|
45
|
+
export declare const QA_STATES: readonly import("../artifacts/request-artifact-state-helpers.js").RequestArtifactState[];
|
|
46
|
+
/**
|
|
47
|
+
* Every QA evidence gate the checker can build, each naming the contract path it
|
|
48
|
+
* stands for. The NAME is the checker's own — `peaks workflow skip` takes gate
|
|
49
|
+
* names and the violation text prints the description — while the PATH is the
|
|
50
|
+
* contract's, and it is the half that makes a gate list derivable instead of
|
|
51
|
+
* restated beside the tables it is supposed to be read from.
|
|
52
|
+
*/
|
|
53
|
+
export declare const QA_EVIDENCE_GATES: ReadonlyArray<{
|
|
54
|
+
name: string;
|
|
55
|
+
description: string;
|
|
56
|
+
relativePath: string;
|
|
57
|
+
}>;
|
|
58
|
+
/**
|
|
59
|
+
* Does this type's table carry a QA phase?
|
|
60
|
+
*
|
|
61
|
+
* One derivation, so the gate list and the checker's verdict cannot disagree: the
|
|
62
|
+
* phase exists for a type exactly when its table carries a QA prerequisite —
|
|
63
|
+
* counted across every QA state, so a type whose only QA row sits at a
|
|
64
|
+
* non-terminal state is not read as having no phase at all.
|
|
65
|
+
*/
|
|
66
|
+
export declare function typeRequiresQaPhase(requestType: RequestType): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* The request types whose table carries NO QA phase — the set a skip may cover.
|
|
69
|
+
*
|
|
70
|
+
* DERIVED, not listed. The skip allowlist used to spell `['docs', 'config', 'chore']`,
|
|
71
|
+
* and `config` carries a QA phase (its table demands `SECURITY_REVIEW` and
|
|
72
|
+
* `TEST_REPORT`), so a plantable record could bypass a phase the contract requires.
|
|
73
|
+
* Reading the answer off the same derivation the pipeline uses means a table change
|
|
74
|
+
* moves the allowlist with it — in both directions, without anyone remembering.
|
|
75
|
+
*/
|
|
76
|
+
export declare const QA_FREE_TYPES: ReadonlyArray<RequestType>;
|
|
77
|
+
/**
|
|
78
|
+
* Fill in the QA request gate for a phase that HAS one.
|
|
79
|
+
*
|
|
80
|
+
* A type whose table carries no QA row has no QA gate to fill, and that is not a
|
|
81
|
+
* special case to handle at the call site: the artifact is still honoured — its
|
|
82
|
+
* state and its location are read either way — so a tree that ran QA for a type
|
|
83
|
+
* whose table does not demand it keeps passing.
|
|
84
|
+
*/
|
|
85
|
+
export declare function markQaRequestGate(gates: PipelineGate[], artifactPath: string): void;
|
|
86
|
+
/**
|
|
87
|
+
* The QA phase's gate list for one type: the phase gate when the phase exists,
|
|
88
|
+
* then one gate per piece of evidence the caller resolved from the contract. An
|
|
89
|
+
* empty list IS the answer for a type with no QA phase.
|
|
90
|
+
*
|
|
91
|
+
* The `security-findings` / `performance-findings` gates were removed here
|
|
92
|
+
* security review or performance review — `peaks-qa/SKILL.md` says so, and the
|
|
93
|
+
* v2.11.0 D1/D4 trim dropped both from every `qa:verdict-issued` table. The
|
|
94
|
+
* evidence they used to demand is now checked on the RD side, at the paths the
|
|
95
|
+
* contract actually names (`audit/security-<rid>.md`, `audit/perf.md` and
|
|
96
|
+
* `rd/security-review.md` / `rd/perf-baseline.md` as the declared legacy tiers
|
|
97
|
+
* behind them).
|
|
98
|
+
*/
|
|
99
|
+
export declare function qaPhaseGates(required: boolean, evidence: ReadonlyArray<{
|
|
100
|
+
name: string;
|
|
101
|
+
description: string;
|
|
102
|
+
}>): PipelineGate[];
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* peaks-workflow — the QA phase, derived from the type tables.
|
|
3
|
+
*
|
|
4
|
+
* WHY THIS IS A MODULE OF ITS OWN. A measured budget, not taste: the file-size
|
|
5
|
+
* census records the gated excess by EQUALITY, and `pipeline-verify-gate-support`
|
|
6
|
+
* already carries its share of that sum. A file under its cap adds nothing to it,
|
|
7
|
+
* so the reasoning below — which a contributor has to be able to find — is paid
|
|
8
|
+
* for here, at zero census cost.
|
|
9
|
+
*
|
|
10
|
+
* WHY A DERIVATION AT ALL. Two layers answered one question — *does this request
|
|
11
|
+
* need a QA phase?* — and gave different answers, because neither read the answer
|
|
12
|
+
* off the type tables that define the contract. One named three request types;
|
|
13
|
+
* the other asked unconditionally. A request whose table carries no QA row at all
|
|
14
|
+
* therefore satisfied every prerequisite its own contract lists and was then
|
|
15
|
+
* refused at commit time for a phase that contract never asked for.
|
|
16
|
+
*
|
|
17
|
+
* The tables are the authority. `MINIMAL_TABLE` carries no `qa:` row, which is
|
|
18
|
+
* what "these types have no QA phase" has always meant, and what
|
|
19
|
+
* `request transition --role qa --state verdict-issued` has always enforced
|
|
20
|
+
* against the same table.
|
|
21
|
+
*
|
|
22
|
+
* WHY IT IS ARMED. A derivation nobody checks is a restatement with better
|
|
23
|
+
* manners. A table row can name a QA artifact no gate stands for, and that row
|
|
24
|
+
* would then build no gate and say nothing about it — the same drift, one layer
|
|
25
|
+
* down. So the declared gate list is reconciled against every type's QA rows once
|
|
26
|
+
* per process, and a mismatch THROWS. The cost is deliberate and wider than it
|
|
27
|
+
* looks: the CLI registers every command eagerly, so an unrepresentable row does
|
|
28
|
+
* not merely fail `verify-pipeline` — it fails EVERY `peaks` invocation that
|
|
29
|
+
* reaches this module, the commit leg and `workflow verdict-aggregate` included.
|
|
30
|
+
* That is the fail-closed
|
|
31
|
+
* direction, and naming the row keeps the repair one line.
|
|
32
|
+
*/
|
|
33
|
+
import { getPrerequisitesFor, VALID_REQUEST_TYPES } from '../artifacts/artifact-prerequisites.js';
|
|
34
|
+
import { allowedStatesForRole } from '../artifacts/request-artifact-state-helpers.js';
|
|
35
|
+
/**
|
|
36
|
+
* Every state the QA role can be in, taken from the repository's own state model
|
|
37
|
+
* rather than restated here.
|
|
38
|
+
*
|
|
39
|
+
* WHY IT IS NOT JUST `verdict-issued`. The terminal state is the one the phase's
|
|
40
|
+
* evidence is resolved at, so an earlier version keyed both the derivation and the
|
|
41
|
+
* reconciliation to it alone — which left the `qa:running` row a feature's table
|
|
42
|
+
* already carries outside the arming. A row at any other state would have been
|
|
43
|
+
* silently unrepresentable. The arming is total over the state axis instead.
|
|
44
|
+
*/
|
|
45
|
+
export const QA_STATES = allowedStatesForRole('qa');
|
|
46
|
+
/**
|
|
47
|
+
* Every QA evidence gate the checker can build, each naming the contract path it
|
|
48
|
+
* stands for. The NAME is the checker's own — `peaks workflow skip` takes gate
|
|
49
|
+
* names and the violation text prints the description — while the PATH is the
|
|
50
|
+
* contract's, and it is the half that makes a gate list derivable instead of
|
|
51
|
+
* restated beside the tables it is supposed to be read from.
|
|
52
|
+
*/
|
|
53
|
+
export const QA_EVIDENCE_GATES = [
|
|
54
|
+
{ name: 'test-cases', description: 'QA test cases', relativePath: 'qa/test-cases/<rid>.md' },
|
|
55
|
+
{
|
|
56
|
+
name: 'test-report',
|
|
57
|
+
description: 'QA test report with execution results',
|
|
58
|
+
relativePath: 'qa/test-reports/<rid>.md'
|
|
59
|
+
}
|
|
60
|
+
];
|
|
61
|
+
/**
|
|
62
|
+
* Every QA prerequisite this type's table carries, at any state the QA role can
|
|
63
|
+
* be in.
|
|
64
|
+
*
|
|
65
|
+
* THE REFUSAL IS NAMED ON PURPOSE. `getPrerequisitesFor` reads a record keyed by
|
|
66
|
+
* type, so a non-member reaches `undefined` and throws a bare `TypeError` — before
|
|
67
|
+
* the derivation existed, a list of names answered such a caller with a gate list
|
|
68
|
+
* instead. A value that no longer works must say what it wanted, which value it
|
|
69
|
+
* got, and what the alternatives are.
|
|
70
|
+
*/
|
|
71
|
+
function qaPrerequisitesOfType(requestType) {
|
|
72
|
+
if (!VALID_REQUEST_TYPES.includes(requestType)) {
|
|
73
|
+
throw new Error(`pipeline-verify: "${String(requestType)}" is not a request type — expected one of ${VALID_REQUEST_TYPES.join(', ')}`);
|
|
74
|
+
}
|
|
75
|
+
return QA_STATES.flatMap((state) => getPrerequisitesFor('qa', state, requestType));
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Does this type's table carry a QA phase?
|
|
79
|
+
*
|
|
80
|
+
* One derivation, so the gate list and the checker's verdict cannot disagree: the
|
|
81
|
+
* phase exists for a type exactly when its table carries a QA prerequisite —
|
|
82
|
+
* counted across every QA state, so a type whose only QA row sits at a
|
|
83
|
+
* non-terminal state is not read as having no phase at all.
|
|
84
|
+
*/
|
|
85
|
+
export function typeRequiresQaPhase(requestType) {
|
|
86
|
+
return qaPrerequisitesOfType(requestType).length > 0;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* The request types whose table carries NO QA phase — the set a skip may cover.
|
|
90
|
+
*
|
|
91
|
+
* DERIVED, not listed. The skip allowlist used to spell `['docs', 'config', 'chore']`,
|
|
92
|
+
* and `config` carries a QA phase (its table demands `SECURITY_REVIEW` and
|
|
93
|
+
* `TEST_REPORT`), so a plantable record could bypass a phase the contract requires.
|
|
94
|
+
* Reading the answer off the same derivation the pipeline uses means a table change
|
|
95
|
+
* moves the allowlist with it — in both directions, without anyone remembering.
|
|
96
|
+
*/
|
|
97
|
+
export const QA_FREE_TYPES = Object.freeze(VALID_REQUEST_TYPES.filter((requestType) => !typeRequiresQaPhase(requestType)));
|
|
98
|
+
/**
|
|
99
|
+
* Fill in the QA request gate for a phase that HAS one.
|
|
100
|
+
*
|
|
101
|
+
* A type whose table carries no QA row has no QA gate to fill, and that is not a
|
|
102
|
+
* special case to handle at the call site: the artifact is still honoured — its
|
|
103
|
+
* state and its location are read either way — so a tree that ran QA for a type
|
|
104
|
+
* whose table does not demand it keeps passing.
|
|
105
|
+
*/
|
|
106
|
+
export function markQaRequestGate(gates, artifactPath) {
|
|
107
|
+
const requestGate = gates[0];
|
|
108
|
+
if (requestGate === undefined)
|
|
109
|
+
return;
|
|
110
|
+
requestGate.passed = true;
|
|
111
|
+
requestGate.detail = `found at ${artifactPath}`;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* The QA phase's gate list for one type: the phase gate when the phase exists,
|
|
115
|
+
* then one gate per piece of evidence the caller resolved from the contract. An
|
|
116
|
+
* empty list IS the answer for a type with no QA phase.
|
|
117
|
+
*
|
|
118
|
+
* The `security-findings` / `performance-findings` gates were removed here
|
|
119
|
+
* security review or performance review — `peaks-qa/SKILL.md` says so, and the
|
|
120
|
+
* v2.11.0 D1/D4 trim dropped both from every `qa:verdict-issued` table. The
|
|
121
|
+
* evidence they used to demand is now checked on the RD side, at the paths the
|
|
122
|
+
* contract actually names (`audit/security-<rid>.md`, `audit/perf.md` and
|
|
123
|
+
* `rd/security-review.md` / `rd/perf-baseline.md` as the declared legacy tiers
|
|
124
|
+
* behind them).
|
|
125
|
+
*/
|
|
126
|
+
export function qaPhaseGates(required, evidence) {
|
|
127
|
+
if (!required)
|
|
128
|
+
return [];
|
|
129
|
+
const gates = [
|
|
130
|
+
{
|
|
131
|
+
name: 'qa-request-exists',
|
|
132
|
+
description: 'QA request artifact created',
|
|
133
|
+
passed: false,
|
|
134
|
+
detail: ''
|
|
135
|
+
}
|
|
136
|
+
];
|
|
137
|
+
for (const gate of evidence) {
|
|
138
|
+
gates.push({ name: gate.name, description: gate.description, passed: false, detail: '' });
|
|
139
|
+
}
|
|
140
|
+
return gates;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* THE ARM — the reconciliation behind the load-time refusal below.
|
|
144
|
+
*
|
|
145
|
+
* `prerequisitesOfType` is a parameter rather than a direct call so an arm can
|
|
146
|
+
* drive this with a table of its own. That is the only way to show the refusal is
|
|
147
|
+
* reachable: a check that can only ever run against the table it already agrees
|
|
148
|
+
* with cannot be observed to fail.
|
|
149
|
+
*
|
|
150
|
+
* It is handed EVERY QA state's rows — `qaPrerequisitesOfType` above, whose
|
|
151
|
+
* `QA_STATES` is the repository's own model — so a `qa:` row at a state the phase
|
|
152
|
+
* does not end in is armed too. Keying only the terminal state is how the
|
|
153
|
+
* `qa:running` row went unarmed.
|
|
154
|
+
*/
|
|
155
|
+
function qaGateReconciliationFailures(types, prerequisitesOfType) {
|
|
156
|
+
const failures = [];
|
|
157
|
+
for (const requestType of types) {
|
|
158
|
+
for (const prerequisite of prerequisitesOfType(requestType)) {
|
|
159
|
+
// The same path set the contract resolver matches on, so a row accepted
|
|
160
|
+
// through a legacy tier is covered by the gate that tier stands behind.
|
|
161
|
+
const contractPaths = [
|
|
162
|
+
prerequisite.relativePath,
|
|
163
|
+
...(prerequisite.legacyRelativePath !== undefined ? [prerequisite.legacyRelativePath] : []),
|
|
164
|
+
...(prerequisite.legacyRelativePaths ?? [])
|
|
165
|
+
];
|
|
166
|
+
if (QA_EVIDENCE_GATES.some((gate) => contractPaths.includes(gate.relativePath)))
|
|
167
|
+
continue;
|
|
168
|
+
failures.push(`the "${requestType}" table carries the QA prerequisite ${prerequisite.relativePath} and no gate in QA_EVIDENCE_GATES stands for it`);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return failures;
|
|
172
|
+
}
|
|
173
|
+
const QA_GATE_RECONCILIATION_FAILURES = qaGateReconciliationFailures(VALID_REQUEST_TYPES, qaPrerequisitesOfType);
|
|
174
|
+
if (QA_GATE_RECONCILIATION_FAILURES.length > 0) {
|
|
175
|
+
throw new Error(`pipeline-verify: the QA gate list does not follow the type tables — ${QA_GATE_RECONCILIATION_FAILURES.join('; ')}`);
|
|
176
|
+
}
|