gentle-pi 4.6.0 → 4.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +65 -55
- package/assets/agents/gentle-ai-explore.md +4 -3
- package/assets/agents/gentle-ai-verify.md +23 -6
- package/assets/agents/gentle-ai-worker.md +9 -6
- package/assets/agents/jd-fix-agent.md +1 -0
- package/assets/agents/jd-judge-a.md +2 -3
- package/assets/agents/jd-judge-b.md +2 -3
- package/assets/agents/review-readability.md +1 -5
- package/assets/agents/review-reliability.md +1 -5
- package/assets/agents/review-resilience.md +1 -5
- package/assets/agents/review-risk.md +1 -5
- package/assets/design-canvas/canvas-api.js +45 -0
- package/assets/design-canvas/canvas-boards.js +456 -0
- package/assets/design-canvas/canvas-boot.js +217 -0
- package/assets/design-canvas/canvas-checks.js +491 -0
- package/assets/design-canvas/canvas-comments.js +315 -0
- package/assets/design-canvas/canvas-compare.js +159 -0
- package/assets/design-canvas/canvas-events.js +75 -0
- package/assets/design-canvas/canvas-export.js +393 -0
- package/assets/design-canvas/canvas-focus.js +203 -0
- package/assets/design-canvas/canvas-handoffs.js +150 -0
- package/assets/design-canvas/canvas-i18n-es.js +392 -0
- package/assets/design-canvas/canvas-i18n.js +108 -0
- package/assets/design-canvas/canvas-layout.js +526 -0
- package/assets/design-canvas/canvas-menu.js +213 -0
- package/assets/design-canvas/canvas-messages.js +86 -0
- package/assets/design-canvas/canvas-minimap.js +163 -0
- package/assets/design-canvas/canvas-parts.js +401 -0
- package/assets/design-canvas/canvas-popover.js +234 -0
- package/assets/design-canvas/canvas-rail.js +348 -0
- package/assets/design-canvas/canvas-sizes.js +524 -0
- package/assets/design-canvas/canvas-store.js +164 -0
- package/assets/design-canvas/canvas-tokens.js +674 -0
- package/assets/design-canvas/canvas-ui.js +24 -0
- package/assets/design-canvas/canvas-view.js +184 -0
- package/assets/design-canvas/canvas.css +759 -16
- package/assets/design-canvas/canvas.js +2 -1497
- package/assets/design-canvas/index.html +117 -36
- package/assets/design-canvas/inspector.js +546 -16
- package/assets/install-wizard/wizard.js +6 -1
- package/assets/migrations/agent-body-history.json +40 -1
- package/assets/orchestrator-delegation-reference.md +10 -16
- package/assets/orchestrator-delegation.md +5 -5
- package/assets/orchestrator-full-delegation-card.md +64 -0
- package/assets/orchestrator-full-delegation.md +34 -0
- package/assets/orchestrator-memory.md +5 -5
- package/assets/orchestrator-prompts.md +2 -2
- package/assets/orchestrator-quota-recovery.md +5 -0
- package/assets/orchestrator-skills.md +14 -13
- package/assets/orchestrator-tracking.md +10 -14
- package/assets/orchestrator-verification.md +12 -8
- package/assets/orchestrator-writer.md +4 -4
- package/assets/orchestrator.md +21 -25
- package/bin/gentle-shell.mjs +292 -65
- package/contracts/review-provider-contract-mirror/provider-contract.lock.json +8 -9
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/manifest.json +3 -3
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/orchestration/pi.md +1 -0
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/routing/pi.md +6 -6
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/generated/provider-capabilities.baseline.json +3 -3
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/generated/provider-roles.baseline.json +1 -1
- package/docs/agent-status.md +61 -0
- package/docs/assets/brand/sponsor-banner.svg +60 -0
- package/docs/bundled-install.md +20 -10
- package/docs/delegated-verification.md +46 -8
- package/docs/desktop-rpc.md +1253 -0
- package/docs/gentle-agents-activity.md +40 -0
- package/docs/gentle-shell.md +91 -30
- package/docs/install-wizard.md +30 -21
- package/docs/odd-preparation-continuity.md +24 -0
- package/docs/permission-modes.md +17 -4
- package/docs/prompt-budget.md +12 -0
- package/docs/rdd-odd-friction-triage-2026-11-07.md +57 -0
- package/docs/readme-reference.md +142 -45
- package/docs/render-cache-performance.md +11 -1
- package/docs/review-coordinator.md +53 -0
- package/docs/review-delivery-preflight.md +22 -0
- package/docs/review-request-context.md +19 -0
- package/docs/review-windows-acl.md +18 -0
- package/docs/voice.md +6 -3
- package/docs/work-continuity.md +11 -1
- package/docs/yolo-mode.md +5 -5
- package/extensions/ask-user-choice.ts +1 -0
- package/extensions/ask-user-question.ts +3 -2
- package/extensions/child-context.ts +21 -7
- package/extensions/child-safety.ts +3 -0
- package/extensions/gentle-agent-status.ts +99 -0
- package/extensions/gentle-agents.ts +559 -66
- package/extensions/gentle-ai.ts +2001 -518
- package/extensions/gentle-design.ts +69 -3
- package/extensions/gentle-desktop-rpc.ts +143 -0
- package/extensions/gentle-guide.ts +3 -0
- package/extensions/gentle-shell.ts +398 -115
- package/extensions/gentle-todo.ts +66 -27
- package/extensions/gentle-tps.ts +48 -0
- package/extensions/quiet-tools.ts +38 -8
- package/extensions/skill-registry.ts +349 -167
- package/extensions/startup-banner.ts +30 -3
- package/lib/agent-assets.ts +30 -6
- package/lib/agent-profile-pin.ts +3 -3
- package/lib/agent-profiles.ts +160 -2
- package/lib/agent-status.ts +105 -0
- package/lib/agent-tool-overlay.ts +117 -0
- package/lib/agents-config.ts +93 -6
- package/lib/agents-history.ts +24 -5
- package/lib/agents-message-delivery.ts +17 -0
- package/lib/agents-messaging.ts +55 -7
- package/lib/agents-protocol.ts +15 -0
- package/lib/agents-report-cap.ts +115 -0
- package/lib/agents-runner.ts +272 -16
- package/lib/agents-session-transport.ts +17 -1
- package/lib/auto-permission-runtime.ts +1 -1
- package/lib/background-jobs-tools.ts +9 -4
- package/lib/bounded-writer-admission.ts +197 -32
- package/lib/card-content-policy.ts +8 -6
- package/lib/child-context-files.ts +21 -6
- package/lib/codemode-renderer.ts +1 -0
- package/lib/command-palette.ts +133 -17
- package/lib/context-backstop.ts +14 -5
- package/lib/delivery-conflict-markers.ts +349 -0
- package/lib/design-canvas-assets.ts +36 -0
- package/lib/design-canvas-server.ts +241 -23
- package/lib/design-comments.ts +94 -4
- package/lib/design-handoffs.ts +2 -1
- package/lib/design-layout.ts +125 -0
- package/lib/design-parts.ts +281 -0
- package/lib/design-system-tokens.ts +111 -0
- package/lib/desktop-agents-service.ts +294 -0
- package/lib/desktop-design-service.ts +233 -0
- package/lib/desktop-jobs-service.ts +263 -0
- package/lib/desktop-rpc-agents.ts +294 -0
- package/lib/desktop-rpc-config.ts +731 -0
- package/lib/desktop-rpc-design.ts +138 -0
- package/lib/desktop-rpc-jobs.ts +181 -0
- package/lib/desktop-rpc-permissions.ts +177 -0
- package/lib/desktop-rpc-profiles.ts +196 -0
- package/lib/desktop-rpc-usage.ts +229 -0
- package/lib/desktop-rpc.ts +225 -0
- package/lib/desktop-usage-service.ts +310 -0
- package/lib/destructive-command-guard.ts +236 -17
- package/lib/execution-surface-guard.ts +20 -0
- package/lib/exploration-budget.ts +4 -2
- package/lib/gentle-ai-binary.ts +1 -1
- package/lib/gentle-ai-renderer.ts +13 -1
- package/lib/gentle-design.ts +204 -14
- package/lib/gentle-shell-bundled.ts +106 -28
- package/lib/gentle-shell-launcher.ts +43 -8
- package/lib/herdr-activity.ts +14 -2
- package/lib/herdr-busy.ts +45 -0
- package/lib/hidden-tools.ts +35 -0
- package/lib/image-attachments.ts +33 -0
- package/lib/image-disk-cache.ts +137 -0
- package/lib/inprocess-reviewer.ts +358 -144
- package/lib/jobs-view.ts +198 -11
- package/lib/model-fallback-policy.ts +9 -0
- package/lib/model-routing-authority.ts +31 -4
- package/lib/nan-provider.ts +42 -28
- package/lib/native-choice-list.ts +20 -2
- package/lib/native-review-cli.ts +172 -20
- package/lib/orchestrator-discovery.ts +39 -2
- package/lib/orchestrator-mode-policy.ts +105 -0
- package/lib/questionnaire/questionnaire-view.ts +105 -12
- package/lib/rdd-mode-control.ts +32 -0
- package/lib/reply-language-anchor.ts +129 -0
- package/lib/request-context-placement.ts +53 -0
- package/lib/review-blocker.ts +92 -0
- package/lib/review-candidate-symlink-scan.ts +136 -0
- package/lib/review-candidate-view-owner.ts +81 -44
- package/lib/review-candidate-view.ts +11 -1
- package/lib/review-continuation-registry.ts +116 -0
- package/lib/review-coordinator.ts +407 -0
- package/lib/review-delivery-preflight.ts +85 -0
- package/lib/review-failure-facts.ts +49 -0
- package/lib/review-host-relay.ts +51 -11
- package/lib/review-integration-v2.ts +63 -4
- package/lib/review-relay-phase-timing.ts +45 -0
- package/lib/review-start-context.ts +17 -0
- package/lib/reviewer-stream.ts +87 -0
- package/lib/session-profile-freeze.ts +4 -2
- package/lib/shell-bar.ts +140 -58
- package/lib/shell-changes.ts +2 -0
- package/lib/shell-panel.ts +17 -3
- package/lib/shell-prompt.ts +16 -3
- package/lib/shell-sidebar-layout.ts +112 -40
- package/lib/shell-sidebar.ts +7 -0
- package/lib/shell-todo.ts +10 -3
- package/lib/shell-usage.ts +10 -0
- package/lib/verifier-admission.ts +1 -1
- package/lib/vim-editor-adapter.ts +9 -2
- package/lib/visual-customization-policy.ts +36 -16
- package/lib/visual-customize-view.ts +216 -21
- package/lib/visual-layout-preview.ts +9 -5
- package/lib/visual-profiles.ts +2 -2
- package/lib/windows-session-transport.ts +53 -2
- package/lib/writer-batch-admission.ts +55 -0
- package/lib/yolo-session-policy.ts +46 -16
- package/package.json +3 -2
- package/prompts/skill-creation.md +1 -10
- package/runtime/design-canvas-assets.mjs +37 -0
- package/runtime/gentle-ai-binary.mjs +1 -1
- package/runtime/gentle-shell-bundled.mjs +106 -28
- package/runtime/gentle-shell-launcher.mjs +42 -7
- package/runtime/native-review-cli.mjs +169 -17
- package/runtime/review-integration-v2.mjs +63 -4
- package/scripts/bootstrap.cmd +2 -2
- package/scripts/bootstrap.sh +41 -4
- package/scripts/build-full-delegation-card.mjs +179 -0
- package/scripts/build-runtime-modules.mjs +1 -0
- package/scripts/bundled-install.mjs +38 -8
- package/scripts/download-progress.mjs +68 -0
- package/scripts/gentle-ai-installer.mjs +41 -18
- package/scripts/gentle-ai-proxy.mjs +294 -0
- package/scripts/install-gentle-ai.mjs +14 -1
- package/scripts/installer-downloads.mjs +34 -8
- package/scripts/installer-preflight.mjs +33 -22
- package/scripts/installer-probes.mjs +25 -5
- package/scripts/installer-runner.mjs +27 -12
- package/scripts/installer-server.mjs +46 -16
- package/scripts/installer-windows.mjs +2 -2
- package/scripts/pi-update.mjs +166 -27
- package/scripts/prepare-verifier.mjs +107 -0
- package/scripts/render-cache-host.mjs +72 -0
- package/scripts/render-cache-performance-worker.mjs +5 -4
- package/scripts/render-cache-performance.mjs +6 -1
- package/scripts/run-test-suite.mjs +40 -28
- package/scripts/update-agent-body-history.mjs +55 -8
- package/scripts/verify-package-files.mjs +50 -19
- package/scripts/voice-worker.cjs +32 -6
- package/skills/branch-pr/SKILL.md +16 -16
- package/skills/comment-writer/SKILL.md +1 -1
- package/skills/design/SKILL.md +16 -13
- package/skills/gentle-ai/SKILL.md +7 -7
- package/skills/gentle-ui-design/SKILL.md +46 -0
- package/skills/gentle-ui-design/references/adaptive-interfaces.md +46 -0
- package/skills/gentle-ui-design/references/browse-and-compare.md +62 -0
- package/skills/gentle-ui-design/references/composition-and-feedback.md +56 -0
- package/skills/gentle-ui-design/references/task-and-content.md +60 -0
- package/skills/judgment-day/SKILL.md +2 -2
- package/skills/judgment-day/references/prompts-and-formats.md +1 -1
- package/skills/rdd-defect-workflow/SKILL.md +6 -6
- package/skills/skill-improver/SKILL.md +2 -2
- package/skills/skill-registry/SKILL.md +11 -11
- package/skills/tui-design/SKILL.md +1 -1
- package/skills/work-unit-commits/SKILL.md +10 -11
- package/tests/agent-home.test.ts +28 -9
- package/tests/agent-profiles-workflow.test.ts +163 -0
- package/tests/agent-prompt-diet-contract.test.ts +101 -0
- package/tests/agent-risk-escalation.test.ts +1 -1
- package/tests/agent-status.test.ts +143 -0
- package/tests/agent-tool-overlay-acceptance.test.ts +158 -0
- package/tests/agent-tool-overlay.test.ts +89 -0
- package/tests/agents-config.test.ts +106 -1
- package/tests/agents-history.test.ts +31 -0
- package/tests/agents-jobs-frames.test.ts +93 -0
- package/tests/agents-message-delivery.test.ts +36 -0
- package/tests/agents-prompt-lifecycle-runtime.test.ts +376 -0
- package/tests/agents-queries.test.ts +144 -4
- package/tests/agents-report-cap.test.ts +126 -0
- package/tests/agents-runner-drain.test.ts +193 -0
- package/tests/agents-runner.test.ts +215 -3
- package/tests/agents-session-transport.test.ts +34 -0
- package/tests/always-on-prompt-verdicts-contract.test.ts +188 -0
- package/tests/append-system-prompt-route.test.ts +12 -1
- package/tests/approved-text-leftovers-contract.test.ts +136 -0
- package/tests/artifact-language.test.ts +1 -1
- package/tests/ask-user-choice.test.ts +4 -3
- package/tests/ask-user-question.test.ts +99 -1
- package/tests/audit-leftovers-contract.test.ts +51 -0
- package/tests/auto-permission-runtime.test.ts +1 -1
- package/tests/autonomous-guard.test.ts +346 -10
- package/tests/bounded-stop-contract.test.ts +51 -3
- package/tests/branch-pr-skill.test.ts +10 -1
- package/tests/bridge-cost.test.ts +19 -4
- package/tests/bundled-install.test.ts +31 -6
- package/tests/card-content-policy.test.ts +3 -3
- package/tests/chained-pr-skill.test.ts +8 -6
- package/tests/child-context-files.test.ts +64 -8
- package/tests/child-safety.test.ts +11 -0
- package/tests/child-skills-catalog.test.ts +56 -0
- package/tests/codegraph-tools.test.ts +11 -5
- package/tests/codemode-rendering.test.ts +4 -1
- package/tests/command-palette.test.ts +284 -1
- package/tests/delegate-for-reason-contract.test.ts +32 -10
- package/tests/delivery-conflict-markers.test.ts +348 -0
- package/tests/design-canvas-all-sizes.test.ts +631 -0
- package/tests/design-canvas-allowlist.test.ts +32 -0
- package/tests/design-canvas-assets.test.ts +11 -695
- package/tests/design-canvas-boards.test.ts +77 -0
- package/tests/design-canvas-checks.test.ts +655 -0
- package/tests/design-canvas-compare.test.ts +79 -0
- package/tests/design-canvas-events.test.ts +59 -0
- package/tests/design-canvas-export.test.ts +1168 -0
- package/tests/design-canvas-focus.test.ts +113 -0
- package/tests/design-canvas-handoffs.test.ts +59 -0
- package/tests/design-canvas-i18n-review.test.ts +513 -0
- package/tests/design-canvas-i18n-views.test.ts +259 -0
- package/tests/design-canvas-i18n.test.ts +526 -0
- package/tests/design-canvas-inspector.test.ts +937 -0
- package/tests/design-canvas-layout.test.ts +1222 -0
- package/tests/design-canvas-minimap.test.ts +413 -0
- package/tests/design-canvas-modules.test.ts +90 -0
- package/tests/design-canvas-parts.test.ts +721 -0
- package/tests/design-canvas-rail.test.ts +799 -0
- package/tests/design-canvas-server.test.ts +855 -17
- package/tests/design-canvas-sizes.test.ts +548 -0
- package/tests/design-canvas-store.test.ts +180 -0
- package/tests/design-canvas-tokens.test.ts +965 -0
- package/tests/design-canvas-view.test.ts +299 -0
- package/tests/design-comments.test.ts +201 -1
- package/tests/design-handoffs.test.ts +20 -0
- package/tests/design-layout.test.ts +100 -0
- package/tests/design-parts.test.ts +260 -0
- package/tests/design-system-tokens.test.ts +215 -0
- package/tests/desktop-rpc-agents.test.ts +893 -0
- package/tests/desktop-rpc-config.test.ts +1452 -0
- package/tests/desktop-rpc-design.test.ts +662 -0
- package/tests/desktop-rpc-jobs.test.ts +796 -0
- package/tests/desktop-rpc-permissions.test.ts +311 -0
- package/tests/desktop-rpc-profiles.test.ts +140 -0
- package/tests/desktop-rpc-safety.test.ts +119 -0
- package/tests/desktop-rpc-usage.test.ts +697 -0
- package/tests/desktop-rpc.test.ts +252 -0
- package/tests/destructive-command-guard.test.ts +52 -0
- package/tests/devbinary/pi-host-relay.devtest.ts +149 -80
- package/tests/devbinary/review-session-consent.devtest.ts +84 -0
- package/tests/download-progress.test.ts +71 -0
- package/tests/engram-safety.test.ts +111 -0
- package/tests/execution-surface-guard.test.ts +55 -0
- package/tests/fixtures/devbinary/status-v9-escalated-non-blocking.captured.json +92 -0
- package/tests/fixtures/devbinary/status-v9-escalated-non-blocking.provenance.md +3 -0
- package/tests/fixtures/primary-session-prompt/gentleman.golden.md +26 -31
- package/tests/fixtures/proxy-tls/proxy.crt +19 -0
- package/tests/fixtures/proxy-tls/proxy.key +28 -0
- package/tests/fixtures/refusal-identity.probe.mjs +139 -0
- package/tests/fixtures/session-profile-v1/gentle-ai-reviewer.ts +89 -0
- package/tests/fixtures/session-profile-v1/replay.ts +53 -6
- package/tests/full-delegation-closure.test.ts +160 -0
- package/tests/full-delegation-notices.test.ts +76 -0
- package/tests/generic-agent-tools.test.ts +3 -3
- package/tests/gentle-agent-status.test.ts +74 -0
- package/tests/gentle-agents-child-jobs.test.ts +237 -0
- package/tests/gentle-agents.test.ts +1403 -20
- package/tests/gentle-ai-binary.test.ts +3 -1
- package/tests/gentle-ai-child-guards.test.ts +1 -0
- package/tests/gentle-ai-elapsed-store.test.ts +19 -0
- package/tests/gentle-ai-exploration-budget.test.ts +18 -2
- package/tests/gentle-ai-installer.test.ts +135 -51
- package/tests/gentle-ai-proxy.test.ts +434 -0
- package/tests/gentle-ai-renderer.test.ts +36 -2
- package/tests/gentle-ai.test.ts +233 -43
- package/tests/gentle-design.test.ts +386 -1
- package/tests/gentle-herdr-activity.test.ts +9 -6
- package/tests/gentle-shell-bin.test.ts +123 -0
- package/tests/gentle-shell-bundled.test.ts +293 -31
- package/tests/gentle-shell-launcher.test.ts +78 -11
- package/tests/gentle-shell.test.ts +1017 -146
- package/tests/gentle-todo.test.ts +51 -11
- package/tests/gentle-tps.test.ts +123 -0
- package/tests/gentle-ui-design-skill.test.ts +59 -0
- package/tests/herdr-busy.test.ts +59 -0
- package/tests/herdr-task-summary-policy.test.ts +8 -4
- package/tests/hidden-tools.test.ts +188 -0
- package/tests/image-disk-cache.test.ts +163 -0
- package/tests/independent-recovery-delivery.test.ts +97 -0
- package/tests/inprocess-reviewer.test.ts +249 -4
- package/tests/install-wizard.test.ts +27 -1
- package/tests/installer-downloads.test.ts +30 -1
- package/tests/installer-posix-bootstrap.test.ts +115 -14
- package/tests/installer-preflight.test.ts +54 -5
- package/tests/installer-probes.test.ts +146 -0
- package/tests/installer-runner.test.ts +79 -44
- package/tests/installer-server.test.ts +215 -13
- package/tests/installer-windows-bootstrap.test.ts +19 -1
- package/tests/jobs-view.test.ts +260 -6
- package/tests/judgment-day-severity-admission.test.ts +46 -0
- package/tests/lazy-module-contradictions-contract.test.ts +158 -0
- package/tests/maintainer/desktop-rpc.maintest.ts +632 -0
- package/tests/maintainer/pi-update-source.maintest.ts +48 -18
- package/tests/modal-mouse-boundaries.test.ts +136 -0
- package/tests/model-fallback-policy.test.ts +26 -7
- package/tests/model-routing-authority.test.ts +178 -2
- package/tests/nan-provider-runtime.test.ts +17 -3
- package/tests/nan-provider.test.ts +111 -56
- package/tests/native-choice-list.test.ts +77 -2
- package/tests/native-review-capability-contract.test.ts +17 -1
- package/tests/native-review-cli-nonblocking-findings.test.ts +165 -0
- package/tests/native-review-cli.test.ts +269 -1
- package/tests/native-review-parity.test.ts +24 -5
- package/tests/native-review-refusal-identity.test.ts +25 -0
- package/tests/no-self-pause-contract.test.ts +13 -2
- package/tests/odd-integration.test.ts +11 -3
- package/tests/odd-routing-canonical-ratchet.test.ts +3 -3
- package/tests/odd-routing-contract.test.ts +80 -28
- package/tests/orchestrator-budget.test.ts +35 -5
- package/tests/orchestrator-consultation-sdk.test.ts +32 -6
- package/tests/orchestrator-delegation-mode.test.ts +154 -0
- package/tests/orchestrator-discovery.test.ts +28 -0
- package/tests/orchestrator-mode-policy.test.ts +175 -0
- package/tests/orchestrator-prompt-budget.test.ts +13 -2
- package/tests/orchestrator-prompt-diet-contract.test.ts +221 -0
- package/tests/orchestrator-rdd-ownership.test.ts +4 -3
- package/tests/orchestrator-work-search.test.ts +4 -2
- package/tests/package-files.test.ts +25 -1
- package/tests/package-manifest.test.ts +16 -13
- package/tests/parallel-reason-contract.test.ts +6 -3
- package/tests/permission-allowlist.test.ts +372 -0
- package/tests/persona-neutral-voseo.test.ts +4 -4
- package/tests/persona-reply-language.test.ts +1 -1
- package/tests/persona-single-channel.test.ts +13 -5
- package/tests/pi-update-launcher.test.ts +25 -7
- package/tests/pi-update-source.test.ts +113 -6
- package/tests/pi-update.test.ts +294 -19
- package/tests/pnpm-workspace-config.test.ts +58 -0
- package/tests/pnpm-workspace-policy.test.ts +47 -0
- package/tests/primary-context-files.test.ts +233 -0
- package/tests/primary-context-three-files.test.ts +174 -0
- package/tests/primary-session-prompt.test.ts +13 -0
- package/tests/profile-pin.test.ts +29 -2
- package/tests/profile-tier-footer.test.ts +5 -0
- package/tests/profiles-panel-delegation-mode.test.ts +422 -0
- package/tests/provider-defect-handoff.test.ts +9 -2
- package/tests/questionnaire-view.test.ts +115 -0
- package/tests/quiet-bash-runtime.test.ts +1 -1
- package/tests/quiet-tool-rendering.test.ts +48 -0
- package/tests/rdd-aware-verification-contract.test.ts +17 -12
- package/tests/rdd-customize.test.ts +287 -0
- package/tests/rdd-mode-cache.test.ts +450 -0
- package/tests/rdd-mode-control.test.ts +407 -0
- package/tests/rdd-mode-scope-regression.test.ts +137 -0
- package/tests/rdd-off-independent-regression.test.ts +69 -0
- package/tests/rdd-status-line.test.ts +112 -1
- package/tests/render-cache-performance.test.ts +171 -2
- package/tests/reply-language-anchor-placement.test.ts +184 -0
- package/tests/reply-language-anchor.test.ts +189 -0
- package/tests/request-context-append-only.test.ts +218 -0
- package/tests/request-context-placement.test.ts +148 -0
- package/tests/review-agent-end-preflight.test.ts +80 -2
- package/tests/review-blocker.test.ts +193 -0
- package/tests/review-candidate-owner-retry.test.ts +1 -1
- package/tests/review-candidate-symlink-scan.test.ts +157 -0
- package/tests/review-candidate-view.test.ts +66 -1
- package/tests/review-candidate-windows-boundary.test.ts +131 -0
- package/tests/review-candidate-windows-probe.test.ts +63 -0
- package/tests/review-committed-restart-ack.test.ts +129 -0
- package/tests/review-continuation-registry.test.ts +107 -0
- package/tests/review-contract-prompt.test.ts +1 -1
- package/tests/review-controller-native-routing.test.ts +261 -5
- package/tests/review-controller-workspace-root.test.ts +230 -3
- package/tests/review-controller.test.ts +98 -12
- package/tests/review-coordinator-correction-gate.test.ts +105 -0
- package/tests/review-coordinator-findings.test.ts +206 -0
- package/tests/review-coordinator-nonblocking-scope.test.ts +169 -0
- package/tests/review-coordinator-runtime.test.ts +117 -0
- package/tests/review-coordinator.test.ts +462 -0
- package/tests/review-delivery-preflight.test.ts +462 -0
- package/tests/review-due-compaction.test.ts +31 -0
- package/tests/review-due-public-boundary.test.ts +26 -0
- package/tests/review-failure-facts.test.ts +87 -0
- package/tests/review-host-relay-routing.test.ts +258 -4
- package/tests/review-host-relay.test.ts +39 -0
- package/tests/review-integration-nonblocking-findings.test.ts +108 -0
- package/tests/review-integration-v2.test.ts +46 -3
- package/tests/review-json-arguments.test.ts +105 -11
- package/tests/review-last-event-closure.test.ts +68 -0
- package/tests/review-ledger-contract.test.ts +19 -40
- package/tests/review-loadout-rdd-off-sdk.test.ts +95 -32
- package/tests/review-one-call-findings.test.ts +131 -0
- package/tests/review-one-call-followups.test.ts +308 -0
- package/tests/review-one-call-reviewer-requests.test.ts +207 -0
- package/tests/review-one-call.test.ts +452 -0
- package/tests/review-owner-identity.test.ts +60 -24
- package/tests/review-relay-phase-timing.test.ts +128 -0
- package/tests/review-relay-transport-agent.test.ts +39 -2
- package/tests/review-reviewer-evidence.test.ts +223 -0
- package/tests/review-risk-assessment.test.ts +126 -8
- package/tests/review-run-statement-guidance-independent.test.ts +54 -0
- package/tests/review-session-standing-permission-controller.test.ts +53 -3
- package/tests/review-start-context.test.ts +19 -0
- package/tests/review-tool-prose-budget.test.ts +122 -0
- package/tests/reviewer-stream.test.ts +149 -0
- package/tests/run-test-suite.test.ts +122 -1
- package/tests/runtime-harness.mjs +4 -1
- package/tests/sensitive-path-tools.test.ts +181 -5
- package/tests/session-profile-append-controller-pi.test.ts +60 -31
- package/tests/session-profile-binding.test.ts +19 -1
- package/tests/session-profile-disk-reader-pi.test.ts +58 -16
- package/tests/session-profile-extension.test.ts +2 -2
- package/tests/session-profile-v1-compat.test.ts +35 -1
- package/tests/shell-bar.test.ts +186 -42
- package/tests/shell-panel.test.ts +50 -22
- package/tests/shell-prompt.test.ts +17 -0
- package/tests/shell-sidebar-fullscreen.test.ts +5 -5
- package/tests/shell-sidebar-layout.test.ts +294 -23
- package/tests/shell-sidebar-scroll-benchmark.test.ts +1 -1
- package/tests/shell-surface-transparent.test.ts +89 -0
- package/tests/shell-todo.test.ts +12 -0
- package/tests/shell-usage.test.ts +59 -10
- package/tests/skill-contradictions-contract.test.ts +122 -0
- package/tests/skill-registry-watcher.test.ts +216 -2
- package/tests/skill-registry.test.ts +1461 -5
- package/tests/startup-banner.test.ts +152 -1
- package/tests/startup-home-repo.test.ts +2 -0
- package/tests/support/design-canvas-dom.ts +369 -0
- package/tests/support/review-coordinator-runtime.ts +264 -0
- package/tests/task-size-routing-contract.test.ts +45 -12
- package/tests/test-strength-contract.test.ts +2 -1
- package/tests/todo-request-append-only.test.ts +214 -0
- package/tests/tool-batching-contract.test.ts +3 -1
- package/tests/update-agent-body-history.test.ts +138 -0
- package/tests/verification-tiers-contract.test.ts +229 -0
- package/tests/verifier-admission.test.ts +49 -0
- package/tests/verifier-preparation.test.ts +229 -0
- package/tests/verify-agent-contract.test.ts +20 -2
- package/tests/verify-first-launch-contract.test.ts +162 -11
- package/tests/vim-editor-adapter.test.ts +2 -2
- package/tests/visual-customization-policy.test.ts +39 -6
- package/tests/visual-customize-view.test.ts +573 -9
- package/tests/visual-layout-preview.test.ts +15 -1
- package/tests/visual-profiles.test.ts +11 -0
- package/tests/voice-worker.test.ts +73 -2
- package/tests/windows-session-transport.test.ts +126 -0
- package/tests/work-continuity-contract.test.ts +77 -6
- package/tests/writer-admission-messages.test.ts +232 -0
- package/tests/writer-batch-admission.test.ts +66 -0
- package/tests/writer-edit-surface-scope.test.ts +52 -20
- package/tests/writer-feature-document-admission.test.ts +276 -0
- package/tests/yolo-customize.test.ts +27 -4
- package/tests/yolo-mode.test.ts +62 -18
- package/tests/yolo-session-policy.test.ts +270 -1
- package/skills/_shared/review-ledger-contract.md +0 -106
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/README.md +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/schemas/lens.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/schemas/refuter.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/schemas/targeted-validator.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/vectors/lens.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/vectors/refuter.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/vectors/targeted-validator.json +0 -0
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import test from "node:test";
|
|
3
|
+
import { parseReviewCoordinatorInput, runReviewCoordinator, type ReviewCoordinatorTool } from "../lib/review-coordinator.ts";
|
|
4
|
+
import { createGentleAiExtension } from "../extensions/gentle-ai.ts";
|
|
5
|
+
|
|
6
|
+
type Body = Record<string, any>;
|
|
7
|
+
const target = "sha256:" + "a".repeat(64);
|
|
8
|
+
const lineage = "review-fixture";
|
|
9
|
+
const scoped = { workspaceRoot: process.cwd(), baseRef: "b".repeat(40), committedOnly: true as const };
|
|
10
|
+
const ready = { result: { target_identity: target, next_transition: { kind: "execute", execute: { operation: "review.start" } } } };
|
|
11
|
+
const collect = { result: { target_identity: target, authority: { lineage_id: lineage }, next_transition: { kind: "collect" } }, collectBindings: [{ collectBinding: "opaque-not-json" }] };
|
|
12
|
+
const approved = { result: { target_identity: target, authority: { lineage_id: lineage }, next_transition: { kind: "execute", execute: { operation: "review.acknowledge-approved" } } } };
|
|
13
|
+
const closed = { outcome: "native-approved-acknowledgement-completed", status: "closed", authority: "burned", target_identity: target, lineage_id: lineage };
|
|
14
|
+
const captured = { outcome: "native-last-event-closure" };
|
|
15
|
+
const stopped = { result: { ...collect.result, next_transition: { kind: "stop", reason_code: "corrected_candidate_unavailable" } } };
|
|
16
|
+
|
|
17
|
+
test("coordinator snapshots single/group reviewer runs through terminal ACK without double-counting legacy diagnostics", async () => {
|
|
18
|
+
const first = { reviewer: { reviewerModel: "fixture/first", usage: { input: 4 }, cost: { total: 0.1 } }, lens: "review-risk" };
|
|
19
|
+
const second = { reviewer: { reviewerModel: "fixture/second", phase: "completion" }, lens: "review-reliability" };
|
|
20
|
+
const group = { ...captured, host_relay: { transport: "pi_host_relay", reviewer_runs: [first, second], reviewers: [first] } };
|
|
21
|
+
const single = { ...captured, host_relay: { transport: "pi_host_relay", reviewer: { reviewerModel: "fixture/third", usage: { input: 2 } }, role: "provider_refuter", submission: "opaque native response, not reviewer facts" } };
|
|
22
|
+
const next = { ...collect, collectBindings: [{ collectBinding: "next-opaque" }] };
|
|
23
|
+
const host = backend([collect, group, next, single, approved, closed]);
|
|
24
|
+
const expected = structuredClone([first, second, { role: "provider_refuter", reviewer: single.host_relay.reviewer }]);
|
|
25
|
+
const result = await runReviewCoordinator({ lineageId: lineage }, { invoke: async (tool, parameters) => {
|
|
26
|
+
if (host.calls.length === 2) first.reviewer.usage.input = 999;
|
|
27
|
+
return await host.invoke(tool, parameters);
|
|
28
|
+
} });
|
|
29
|
+
assert.equal(result.outcome, "closed"); assert.deepEqual(result.reviewer_runs, expected);
|
|
30
|
+
assert.equal((result.metrics as Body).reviewer_cost, undefined, "host evidence is not a second SDK accounting total");
|
|
31
|
+
assert.doesNotMatch(JSON.stringify(result.reviewer_runs), /opaque native response/);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test("coordinator retains earlier runs and a failed reviewer attempt without duplicating grouped failure evidence", async () => {
|
|
35
|
+
const first = { reviewer: { reviewerModel: "fixture/first", usage: { output: 3 } } };
|
|
36
|
+
const next = { ...collect, collectBindings: [{ collectBinding: "next-opaque" }] };
|
|
37
|
+
const failure = { outcome: "pi-host-relay-transport-failure", failure: { reviewer: { reviewerModel: "fixture/failed", phase: "auth" } } };
|
|
38
|
+
const result = await runReviewCoordinator({ lineageId: lineage }, backend([collect, { ...captured, host_relay: { reviewer_runs: [first], reviewers: [first] } }, next, failure]));
|
|
39
|
+
assert.equal(result.outcome, "blocked");
|
|
40
|
+
assert.deepEqual(result.reviewer_runs, [first, { reviewer: failure.failure.reviewer }]);
|
|
41
|
+
const groupedFailure = { ...failure, host_relay: { reviewer_runs: [first, { reviewer: failure.failure.reviewer }], reviewers: [first] } };
|
|
42
|
+
const grouped = await runReviewCoordinator({ lineageId: lineage }, backend([collect, groupedFailure]));
|
|
43
|
+
assert.deepEqual(grouped.reviewer_runs, [first, { reviewer: failure.failure.reviewer }], "group evidence supersedes the same reviewer repeated in failure diagnostics");
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
test("reviewer evidence snapshots stay within the existing transition limit and do not persist across invocations", async () => {
|
|
47
|
+
let captures = 0;
|
|
48
|
+
const result = await runReviewCoordinator({ lineageId: lineage }, { invoke: async tool => {
|
|
49
|
+
if (tool === "gentle_review") return { ...collect, collectBindings: Array.from({ length: 4 }, (_, i) => ({ collectBinding: `opaque-${captures}-${i}` })) };
|
|
50
|
+
captures++;
|
|
51
|
+
return { ...captured, host_relay: { reviewer_runs: Array.from({ length: 4 }, () => ({ reviewer: { reviewerModel: "fixture/model", phase: "completion" } })) } };
|
|
52
|
+
} });
|
|
53
|
+
assert.equal(result.outcome, "transition-limit"); assert.equal(captures, 24);
|
|
54
|
+
assert.equal((result.reviewer_runs as Body[]).length, 96);
|
|
55
|
+
const next = await runReviewCoordinator({ lineageId: lineage }, backend([stopped]));
|
|
56
|
+
assert.deepEqual(next.reviewer_runs, []);
|
|
57
|
+
});
|
|
58
|
+
function backend(responses: Body[]) {
|
|
59
|
+
const calls: { tool: ReviewCoordinatorTool; parameters: Body }[] = [];
|
|
60
|
+
return { calls, async invoke(tool: ReviewCoordinatorTool, parameters: Body) {
|
|
61
|
+
calls.push({ tool, parameters });
|
|
62
|
+
assert.ok(responses.length, "no unexpected follow-up or retry");
|
|
63
|
+
return responses.shift()!;
|
|
64
|
+
} };
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
test("fresh ordinary review retains selectors, displays forecasts and ends at native ACK", async () => {
|
|
68
|
+
const forecast = { outcome: "reviewer-model-run-forecast" };
|
|
69
|
+
const host = backend([{ reviewDue: true }, ready, { result: { lineage_id: lineage } }, collect, forecast, captured, approved, closed]);
|
|
70
|
+
const shown: Body[] = [];
|
|
71
|
+
const result = await runReviewCoordinator({ ...scoped, lenses: ["risk"], lensesReason: "permission check", requestContextPath: "spec.md" }, { ...host, presentForecast: async value => { shown.push(value); return true; } });
|
|
72
|
+
assert.equal(result.outcome, "closed"); assert.deepEqual(result.result, closed); assert.deepEqual(shown, [forecast]);
|
|
73
|
+
assert.deepEqual(result.forecasts, [forecast], "the primary model must receive the complete forecast for lossless relay");
|
|
74
|
+
assert.equal(result.current_candidate, undefined, "ACK describes only its frozen target");
|
|
75
|
+
assert.equal(host.calls.at(-1)!.parameters.operation, "acknowledge-approved");
|
|
76
|
+
assert.equal(JSON.parse(String(host.calls[2].parameters.input)).requestContextPath, "spec.md");
|
|
77
|
+
for (const call of host.calls) {
|
|
78
|
+
assert.equal(call.parameters.workspaceRoot, scoped.workspaceRoot);
|
|
79
|
+
if (["assess", "inspect", "status"].includes(String(call.parameters.operation))) assert.deepEqual(JSON.parse(String(call.parameters.input)), { baseRef: scoped.baseRef, committedOnly: true });
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
test("routing ignores every native state, reason code and capture closure shape", async () => {
|
|
84
|
+
for (const state of ["correction_required", "validating", "declined", "future-state"]) {
|
|
85
|
+
const response: Body = structuredClone(collect);
|
|
86
|
+
response.result.authority.state = state; response.result.next_transition.reason_code = "future-reason";
|
|
87
|
+
// Only closure.advisory_findings and advisory_finding_claims are read (relayed on approval); every other closure field stays unread.
|
|
88
|
+
const closure = {};
|
|
89
|
+
for (const key of ["schema", "operation", "lineage_id", "state", "store_revision", "action", "escalation", "status_continuation", "acknowledgement", "next_action"]) Object.defineProperty(closure, key, { get() { throw new Error("must not inspect closure shape"); } });
|
|
90
|
+
const capture = { outcome: "native-last-event-closure", closure };
|
|
91
|
+
for (const object of [response.result, response.result.authority]) Object.defineProperty(object, "state", { get() { throw new Error("must not read state"); }, configurable: true });
|
|
92
|
+
Object.defineProperty(response.result.next_transition, "reason_code", { get() { throw new Error("must not read reason_code"); } });
|
|
93
|
+
// Serialization is transport instrumentation, so poison only property reads.
|
|
94
|
+
Object.defineProperty(response, "toJSON", { value: () => ({ fixture: true }) });
|
|
95
|
+
Object.defineProperty(capture, "toJSON", { value: () => ({ fixture: true }) });
|
|
96
|
+
const host = backend([response, capture, approved, closed]);
|
|
97
|
+
assert.equal((await runReviewCoordinator({ lineageId: lineage }, host)).outcome, "closed");
|
|
98
|
+
assert.equal(host.calls[1].parameters.collectBinding, "opaque-not-json");
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
test("stop is surfaced unchanged before edit; authored collect returns to the model", async () => {
|
|
103
|
+
for (const response of [stopped, { ...collect, result: { ...collect.result, next_transition: { kind: "collect", correction_request: { schema: "gentle-ai.review-correction-plan-request/v1", request_hash: "opaque-request" } } }, collectBindings: [{ collectBinding: "plan" }] }, { ...collect, collectBindings: [] }]) {
|
|
104
|
+
const host = backend([response]); const result = await runReviewCoordinator({ lineageId: lineage }, host);
|
|
105
|
+
assert.equal(result.outcome, response === stopped ? "stopped" : "input-required");
|
|
106
|
+
assert.equal(result.result, response); assert.equal(host.calls.length, 1);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
test("an intended-untracked selection returns selection-required; a correction request still returns input-required", async () => {
|
|
111
|
+
const selecting = { operation: "inspect", status: "blocked", result: { next_transition: { kind: "collect" } }, selectionBinding: "opaque-selection", nextStep: "select-intended-untracked" };
|
|
112
|
+
const correction = { ...collect, result: { ...collect.result, next_transition: { kind: "collect", correction_request: { request_hash: "opaque-request" } } }, collectBindings: [{ collectBinding: "plan" }] };
|
|
113
|
+
for (const [response, expected] of [[selecting, "selection-required"], [correction, "input-required"], [{ ...correction, selectionBinding: "opaque-selection" }, "input-required"]] as const) {
|
|
114
|
+
const host = backend([response]); const result = await runReviewCoordinator({ lineageId: lineage }, host);
|
|
115
|
+
assert.equal(result.outcome, expected);
|
|
116
|
+
// The selection drops only the facade's single-operation nextStep; resume_input names the way on.
|
|
117
|
+
const { nextStep: _nextStep, ...relayed } = response as Body;
|
|
118
|
+
assert.deepEqual(result.result, response === selecting ? relayed : response, "the facade envelope is relayed otherwise unchanged"); assert.equal(host.calls.length, 1);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
test("post-edit opaque captures need no targeted-validator reason or operation", async () => {
|
|
123
|
+
const host = backend([collect, captured, approved, closed]);
|
|
124
|
+
assert.equal((await runReviewCoordinator({ lineageId: lineage }, host)).outcome, "closed");
|
|
125
|
+
assert.equal(host.calls.filter(call => call.tool === "gentle_review_capture").length, 1);
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
test("opaque captures need no Pi metadata and groups retain provider order", async () => {
|
|
129
|
+
const host = backend([{ ...collect, collectBindings: [{ collectBinding: "second" }, { collectBinding: "first" }] }, captured, stopped]);
|
|
130
|
+
assert.equal((await runReviewCoordinator({ lineageId: lineage }, host)).outcome, "stopped");
|
|
131
|
+
assert.equal(host.calls[1].tool, "gentle_review_capture_group"); assert.deepEqual(host.calls[1].parameters.collectBindings, ["second", "first"]);
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
test("capture failures and missing forecast display never run or acknowledge further", async () => {
|
|
135
|
+
for (const capture of [{ outcome: "capture-binding-rejected" }, { outcome: "native-reviewer-result-failed", reconciliation: approved }, { outcome: "reviewer-model-run-forecast" }]) {
|
|
136
|
+
const host = backend([collect, capture]);
|
|
137
|
+
assert.ok(["blocked", "forecast"].includes(String((await runReviewCoordinator({ lineageId: lineage }, host)).outcome)));
|
|
138
|
+
assert.equal(host.calls.length, 2);
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
test("a reconciled reviewer group continues only through bound STATUS; drift, uncertain or failed reconciliation stays blocked", async () => {
|
|
143
|
+
const group = { ...collect, collectBindings: [{ collectBinding: "first" }, { collectBinding: "second" }] };
|
|
144
|
+
const reconciled = { tool: "gentle_review_capture_group", status: "reconciled", outcome: "native-reviewer-group-status-reconciled", next_transition: { kind: "execute", execute: { operation: "review.acknowledge-approved" } } };
|
|
145
|
+
const refuter = { ...collect, collectBindings: [{ collectBinding: "refuter" }] };
|
|
146
|
+
const host = backend([group, reconciled, refuter, captured, approved, closed]);
|
|
147
|
+
assert.equal((await runReviewCoordinator({ lineageId: lineage }, host)).outcome, "closed");
|
|
148
|
+
assert.deepEqual(host.calls.map(call => call.tool === "gentle_review" ? `status-or-ack:${call.parameters.operation}` : call.tool), ["status-or-ack:status", "gentle_review_capture_group", "status-or-ack:status", "gentle_review_capture", "status-or-ack:status", "status-or-ack:acknowledge-approved"], "the reconciled capture's own next_transition is never followed");
|
|
149
|
+
for (const capture of [
|
|
150
|
+
{ ...reconciled, native_failure: { reason: "unknown" } },
|
|
151
|
+
{ ...reconciled, failure: { kind: "transport" } },
|
|
152
|
+
{ ...reconciled, reconciliation: {} },
|
|
153
|
+
{ ...reconciled, reconciliation_failure: {} },
|
|
154
|
+
{ ...reconciled, status: "blocked" },
|
|
155
|
+
{ tool: "gentle_review_capture_group", outcome: "native-reviewer-group-status-reconciliation-failed", reconciliation_failure: {} },
|
|
156
|
+
{ tool: "gentle_review_capture_group", status: "blocked", outcome: "capture-group-authority-drift", reconciliation: {} },
|
|
157
|
+
{ tool: "gentle_review_capture", status: "reconciled", outcome: "native-capture-outcome-unknown", native_failure: {} },
|
|
158
|
+
]) {
|
|
159
|
+
const blocked = backend([group, capture]);
|
|
160
|
+
const result = await runReviewCoordinator({ lineageId: lineage }, blocked);
|
|
161
|
+
assert.equal(result.outcome, "blocked", JSON.stringify(capture)); assert.equal(result.result, capture); assert.equal(blocked.calls.length, 2);
|
|
162
|
+
}
|
|
163
|
+
// Fresh reconciled groups forever still end at the existing transition cap.
|
|
164
|
+
let groups = 0;
|
|
165
|
+
const capped = await runReviewCoordinator({ lineageId: lineage }, { invoke: async tool => {
|
|
166
|
+
if (tool === "gentle_review") return { ...collect, collectBindings: [{ collectBinding: `a-${groups}` }, { collectBinding: `b-${groups}` }] };
|
|
167
|
+
groups++; return reconciled;
|
|
168
|
+
} });
|
|
169
|
+
assert.equal(capped.outcome, "transition-limit"); assert.equal(groups, 24);
|
|
170
|
+
// Only a group capture reports this outcome; from a single capture it is unknown.
|
|
171
|
+
const single = backend([collect, reconciled]);
|
|
172
|
+
assert.equal((await runReviewCoordinator({ lineageId: lineage }, single)).outcome, "blocked"); assert.equal(single.calls.length, 2);
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
test("advisory_finding_claims is relayed only as a plain object of strings", async () => {
|
|
176
|
+
const findings = { statement: "fixture", findings: [{ id: "F1" }] };
|
|
177
|
+
const run = async (claims: unknown) => {
|
|
178
|
+
const closure = { advisory_findings: findings, advisory_finding_claims: claims };
|
|
179
|
+
return await runReviewCoordinator({ lineageId: lineage }, backend([collect, { ...captured, closure }, approved, closed]));
|
|
180
|
+
};
|
|
181
|
+
assert.deepEqual((await run({ F1: "reviewer text" })).advisory_finding_claims, { F1: "reviewer text" });
|
|
182
|
+
for (const claims of [["reviewer text"], "reviewer text", { F1: 3 }, { F1: ["reviewer text"] }, null, 7, new Map([["F1", "x"]])]) {
|
|
183
|
+
const result = await run(claims);
|
|
184
|
+
assert.equal(result.outcome, "closed");
|
|
185
|
+
assert.deepEqual(result.advisory_findings, findings);
|
|
186
|
+
assert.equal(Object.hasOwn(result, "advisory_finding_claims"), false, JSON.stringify(claims));
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
test("reoffered and duplicate opaque bindings cannot execute twice", async () => {
|
|
191
|
+
const host = backend([collect, captured, collect]);
|
|
192
|
+
assert.equal((await runReviewCoordinator({ lineageId: lineage }, host)).outcome, "repeated-capture");
|
|
193
|
+
assert.equal(host.calls.length, 3);
|
|
194
|
+
const duplicate = backend([{ ...collect, collectBindings: [...collect.collectBindings, ...collect.collectBindings] }]);
|
|
195
|
+
assert.equal((await runReviewCoordinator({ lineageId: lineage }, duplicate)).outcome, "repeated-capture");
|
|
196
|
+
assert.equal(duplicate.calls.length, 1);
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
test("lineage and target drift block before ACK, including a mismatched ACK envelope", async () => {
|
|
200
|
+
for (const change of [{ target_identity: "other" }, { authority: { lineage_id: "other" } }]) {
|
|
201
|
+
const host = backend([collect, captured, { result: { ...approved.result, ...change } }]);
|
|
202
|
+
assert.equal((await runReviewCoordinator({ lineageId: lineage }, host)).outcome, "binding-drift");
|
|
203
|
+
assert.equal(host.calls.length, 3);
|
|
204
|
+
}
|
|
205
|
+
const host = backend([approved, { ...closed, target_identity: "other" }]);
|
|
206
|
+
assert.equal((await runReviewCoordinator({ lineageId: lineage }, host)).outcome, "blocked");
|
|
207
|
+
assert.equal(host.calls.length, 2);
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
test("cancellation stops dispatch but a racing verified burn remains terminal", async () => {
|
|
211
|
+
const host = backend([]);
|
|
212
|
+
await assert.rejects(runReviewCoordinator({}, { ...host, signal: AbortSignal.abort() }), { name: "AbortError" });
|
|
213
|
+
assert.equal(host.calls.length, 0);
|
|
214
|
+
const controller = new AbortController(); let calls = 0;
|
|
215
|
+
const result = await runReviewCoordinator({ lineageId: lineage }, { signal: controller.signal, async invoke() { if (++calls === 1) return approved; controller.abort(); return closed; } });
|
|
216
|
+
assert.equal(result.outcome, "closed"); assert.equal(calls, 2); assert.equal(result.result, closed);
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
test("no retries after missing or unsuccessful ACK", async () => {
|
|
220
|
+
for (const ack of [{}, { ...closed, authority: "active" }]) {
|
|
221
|
+
const host = backend([approved, ack]); assert.equal((await runReviewCoordinator({ lineageId: lineage }, host)).outcome, "blocked"); assert.equal(host.calls.length, 2);
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
test("assessment, consent and existing frozen intent retain their explicit boundaries", async () => {
|
|
226
|
+
for (const [assessment, outcome] of [[{ reviewDue: false }, "not-due"], [{}, "assessment-unavailable"]] as const) {
|
|
227
|
+
const host = backend([assessment]); assert.equal((await runReviewCoordinator({}, host)).outcome, outcome); assert.equal(host.calls.length, 1);
|
|
228
|
+
}
|
|
229
|
+
const old = backend([{ reviewDue: true }, collect]);
|
|
230
|
+
assert.equal((await runReviewCoordinator({ requestContextPath: "new.md" }, old)).outcome, "request-context-requires-fresh-review");
|
|
231
|
+
const consent = { outcome: "native-review-consent-required" };
|
|
232
|
+
const host = backend([{ reviewDue: true }, ready, consent]); assert.equal((await runReviewCoordinator({}, host)).result, consent); assert.equal(host.calls.length, 3);
|
|
233
|
+
assert.throws(() => parseReviewCoordinatorInput({ lineageId: lineage, requestContextPath: "new.md" }), /immutable/);
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
test("ambiguous selectors and consent arguments are rejected before dispatch", () => {
|
|
237
|
+
for (const value of [{ baseRef: "main" }, { committedOnly: true }, { consent: "granted" }, { lenses: ["risk"] }, { intendedUntracked: [] }]) assert.throws(() => parseReviewCoordinatorInput(value));
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
test("coordinator is registered by default in a parent session; absent in child sessions and with the explicit opt-out", () => {
|
|
241
|
+
for (const [env, expected] of [[{}, true], [{ GENTLE_PI_EXPERIMENTAL_REVIEW_COORDINATOR: "1" }, true], [{ GENTLE_PI_EXPERIMENTAL_REVIEW_COORDINATOR: "0" }, false], [{ GENTLE_PI_AGENTS_CHILD: "1" }, false], [{ GENTLE_PI_EXPERIMENTAL_REVIEW_COORDINATOR: "1", GENTLE_PI_AGENTS_CHILD: "1" }, false]] as const) {
|
|
242
|
+
const tools = new Map();
|
|
243
|
+
createGentleAiExtension({ nativeReviewCli: null, processEnv: env })({ registerTool: (tool: { name: string }) => tools.set(tool.name, tool), registerCommand() {}, on() {} } as never);
|
|
244
|
+
assert.equal(tools.has("gentle_review_run"), expected);
|
|
245
|
+
for (const name of ["gentle_review", "gentle_review_capture", "gentle_review_capture_group"]) assert.ok(tools.has(name));
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
test("forecasts remain lossless in final results even if capture later refuses", async () => {
|
|
250
|
+
const first = { outcome: "reviewer-model-run-forecast", cost_forecast: { model_runs: 2, roles: ["review-risk", "review-refuter"] }, message: "Relay all forecast fields" };
|
|
251
|
+
const second = { outcome: "reviewer-model-run-forecast", cost_forecast: { model_runs: 1, roles: ["review-validator"] } };
|
|
252
|
+
const next = { ...collect, collectBindings: [{ collectBinding: "another-opaque" }] };
|
|
253
|
+
const host = backend([collect, first, captured, next, second, { outcome: "capture-binding-rejected" }]);
|
|
254
|
+
const expected = structuredClone([first, second]);
|
|
255
|
+
const result = await runReviewCoordinator({ lineageId: lineage }, { ...host, presentForecast: async forecast => { forecast.message = "UI rendering must not alter the model relay"; return true; } });
|
|
256
|
+
assert.equal(result.outcome, "blocked"); assert.deepEqual(result.forecasts, expected);
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
test("a captured provider-role artifact continues only through bound STATUS; look-alikes stay blocked", async () => {
|
|
260
|
+
const role = { tool: "gentle_review_capture", status: "captured", outcome: "native-provider-role-captured", provider_role: { role: "refuter", captured: true } };
|
|
261
|
+
const host = backend([collect, role, approved, closed]);
|
|
262
|
+
assert.equal((await runReviewCoordinator({ lineageId: lineage }, host)).outcome, "closed");
|
|
263
|
+
assert.deepEqual(host.calls.map(call => call.tool === "gentle_review" ? String(call.parameters.operation) : call.tool), ["status", "gentle_review_capture", "status", "acknowledge-approved"]);
|
|
264
|
+
const group = { ...collect, collectBindings: [{ collectBinding: "first" }, { collectBinding: "second" }] };
|
|
265
|
+
for (const [status, capture] of [
|
|
266
|
+
[collect, { ...role, status: "blocked" }],
|
|
267
|
+
[collect, { ...role, failure: { kind: "transport" } }],
|
|
268
|
+
[collect, { ...role, native_failure: {} }],
|
|
269
|
+
[collect, { ...role, reconciliation: {} }],
|
|
270
|
+
[collect, { ...role, reconciliation_failure: {} }],
|
|
271
|
+
[collect, { ...role, status: "reconciled" }],
|
|
272
|
+
[collect, (({ status: _status, ...rest }) => rest)(role)],
|
|
273
|
+
[collect, { ...role, outcome: "native-provider-role-capture-recorded" }],
|
|
274
|
+
[group, role],
|
|
275
|
+
] as const) {
|
|
276
|
+
const blocked = backend([status, capture]);
|
|
277
|
+
const result = await runReviewCoordinator({ lineageId: lineage }, blocked);
|
|
278
|
+
assert.equal(result.outcome, "blocked", JSON.stringify(capture)); assert.equal(result.result, capture); assert.equal(blocked.calls.length, 2);
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
test("advisory finding claim marks are relayed only as arrays of strings, and only with the claims", async () => {
|
|
283
|
+
const findings = { statement: "fixture", findings: [{ id: "F1" }, { id: "F2" }] };
|
|
284
|
+
const run = async (closure: Body) => await runReviewCoordinator({ lineageId: lineage }, backend([collect, { ...captured, closure: { advisory_findings: findings, ...closure } }, approved, closed]));
|
|
285
|
+
const marked = await run({ advisory_finding_claims: { F1: "cut" }, advisory_finding_claims_truncated: ["F1"], advisory_finding_claims_omitted: ["F2"] });
|
|
286
|
+
assert.deepEqual(marked.advisory_finding_claims_truncated, ["F1"]); assert.deepEqual(marked.advisory_finding_claims_omitted, ["F2"]);
|
|
287
|
+
for (const mark of ["F1", [1], { F1: true }, null]) {
|
|
288
|
+
const result = await run({ advisory_finding_claims: { F1: "cut" }, advisory_finding_claims_truncated: mark, advisory_finding_claims_omitted: mark });
|
|
289
|
+
assert.equal(result.outcome, "closed");
|
|
290
|
+
assert.equal(Object.hasOwn(result, "advisory_finding_claims_truncated"), false, JSON.stringify(mark));
|
|
291
|
+
assert.equal(Object.hasOwn(result, "advisory_finding_claims_omitted"), false, JSON.stringify(mark));
|
|
292
|
+
}
|
|
293
|
+
const withoutClaims = await run({ advisory_finding_claims_truncated: ["F1"] });
|
|
294
|
+
assert.equal(Object.hasOwn(withoutClaims, "advisory_finding_claims_truncated"), false);
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
test("cancellation after an admitted closure with findings returns cancelled; a refused capture or a closure without findings still aborts", async () => {
|
|
298
|
+
const findings = { statement: "fixture", findings: [{ id: "F1" }] };
|
|
299
|
+
const withFindings = { ...captured, closure: { advisory_findings: findings, advisory_finding_claims: { F1: "claim" } } };
|
|
300
|
+
const racing = (response: Body) => {
|
|
301
|
+
const controller = new AbortController(); const calls: string[] = [];
|
|
302
|
+
return { calls, signal: controller.signal, async invoke(tool: ReviewCoordinatorTool) { calls.push(tool); if (tool === "gentle_review") return collect; controller.abort(); return response; } };
|
|
303
|
+
};
|
|
304
|
+
const host = racing(withFindings);
|
|
305
|
+
const result = await runReviewCoordinator({ lineageId: lineage }, host);
|
|
306
|
+
assert.equal(result.outcome, "cancelled"); assert.deepEqual(result.result, withFindings, "the fixture envelope carries no status or state to drop");
|
|
307
|
+
assert.deepEqual(result.advisory_findings, findings); assert.deepEqual(result.advisory_finding_claims, { F1: "claim" });
|
|
308
|
+
assert.deepEqual(host.calls, ["gentle_review", "gentle_review_capture"], "nothing is dispatched after the cancellation");
|
|
309
|
+
for (const response of [{ ...withFindings, failure: { kind: "transport" } }, { ...withFindings, outcome: "capture-binding-rejected" }, { ...captured, closure: {} }, captured]) {
|
|
310
|
+
const refused = racing(response);
|
|
311
|
+
await assert.rejects(runReviewCoordinator({ lineageId: lineage }, refused), { name: "AbortError" }, JSON.stringify(response));
|
|
312
|
+
assert.equal(refused.calls.length, 2);
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
test("after a captured provider-role artifact, drift, a reoffered capture and the cap still stop the run", async () => {
|
|
317
|
+
const role = { tool: "gentle_review_capture", status: "captured", outcome: "native-provider-role-captured", provider_role: { role: "refuter", captured: true } };
|
|
318
|
+
const drift = backend([collect, role, { result: { ...approved.result, target_identity: "other" } }]);
|
|
319
|
+
assert.equal((await runReviewCoordinator({ lineageId: lineage }, drift)).outcome, "binding-drift"); assert.equal(drift.calls.length, 3);
|
|
320
|
+
const reoffered = backend([collect, role, collect]);
|
|
321
|
+
assert.equal((await runReviewCoordinator({ lineageId: lineage }, reoffered)).outcome, "repeated-capture"); assert.equal(reoffered.calls.length, 3);
|
|
322
|
+
let roles = 0;
|
|
323
|
+
const capped = await runReviewCoordinator({ lineageId: lineage }, { invoke: async tool => {
|
|
324
|
+
if (tool === "gentle_review") return { ...collect, collectBindings: [{ collectBinding: `role-${roles}` }] };
|
|
325
|
+
roles++; return role;
|
|
326
|
+
} });
|
|
327
|
+
assert.equal(capped.outcome, "transition-limit"); assert.equal(roles, 24);
|
|
328
|
+
});
|
|
329
|
+
|
|
330
|
+
test("a retained approved closure with findings survives every later abort before the acknowledgement; a completed acknowledgement stays closed", async () => {
|
|
331
|
+
const findings = { statement: "fixture", findings: [{ id: "F1" }] };
|
|
332
|
+
const withFindings = { ...captured, status: "closed", closure: { state: "approved", advisory_findings: findings, advisory_finding_claims: { F1: "claim" }, advisory_finding_claims_truncated: ["F1"] } };
|
|
333
|
+
const expected = { outcome: "native-last-event-closure", closure: { advisory_findings: findings, advisory_finding_claims: { F1: "claim" }, advisory_finding_claims_truncated: ["F1"] } };
|
|
334
|
+
// Abort observed after STATUS completed (while its step is recorded), before the acknowledgement.
|
|
335
|
+
{
|
|
336
|
+
const controller = new AbortController(); const calls: string[] = []; let statuses = 0; let abortAtNextClock = false;
|
|
337
|
+
const result = await runReviewCoordinator({ lineageId: lineage }, { signal: controller.signal,
|
|
338
|
+
now: () => { if (abortAtNextClock) controller.abort(); return 0; },
|
|
339
|
+
async invoke(tool, parameters) {
|
|
340
|
+
calls.push(tool === "gentle_review" ? String(parameters.operation) : tool);
|
|
341
|
+
if (tool !== "gentle_review") return withFindings;
|
|
342
|
+
if (++statuses === 1) return collect;
|
|
343
|
+
abortAtNextClock = true; return approved;
|
|
344
|
+
} });
|
|
345
|
+
assert.equal(result.outcome, "cancelled"); assert.deepEqual(result.result, expected);
|
|
346
|
+
assert.deepEqual(result.advisory_findings, findings); assert.deepEqual(result.advisory_finding_claims, { F1: "claim" }); assert.deepEqual(result.advisory_finding_claims_truncated, ["F1"]);
|
|
347
|
+
assert.deepEqual(calls, ["status", "gentle_review_capture", "status"], "no acknowledgement after the abort");
|
|
348
|
+
}
|
|
349
|
+
// The acknowledgement rejects because of the abort; or completes although the signal aborted.
|
|
350
|
+
for (const [ack, outcome] of [["rejects", "cancelled"], ["completes", "closed"]] as const) {
|
|
351
|
+
const controller = new AbortController(); let statuses = 0;
|
|
352
|
+
const result = await runReviewCoordinator({ lineageId: lineage }, { signal: controller.signal, async invoke(tool, parameters) {
|
|
353
|
+
if (tool !== "gentle_review") return withFindings;
|
|
354
|
+
if (parameters.operation === "acknowledge-approved") {
|
|
355
|
+
controller.abort();
|
|
356
|
+
if (ack === "rejects") throw Object.assign(new Error("aborted"), { name: "AbortError" });
|
|
357
|
+
return closed;
|
|
358
|
+
}
|
|
359
|
+
return ++statuses === 1 ? collect : approved;
|
|
360
|
+
} });
|
|
361
|
+
assert.equal(result.outcome, outcome, ack);
|
|
362
|
+
assert.deepEqual(result.advisory_findings, findings, ack);
|
|
363
|
+
}
|
|
364
|
+
// A non-abort rejection is not a cancellation.
|
|
365
|
+
let statuses = 0;
|
|
366
|
+
await assert.rejects(runReviewCoordinator({ lineageId: lineage }, { async invoke(tool) {
|
|
367
|
+
if (tool !== "gentle_review") return withFindings;
|
|
368
|
+
if (++statuses === 1) return collect;
|
|
369
|
+
throw new Error("transport failure");
|
|
370
|
+
} }), /transport failure/);
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
test("only the abort itself turns a retained approved closure into cancelled; another error thrown while aborted is rethrown", async () => {
|
|
374
|
+
const findings = { statement: "fixture", findings: [{ id: "F1" }] };
|
|
375
|
+
const withFindings = { ...captured, closure: { advisory_findings: findings } };
|
|
376
|
+
const failing = (abort: (controller: AbortController) => void, thrown: (signal: AbortSignal) => unknown) => {
|
|
377
|
+
const controller = new AbortController(); let statuses = 0;
|
|
378
|
+
return runReviewCoordinator({ lineageId: lineage }, { signal: controller.signal, async invoke(tool) {
|
|
379
|
+
if (tool !== "gentle_review") return withFindings;
|
|
380
|
+
if (++statuses === 1) return collect;
|
|
381
|
+
abort(controller); throw thrown(controller.signal);
|
|
382
|
+
} });
|
|
383
|
+
};
|
|
384
|
+
const transport = new Error("transport failure");
|
|
385
|
+
await assert.rejects(failing(controller => controller.abort(), () => transport), error => error === transport, "a non-abort error is rethrown, not cancelled");
|
|
386
|
+
const timeout = new DOMException("deadline", "TimeoutError");
|
|
387
|
+
for (const [label, abort, thrown] of [
|
|
388
|
+
["AbortError-named error", (controller: AbortController) => controller.abort(), () => Object.assign(new Error("aborted"), { name: "AbortError" })],
|
|
389
|
+
["the signal's default reason", (controller: AbortController) => controller.abort(), (signal: AbortSignal) => signal.reason],
|
|
390
|
+
["the signal's own custom reason", (controller: AbortController) => controller.abort(timeout), (signal: AbortSignal) => signal.reason],
|
|
391
|
+
] as const) {
|
|
392
|
+
const result = await failing(abort, thrown);
|
|
393
|
+
assert.equal(result.outcome, "cancelled", label); assert.deepEqual(result.advisory_findings, findings, label);
|
|
394
|
+
}
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
test("resume_input names the INSPECT's resolved workspace_root only when the caller passed none", async () => {
|
|
398
|
+
const selecting = { operation: "inspect", status: "blocked", result: { next_transition: { kind: "collect" } }, selectionBinding: "opaque-selection", workspace_root: "/resolved/root" };
|
|
399
|
+
const input = { lenses: ["risk"], lensesReason: "fixture" };
|
|
400
|
+
assert.deepEqual((await runReviewCoordinator(input, backend([{ reviewDue: true }, selecting]))).resume_input, { ...input, workspaceRoot: "/resolved/root" });
|
|
401
|
+
assert.deepEqual((await runReviewCoordinator({ ...input, workspaceRoot: "/caller/root" }, backend([{ reviewDue: true }, selecting]))).resume_input, { ...input, workspaceRoot: "/caller/root" });
|
|
402
|
+
const { workspace_root: _root, ...unrooted } = selecting;
|
|
403
|
+
assert.deepEqual((await runReviewCoordinator(input, backend([{ reviewDue: true }, unrooted]))).resume_input, input);
|
|
404
|
+
});
|
|
405
|
+
|
|
406
|
+
// odd/tasks/review-one-call.md T11 (S5): the correction request's findings, relayed beside input-required.
|
|
407
|
+
const correctionFinding = (id: string, claim: unknown, extra: Body = {}) => ({ id, lens: "risk", location: "a.ts:1", severity: "CRITICAL", claim, proof_refs: ["p"], evidence: "e", evidence_class: "deterministic", causal_disposition: "introduced", ...extra });
|
|
408
|
+
// L21: the provider answered the non-blocking question (with none), so the correction fields come back.
|
|
409
|
+
const answeredNone = { statement: "s", findings: [] };
|
|
410
|
+
// `null` builds a STATUS without the key (the provider did not answer).
|
|
411
|
+
const correctionStatus = (findings: unknown, nonBlocking: unknown = answeredNone) => ({ ...collect, result: { ...collect.result, next_transition: { kind: "collect", correction_request: { request_hash: "opaque-request", findings } },
|
|
412
|
+
...(nonBlocking === null ? {} : { non_blocking_findings: nonBlocking }) }, collectBindings: [{ collectBinding: "plan" }] });
|
|
413
|
+
|
|
414
|
+
test("a correction request's findings are relayed as provider fields plus bounded claims, never routed on", async () => {
|
|
415
|
+
const findings = [correctionFinding("B1", "first claim"), correctionFinding("B2", "second claim", { future_field: "kept in STATUS only" }), correctionFinding("B1", "duplicate id")];
|
|
416
|
+
const response = correctionStatus(findings);
|
|
417
|
+
const host = backend([response]);
|
|
418
|
+
const result = await runReviewCoordinator({ lineageId: lineage }, host);
|
|
419
|
+
assert.equal(result.outcome, "input-required"); assert.equal(host.calls.length, 1);
|
|
420
|
+
const { non_blocking_findings: _answer, ...nested } = response.result as Body;
|
|
421
|
+
assert.deepEqual(result.result, { ...response, result: nested }, "the STATUS envelope is relayed unchanged apart from the non-blocking answer (L19)");
|
|
422
|
+
const listed = { lens: "risk", location: "a.ts:1", severity: "CRITICAL", evidence_class: "deterministic", causal_disposition: "introduced" };
|
|
423
|
+
assert.deepEqual(result.correction_findings, [{ id: "B1", ...listed }, { id: "B2", ...listed }, { id: "B1", ...listed }]);
|
|
424
|
+
assert.deepEqual(result.correction_finding_claims, { B2: "second claim" }, "an id with more than one finding is left out");
|
|
425
|
+
const bounded = await runReviewCoordinator({ lineageId: lineage }, backend([correctionStatus([correctionFinding("B1", "é".repeat(600)), ...Array.from({ length: 8 }, (_, i) => correctionFinding(`C${i}`, "z".repeat(1024)))])]));
|
|
426
|
+
assert.equal((bounded.correction_finding_claims as Body).B1, "é".repeat(512)); assert.deepEqual(bounded.correction_finding_claims_truncated, ["B1"]);
|
|
427
|
+
assert.deepEqual(Object.keys(bounded.correction_finding_claims as Body), ["B1", "C0", "C1", "C2", "C3", "C4", "C5", "C6"]); assert.deepEqual(bounded.correction_finding_claims_omitted, ["C7"]);
|
|
428
|
+
});
|
|
429
|
+
|
|
430
|
+
test("without the provider's non-blocking answer a correction request returns no correction fields (L21)", async () => {
|
|
431
|
+
const findings = [correctionFinding("B1", "first claim")];
|
|
432
|
+
const response = correctionStatus(findings, null);
|
|
433
|
+
const result = await runReviewCoordinator({ lineageId: lineage }, backend([response]));
|
|
434
|
+
assert.equal(result.outcome, "input-required"); assert.equal(result.result, response, "the STATUS envelope is relayed unchanged");
|
|
435
|
+
for (const key of ["correction_findings", "correction_finding_claims", "correction_finding_claims_truncated", "correction_finding_claims_omitted", "non_blocking_findings"]) assert.equal(Object.hasOwn(result, key), false, key);
|
|
436
|
+
// A set the run drops (whitespace-only) is not an answer either.
|
|
437
|
+
const dropped = await runReviewCoordinator({ lineageId: lineage }, backend([correctionStatus(findings, { statement: " ", findings: [] })]));
|
|
438
|
+
for (const key of ["correction_findings", "correction_finding_claims", "non_blocking_findings"]) assert.equal(Object.hasOwn(dropped, key), false, `dropped: ${key}`);
|
|
439
|
+
const answered = await runReviewCoordinator({ lineageId: lineage }, backend([correctionStatus(findings)]));
|
|
440
|
+
assert.deepEqual(answered.correction_finding_claims, { B1: "first claim" }); assert.deepEqual(answered.non_blocking_findings, answeredNone);
|
|
441
|
+
});
|
|
442
|
+
|
|
443
|
+
test("a malformed correction finding set is dropped whole and the outcome stays input-required", async () => {
|
|
444
|
+
const proto = Object.create({ id: "B1" });
|
|
445
|
+
for (const findings of [undefined, [], "B1", [null], [correctionFinding("B1", "")], [correctionFinding("B1", 3)], [{ ...correctionFinding("B1", "c"), severity: 1 }], [{ ...correctionFinding("B1", "c"), lens: undefined }],
|
|
446
|
+
[{ ...correctionFinding("B1", "c"), evidence_class: 2 }], [proto], [new Map([["id", "B1"]])], [correctionFinding("B1", "c"), ["B2"]]]) {
|
|
447
|
+
const result = await runReviewCoordinator({ lineageId: lineage }, backend([correctionStatus(findings)]));
|
|
448
|
+
assert.equal(result.outcome, "input-required", JSON.stringify(findings));
|
|
449
|
+
for (const key of ["correction_findings", "correction_finding_claims", "correction_finding_claims_truncated", "correction_finding_claims_omitted"]) assert.equal(Object.hasOwn(result, key), false, `${key}: ${JSON.stringify(findings)}`);
|
|
450
|
+
}
|
|
451
|
+
});
|
|
452
|
+
|
|
453
|
+
test("correction findings are read only after the correction request decided input-required, and never from any other response", async () => {
|
|
454
|
+
// A correction request without kind collect routes as before; its findings are not read.
|
|
455
|
+
const request: Body = { request_hash: "opaque" };
|
|
456
|
+
Object.defineProperty(request, "findings", { get() { throw new Error("must not read findings before the routing decision"); } });
|
|
457
|
+
const stoppedWithRequest = { ...collect, result: { ...collect.result, next_transition: { kind: "stop", correction_request: request } } };
|
|
458
|
+
assert.equal((await runReviewCoordinator({ lineageId: lineage }, backend([stoppedWithRequest]))).outcome, "stopped");
|
|
459
|
+
// An approved run carries the advisory keys only.
|
|
460
|
+
const closedRun = await runReviewCoordinator({ lineageId: lineage }, backend([collect, { ...captured, closure: { advisory_findings: { statement: "s", findings: [{ id: "F1" }] }, advisory_finding_claims: { F1: "c" } } }, approved, closed]));
|
|
461
|
+
assert.equal(closedRun.outcome, "closed"); assert.equal(Object.hasOwn(closedRun, "correction_findings"), false); assert.deepEqual(closedRun.advisory_finding_claims, { F1: "c" });
|
|
462
|
+
});
|