@tea-agent/loop-agent 0.1.0-fe-test.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/AGENTS.md +114 -0
- package/CHANGELOG.md +2283 -0
- package/README.md +177 -0
- package/bin/agent-worker.js +22 -0
- package/bin/loop-agent.js +57 -0
- package/dist/adapters/aimax.js +91 -0
- package/dist/adapters/context.js +32 -0
- package/dist/adapters/index.js +29 -0
- package/dist/adapters/loop-agent.js +192 -0
- package/dist/adapters/types.js +1 -0
- package/dist/application/context-usage/skill-resolution-stats.js +263 -0
- package/dist/application/dag/args.js +486 -0
- package/dist/application/dag/generate-task-dag.js +408 -0
- package/dist/application/dag/report-dag.js +14 -0
- package/dist/application/dag/run-dag.js +109 -0
- package/dist/application/dag/validate-dag.js +166 -0
- package/dist/application/evaluation/alias.js +184 -0
- package/dist/application/evaluation/budget.js +192 -0
- package/dist/application/evaluation/campaign-hash.js +47 -0
- package/dist/application/evaluation/campaign-matrix.js +372 -0
- package/dist/application/evaluation/campaign-scorecard.js +135 -0
- package/dist/application/evaluation/campaign.js +370 -0
- package/dist/application/evaluation/candidate-hash.js +75 -0
- package/dist/application/evaluation/candidate.js +69 -0
- package/dist/application/evaluation/corpus-hash.js +38 -0
- package/dist/application/evaluation/corpus.js +56 -0
- package/dist/application/evaluation/experiment.js +294 -0
- package/dist/application/evaluation/ignition.js +198 -0
- package/dist/application/evaluation/integrity-audit.js +162 -0
- package/dist/application/evaluation/outer-loop.js +132 -0
- package/dist/application/evaluation/pi-cell-executor.js +39 -0
- package/dist/application/evaluation/private-verifier.js +46 -0
- package/dist/application/evaluation/promotion-policy.js +151 -0
- package/dist/application/evaluation/proposer.js +98 -0
- package/dist/application/evaluation/replay.js +289 -0
- package/dist/application/evaluation/types.js +652 -0
- package/dist/application/loop/run-action.js +19 -0
- package/dist/application/task-lifecycle/advance.js +1204 -0
- package/dist/application/task-lifecycle/gates.js +130 -0
- package/dist/application/task-lifecycle/index.js +7 -0
- package/dist/application/task-lifecycle/observe.js +424 -0
- package/dist/application/task-lifecycle/plan-transitions.js +251 -0
- package/dist/application/task-lifecycle/recommendations.js +180 -0
- package/dist/application/task-lifecycle/record.js +73 -0
- package/dist/application/task-lifecycle/types.js +1 -0
- package/dist/build-stamp.json +6 -0
- package/dist/cli/catalog.js +24 -0
- package/dist/cli/command-definitions.js +659 -0
- package/dist/cli/help.js +56 -0
- package/dist/cli/index.js +5 -0
- package/dist/cli/program.js +647 -0
- package/dist/cli/router.js +13 -0
- package/dist/cli/update/init-surface-notifier.js +167 -0
- package/dist/cli/update/notifier.js +117 -0
- package/dist/cli/update/npm-client.js +151 -0
- package/dist/cli/update/policy.js +92 -0
- package/dist/cli/update/runtime-activity.js +29 -0
- package/dist/cli/update/state.js +68 -0
- package/dist/cli-governance/active-residue-check.js +38 -0
- package/dist/cli.js +57 -0
- package/dist/commands/client-recovery.js +1373 -0
- package/dist/commands/closeout.js +13 -0
- package/dist/commands/coverage-audit.js +14 -0
- package/dist/commands/coverage-report.js +50 -0
- package/dist/commands/cursor-prompt.js +182 -0
- package/dist/commands/dag-approve.js +142 -0
- package/dist/commands/dag-final-verification.js +76 -0
- package/dist/commands/dag-init-hybrid.js +57 -0
- package/dist/commands/dag-reconcile-run.js +5 -0
- package/dist/commands/dag-reconcile-tasks.js +51 -0
- package/dist/commands/dag-reject.js +91 -0
- package/dist/commands/dag-report.js +76 -0
- package/dist/commands/dag-request-interrupt.js +20 -0
- package/dist/commands/dag-rerun-task.js +19 -0
- package/dist/commands/dag-rerun.js +111 -0
- package/dist/commands/dag-resume.js +35 -0
- package/dist/commands/dag-run-task.js +12 -0
- package/dist/commands/dag-validate.js +20 -0
- package/dist/commands/dag-workflow-compile.js +91 -0
- package/dist/commands/dag-workflow-plan.js +130 -0
- package/dist/commands/dag-workflow-validate.js +66 -0
- package/dist/commands/delegate.js +130 -0
- package/dist/commands/docs-archive.js +5 -0
- package/dist/commands/docs-audit.js +6 -0
- package/dist/commands/doctor.js +283 -0
- package/dist/commands/eval.js +1398 -0
- package/dist/commands/examples.js +90 -0
- package/dist/commands/goal.js +92 -0
- package/dist/commands/handoff-check.js +5 -0
- package/dist/commands/harvest.js +44 -0
- package/dist/commands/import-prd.js +81 -0
- package/dist/commands/init-upgrade.js +3085 -0
- package/dist/commands/init.js +3630 -0
- package/dist/commands/inspect.js +11 -0
- package/dist/commands/instructions.js +223 -0
- package/dist/commands/knowledge.js +162 -0
- package/dist/commands/loop-benchmark.js +72 -0
- package/dist/commands/loop.js +251 -0
- package/dist/commands/new-task.js +5 -0
- package/dist/commands/operator.js +44 -0
- package/dist/commands/pi-prompt.js +174 -0
- package/dist/commands/pi-reuse-benchmark.js +153 -0
- package/dist/commands/plan-list.js +5 -0
- package/dist/commands/plan.js +50 -0
- package/dist/commands/promote-run.js +29 -0
- package/dist/commands/reference-index.js +16 -0
- package/dist/commands/run-dag-progress.js +123 -0
- package/dist/commands/run-dag.js +22 -0
- package/dist/commands/spine.js +38 -0
- package/dist/commands/stats.js +113 -0
- package/dist/commands/status.js +57 -0
- package/dist/commands/study-init.js +192 -0
- package/dist/commands/task-advance.js +366 -0
- package/dist/commands/task-contract.js +269 -0
- package/dist/commands/task-source-prepare.js +479 -0
- package/dist/commands/task-status.js +133 -0
- package/dist/commands/workflow.js +259 -0
- package/dist/commands/worktree-create.js +31 -0
- package/dist/commands/worktree-list.js +5 -0
- package/dist/commands/worktree-remove.js +26 -0
- package/dist/executors/config-core.js +5 -0
- package/dist/executors/config.js +2 -0
- package/dist/executors/dag-pi-executor.js +1277 -0
- package/dist/executors/dag-static-executor.js +42 -0
- package/dist/executors/dag.js +3 -0
- package/dist/executors/index.js +6 -0
- package/dist/executors/model-routing.js +71 -0
- package/dist/executors/pi-defaults.js +9 -0
- package/dist/executors/pi-event-serializer.js +65 -0
- package/dist/executors/pi-executor.js +981 -0
- package/dist/executors/pi-playwright-cli-tool.js +1006 -0
- package/dist/executors/pi-prompt-transport.js +198 -0
- package/dist/executors/pi-reuse-benchmark.js +316 -0
- package/dist/executors/pi-runtime-reuse.js +29 -0
- package/dist/executors/pi-sdk-executor.js +722 -0
- package/dist/executors/pi-sdk.js +1 -0
- package/dist/executors/pi-writer-tool-policy.js +266 -0
- package/dist/executors/pi.js +3 -0
- package/dist/executors/playwright-cli-launcher.js +63 -0
- package/dist/executors/process-tree.js +33 -0
- package/dist/executors/shell-executor.js +3055 -0
- package/dist/executors/shell-presets.js +99 -0
- package/dist/executors/shell-verification.js +262 -0
- package/dist/executors/shell-write-guard.js +543 -0
- package/dist/executors/shell.js +3 -0
- package/dist/executors/static.js +1 -0
- package/dist/governance/checks.js +437 -0
- package/dist/governance/document-index-closure.js +164 -0
- package/dist/governance/exec-plans.js +549 -0
- package/dist/governance/harness.js +9 -0
- package/dist/governance/index.js +3 -0
- package/dist/governance/manifest-types.js +254 -0
- package/dist/governance/manifest.js +2 -0
- package/dist/governance/path-guard.js +69 -0
- package/dist/governance/path-guards.js +2 -0
- package/dist/governance/profiles.js +3 -0
- package/dist/governance/requirement-coverage.js +425 -0
- package/dist/governance/skill-safety.js +135 -0
- package/dist/governance/spine-audit.js +155 -0
- package/dist/infrastructure/evaluation/alias-store.js +199 -0
- package/dist/infrastructure/evaluation/campaign-store.js +154 -0
- package/dist/infrastructure/evaluation/candidate-store.js +439 -0
- package/dist/infrastructure/evaluation/corpus-store.js +181 -0
- package/dist/infrastructure/evaluation/experiment-store.js +124 -0
- package/dist/infrastructure/evaluation/ignition-store.js +82 -0
- package/dist/infrastructure/evaluation/private-verifier-store.js +145 -0
- package/dist/infrastructure/evaluation/proposer-store.js +78 -0
- package/dist/infrastructure/evaluation/store.js +40 -0
- package/dist/infrastructure/harness/active-residue-policy.js +73 -0
- package/dist/infrastructure/harness/artifact-store.js +72 -0
- package/dist/infrastructure/harness/atomic-write.js +50 -0
- package/dist/infrastructure/harness/completed-facts-guard.js +40 -0
- package/dist/infrastructure/harness/loop-action-store.js +20 -0
- package/dist/infrastructure/harness/loop-store.js +41 -0
- package/dist/infrastructure/harness/one-shot-run-store.js +94 -0
- package/dist/infrastructure/harness/task-store.js +108 -0
- package/dist/records/closeout.js +2 -0
- package/dist/records/harvest.js +215 -0
- package/dist/records/index.js +3 -0
- package/dist/records/one-shot-runs.js +386 -0
- package/dist/records/promotion.js +200 -0
- package/dist/shared/artifacts-core.js +107 -0
- package/dist/shared/artifacts.js +2 -0
- package/dist/shared/context-files.js +32 -0
- package/dist/shared/context.js +2 -0
- package/dist/shared/copy-dir.js +17 -0
- package/dist/shared/git-progress.js +172 -0
- package/dist/shared/index.js +5 -0
- package/dist/shared/logger.js +17 -0
- package/dist/shared/one-shot-prompt-args.js +98 -0
- package/dist/shared/openspec-spec.js +125 -0
- package/dist/shared/operator/capabilities.js +2659 -0
- package/dist/shared/operator/command-lifecycle.js +94 -0
- package/dist/shared/operator/envelope.js +59 -0
- package/dist/shared/operator/index.js +5 -0
- package/dist/shared/operator/registry.js +38 -0
- package/dist/shared/operator/types.js +5 -0
- package/dist/shared/output-truncation.js +37 -0
- package/dist/shared/package-metadata.js +530 -0
- package/dist/shared/path-refs.js +31 -0
- package/dist/shared/pi-retry-settings.js +23 -0
- package/dist/shared/playwright-cli-command-policy.js +41 -0
- package/dist/shared/preview.js +39 -0
- package/dist/shared/prompts.js +26 -0
- package/dist/shared/reference-context.js +264 -0
- package/dist/shared/resilient-git.js +133 -0
- package/dist/shared/runtime-activity.js +6 -0
- package/dist/shared/timeout-policy.js +24 -0
- package/dist/shared/timeout.js +1 -0
- package/dist/shared/types.js +5 -0
- package/dist/sidecars/cursor-prompt/executor.js +428 -0
- package/dist/sidecars/cursor-prompt/index.js +3 -0
- package/dist/sidecars/cursor-prompt/stream.js +121 -0
- package/dist/task/config-types.js +235 -0
- package/dist/task/config.js +2 -0
- package/dist/task/contract/adopt.js +166 -0
- package/dist/task/contract/apply.js +326 -0
- package/dist/task/contract/canonicalize.js +60 -0
- package/dist/task/contract/constants.js +30 -0
- package/dist/task/contract/diff.js +177 -0
- package/dist/task/contract/hash.js +42 -0
- package/dist/task/contract/import-revision.js +96 -0
- package/dist/task/contract/index.js +17 -0
- package/dist/task/contract/journal.js +155 -0
- package/dist/task/contract/lock.js +153 -0
- package/dist/task/contract/observe.js +296 -0
- package/dist/task/contract/paths.js +19 -0
- package/dist/task/contract/project.js +185 -0
- package/dist/task/contract/recover.js +312 -0
- package/dist/task/contract/request-ledger.js +37 -0
- package/dist/task/contract/schema.js +153 -0
- package/dist/task/contract/transaction.js +160 -0
- package/dist/task/contract/types.js +1 -0
- package/dist/task/contract/validate-draft.js +106 -0
- package/dist/task/dag-source-paths.js +50 -0
- package/dist/task/delegate.js +208 -0
- package/dist/task/frontend-preflight.js +131 -0
- package/dist/task/frontend-project-capability.js +570 -0
- package/dist/task/goal-audit.js +51 -0
- package/dist/task/goal-policy.js +8 -0
- package/dist/task/goal.js +3 -0
- package/dist/task/ids.js +1 -0
- package/dist/task/index.js +12 -0
- package/dist/task/lifecycle.js +1 -0
- package/dist/task/operator/capabilities.js +6 -0
- package/dist/task/operator/envelope.js +2 -0
- package/dist/task/operator/index.js +5 -0
- package/dist/task/operator/registry.js +2 -0
- package/dist/task/operator/types.js +1 -0
- package/dist/task/paths.js +1 -0
- package/dist/task/read-model.js +140 -0
- package/dist/task/runtime.js +708 -0
- package/dist/task/source-prepare/artifact-meta.js +137 -0
- package/dist/task/source-prepare/build-draft.js +232 -0
- package/dist/task/source-prepare/completeness.js +248 -0
- package/dist/task/source-prepare/index.js +10 -0
- package/dist/task/source-prepare/parse-intent.js +496 -0
- package/dist/task/source-prepare/path-policy.js +197 -0
- package/dist/task/source-prepare/placeholder-paths.js +77 -0
- package/dist/task/source-prepare/prepare.js +920 -0
- package/dist/task/source-prepare/reference-integrity.js +290 -0
- package/dist/task/source-prepare/semantic-intake.js +717 -0
- package/dist/task/source-prepare/types.js +7 -0
- package/dist/task/source-references.js +228 -0
- package/dist/task/source-state.js +1 -0
- package/dist/task/state.js +41 -0
- package/dist/task/subagent-guidance.js +1 -0
- package/dist/task/task-demand-routing.js +443 -0
- package/dist/task/workflow-state-types.js +92 -0
- package/dist/task/worktree-cleanup.js +140 -0
- package/dist/task/worktree.js +388 -0
- package/dist/verification/maven/cache.js +142 -0
- package/dist/verification/maven/index.js +120 -0
- package/dist/verification/maven/plan-commands.js +421 -0
- package/dist/verification/maven/pom-static.js +136 -0
- package/dist/verification/maven/scope-resolve.js +153 -0
- package/dist/verification/maven/stale.js +130 -0
- package/dist/verification/maven/types.js +23 -0
- package/dist/verification/maven/workspace-graph.js +322 -0
- package/dist/worker/cli.js +957 -0
- package/dist/worker/closeout/apply.js +73 -0
- package/dist/worker/closeout/preview.js +30 -0
- package/dist/worker/console/app-data.js +316 -0
- package/dist/worker/console/chat/artifact-card.js +30 -0
- package/dist/worker/console/chat/assistant-content.js +121 -0
- package/dist/worker/console/chat/chat-event-store.js +981 -0
- package/dist/worker/console/chat/chat-ui-policy.js +25 -0
- package/dist/worker/console/chat/compaction-errors.js +64 -0
- package/dist/worker/console/chat/composer-draft-store.js +45 -0
- package/dist/worker/console/chat/context-panel.js +54 -0
- package/dist/worker/console/chat/contract-apply-receipt-store.js +174 -0
- package/dist/worker/console/chat/explore-tools.js +299 -0
- package/dist/worker/console/chat/human-gate-card.js +45 -0
- package/dist/worker/console/chat/interview-adapter.js +149 -0
- package/dist/worker/console/chat/mcp-inventory.js +221 -0
- package/dist/worker/console/chat/model-resolver.js +215 -0
- package/dist/worker/console/chat/operation-card.js +92 -0
- package/dist/worker/console/chat/pi-console-config.js +376 -0
- package/dist/worker/console/chat/pi-runtime.js +2446 -0
- package/dist/worker/console/chat/repo-browser.js +140 -0
- package/dist/worker/console/chat/repo-walk.js +125 -0
- package/dist/worker/console/chat/resource-loader.js +59 -0
- package/dist/worker/console/chat/resource-preferences-store.js +152 -0
- package/dist/worker/console/chat/routes.js +3137 -0
- package/dist/worker/console/chat/runtime-context.js +102 -0
- package/dist/worker/console/chat/runtime-selection.js +96 -0
- package/dist/worker/console/chat/semantic-activity.js +489 -0
- package/dist/worker/console/chat/session-store.js +484 -0
- package/dist/worker/console/chat/shortcuts.js +217 -0
- package/dist/worker/console/chat/tool-adapter.js +131 -0
- package/dist/worker/console/chat/tool-preview.js +247 -0
- package/dist/worker/console/chat/tools.js +212 -0
- package/dist/worker/console/chat/turn-execution-registry.js +82 -0
- package/dist/worker/console/chat/turn-process.js +346 -0
- package/dist/worker/console/chat/usage.js +165 -0
- package/dist/worker/console/chat/workspace-landing.js +103 -0
- package/dist/worker/console/dag-confirmation.js +347 -0
- package/dist/worker/console/dag-execution-receipt.js +393 -0
- package/dist/worker/console/doctor.js +230 -0
- package/dist/worker/console/draft-store.js +158 -0
- package/dist/worker/console/harness-pi-model-matrix.js +137 -0
- package/dist/worker/console/human-gate-token.js +130 -0
- package/dist/worker/console/index.js +17 -0
- package/dist/worker/console/inspect-split.js +82 -0
- package/dist/worker/console/interview/assessment.js +67 -0
- package/dist/worker/console/interview/grill-me.js +277 -0
- package/dist/worker/console/interview/session.js +100 -0
- package/dist/worker/console/interview/tools.js +109 -0
- package/dist/worker/console/loopback.js +16 -0
- package/dist/worker/console/mutation-gate-receipt-store.js +184 -0
- package/dist/worker/console/night-aux-ticker.js +146 -0
- package/dist/worker/console/observe-health-match.js +179 -0
- package/dist/worker/console/observe-link.js +42 -0
- package/dist/worker/console/open-browser.js +134 -0
- package/dist/worker/console/operation-run-facts.js +190 -0
- package/dist/worker/console/operation-runner.js +353 -0
- package/dist/worker/console/operation-sse.js +184 -0
- package/dist/worker/console/operation-store.js +169 -0
- package/dist/worker/console/operation-wait.js +355 -0
- package/dist/worker/console/operator-actions.js +3768 -0
- package/dist/worker/console/operator-selection.js +105 -0
- package/dist/worker/console/operator-surface-health.js +24 -0
- package/dist/worker/console/operator-user-error.js +45 -0
- package/dist/worker/console/pi-readiness.js +288 -0
- package/dist/worker/console/prd-identity.js +102 -0
- package/dist/worker/console/prd-intake-bridge.js +441 -0
- package/dist/worker/console/prd-reference-discovery.js +124 -0
- package/dist/worker/console/recovery-cta.js +320 -0
- package/dist/worker/console/recovery-error-copy.js +198 -0
- package/dist/worker/console/recovery-selection.js +107 -0
- package/dist/worker/console/repo-fingerprint.js +35 -0
- package/dist/worker/console/resolve-dag-run-for-task.js +115 -0
- package/dist/worker/console/resource-loader.js +95 -0
- package/dist/worker/console/routes.js +475 -0
- package/dist/worker/console/security.js +170 -0
- package/dist/worker/console/server.js +357 -0
- package/dist/worker/console/sibling-controller.js +33 -0
- package/dist/worker/console/static/assets/abnfDiagram-N423BO3Z-BmOEx0gA.js +1 -0
- package/dist/worker/console/static/assets/arc-BGiVVe8b.js +1 -0
- package/dist/worker/console/static/assets/architectureDiagram-T3A2C74G-nDdu4rgJ.js +36 -0
- package/dist/worker/console/static/assets/blockDiagram-VBNYF7ZC-Bb5u0BWf.js +132 -0
- package/dist/worker/console/static/assets/c4Diagram-5PPSVZJV-BlhC0j94.js +10 -0
- package/dist/worker/console/static/assets/channel-Tl-FkUqr.js +1 -0
- package/dist/worker/console/static/assets/chunk-2GRJ4B5K-Ai8_qQXI.js +1 -0
- package/dist/worker/console/static/assets/chunk-2Q5K7J3B-B9gyCjqX.js +1 -0
- package/dist/worker/console/static/assets/chunk-5RXB4S5H-Bzbj3zGH.js +231 -0
- package/dist/worker/console/static/assets/chunk-5VM5RSS4-BT415PvT.js +15 -0
- package/dist/worker/console/static/assets/chunk-6Q2QTUOP-D_A5_5QL.js +88 -0
- package/dist/worker/console/static/assets/chunk-GF5L2VYU-srJkaP3f.js +206 -0
- package/dist/worker/console/static/assets/chunk-JWPE2WC7-UYGvEP4l.js +1 -0
- package/dist/worker/console/static/assets/chunk-KBJHAD2P-B8luBrrz.js +1 -0
- package/dist/worker/console/static/assets/chunk-RYQCIY6F-DN7wXZSq.js +1 -0
- package/dist/worker/console/static/assets/chunk-XXDRQBXY-DXKyMuKS.js +1 -0
- package/dist/worker/console/static/assets/classDiagram-JCYQIIEL-BaehtRk4.js +1 -0
- package/dist/worker/console/static/assets/classDiagram-v2-OCEON4UE-BaehtRk4.js +1 -0
- package/dist/worker/console/static/assets/cose-bilkent-JH36ORCC-dqvoynXj.js +1 -0
- package/dist/worker/console/static/assets/cynefin-VYW2F7L2--PcyL34A.js +166 -0
- package/dist/worker/console/static/assets/cynefinDiagram-MW4NZA55-DvWs_hTY.js +62 -0
- package/dist/worker/console/static/assets/cytoscape.esm-yzknjiTM.js +321 -0
- package/dist/worker/console/static/assets/dagre-VZM6K2ZE-DxeIxbyO.js +4 -0
- package/dist/worker/console/static/assets/defaultLocale-DX6XiGOO.js +1 -0
- package/dist/worker/console/static/assets/diagram-7IWD3JNH-DPCG61Of.js +30 -0
- package/dist/worker/console/static/assets/diagram-B4RE2ZJO-CmuU50-U.js +3 -0
- package/dist/worker/console/static/assets/diagram-LBJQPF4R-B61XLD_v.js +24 -0
- package/dist/worker/console/static/assets/diagram-Q27KOJAE-BB7HTRRY.js +24 -0
- package/dist/worker/console/static/assets/diagram-UB23O5K3-DvkboAIp.js +41 -0
- package/dist/worker/console/static/assets/ebnfDiagram-BXEA7PRR-BdJ_y1fL.js +1 -0
- package/dist/worker/console/static/assets/erDiagram-JOGREHBK-9bUBZTRi.js +85 -0
- package/dist/worker/console/static/assets/flowDiagram-UKHOOZJN-Dw4L4RBa.js +156 -0
- package/dist/worker/console/static/assets/ganttDiagram-PKOTCBZU-Jr82N_QP.js +292 -0
- package/dist/worker/console/static/assets/gitGraphDiagram-DS77QQ5N-DAz9wFLr.js +106 -0
- package/dist/worker/console/static/assets/graph-DOmOIIwC.js +1 -0
- package/dist/worker/console/static/assets/index-B7Y-0g3J.css +1 -0
- package/dist/worker/console/static/assets/index-DkCrqaYg.js +325 -0
- package/dist/worker/console/static/assets/infoDiagram-6WML65LV-CBB5Np7y.js +2 -0
- package/dist/worker/console/static/assets/init-Gi6I4Gst.js +1 -0
- package/dist/worker/console/static/assets/ishikawaDiagram-WSZJBQD7-D8IOp94y.js +70 -0
- package/dist/worker/console/static/assets/journeyDiagram-NVQOT4AX-Dgd3AHGG.js +139 -0
- package/dist/worker/console/static/assets/kanban-definition-27J2QSJJ-BmYOxLE9.js +89 -0
- package/dist/worker/console/static/assets/layout-D-LzfAck.js +1 -0
- package/dist/worker/console/static/assets/linear-DfYTEF6J.js +1 -0
- package/dist/worker/console/static/assets/map-DxJ2ADlA.js +1 -0
- package/dist/worker/console/static/assets/mermaid.core-BjuFPRqa.js +308 -0
- package/dist/worker/console/static/assets/mindmap-definition-FAOFIHXS-CLyUViGd.js +96 -0
- package/dist/worker/console/static/assets/ordinal-Cboi1Yqb.js +1 -0
- package/dist/worker/console/static/assets/pegDiagram-VL7TDLO6-BvX2Di4-.js +1 -0
- package/dist/worker/console/static/assets/pieDiagram-7S7Q4E2Y-BFj0_OLv.js +39 -0
- package/dist/worker/console/static/assets/quadrantDiagram-CIZ2JOQS-BIUrD_hx.js +7 -0
- package/dist/worker/console/static/assets/railroadDiagram-AXF67PYL-CHBB48fj.js +1 -0
- package/dist/worker/console/static/assets/requirementDiagram-LRYGKXZP-sJrYw2Sf.js +84 -0
- package/dist/worker/console/static/assets/sankeyDiagram-W5VNT64P-BzHH6fPR.js +40 -0
- package/dist/worker/console/static/assets/sequenceDiagram-SI44F4Z6-7QCnelCt.js +162 -0
- package/dist/worker/console/static/assets/sizeCapture-X5ZJPWSS-sDYSxn72.js +1 -0
- package/dist/worker/console/static/assets/stateDiagram-OKZ733FA-XpiUdwzm.js +1 -0
- package/dist/worker/console/static/assets/stateDiagram-v2-UEYNNEHI-eEhq2A8Y.js +1 -0
- package/dist/worker/console/static/assets/swimlanes-SLNWSIFB-DvqgNPzD.js +2 -0
- package/dist/worker/console/static/assets/swimlanesDiagram-ULZ7WXOC-la8AC7fo.js +8 -0
- package/dist/worker/console/static/assets/timeline-definition-Z64GVDOM-2TyOYNx0.js +120 -0
- package/dist/worker/console/static/assets/vennDiagram-T6HMQDX7-B-nM6wM2.js +34 -0
- package/dist/worker/console/static/assets/wardleyDiagram-T6FBY63Y-B86wPdbr.js +78 -0
- package/dist/worker/console/static/assets/xychartDiagram-ELKLHX3M-Dr1C4AQz.js +7 -0
- package/dist/worker/console/static/favicon.svg +37 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_AMS-Regular.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Caligraphic-Bold.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Caligraphic-Regular.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Fraktur-Bold.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Fraktur-Regular.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Main-Bold.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Main-BoldItalic.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Main-Italic.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Main-Regular.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Math-BoldItalic.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Math-Italic.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_SansSerif-Bold.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_SansSerif-Italic.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_SansSerif-Regular.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Script-Regular.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Size1-Regular.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Size2-Regular.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Size3-Regular.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Size4-Regular.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Typewriter-Regular.woff2 +0 -0
- package/dist/worker/console/static/index.html +15 -0
- package/dist/worker/console/static-src/app/console-types.js +184 -0
- package/dist/worker/console/static-src/app/useConsoleShell.js +101 -0
- package/dist/worker/console/static-src/app/useOperatorActions.js +324 -0
- package/dist/worker/console/static-src/app/usePrdImport.js +172 -0
- package/dist/worker/console/static-src/app/useRecoveryActions.js +289 -0
- package/dist/worker/console/static-src/app/useRecoveryConsole.js +425 -0
- package/dist/worker/console/static-src/app/useTaskWizard.js +296 -0
- package/dist/worker/console/static-src/chat-markdown-security.js +38 -0
- package/dist/worker/console/static-src/chat-view-types.js +2 -0
- package/dist/worker/console/static-src/night/night-types.js +24 -0
- package/dist/worker/console/static-src/night/useNightBoard.js +94 -0
- package/dist/worker/console/static-src/night/useNightWizard.js +171 -0
- package/dist/worker/console/static-src/night-prepare-result.js +118 -0
- package/dist/worker/console/static-src/operator-chat/activity-journey.js +125 -0
- package/dist/worker/console/static-src/operator-chat/activity-rail-presentation.js +73 -0
- package/dist/worker/console/static-src/operator-chat/activity-references.js +20 -0
- package/dist/worker/console/static-src/operator-chat/chat-sse-events.js +420 -0
- package/dist/worker/console/static-src/operator-chat/format.js +71 -0
- package/dist/worker/console/static-src/operator-chat/landing-density.js +23 -0
- package/dist/worker/console/static-src/operator-chat/mutation-gate.js +45 -0
- package/dist/worker/console/static-src/operator-chat/refs.js +86 -0
- package/dist/worker/console/static-src/operator-chat/resource-auto-invocation.js +91 -0
- package/dist/worker/console/static-src/operator-chat/resource-diagnostics.js +204 -0
- package/dist/worker/console/static-src/operator-chat/runtime-snapshot-store.js +257 -0
- package/dist/worker/console/static-src/operator-chat/session-title-watcher.js +128 -0
- package/dist/worker/console/static-src/operator-chat/sidebar-split.js +90 -0
- package/dist/worker/console/static-src/operator-chat/slash-palette-layout.js +24 -0
- package/dist/worker/console/static-src/operator-chat/slash-palette-nav.js +141 -0
- package/dist/worker/console/static-src/operator-chat/spatial-overlay.js +38 -0
- package/dist/worker/console/static-src/operator-chat/tools-catalog.js +77 -0
- package/dist/worker/console/static-src/operator-chat/turn-stream-controller.js +690 -0
- package/dist/worker/console/static-src/operator-chat/turn-submission.js +158 -0
- package/dist/worker/console/static-src/operator-chat/types.js +1 -0
- package/dist/worker/console/static-src/operator-chat/useActivityRailTransition.js +59 -0
- package/dist/worker/console/static-src/operator-chat/useChatSessions.js +495 -0
- package/dist/worker/console/static-src/operator-chat/useChatStream.js +780 -0
- package/dist/worker/console/static-src/operator-chat/useChatThread.js +280 -0
- package/dist/worker/console/static-src/operator-chat/useComposer.js +257 -0
- package/dist/worker/console/static-src/operator-chat/useInterview.js +108 -0
- package/dist/worker/console/static-src/operator-chat/useOverlayFocus.js +84 -0
- package/dist/worker/console/static-src/operator-chat/useRepoBrowser.js +148 -0
- package/dist/worker/console/static-src/operator-chat/useRuntimeControls.js +358 -0
- package/dist/worker/console/static-src/operator-chat/useRuntimeSnapshot.js +196 -0
- package/dist/worker/console/static-src/operator-chat/useWorkspaceLayout.js +58 -0
- package/dist/worker/console/static-src/operator-chat/workspace-layout-mode.js +35 -0
- package/dist/worker/console/static-src/prd-file-import.js +218 -0
- package/dist/worker/console/vite.config.js +27 -0
- package/dist/worker/console/workflow-kinds.js +46 -0
- package/dist/worker/delivery/final-verification.js +302 -0
- package/dist/worker/delivery/git-transaction.js +497 -0
- package/dist/worker/delivery/package.js +537 -0
- package/dist/worker/delivery/verification-bundle.js +544 -0
- package/dist/worker/feature/acceptance-policy.js +227 -0
- package/dist/worker/feature/advance.js +301 -0
- package/dist/worker/feature/decision-loader.js +99 -0
- package/dist/worker/feature/discover.js +14 -0
- package/dist/worker/feature/doctor.js +223 -0
- package/dist/worker/feature/fullstack-validate.js +337 -0
- package/dist/worker/feature/next-action.js +140 -0
- package/dist/worker/feature/profile-schema.js +47 -0
- package/dist/worker/feature/ready-plan-projection.js +82 -0
- package/dist/worker/feature/reducer.js +137 -0
- package/dist/worker/feature/review.js +678 -0
- package/dist/worker/feature/run.js +390 -0
- package/dist/worker/feature/scaffold.js +812 -0
- package/dist/worker/feature/types.js +1 -0
- package/dist/worker/follow-up/approve.js +273 -0
- package/dist/worker/follow-up/factory.js +234 -0
- package/dist/worker/follow-up/paths.js +25 -0
- package/dist/worker/follow-up/policy.js +26 -0
- package/dist/worker/follow-up/schema.js +93 -0
- package/dist/worker/follow-up/store.js +96 -0
- package/dist/worker/loop-agent/command-result.js +1 -0
- package/dist/worker/loop-agent/controller-protocol.js +143 -0
- package/dist/worker/loop-agent/loop-agent-client.js +489 -0
- package/dist/worker/loop-agent/parse-json.js +14 -0
- package/dist/worker/materialize/harness-task-lifecycle-probe.js +126 -0
- package/dist/worker/materialize/harness-task-lineage.js +220 -0
- package/dist/worker/materialize/harness-task-materializer.js +648 -0
- package/dist/worker/metrics/projector.js +139 -0
- package/dist/worker/observability/dag-execution-trajectory.js +591 -0
- package/dist/worker/observability/event-history.js +216 -0
- package/dist/worker/observability/event-store.js +83 -0
- package/dist/worker/observability/events.js +79 -0
- package/dist/worker/observability/interrupt-eligibility.js +264 -0
- package/dist/worker/observability/progress-composite.js +34 -0
- package/dist/worker/observability/read-model.js +2499 -0
- package/dist/worker/observability/snapshot-store.js +43 -0
- package/dist/worker/observability/types.js +1 -0
- package/dist/worker/observe/dag-node-execution-output.js +180 -0
- package/dist/worker/observe/dag-run-artifacts.js +90 -0
- package/dist/worker/observe/health.js +58 -0
- package/dist/worker/observe/night-jobs.js +104 -0
- package/dist/worker/observe/node-input.js +441 -0
- package/dist/worker/observe/paths.js +174 -0
- package/dist/worker/observe/routes.js +1077 -0
- package/dist/worker/observe/server.js +117 -0
- package/dist/worker/observe/spec-evidence.js +398 -0
- package/dist/worker/observe/static/api.js +117 -0
- package/dist/worker/observe/static/app.js +169 -0
- package/dist/worker/observe/static/constants.js +182 -0
- package/dist/worker/observe/static/copy.js +67 -0
- package/dist/worker/observe/static/custom-select.js +567 -0
- package/dist/worker/observe/static/dag-edge-routing.js +368 -0
- package/dist/worker/observe/static/dag-helpers.js +161 -0
- package/dist/worker/observe/static/dag-history-labels.js +95 -0
- package/dist/worker/observe/static/dag-layout.d.ts +36 -0
- package/dist/worker/observe/static/dag-layout.js +163 -0
- package/dist/worker/observe/static/dag-model.js +145 -0
- package/dist/worker/observe/static/dom.js +220 -0
- package/dist/worker/observe/static/favicon.svg +37 -0
- package/dist/worker/observe/static/format-pool.d.ts +71 -0
- package/dist/worker/observe/static/format-pool.js +153 -0
- package/dist/worker/observe/static/format.js +347 -0
- package/dist/worker/observe/static/index.html +409 -0
- package/dist/worker/observe/static/kpi.js +78 -0
- package/dist/worker/observe/static/markdown-render.js +124 -0
- package/dist/worker/observe/static/operator-chrome.css +517 -0
- package/dist/worker/observe/static/operator-chrome.d.ts +83 -0
- package/dist/worker/observe/static/operator-chrome.js +623 -0
- package/dist/worker/observe/static/relations.js +133 -0
- package/dist/worker/observe/static/router.js +156 -0
- package/dist/worker/observe/static/run-processing.js +148 -0
- package/dist/worker/observe/static/shell-chrome.js +65 -0
- package/dist/worker/observe/static/state.js +496 -0
- package/dist/worker/observe/static/styles.css +3567 -0
- package/dist/worker/observe/static/views/batch.js +227 -0
- package/dist/worker/observe/static/views/dag-graph.js +508 -0
- package/dist/worker/observe/static/views/dag-inspector.js +1722 -0
- package/dist/worker/observe/static/views/dag-trajectory.js +313 -0
- package/dist/worker/observe/static/views/dag.js +483 -0
- package/dist/worker/observe/static/views/dags.js +877 -0
- package/dist/worker/observe/static/views/dashboard.js +747 -0
- package/dist/worker/observe/static/views/failures.js +143 -0
- package/dist/worker/observe/static/views/feature.js +492 -0
- package/dist/worker/observe/static/views/night.js +201 -0
- package/dist/worker/observe/static/views/pool.js +708 -0
- package/dist/worker/observe/static/views/run.js +453 -0
- package/dist/worker/observe/static/views/session-timeline.js +771 -0
- package/dist/worker/observe/static/views/shell.js +7 -0
- package/dist/worker/observe/static/views/task.js +315 -0
- package/dist/worker/observe/static/views/timeline.js +163 -0
- package/dist/worker/outcomes/adapters.js +153 -0
- package/dist/worker/outcomes/declared-artifacts.js +103 -0
- package/dist/worker/outcomes/evidence-tokens.js +29 -0
- package/dist/worker/outcomes/gate.js +40 -0
- package/dist/worker/outcomes/projector.js +227 -0
- package/dist/worker/outcomes/registry.js +1 -0
- package/dist/worker/outcomes/store.js +131 -0
- package/dist/worker/outcomes/types.js +79 -0
- package/dist/worker/pool/attempt-identity.js +41 -0
- package/dist/worker/pool/attempt-lease.js +184 -0
- package/dist/worker/pool/attempt-transition.js +210 -0
- package/dist/worker/pool/begin-attempt-with-lease.js +26 -0
- package/dist/worker/pool/begin-attempt.js +35 -0
- package/dist/worker/pool/doctor.js +165 -0
- package/dist/worker/pool/failure-routing.js +182 -0
- package/dist/worker/pool/migrate-state.js +303 -0
- package/dist/worker/pool/reconcile.js +285 -0
- package/dist/worker/pool/recovery-decision.js +163 -0
- package/dist/worker/pool/run-owner-store.js +126 -0
- package/dist/worker/pool/run-store.js +360 -0
- package/dist/worker/pool/runtime-reconcile-inventory.js +127 -0
- package/dist/worker/pool/state-projection.js +57 -0
- package/dist/worker/pool/types.js +17 -0
- package/dist/worker/pool/validation.js +144 -0
- package/dist/worker/preflight.js +157 -0
- package/dist/worker/profile-mapping.js +76 -0
- package/dist/worker/progress-reporter.js +63 -0
- package/dist/worker/report/morning-report.js +155 -0
- package/dist/worker/repos/repo-resolver.js +23 -0
- package/dist/worker/run-task/execute-prepared-task.js +178 -0
- package/dist/worker/run-task/run-task.js +912 -0
- package/dist/worker/runner/run-ready.js +561 -0
- package/dist/worker/runner/single-task-attempt.js +176 -0
- package/dist/worker/scheduler/admission.js +547 -0
- package/dist/worker/scheduler/auto-followup.js +99 -0
- package/dist/worker/scheduler/cli.js +644 -0
- package/dist/worker/scheduler/clock-install/darwin-launchd.js +238 -0
- package/dist/worker/scheduler/clock-install/linux-systemd-user.js +224 -0
- package/dist/worker/scheduler/clock-install/types.js +1 -0
- package/dist/worker/scheduler/clock-install/win32-schtasks.js +227 -0
- package/dist/worker/scheduler/clock-install.js +284 -0
- package/dist/worker/scheduler/clock.js +420 -0
- package/dist/worker/scheduler/dispatcher.js +503 -0
- package/dist/worker/scheduler/doctor.js +431 -0
- package/dist/worker/scheduler/evidence.js +170 -0
- package/dist/worker/scheduler/git-base.js +90 -0
- package/dist/worker/scheduler/index.js +25 -0
- package/dist/worker/scheduler/lease.js +114 -0
- package/dist/worker/scheduler/lifecycle.js +348 -0
- package/dist/worker/scheduler/lock.js +80 -0
- package/dist/worker/scheduler/morning-window.js +191 -0
- package/dist/worker/scheduler/night-git-finalizer.js +114 -0
- package/dist/worker/scheduler/night-harvest.js +412 -0
- package/dist/worker/scheduler/paths.js +92 -0
- package/dist/worker/scheduler/prepared-attempt-recovery.js +471 -0
- package/dist/worker/scheduler/recovery.js +277 -0
- package/dist/worker/scheduler/reservation.js +146 -0
- package/dist/worker/scheduler/retry.js +199 -0
- package/dist/worker/scheduler/scheduler-loop.js +272 -0
- package/dist/worker/scheduler/store.js +275 -0
- package/dist/worker/scheduler/traceability.js +54 -0
- package/dist/worker/scheduler/trigger.js +258 -0
- package/dist/worker/scheduler/types.js +369 -0
- package/dist/worker/scheduler/workspace-adapter.js +128 -0
- package/dist/worker/task-graph/acceptance-schema.js +40 -0
- package/dist/worker/task-graph/ready-planner.js +267 -0
- package/dist/worker/task-graph/ready-queue.js +23 -0
- package/dist/worker/task-graph/task-graph-schema.js +59 -0
- package/dist/worker/task-graph/types.js +1 -0
- package/dist/worker/task-graph/validate.js +293 -0
- package/dist/worker/task-spec/complexity-mapping.js +8 -0
- package/dist/worker/task-spec/schema.js +125 -0
- package/dist/worker/task-spec/types.js +1 -0
- package/dist/worker/task-spec/validate.js +391 -0
- package/dist/worker/task-spec/workflow-routing.js +149 -0
- package/dist/workflows/dag/authoring.js +8 -0
- package/dist/workflows/dag/authority-surface.js +138 -0
- package/dist/workflows/dag/backend-test-analysis-contract.js +507 -0
- package/dist/workflows/dag/backend-test-case-coverage-analysis.js +1985 -0
- package/dist/workflows/dag/backend-test-case-manifest.js +638 -0
- package/dist/workflows/dag/backend-test-classification-contract.js +38 -0
- package/dist/workflows/dag/backend-test-contract-envelope.js +205 -0
- package/dist/workflows/dag/backend-test-coverage-contract.js +202 -0
- package/dist/workflows/dag/backend-test-execution-contract.js +715 -0
- package/dist/workflows/dag/backend-test-gap-fill.js +205 -0
- package/dist/workflows/dag/backend-test-intake-context.js +178 -0
- package/dist/workflows/dag/backend-test-layout.js +133 -0
- package/dist/workflows/dag/backend-test-markdown-workflow.js +1984 -0
- package/dist/workflows/dag/backend-test-module-stem.js +26 -0
- package/dist/workflows/dag/backend-test-pytest-collection.js +859 -0
- package/dist/workflows/dag/backend-test-result-contract.js +1030 -0
- package/dist/workflows/dag/backend-test-scenario-param.js +1670 -0
- package/dist/workflows/dag/backend-test-scenario-partitions.js +249 -0
- package/dist/workflows/dag/backend-test-semantic-review-contract.js +36 -0
- package/dist/workflows/dag/backend-test-stability-contract.js +57 -0
- package/dist/workflows/dag/backend-test-writer-completeness.js +1058 -0
- package/dist/workflows/dag/budget-enforcement.js +67 -0
- package/dist/workflows/dag/canvas-observer.js +474 -0
- package/dist/workflows/dag/context-policy.js +137 -0
- package/dist/workflows/dag/contract-output-registry.js +14 -0
- package/dist/workflows/dag/contract-validator-registrations.js +10 -0
- package/dist/workflows/dag/controller-identity.js +104 -0
- package/dist/workflows/dag/convergence/controller.js +596 -0
- package/dist/workflows/dag/decision-envelope.js +557 -0
- package/dist/workflows/dag/decision-evidence.js +153 -0
- package/dist/workflows/dag/decision-gates.js +1 -0
- package/dist/workflows/dag/dynamic-runtime/condition.js +48 -0
- package/dist/workflows/dag/dynamic-runtime/loop-until.js +161 -0
- package/dist/workflows/dag/dynamic-runtime/map.js +435 -0
- package/dist/workflows/dag/dynamic-runtime/reduction.js +72 -0
- package/dist/workflows/dag/dynamic-runtime/shared.js +203 -0
- package/dist/workflows/dag/event-observer.js +132 -0
- package/dist/workflows/dag/executor-registry.js +23 -0
- package/dist/workflows/dag/facts.js +4 -0
- package/dist/workflows/dag/failure-category.js +118 -0
- package/dist/workflows/dag/failure-routing.js +105 -0
- package/dist/workflows/dag/final-verification.js +180 -0
- package/dist/workflows/dag/frontend-implementation-contract.js +1911 -0
- package/dist/workflows/dag/frontend-lint-baseline.js +474 -0
- package/dist/workflows/dag/frontend-plan-render.js +90 -0
- package/dist/workflows/dag/frontend-prewrite-gate.js +1011 -0
- package/dist/workflows/dag/frontend-project-capability.js +1 -0
- package/dist/workflows/dag/frontend-recovery-plan.js +73 -0
- package/dist/workflows/dag/frontend-recovery-root-manifest.js +123 -0
- package/dist/workflows/dag/frontend-recovery-run.js +539 -0
- package/dist/workflows/dag/frontend-repair.js +541 -0
- package/dist/workflows/dag/frontend-review-context.js +116 -0
- package/dist/workflows/dag/frontend-risk.js +161 -0
- package/dist/workflows/dag/frontend-test-case-checklist.js +343 -0
- package/dist/workflows/dag/frontend-test-case-manifest.js +104 -0
- package/dist/workflows/dag/frontend-test-case-quality.js +105 -0
- package/dist/workflows/dag/frontend-test-html-report.js +174 -0
- package/dist/workflows/dag/frontend-test-l5-report.js +177 -0
- package/dist/workflows/dag/frontend-test-result-contract.js +487 -0
- package/dist/workflows/dag/frontend-verification-trace.js +275 -0
- package/dist/workflows/dag/frontend-worktree-diff.js +201 -0
- package/dist/workflows/dag/frontend-writer-recovery.js +106 -0
- package/dist/workflows/dag/frontend-writer-rollback.js +821 -0
- package/dist/workflows/dag/governance-constants.js +5 -0
- package/dist/workflows/dag/governance-profile.js +413 -0
- package/dist/workflows/dag/index.js +6 -0
- package/dist/workflows/dag/init-hybrid.js +7345 -0
- package/dist/workflows/dag/interrupt-request.js +559 -0
- package/dist/workflows/dag/knowledge-curator.js +165 -0
- package/dist/workflows/dag/l5-report-metrics.js +33 -0
- package/dist/workflows/dag/lifecycle.js +855 -0
- package/dist/workflows/dag/liveness-policy.js +251 -0
- package/dist/workflows/dag/node-execution.js +1081 -0
- package/dist/workflows/dag/observer-compose.js +52 -0
- package/dist/workflows/dag/output-protocol.js +356 -0
- package/dist/workflows/dag/project-governance-context.js +514 -0
- package/dist/workflows/dag/prompt-source.js +88 -0
- package/dist/workflows/dag/prompt.js +348 -0
- package/dist/workflows/dag/reconcile-run.js +145 -0
- package/dist/workflows/dag/reconcile-tasks.js +404 -0
- package/dist/workflows/dag/recovery-recommendation.js +329 -0
- package/dist/workflows/dag/repair-artifact.js +363 -0
- package/dist/workflows/dag/report.js +1229 -0
- package/dist/workflows/dag/rerun-plan.js +614 -0
- package/dist/workflows/dag/rerun-run.js +556 -0
- package/dist/workflows/dag/rerun-task.js +370 -0
- package/dist/workflows/dag/retry-policy.js +263 -0
- package/dist/workflows/dag/run-store.js +41 -0
- package/dist/workflows/dag/runner.js +1069 -0
- package/dist/workflows/dag/runtime-contract.js +87 -0
- package/dist/workflows/dag/runtime.js +5 -0
- package/dist/workflows/dag/scheduler.js +497 -0
- package/dist/workflows/dag/sdd-embedded.js +128 -0
- package/dist/workflows/dag/skill-instructions.js +478 -0
- package/dist/workflows/dag/skill-snapshot.js +553 -0
- package/dist/workflows/dag/skills.js +41 -0
- package/dist/workflows/dag/spec.js +3 -0
- package/dist/workflows/dag/task-contract-binding.js +138 -0
- package/dist/workflows/dag/task-demand-routing.js +1 -0
- package/dist/workflows/dag/topo.js +30 -0
- package/dist/workflows/dag/types.js +1145 -0
- package/dist/workflows/dag/upstream-artifacts.js +98 -0
- package/dist/workflows/dag/validate.js +998 -0
- package/dist/workflows/dag/workspace-checkpoint.js +186 -0
- package/dist/workflows/dynamic/artifacts.js +65 -0
- package/dist/workflows/dynamic/compile.js +371 -0
- package/dist/workflows/dynamic/compileTypes.js +1 -0
- package/dist/workflows/dynamic/errors.js +5 -0
- package/dist/workflows/dynamic/index.js +7 -0
- package/dist/workflows/dynamic/profiles.js +156 -0
- package/dist/workflows/dynamic/spec.js +115 -0
- package/dist/workflows/dynamic/validate.js +275 -0
- package/dist/workflows/loop/actions/dag-action.js +129 -0
- package/dist/workflows/loop/actions/pi-review.js +267 -0
- package/dist/workflows/loop/actions/shared.js +157 -0
- package/dist/workflows/loop/actions/shell-verify.js +82 -0
- package/dist/workflows/loop/actions/types.js +1 -0
- package/dist/workflows/loop/actions/workflow-action.js +255 -0
- package/dist/workflows/loop/actions.js +160 -0
- package/dist/workflows/loop/benchmark.js +510 -0
- package/dist/workflows/loop/closeout.js +135 -0
- package/dist/workflows/loop/context.js +47 -0
- package/dist/workflows/loop/events.js +26 -0
- package/dist/workflows/loop/hash.js +32 -0
- package/dist/workflows/loop/index.js +8 -0
- package/dist/workflows/loop/paths.js +17 -0
- package/dist/workflows/loop/policy/auto-policy.js +112 -0
- package/dist/workflows/loop/policy/path-patterns.js +13 -0
- package/dist/workflows/loop/rounds.js +81 -0
- package/dist/workflows/loop/signals.js +52 -0
- package/dist/workflows/loop/state.js +116 -0
- package/dist/workflows/loop/templates.js +54 -0
- package/dist/workflows/loop/types.js +28 -0
- package/docs/README.md +82 -0
- package/docs/architecture/README.md +35 -0
- package/docs/architecture/dag-execution.md +165 -0
- package/docs/architecture/evolution.md +108 -0
- package/docs/architecture/facts-and-state.md +74 -0
- package/docs/architecture/runtime-boundaries.md +226 -0
- package/docs/architecture/system-overview.md +100 -0
- package/docs/architecture/worker-and-feature.md +122 -0
- package/docs/governance/README.md +18 -0
- package/docs/governance/harness-methodology-debugging.md +177 -0
- package/docs/governance/harness-methodology-tdd.md +130 -0
- package/docs/governance/harness-methodology-verification.md +27 -0
- package/docs/init-surface.manifest.json +358 -0
- package/docs/operations/README.md +15 -0
- package/docs/operations/local-development-environment.md +77 -0
- package/docs/skills/README.md +7 -0
- package/docs/skills/vetted-skill-registry.md +49 -0
- package/docs/templates/README.md +67 -0
- package/docs/templates/adr.md +60 -0
- package/docs/templates/agent-dag-authority-surface-audit.prompt.md +94 -0
- package/docs/templates/agent-dag-decision-envelope.schema.json +213 -0
- package/docs/templates/agent-dag-decision-gate-dogfood-report.md +117 -0
- package/docs/templates/agent-dag-decision-gate.prompt.md +246 -0
- package/docs/templates/agent-dag-process-supervisor.prompt.md +98 -0
- package/docs/templates/agent-dag-report.schema.json +473 -0
- package/docs/templates/agent-dag-review-verdict.prompt.md +68 -0
- package/docs/templates/agent-dag.base.json +190 -0
- package/docs/templates/agent-dag.final-verification.json +185 -0
- package/docs/templates/agent-dag.schema.json +590 -0
- package/docs/templates/agent-dag.supervised-implementation.json +640 -0
- package/docs/templates/agent-worker-production-readiness-checklist.md +47 -0
- package/docs/templates/backend-test-analysis.schema.json +37 -0
- package/docs/templates/backend-test-case-manifest.schema.json +223 -0
- package/docs/templates/backend-test-dag.classify.prompt.md +75 -0
- package/docs/templates/backend-test-dag.generate-pytest.prompt.md +41 -0
- package/docs/templates/backend-test-dag.json +671 -0
- package/docs/templates/backend-test-dag.retrospect.prompt.md +165 -0
- package/docs/templates/backend-test-dag.review-cases.prompt.md +36 -0
- package/docs/templates/backend-test-execution.schema.json +138 -0
- package/docs/templates/backend-test-result.schema.json +99 -0
- package/docs/templates/branch-merge-report.md +115 -0
- package/docs/templates/evaluation/agents-map-slim-v1.candidate.json +9 -0
- package/docs/templates/evaluation/agents-map-slim-v1.md +87 -0
- package/docs/templates/evaluation/agents-map-verbose-v0.candidate.json +9 -0
- package/docs/templates/evaluation/agents-map-verbose-v0.md +153 -0
- package/docs/templates/evaluation/campaign-budget-v1.json +12 -0
- package/docs/templates/evaluation/campaign-dogfood-v0.json +24 -0
- package/docs/templates/evaluation/campaign-evidence-v1.json +44 -0
- package/docs/templates/evaluation/context-policy-baseline-v1.json +17 -0
- package/docs/templates/evaluation/context-policy-role-specialized-v1.json +28 -0
- package/docs/templates/evaluation/corpus-dogfood-v0.manifest.json +118 -0
- package/docs/templates/evaluation/matrix-dag-dry-run-v1.json +21 -0
- package/docs/templates/evaluation/matrix-fixture-v1.json +10 -0
- package/docs/templates/evaluation/private-verifier-dogfood-v0.json +16 -0
- package/docs/templates/exec-plan.md +66 -0
- package/docs/templates/feature-spec.md +53 -0
- package/docs/templates/frontend-design-contract.md +68 -0
- package/docs/templates/frontend-eval/fixtures/failures/01-type-build-error.md +17 -0
- package/docs/templates/frontend-eval/fixtures/failures/02-unit-component-test-fail.md +16 -0
- package/docs/templates/frontend-eval/fixtures/failures/03-fixture-schema-drift.md +16 -0
- package/docs/templates/frontend-eval/fixtures/failures/04-missing-loading-empty-error-state.md +16 -0
- package/docs/templates/frontend-eval/fixtures/failures/05-forbidden-write-writeset-expansion.md +16 -0
- package/docs/templates/frontend-eval/fixtures/failures/06-unapproved-dependency-add.md +16 -0
- package/docs/templates/frontend-eval/fixtures/failures/07-mock-production-on.md +21 -0
- package/docs/templates/frontend-eval/fixtures/functional/01-simple-component-style.md +29 -0
- package/docs/templates/frontend-eval/fixtures/functional/02-form-validation.md +28 -0
- package/docs/templates/frontend-eval/fixtures/functional/03-list-detail-page.md +28 -0
- package/docs/templates/frontend-eval/fixtures/functional/04-api-mock.md +29 -0
- package/docs/templates/frontend-eval/fixtures/functional/05-permission-auth-gated-ui.md +27 -0
- package/docs/templates/frontend-eval/fixtures/functional/06-ssr-server-client-boundary.md +28 -0
- package/docs/templates/frontend-eval/fixtures/functional/07-shared-public-component-api.md +28 -0
- package/docs/templates/frontend-eval/fixtures/functional/08-pure-local-no-remote.md +27 -0
- package/docs/templates/frontend-eval/metrics.md +138 -0
- package/docs/templates/frontend-eval/smoke-targets.md +53 -0
- package/docs/templates/frontend-implementation-contract.schema.json +35 -0
- package/docs/templates/frontend-task-constraints.md +62 -0
- package/docs/templates/frontend-task-requirement.md +104 -0
- package/docs/templates/frontend-test-case-checklist.md +44 -0
- package/docs/templates/frontend-test-case.example.md +143 -0
- package/docs/templates/frontend-test-dag.generate-cases.prompt.md +63 -0
- package/docs/templates/frontend-test-dag.json +409 -0
- package/docs/templates/frontend-test-dag.retrieve-context.prompt.md +21 -0
- package/docs/templates/frontend-test-dag.retrospect.prompt.md +5 -0
- package/docs/templates/frontend-test-dag.review-cases.prompt.md +5 -0
- package/docs/templates/frontend-test-dag.review-execution.prompt.md +3 -0
- package/docs/templates/frontend-test-standard-scenarios.v1.json +159 -0
- package/docs/templates/harness.schema.json +351 -0
- package/docs/templates/hybrid-dag.json +188 -0
- package/docs/templates/init-evolution-review.md +35 -0
- package/docs/templates/init-managed-agents.md +157 -0
- package/docs/templates/interactive-ui-round2-experiment.md +66 -0
- package/docs/templates/knowledge-graph-bootstrap-dag.json +118 -0
- package/docs/templates/knowledge-sync-dag.json +178 -0
- package/docs/templates/knowledge-sync-draft.schema.json +71 -0
- package/docs/templates/product-line/AGENTS.md +9 -0
- package/docs/templates/product-line/README.md +42 -0
- package/docs/templates/product-line/acceptance.yaml +23 -0
- package/docs/templates/product-line/closeout.yaml +9 -0
- package/docs/templates/product-line/design.md +13 -0
- package/docs/templates/product-line/feature-scaffold-batch.example.yaml +31 -0
- package/docs/templates/product-line/feature.yaml +11 -0
- package/docs/templates/product-line/links.md +10 -0
- package/docs/templates/product-line/requirement.md +17 -0
- package/docs/templates/product-line/scaffold-samples/README.md +36 -0
- package/docs/templates/product-line/scaffold-samples/backend-only/acceptance.yaml +16 -0
- package/docs/templates/product-line/scaffold-samples/backend-only/design.md +14 -0
- package/docs/templates/product-line/scaffold-samples/backend-only/feature.yaml +14 -0
- package/docs/templates/product-line/scaffold-samples/backend-only/requirement.md +6 -0
- package/docs/templates/product-line/scaffold-samples/backend-only/tasks/BE-IMPL-001.yaml +83 -0
- package/docs/templates/product-line/scaffold-samples/backend-only/tasks/task-graph.yaml +14 -0
- package/docs/templates/product-line/scaffold-samples/fe-with-api/acceptance.yaml +18 -0
- package/docs/templates/product-line/scaffold-samples/fe-with-api/design.md +18 -0
- package/docs/templates/product-line/scaffold-samples/fe-with-api/feature.yaml +14 -0
- package/docs/templates/product-line/scaffold-samples/fe-with-api/requirement.md +6 -0
- package/docs/templates/product-line/scaffold-samples/fe-with-api/tasks/BE-IMPL-001.yaml +84 -0
- package/docs/templates/product-line/scaffold-samples/fe-with-api/tasks/CONTRACT-001.yaml +84 -0
- package/docs/templates/product-line/scaffold-samples/fe-with-api/tasks/FE-IMPL-001.yaml +86 -0
- package/docs/templates/product-line/scaffold-samples/fe-with-api/tasks/task-graph.yaml +40 -0
- package/docs/templates/product-line/scaffold-samples/frontend-only/acceptance.yaml +16 -0
- package/docs/templates/product-line/scaffold-samples/frontend-only/design.md +14 -0
- package/docs/templates/product-line/scaffold-samples/frontend-only/feature.yaml +14 -0
- package/docs/templates/product-line/scaffold-samples/frontend-only/requirement.md +6 -0
- package/docs/templates/product-line/scaffold-samples/frontend-only/tasks/FE-IMPL-001.yaml +85 -0
- package/docs/templates/product-line/scaffold-samples/frontend-only/tasks/task-graph.yaml +14 -0
- package/docs/templates/product-line/task-graph.yaml +23 -0
- package/docs/templates/product-line/task.yaml +68 -0
- package/docs/templates/product-line/test-plan.md +7 -0
- package/docs/templates/production-readiness-checklist.md +57 -0
- package/docs/templates/progress-log.md +27 -0
- package/docs/templates/project-start-checklist.md +9 -0
- package/docs/templates/qa-report.md +48 -0
- package/docs/templates/sprint-contract.md +29 -0
- package/docs/templates/worker-dogfood-evidence.md +80 -0
- package/docs/templates/worker-dogfood-setup.md +68 -0
- package/examples/decision-gate-agent-dag.json +177 -0
- package/examples/example-dag.json +46 -0
- package/examples/hybrid-loop-agent-dag.json +189 -0
- package/examples/l5-report-coms-process-definition.html +322 -0
- package/examples/l5-report-demo.html +79 -0
- package/harness.json +90 -0
- package/package.json +98 -0
- package/scripts/kb-bootstrap-init-skeleton.sh +241 -0
- package/scripts/kb-graph-incremental-prepare.mjs +386 -0
- package/scripts/kb-graph-materialize.mjs +105 -0
- package/scripts/kb-graph-promote.mjs +164 -0
- package/scripts/kb-query.mjs +554 -0
- package/skills/agent-worker/SKILL.md +48 -0
- package/skills/agent-worker/references/agent-worker-operator.md +159 -0
- package/skills/ai-engineering-context/SKILL.md +48 -0
- package/skills/analyze-product-dependencies/SKILL.md +108 -0
- package/skills/analyze-product-dependencies/references/api-documentation-schema.md +35 -0
- package/skills/analyze-product-dependencies/references/dependency-analysis-schema.md +38 -0
- package/skills/analyze-product-dependencies/references/example.md +76 -0
- package/skills/analyze-product-dependencies/references/forward-test-cases.md +110 -0
- package/skills/analyze-product-dependencies/references/input-contract.md +34 -0
- package/skills/analyze-product-dependencies/references/kb-integration.md +64 -0
- package/skills/analyze-product-dependencies/references/scouting-rules.md +76 -0
- package/skills/analyze-product-dependencies/scripts/test-validators.mjs +460 -0
- package/skills/analyze-product-dependencies/scripts/validate-api-documentation.mjs +194 -0
- package/skills/analyze-product-dependencies/scripts/validate-dependency-analysis.mjs +200 -0
- package/skills/analyze-product-dependencies/scripts/validate-product-requirement-input.mjs +90 -0
- package/skills/analyze-product-dependencies/scripts/validation-helpers.mjs +138 -0
- package/skills/analyze-product-requirements/SKILL.md +145 -0
- package/skills/analyze-product-requirements/references/acceptance-criteria.md +87 -0
- package/skills/analyze-product-requirements/references/clarification-and-knowledge.md +70 -0
- package/skills/analyze-product-requirements/references/example.md +104 -0
- package/skills/analyze-product-requirements/references/forward-test-cases.md +144 -0
- package/skills/analyze-product-requirements/references/kb-integration.md +56 -0
- package/skills/analyze-product-requirements/references/product-analysis-schema.md +41 -0
- package/skills/analyze-product-requirements/references/product-requirement-schema.md +42 -0
- package/skills/analyze-product-requirements/references/requirement-clarification-schema.md +66 -0
- package/skills/analyze-product-requirements/scripts/compute-source-identity.mjs +35 -0
- package/skills/analyze-product-requirements/scripts/test-validators.mjs +501 -0
- package/skills/analyze-product-requirements/scripts/validate-product-analysis.mjs +100 -0
- package/skills/analyze-product-requirements/scripts/validate-product-requirement.mjs +109 -0
- package/skills/analyze-product-requirements/scripts/validate-requirement-clarification.mjs +109 -0
- package/skills/analyze-product-requirements/scripts/validation-helpers.mjs +175 -0
- package/skills/browser-tools/SKILL.md +196 -0
- package/skills/browser-tools/browser-content.js +103 -0
- package/skills/browser-tools/browser-cookies.js +35 -0
- package/skills/browser-tools/browser-eval.js +53 -0
- package/skills/browser-tools/browser-hn-scraper.js +108 -0
- package/skills/browser-tools/browser-nav.js +44 -0
- package/skills/browser-tools/browser-pick.js +162 -0
- package/skills/browser-tools/browser-screenshot.js +34 -0
- package/skills/browser-tools/browser-start.js +86 -0
- package/skills/browser-tools/package-lock.json +2556 -0
- package/skills/browser-tools/package.json +19 -0
- package/skills/code-review-core/SKILL.md +20 -0
- package/skills/codebase-scout/SKILL.md +19 -0
- package/skills/frontend-bounded-implement/SKILL.md +53 -0
- package/skills/frontend-design-review/SKILL.md +79 -0
- package/skills/frontend-design-review/references/review-checklist.md +43 -0
- package/skills/frontend-implementation/SKILL.md +52 -0
- package/skills/frontend-implementation/references/code-standards.md +33 -0
- package/skills/frontend-implementation/references/design-spec.md +56 -0
- package/skills/frontend-implementation/references/node-contracts.md +31 -0
- package/skills/frontend-review/SKILL.md +55 -0
- package/skills/frontend-review/references/review-findings.md +50 -0
- package/skills/frontend-verification/SKILL.md +61 -0
- package/skills/frontend-verification/references/verification-checklist.md +48 -0
- package/skills/grill-me/SKILL.md +10 -0
- package/skills/grill-with-docs/SKILL.md +80 -0
- package/skills/grill-with-docs/adr-format.md +58 -0
- package/skills/grill-with-docs/context-format.md +52 -0
- package/skills/init-capability-evolution/SKILL.md +70 -0
- package/skills/local-jacoco-coverage/SKILL.md +281 -0
- package/skills/local-jacoco-coverage/references/requirement-to-source-mapping.md +85 -0
- package/skills/local-jacoco-coverage/references/runtime-alignment.md +106 -0
- package/skills/local-jacoco-coverage/scripts/run-coverage-analysis.sh +148 -0
- package/skills/local-jacoco-coverage/scripts/start-jacoco-agent.sh +110 -0
- package/skills/loop-agent/SKILL.md +68 -0
- package/skills/loop-agent/references/README.md +67 -0
- package/skills/loop-agent/references/command-reference.md +645 -0
- package/skills/loop-agent/references/docs-converge.md +126 -0
- package/skills/loop-agent/references/harness-policy.md +289 -0
- package/skills/loop-agent/references/hybrid-dag.md +245 -0
- package/skills/loop-agent/references/learned/README.md +21 -0
- package/skills/loop-agent/references/long-running-loop.md +57 -0
- package/skills/loop-agent/references/model-routing.md +45 -0
- package/skills/loop-agent/references/multi-worktree.md +54 -0
- package/skills/loop-agent/references/one-shot-runs.md +84 -0
- package/skills/loop-agent/references/orchestrator-and-interventions.md +175 -0
- package/skills/loop-agent/references/pi-prompt.md +23 -0
- package/skills/loop-agent/references/pi-subagent-assisted-mode.md +84 -0
- package/skills/loop-agent/references/post-implementation-and-patterns.md +54 -0
- package/skills/loop-agent/references/source-and-plan-practice.md +169 -0
- package/skills/loop-agent/references/task-workflow.md +104 -0
- package/skills/loop-agent/references/verification-and-failure-handling.md +148 -0
- package/skills/playwright-cli/SKILL.md +93 -0
- package/skills/playwright-cli/references/element-attributes.md +23 -0
- package/skills/playwright-cli/references/playwright-tests.md +39 -0
- package/skills/playwright-cli/references/request-mocking.md +87 -0
- package/skills/playwright-cli/references/running-code.md +241 -0
- package/skills/playwright-cli/references/session-management.md +225 -0
- package/skills/playwright-cli/references/storage-state.md +275 -0
- package/skills/playwright-cli/references/test-generation.md +433 -0
- package/skills/playwright-cli/references/tracing.md +5 -0
- package/skills/playwright-cli/references/video-recording.md +5 -0
- package/skills/playwright-cli-case-generator/SKILL.md +108 -0
- package/skills/requesting-code-review/SKILL.md +101 -0
- package/skills/requesting-code-review/code-reviewer.md +168 -0
- package/skills/systematic-debugging/CREATION-LOG.md +119 -0
- package/skills/systematic-debugging/SKILL.md +312 -0
- package/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
- package/skills/systematic-debugging/condition-based-waiting.md +115 -0
- package/skills/systematic-debugging/defense-in-depth.md +122 -0
- package/skills/systematic-debugging/find-polluter.sh +63 -0
- package/skills/systematic-debugging/root-cause-tracing.md +169 -0
- package/skills/systematic-debugging/test-academic.md +14 -0
- package/skills/systematic-debugging/test-pressure-1.md +58 -0
- package/skills/systematic-debugging/test-pressure-2.md +68 -0
- package/skills/systematic-debugging/test-pressure-3.md +69 -0
- package/skills/test-driven-development/SKILL.md +27 -0
- package/skills/using-git-worktrees/SKILL.md +215 -0
- package/skills/verification-before-completion/SKILL.md +154 -0
- package/skills/webapp-testing/SKILL.md +19 -0
|
@@ -0,0 +1,1030 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { writeDagRunJsonArtifact } from "../../infrastructure/harness/artifact-store.js";
|
|
6
|
+
export const BACKEND_TEST_RESULT_SCHEMA_ID = "backend-test-result-v1";
|
|
7
|
+
const SECRET_KEY = /(?:password|passwd|secret|token|api[_-]?key|private[_-]?key|credential|authorization)/i;
|
|
8
|
+
const SECRET_VALUE = /(?:-----BEGIN [A-Z ]*PRIVATE KEY-----|\b(?:sk|ghp|github_pat|xox[baprs]|AKIA)[-_A-Za-z0-9]{12,}\b)/;
|
|
9
|
+
export const BACKEND_TEST_CLASSIFICATION_CATEGORIES = [
|
|
10
|
+
"ProductBug",
|
|
11
|
+
"TestBug",
|
|
12
|
+
"EnvFailure",
|
|
13
|
+
"ContractMismatch",
|
|
14
|
+
"FlakyTest",
|
|
15
|
+
"Unknown",
|
|
16
|
+
];
|
|
17
|
+
export const backendTestExecutionStatusSchema = z.enum([
|
|
18
|
+
"completed",
|
|
19
|
+
"collection-error",
|
|
20
|
+
"setup-error",
|
|
21
|
+
"teardown-error",
|
|
22
|
+
"command-error",
|
|
23
|
+
"report-error",
|
|
24
|
+
]);
|
|
25
|
+
export const backendTestCollectionStatusSchema = z.enum([
|
|
26
|
+
"ok",
|
|
27
|
+
"error",
|
|
28
|
+
"unknown",
|
|
29
|
+
"skipped",
|
|
30
|
+
]);
|
|
31
|
+
/**
|
|
32
|
+
* Task Pool consumable outcome tokens (frozen for M2; no auto follow-up).
|
|
33
|
+
* - passed: all executed tests green
|
|
34
|
+
* - completed-with-failures: process completed with assertion/test failures
|
|
35
|
+
* - collection-error: import/collection failures
|
|
36
|
+
* - command-error: runner/command could not complete normally
|
|
37
|
+
* - report-error: junit missing/corrupt after execution attempt
|
|
38
|
+
*/
|
|
39
|
+
export const backendTestOutcomeSchema = z.enum([
|
|
40
|
+
"passed",
|
|
41
|
+
"completed-with-failures",
|
|
42
|
+
"collection-error",
|
|
43
|
+
"setup-error",
|
|
44
|
+
"teardown-error",
|
|
45
|
+
"command-error",
|
|
46
|
+
"report-error",
|
|
47
|
+
]);
|
|
48
|
+
const junitRelativePathSchema = z
|
|
49
|
+
.string()
|
|
50
|
+
.min(1)
|
|
51
|
+
.refine((value) => !path.posix.isAbsolute(value) &&
|
|
52
|
+
!value.includes("\\") &&
|
|
53
|
+
value
|
|
54
|
+
.split("/")
|
|
55
|
+
.every((segment) => segment.length > 0 && segment !== "." && segment !== ".."), { message: "junit.relativePath must be a safe run-relative POSIX path" });
|
|
56
|
+
const failureSummarySchema = z
|
|
57
|
+
.object({
|
|
58
|
+
classname: z.string().min(1),
|
|
59
|
+
name: z.string().min(1),
|
|
60
|
+
message: z.string().min(1),
|
|
61
|
+
kind: z.enum(["failure", "error"]).default("failure"),
|
|
62
|
+
nodeId: z.string().min(1).optional(),
|
|
63
|
+
caseId: z.string().min(1).optional(),
|
|
64
|
+
tpId: z.string().min(1).optional(),
|
|
65
|
+
phase: z.enum(["collection", "setup", "call", "teardown", "unknown"]).optional(),
|
|
66
|
+
})
|
|
67
|
+
.strict();
|
|
68
|
+
export const backendTestResultContractSchema = z
|
|
69
|
+
.object({
|
|
70
|
+
schemaVersion: z.literal(1),
|
|
71
|
+
/** Process-level status of the pytest invocation. Task Pool: use with outcome. */
|
|
72
|
+
executionStatus: backendTestExecutionStatusSchema,
|
|
73
|
+
pytestExitCode: z.number().int().min(0).max(255),
|
|
74
|
+
collectionStatus: backendTestCollectionStatusSchema,
|
|
75
|
+
/** Total tests counted from JUnit (or 0 when report unavailable). */
|
|
76
|
+
tests: z.number().int().min(0),
|
|
77
|
+
passed: z.number().int().min(0),
|
|
78
|
+
failed: z.number().int().min(0),
|
|
79
|
+
error: z.number().int().min(0),
|
|
80
|
+
skipped: z.number().int().min(0),
|
|
81
|
+
collectedItemCount: z.number().int().min(0),
|
|
82
|
+
setupStartedCount: z.number().int().min(0),
|
|
83
|
+
businessTestBodyExecutedCount: z.number().int().min(0),
|
|
84
|
+
setupErrorCount: z.number().int().min(0),
|
|
85
|
+
testFailureCount: z.number().int().min(0),
|
|
86
|
+
teardownErrorCount: z.number().int().min(0),
|
|
87
|
+
durationMs: z.number().nonnegative().optional(),
|
|
88
|
+
junit: z
|
|
89
|
+
.object({
|
|
90
|
+
relativePath: junitRelativePathSchema,
|
|
91
|
+
sha256: z
|
|
92
|
+
.string()
|
|
93
|
+
.regex(/^[a-f0-9]{64}$/, "junit.sha256 must be lowercase hex sha256"),
|
|
94
|
+
})
|
|
95
|
+
.strict(),
|
|
96
|
+
/** Non-secret command summary only (no tokens/passwords). */
|
|
97
|
+
commandSummary: z.string().min(1),
|
|
98
|
+
/** Truncated failure/error summaries for Task Pool triage. */
|
|
99
|
+
failures: z.array(failureSummarySchema),
|
|
100
|
+
/**
|
|
101
|
+
* Authoritative shell-facing outcome for backend-test-outcome-gate-shell.
|
|
102
|
+
* Do not override from retrospective Markdown.
|
|
103
|
+
*/
|
|
104
|
+
outcome: backendTestOutcomeSchema,
|
|
105
|
+
})
|
|
106
|
+
.strict()
|
|
107
|
+
.superRefine((value, ctx) => {
|
|
108
|
+
if (value.tests !==
|
|
109
|
+
value.passed + value.failed + value.error + value.skipped) {
|
|
110
|
+
ctx.addIssue({
|
|
111
|
+
code: z.ZodIssueCode.custom,
|
|
112
|
+
message: "tests must equal passed+failed+error+skipped",
|
|
113
|
+
path: ["tests"],
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
if (SECRET_KEY.test(value.commandSummary) ||
|
|
117
|
+
SECRET_VALUE.test(value.commandSummary)) {
|
|
118
|
+
ctx.addIssue({
|
|
119
|
+
code: z.ZodIssueCode.custom,
|
|
120
|
+
message: "commandSummary must not contain secret-like content",
|
|
121
|
+
path: ["commandSummary"],
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
for (const [index, failure] of value.failures.entries()) {
|
|
125
|
+
if (SECRET_VALUE.test(failure.message)) {
|
|
126
|
+
ctx.addIssue({
|
|
127
|
+
code: z.ZodIssueCode.custom,
|
|
128
|
+
message: "failure message must not contain secret-like content",
|
|
129
|
+
path: ["failures", index, "message"],
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
const MAX_FAILURE_MESSAGE = 500;
|
|
135
|
+
const MAX_FAILURES = 50;
|
|
136
|
+
function decodeXmlEntities(value) {
|
|
137
|
+
return value
|
|
138
|
+
.replace(/</g, "<")
|
|
139
|
+
.replace(/>/g, ">")
|
|
140
|
+
.replace(/"/g, '"')
|
|
141
|
+
.replace(/'/g, "'")
|
|
142
|
+
.replace(/&/g, "&");
|
|
143
|
+
}
|
|
144
|
+
const XML_ATTR_PATTERNS = {
|
|
145
|
+
tests: /\btests\s*=\s*"([^"]*)"/i,
|
|
146
|
+
failures: /\bfailures\s*=\s*"([^"]*)"/i,
|
|
147
|
+
errors: /\berrors\s*=\s*"([^"]*)"/i,
|
|
148
|
+
skipped: /\bskipped\s*=\s*"([^"]*)"/i,
|
|
149
|
+
time: /\btime\s*=\s*"([^"]*)"/i,
|
|
150
|
+
classname: /\bclassname\s*=\s*"([^"]*)"/i,
|
|
151
|
+
name: /\bname\s*=\s*"([^"]*)"/i,
|
|
152
|
+
message: /\bmessage\s*=\s*"([^"]*)"/i,
|
|
153
|
+
};
|
|
154
|
+
function attr(tag, name) {
|
|
155
|
+
const pattern = XML_ATTR_PATTERNS[name];
|
|
156
|
+
if (!pattern)
|
|
157
|
+
return undefined;
|
|
158
|
+
const match = tag.match(pattern);
|
|
159
|
+
return match ? decodeXmlEntities(match[1] ?? "") : undefined;
|
|
160
|
+
}
|
|
161
|
+
function truncate(value, max = MAX_FAILURE_MESSAGE) {
|
|
162
|
+
const normalized = value.replace(/\s+/g, " ").trim();
|
|
163
|
+
if (normalized.length <= max)
|
|
164
|
+
return normalized;
|
|
165
|
+
return `${normalized.slice(0, max - 1)}…`;
|
|
166
|
+
}
|
|
167
|
+
function assertNoSecrets(label, value) {
|
|
168
|
+
if (SECRET_KEY.test(value) || SECRET_VALUE.test(value)) {
|
|
169
|
+
throw new Error(`secret-like content rejected in ${label}`);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Minimal JUnit XML parser (no new npm deps). Fail-closed on non-JUnit markup.
|
|
174
|
+
*/
|
|
175
|
+
export function parseJunitXml(xml) {
|
|
176
|
+
const trimmed = xml.trim();
|
|
177
|
+
if (!trimmed) {
|
|
178
|
+
throw new Error("invalid junit xml: empty");
|
|
179
|
+
}
|
|
180
|
+
if (!/<testsuites\b/i.test(trimmed) && !/<testsuite\b/i.test(trimmed)) {
|
|
181
|
+
throw new Error("invalid junit xml: missing testsuites/testsuite root");
|
|
182
|
+
}
|
|
183
|
+
const hasSuitesRoot = /<testsuites\b/i.test(trimmed);
|
|
184
|
+
if ((hasSuitesRoot && !/<\/testsuites>\s*$/i.test(trimmed)) ||
|
|
185
|
+
(!hasSuitesRoot && !/<\/testsuite>\s*$/i.test(trimmed))) {
|
|
186
|
+
throw new Error("invalid junit xml: unclosed root element");
|
|
187
|
+
}
|
|
188
|
+
const openedCases = (trimmed.match(/<testcase\b/gi) ?? []).length;
|
|
189
|
+
const closedCases = (trimmed.match(/<\/testcase>/gi) ?? []).length;
|
|
190
|
+
const selfClosingCases = (trimmed.match(/<testcase\b[^>]*\/>/gi) ?? [])
|
|
191
|
+
.length;
|
|
192
|
+
if (openedCases !== closedCases + selfClosingCases) {
|
|
193
|
+
throw new Error("invalid junit xml: unclosed testcase element");
|
|
194
|
+
}
|
|
195
|
+
// Prefer root testsuites aggregates when present, then fall back to the first
|
|
196
|
+
// testsuite aggregate. Pytest commonly emits time only on <testsuite>.
|
|
197
|
+
const suitesOpen = trimmed.match(/<testsuites\b[^>]*>/i)?.[0];
|
|
198
|
+
const firstSuiteOpen = trimmed.match(/<testsuite\b[^>]*>/i)?.[0];
|
|
199
|
+
let tests = 0;
|
|
200
|
+
let failed = 0;
|
|
201
|
+
let errors = 0;
|
|
202
|
+
let skipped = 0;
|
|
203
|
+
let timeSec;
|
|
204
|
+
if (suitesOpen) {
|
|
205
|
+
const t = attr(suitesOpen, "tests");
|
|
206
|
+
const f = attr(suitesOpen, "failures");
|
|
207
|
+
const e = attr(suitesOpen, "errors");
|
|
208
|
+
const s = attr(suitesOpen, "skipped");
|
|
209
|
+
const time = attr(suitesOpen, "time");
|
|
210
|
+
if (t !== undefined)
|
|
211
|
+
tests = Number(t);
|
|
212
|
+
if (f !== undefined)
|
|
213
|
+
failed = Number(f);
|
|
214
|
+
if (e !== undefined)
|
|
215
|
+
errors = Number(e);
|
|
216
|
+
if (s !== undefined)
|
|
217
|
+
skipped = Number(s);
|
|
218
|
+
if (time !== undefined && time !== "")
|
|
219
|
+
timeSec = Number(time);
|
|
220
|
+
}
|
|
221
|
+
if (timeSec === undefined && firstSuiteOpen) {
|
|
222
|
+
const time = attr(firstSuiteOpen, "time");
|
|
223
|
+
if (time !== undefined && time !== "")
|
|
224
|
+
timeSec = Number(time);
|
|
225
|
+
}
|
|
226
|
+
// Self-closing first so empty cases ending with /> are not greedily paired with a later </testcase>.
|
|
227
|
+
const caseRe = /<testcase\b([^>]*?)\/>|<testcase\b([^>]*)>([\s\S]*?)<\/testcase>/gi;
|
|
228
|
+
const failures = [];
|
|
229
|
+
const cases = [];
|
|
230
|
+
let caseCount = 0;
|
|
231
|
+
let caseFailed = 0;
|
|
232
|
+
let caseErrors = 0;
|
|
233
|
+
let caseSkipped = 0;
|
|
234
|
+
let match = caseRe.exec(trimmed);
|
|
235
|
+
while (match !== null) {
|
|
236
|
+
caseCount += 1;
|
|
237
|
+
const openAttrs = match[1] ?? match[2] ?? "";
|
|
238
|
+
const body = match[3] ?? "";
|
|
239
|
+
const classname = attr(openAttrs, "classname") || "unknown";
|
|
240
|
+
const name = attr(openAttrs, "name") || "unknown";
|
|
241
|
+
const caseTime = attr(openAttrs, "time");
|
|
242
|
+
const caseDurationMs = caseTime !== undefined && caseTime !== "" && !Number.isNaN(Number(caseTime))
|
|
243
|
+
? Math.round(Number(caseTime) * 1000)
|
|
244
|
+
: undefined;
|
|
245
|
+
const failureTag = body.match(/<failure\b([^>]*)>([\s\S]*?)<\/failure>|<failure\b([^>]*)\/>/i);
|
|
246
|
+
const errorTag = body.match(/<error\b([^>]*)>([\s\S]*?)<\/error>|<error\b([^>]*)\/>/i);
|
|
247
|
+
const skippedTag = /<skipped\b/i.test(body);
|
|
248
|
+
const caseStdout = body.match(/<system-out\b[^>]*>([\s\S]*?)<\/system-out>/i)?.[1];
|
|
249
|
+
const caseStderr = body.match(/<system-err\b[^>]*>([\s\S]*?)<\/system-err>/i)?.[1];
|
|
250
|
+
const capturedOutput = {
|
|
251
|
+
...(caseStdout ? { stdout: decodeXmlEntities(caseStdout).trim() } : {}),
|
|
252
|
+
...(caseStderr ? { stderr: decodeXmlEntities(caseStderr).trim() } : {}),
|
|
253
|
+
};
|
|
254
|
+
if (failureTag) {
|
|
255
|
+
caseFailed += 1;
|
|
256
|
+
const fAttrs = failureTag[1] ?? failureTag[3] ?? "";
|
|
257
|
+
const fBody = decodeXmlEntities(failureTag[2] ?? "").trim();
|
|
258
|
+
const message = decodeXmlEntities(attr(fAttrs, "message") || fBody || "failure");
|
|
259
|
+
const summary = truncate(message);
|
|
260
|
+
failures.push({
|
|
261
|
+
classname,
|
|
262
|
+
name,
|
|
263
|
+
message: summary,
|
|
264
|
+
kind: "failure",
|
|
265
|
+
});
|
|
266
|
+
cases.push({ classname, name, durationMs: caseDurationMs, status: "failure", message: summary, details: fBody || summary, ...capturedOutput });
|
|
267
|
+
}
|
|
268
|
+
else if (errorTag) {
|
|
269
|
+
caseErrors += 1;
|
|
270
|
+
const eAttrs = errorTag[1] ?? errorTag[3] ?? "";
|
|
271
|
+
const eBody = decodeXmlEntities(errorTag[2] ?? "").trim();
|
|
272
|
+
const message = decodeXmlEntities(attr(eAttrs, "message") || eBody || "error");
|
|
273
|
+
const summary = truncate(message);
|
|
274
|
+
failures.push({
|
|
275
|
+
classname,
|
|
276
|
+
name,
|
|
277
|
+
message: summary,
|
|
278
|
+
kind: "error",
|
|
279
|
+
});
|
|
280
|
+
cases.push({ classname, name, durationMs: caseDurationMs, status: "error", message: summary, details: eBody || summary, ...capturedOutput });
|
|
281
|
+
}
|
|
282
|
+
else if (skippedTag) {
|
|
283
|
+
caseSkipped += 1;
|
|
284
|
+
const skippedAttrs = body.match(/<skipped\b([^>]*)/i)?.[1] ?? "";
|
|
285
|
+
const message = attr(skippedAttrs, "message");
|
|
286
|
+
cases.push({ classname, name, durationMs: caseDurationMs, status: "skipped", ...(message ? { message } : {}), ...capturedOutput });
|
|
287
|
+
}
|
|
288
|
+
else {
|
|
289
|
+
cases.push({ classname, name, durationMs: caseDurationMs, status: "passed", ...capturedOutput });
|
|
290
|
+
}
|
|
291
|
+
match = caseRe.exec(trimmed);
|
|
292
|
+
}
|
|
293
|
+
// Prefer case-level facts when testcase elements exist; never trust root counters
|
|
294
|
+
// that hide <failure>/<error> children (fail-closed on contradictory aggregates).
|
|
295
|
+
if (caseCount > 0) {
|
|
296
|
+
if (suitesOpen) {
|
|
297
|
+
const declaredTests = attr(suitesOpen, "tests") !== undefined
|
|
298
|
+
? Number(attr(suitesOpen, "tests"))
|
|
299
|
+
: undefined;
|
|
300
|
+
const declaredFailed = attr(suitesOpen, "failures") !== undefined
|
|
301
|
+
? Number(attr(suitesOpen, "failures"))
|
|
302
|
+
: undefined;
|
|
303
|
+
const declaredErrors = attr(suitesOpen, "errors") !== undefined
|
|
304
|
+
? Number(attr(suitesOpen, "errors"))
|
|
305
|
+
: undefined;
|
|
306
|
+
const declaredSkipped = attr(suitesOpen, "skipped") !== undefined
|
|
307
|
+
? Number(attr(suitesOpen, "skipped"))
|
|
308
|
+
: undefined;
|
|
309
|
+
// pytest collection reports often use tests="0" with a synthetic error testcase.
|
|
310
|
+
// Always fail-closed when root counters under-report failure/error children.
|
|
311
|
+
if (declaredTests !== undefined &&
|
|
312
|
+
!Number.isNaN(declaredTests) &&
|
|
313
|
+
declaredTests !== caseCount) {
|
|
314
|
+
const collectionStyle = declaredTests === 0 && caseErrors > 0 && caseFailed === 0;
|
|
315
|
+
if (!collectionStyle) {
|
|
316
|
+
throw new Error(`invalid junit xml: testsuites tests=${declaredTests} disagrees with testcase count=${caseCount}`);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
if (declaredFailed !== undefined &&
|
|
320
|
+
!Number.isNaN(declaredFailed) &&
|
|
321
|
+
declaredFailed !== caseFailed) {
|
|
322
|
+
throw new Error(`invalid junit xml: testsuites failures=${declaredFailed} disagrees with case failures=${caseFailed}`);
|
|
323
|
+
}
|
|
324
|
+
if (declaredErrors !== undefined &&
|
|
325
|
+
!Number.isNaN(declaredErrors) &&
|
|
326
|
+
declaredErrors !== caseErrors) {
|
|
327
|
+
throw new Error(`invalid junit xml: testsuites errors=${declaredErrors} disagrees with case errors=${caseErrors}`);
|
|
328
|
+
}
|
|
329
|
+
if (declaredSkipped !== undefined &&
|
|
330
|
+
!Number.isNaN(declaredSkipped) &&
|
|
331
|
+
declaredSkipped !== caseSkipped) {
|
|
332
|
+
throw new Error(`invalid junit xml: testsuites skipped=${declaredSkipped} disagrees with case skipped=${caseSkipped}`);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
tests = caseCount;
|
|
336
|
+
failed = caseFailed;
|
|
337
|
+
errors = caseErrors;
|
|
338
|
+
skipped = caseSkipped;
|
|
339
|
+
}
|
|
340
|
+
else if (!suitesOpen || Number.isNaN(tests) || tests === 0) {
|
|
341
|
+
// No testcase bodies: fall back to first testsuite attributes.
|
|
342
|
+
const suiteOpen = trimmed.match(/<testsuite\b[^>]*>/i)?.[0];
|
|
343
|
+
if (!suiteOpen) {
|
|
344
|
+
throw new Error("invalid junit xml: no testsuite data");
|
|
345
|
+
}
|
|
346
|
+
tests = Number(attr(suiteOpen, "tests") ?? "0");
|
|
347
|
+
failed = Number(attr(suiteOpen, "failures") ?? "0");
|
|
348
|
+
errors = Number(attr(suiteOpen, "errors") ?? "0");
|
|
349
|
+
skipped = Number(attr(suiteOpen, "skipped") ?? "0");
|
|
350
|
+
const time = attr(suiteOpen, "time");
|
|
351
|
+
if (time)
|
|
352
|
+
timeSec = Number(time);
|
|
353
|
+
}
|
|
354
|
+
if ([tests, failed, errors, skipped].some((n) => Number.isNaN(n) || n < 0)) {
|
|
355
|
+
throw new Error("invalid junit xml: non-numeric suite counters");
|
|
356
|
+
}
|
|
357
|
+
const passed = Math.max(0, tests - failed - errors - skipped);
|
|
358
|
+
return {
|
|
359
|
+
tests,
|
|
360
|
+
passed,
|
|
361
|
+
failed,
|
|
362
|
+
errors,
|
|
363
|
+
skipped,
|
|
364
|
+
durationMs: timeSec !== undefined && !Number.isNaN(timeSec)
|
|
365
|
+
? Math.round(timeSec * 1000)
|
|
366
|
+
: undefined,
|
|
367
|
+
cases,
|
|
368
|
+
failures: failures.slice(0, MAX_FAILURES),
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
const HTML_ENTITY_MAP = {
|
|
372
|
+
"&": "&",
|
|
373
|
+
"<": "<",
|
|
374
|
+
">": ">",
|
|
375
|
+
""": '"',
|
|
376
|
+
"'": "'",
|
|
377
|
+
};
|
|
378
|
+
/** Decode one HTML entity layer. Safe for the outer data-jsonblob attribute. */
|
|
379
|
+
function decodeHtmlEntities(value) {
|
|
380
|
+
return value.replace(/&(?:amp|lt|gt|quot|apos|#\d+|#x[0-9a-f]+);/gi, (entity) => {
|
|
381
|
+
const named = HTML_ENTITY_MAP[entity.toLowerCase()];
|
|
382
|
+
if (named !== undefined)
|
|
383
|
+
return named;
|
|
384
|
+
const hex = entity.match(/^&#x([0-9a-f]+);$/i)?.[1];
|
|
385
|
+
const decimal = entity.match(/^&#(\d+);$/)?.[1];
|
|
386
|
+
const codePoint = hex
|
|
387
|
+
? Number.parseInt(hex, 16)
|
|
388
|
+
: decimal
|
|
389
|
+
? Number.parseInt(decimal, 10)
|
|
390
|
+
: Number.NaN;
|
|
391
|
+
return Number.isFinite(codePoint)
|
|
392
|
+
? String.fromCodePoint(codePoint)
|
|
393
|
+
: entity;
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
/** Decode nested entities only after JSON parsing; bounded to avoid overwork. */
|
|
397
|
+
function decodeHtmlEntitiesDeep(value) {
|
|
398
|
+
let current = value;
|
|
399
|
+
for (let index = 0; index < 3; index += 1) {
|
|
400
|
+
const decoded = decodeHtmlEntities(current);
|
|
401
|
+
if (decoded === current)
|
|
402
|
+
break;
|
|
403
|
+
current = decoded;
|
|
404
|
+
}
|
|
405
|
+
return current;
|
|
406
|
+
}
|
|
407
|
+
function parseDurationLabelMs(raw) {
|
|
408
|
+
if (!raw)
|
|
409
|
+
return undefined;
|
|
410
|
+
const value = Number.parseFloat(raw);
|
|
411
|
+
if (!Number.isFinite(value))
|
|
412
|
+
return undefined;
|
|
413
|
+
if (/\bms\b/i.test(raw))
|
|
414
|
+
return Math.round(value);
|
|
415
|
+
if (/\bsec|s\b/i.test(raw))
|
|
416
|
+
return Math.round(value * 1000);
|
|
417
|
+
// pytest-html commonly emits bare milliseconds without a unit suffix.
|
|
418
|
+
return Math.round(value);
|
|
419
|
+
}
|
|
420
|
+
function canonicalPytestItemId(testId) {
|
|
421
|
+
return testId.replace(/::(?:setup|teardown)$/i, "");
|
|
422
|
+
}
|
|
423
|
+
function pytestHtmlPhase(testId, log) {
|
|
424
|
+
if (/::setup$/i.test(testId) || /ERROR at setup|Captured setup/i.test(log))
|
|
425
|
+
return "setup";
|
|
426
|
+
if (/::teardown$/i.test(testId) || /ERROR at teardown|Captured teardown/i.test(log))
|
|
427
|
+
return "teardown";
|
|
428
|
+
if (/collecting|ERROR collecting/i.test(log))
|
|
429
|
+
return "collection";
|
|
430
|
+
return "call";
|
|
431
|
+
}
|
|
432
|
+
function pytestFailureIdentity(nodeId) {
|
|
433
|
+
const caseToken = nodeId.match(/BE[-_][A-Z0-9_-]+[-_]\d{2,3}/i)?.[0];
|
|
434
|
+
const caseId = caseToken
|
|
435
|
+
? caseToken.replace(/^BE_/i, "BE-").replaceAll("_", "-").toUpperCase()
|
|
436
|
+
: undefined;
|
|
437
|
+
const tpId = nodeId.match(/\[(TP-[A-Z0-9-]+)\]/i)?.[1]?.toUpperCase();
|
|
438
|
+
return { ...(caseId ? { caseId } : {}), ...(tpId ? { tpId } : {}) };
|
|
439
|
+
}
|
|
440
|
+
function parsedExecutionCounts(parsed) {
|
|
441
|
+
const setupErrorCount = parsed.cases.filter((item) => item.status === "error" && (item.phase === "setup" || /setup|fixture ['"][^'"]+['"] not found/i.test(`${item.name} ${item.message ?? ""} ${item.details ?? ""}`))).length;
|
|
442
|
+
const teardownErrorCount = parsed.cases.filter((item) => item.status === "error" && (item.phase === "teardown" || /teardown/i.test(`${item.name} ${item.message ?? ""} ${item.details ?? ""}`))).length;
|
|
443
|
+
const businessTestBodyExecutedCount = parsed.cases.filter((item) => item.status === "passed" || item.status === "failure" || (item.status === "error" && item.phase === "call" && !/fixture ['"][^'"]+['"] not found/i.test(`${item.message ?? ""} ${item.details ?? ""}`))).length;
|
|
444
|
+
return {
|
|
445
|
+
collectedItemCount: parsed.tests,
|
|
446
|
+
setupStartedCount: Math.max(0, parsed.tests - parsed.cases.filter((item) => item.phase === "collection").length),
|
|
447
|
+
businessTestBodyExecutedCount,
|
|
448
|
+
setupErrorCount,
|
|
449
|
+
testFailureCount: parsed.failed,
|
|
450
|
+
teardownErrorCount,
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* Extract the pytest-html 4.x JSON island from a self-contained HTML report.
|
|
455
|
+
*
|
|
456
|
+
* pytest-html 4.x embeds the full report payload as an HTML-entity-escaped
|
|
457
|
+
* JSON string in `<div id="data-container" data-jsonblob="...">`. This helper
|
|
458
|
+
* locates that attribute, decodes entities and parses the JSON. Fail-closed on
|
|
459
|
+
* a non-pytest-html document so the pipeline never silently drops test facts.
|
|
460
|
+
*/
|
|
461
|
+
export function extractPytestHtmlReportData(html) {
|
|
462
|
+
const match = html.match(/id=["']data-container["'][^>]*data-jsonblob=["']([^"']*)["']/i);
|
|
463
|
+
if (!match || !match[1]) {
|
|
464
|
+
throw new Error("invalid pytest-html report: missing data-container data-jsonblob island");
|
|
465
|
+
}
|
|
466
|
+
const decoded = decodeHtmlEntities(match[1]);
|
|
467
|
+
try {
|
|
468
|
+
return JSON.parse(decoded);
|
|
469
|
+
}
|
|
470
|
+
catch (error) {
|
|
471
|
+
throw new Error(`invalid pytest-html report: data-jsonblob is not valid JSON (${error instanceof Error ? error.message : String(error)})`);
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
/**
|
|
475
|
+
* Parse a self-contained pytest-html 4.x report into the same ParsedJunit
|
|
476
|
+
* shape used by the HTML/facts renderers, so the downstream rendering path
|
|
477
|
+
* stays uniform regardless of the evidence source.
|
|
478
|
+
*
|
|
479
|
+
* Unlike JUnit, pytest-html stores per-test captured stdout in a `log` field
|
|
480
|
+
* (with section markers like "Captured stdout call"). We surface that as the
|
|
481
|
+
* case `stdout` so HTTP_REQUEST/HTTP_RESPONSE lines remain visible in the
|
|
482
|
+
* per-case cards.
|
|
483
|
+
*/
|
|
484
|
+
export function parsePytestHtmlReport(html) {
|
|
485
|
+
const data = extractPytestHtmlReportData(html);
|
|
486
|
+
const entries = Object.entries(data.tests ?? {});
|
|
487
|
+
if (entries.length === 0) {
|
|
488
|
+
throw new Error("invalid pytest-html report: no test entries in data-jsonblob");
|
|
489
|
+
}
|
|
490
|
+
const cases = [];
|
|
491
|
+
const failures = [];
|
|
492
|
+
let passed = 0;
|
|
493
|
+
let failed = 0;
|
|
494
|
+
let errors = 0;
|
|
495
|
+
let skipped = 0;
|
|
496
|
+
for (const [nodeId, records] of entries) {
|
|
497
|
+
const record = records[0];
|
|
498
|
+
if (!record)
|
|
499
|
+
continue;
|
|
500
|
+
const rawResult = (record.result ?? "").toLowerCase();
|
|
501
|
+
const rawTestId = record.testId ?? nodeId;
|
|
502
|
+
const capturedLog = record.log ?? "";
|
|
503
|
+
const phase = pytestHtmlPhase(rawTestId, capturedLog);
|
|
504
|
+
const canonicalNodeId = canonicalPytestItemId(nodeId.includes("::") ? nodeId : rawTestId);
|
|
505
|
+
const { classname, name, filePath } = splitPytestNodeId(canonicalNodeId);
|
|
506
|
+
const identity = pytestFailureIdentity(canonicalNodeId);
|
|
507
|
+
const filePathFields = filePath ? { filePath } : {};
|
|
508
|
+
const durationMs = parseDurationLabelMs(record.duration);
|
|
509
|
+
const decodedCapturedLog = decodeHtmlEntitiesDeep(capturedLog);
|
|
510
|
+
const stdout = splitPytestHtmlLogSections(capturedLog).stdout || undefined;
|
|
511
|
+
const stderr = splitPytestHtmlLogSections(capturedLog).stderr || undefined;
|
|
512
|
+
const baseCase = { classname, name, nodeId: canonicalNodeId, phase, ...filePathFields, durationMs };
|
|
513
|
+
if (rawResult === "passed") {
|
|
514
|
+
passed += 1;
|
|
515
|
+
cases.push({ ...baseCase, status: "passed", ...(stdout ? { stdout } : {}), ...(stderr ? { stderr } : {}) });
|
|
516
|
+
}
|
|
517
|
+
else if (rawResult === "failed") {
|
|
518
|
+
failed += 1;
|
|
519
|
+
const message = extractPytestHtmlFailureMessage(capturedLog) || "failure";
|
|
520
|
+
const summary = truncate(message);
|
|
521
|
+
failures.push({ classname, name, message: summary, kind: "failure", nodeId: canonicalNodeId, phase, ...identity });
|
|
522
|
+
cases.push({ ...baseCase, status: "failure", message: summary, details: decodedCapturedLog || summary, ...(stdout ? { stdout } : {}), ...(stderr ? { stderr } : {}) });
|
|
523
|
+
}
|
|
524
|
+
else if (rawResult === "error") {
|
|
525
|
+
errors += 1;
|
|
526
|
+
const message = extractPytestHtmlFailureMessage(capturedLog) || "error";
|
|
527
|
+
const summary = truncate(message);
|
|
528
|
+
failures.push({ classname, name, message: summary, kind: "error", nodeId: canonicalNodeId, phase, ...identity });
|
|
529
|
+
cases.push({ ...baseCase, status: "error", message: summary, details: decodedCapturedLog || summary, ...(stdout ? { stdout } : {}), ...(stderr ? { stderr } : {}) });
|
|
530
|
+
}
|
|
531
|
+
else if (rawResult === "skipped" || rawResult === "xfailed") {
|
|
532
|
+
skipped += 1;
|
|
533
|
+
cases.push({ ...baseCase, status: "skipped", ...(stdout ? { stdout } : {}), ...(stderr ? { stderr } : {}) });
|
|
534
|
+
}
|
|
535
|
+
else {
|
|
536
|
+
errors += 1;
|
|
537
|
+
const message = `unexpected pytest-html result label: ${record.result ?? "(empty)"}`;
|
|
538
|
+
const summary = truncate(message);
|
|
539
|
+
failures.push({ classname, name, message: summary, kind: "error", nodeId: canonicalNodeId, phase, ...identity });
|
|
540
|
+
cases.push({ ...baseCase, status: "error", message: summary, details: decodedCapturedLog || summary, ...(stdout ? { stdout } : {}), ...(stderr ? { stderr } : {}) });
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
const tests = cases.length;
|
|
544
|
+
return {
|
|
545
|
+
tests,
|
|
546
|
+
passed,
|
|
547
|
+
failed,
|
|
548
|
+
errors,
|
|
549
|
+
skipped,
|
|
550
|
+
durationMs: undefined,
|
|
551
|
+
cases,
|
|
552
|
+
failures: failures.slice(0, MAX_FAILURES),
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* Split a pytest node id into module classname, test name, and optional file path.
|
|
557
|
+
*
|
|
558
|
+
* Handles:
|
|
559
|
+
* - `testcase/test_x.py::test_name`
|
|
560
|
+
* - `testcase/test_x.py::TestClass::test_name` (class-based; previous code
|
|
561
|
+
* treated `TestClass` as the file segment and later filtered it to unknown.py)
|
|
562
|
+
* - Windows separators and parametrized names `test_name[param]`
|
|
563
|
+
*/
|
|
564
|
+
export function splitPytestNodeId(testId) {
|
|
565
|
+
const normalized = testId.replaceAll("\\", "/").trim();
|
|
566
|
+
if (!normalized) {
|
|
567
|
+
return { classname: "unknown", name: "unknown" };
|
|
568
|
+
}
|
|
569
|
+
const parts = normalized.split("::").filter(Boolean);
|
|
570
|
+
if (parts.length < 2) {
|
|
571
|
+
// Bare id without "::" — keep as name; path unknown.
|
|
572
|
+
return { classname: "unknown", name: normalized };
|
|
573
|
+
}
|
|
574
|
+
let rawName = parts[parts.length - 1];
|
|
575
|
+
// Drop call args if present; keep parametrize brackets in display name strip for id match.
|
|
576
|
+
const paren = rawName.indexOf("(");
|
|
577
|
+
if (paren >= 0)
|
|
578
|
+
rawName = rawName.slice(0, paren);
|
|
579
|
+
const cleanName = rawName.trim() || "unknown";
|
|
580
|
+
// Prefer the first segment that looks like a .py file path.
|
|
581
|
+
const filePart = parts.find((part) => /\.py$/i.test(part)) ??
|
|
582
|
+
(parts[0].includes("/") || parts[0].includes(".") ? parts[0] : undefined);
|
|
583
|
+
const filePath = filePart
|
|
584
|
+
? filePart.replace(/\\/g, "/")
|
|
585
|
+
: undefined;
|
|
586
|
+
const moduleWithoutExt = (filePath ?? "unknown").replace(/\.py$/i, "");
|
|
587
|
+
const classname = moduleWithoutExt.replaceAll("/", ".") || "unknown";
|
|
588
|
+
return {
|
|
589
|
+
classname,
|
|
590
|
+
name: cleanName,
|
|
591
|
+
...(filePath ? { filePath } : {}),
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
function splitPytestHtmlLogSections(log) {
|
|
595
|
+
if (!log)
|
|
596
|
+
return { stdout: "", stderr: "" };
|
|
597
|
+
// pytest-html HTML-entity-escapes the captured log content (e.g. `"`
|
|
598
|
+
// for `"`). Decode entities first so downstream HTTP log parsers see the
|
|
599
|
+
// real JSON/kv payload rather than escaped markup.
|
|
600
|
+
const decoded = decodeHtmlEntitiesDeep(log);
|
|
601
|
+
// pytest-html interleaves captured stdout/stderr with section markers like
|
|
602
|
+
// "----------------------------- Captured stdout call -----------------------------".
|
|
603
|
+
// String.split includes capture-group matches in the result array, so the
|
|
604
|
+
// layout is [beforeText, label, body, label, body, ...]. Iterate label/body
|
|
605
|
+
// pairs starting at index 1.
|
|
606
|
+
const sections = decoded.split(/^-+ Captured (stdout|stderr|log|call|setup|teardown)(?: call| setup| teardown)? -+$/m);
|
|
607
|
+
let stdout = "";
|
|
608
|
+
let stderr = "";
|
|
609
|
+
for (let index = 1; index < sections.length - 1; index += 2) {
|
|
610
|
+
const label = sections[index]?.toLowerCase() ?? "";
|
|
611
|
+
const body = sections[index + 1] ?? "";
|
|
612
|
+
if (label.includes("stderr")) {
|
|
613
|
+
stderr = `${stderr}${body}`.trim();
|
|
614
|
+
}
|
|
615
|
+
else {
|
|
616
|
+
stdout = `${stdout}${body}`.trim();
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
if (!stdout && !stderr) {
|
|
620
|
+
// No recognizable section markers: treat the whole log as stdout so HTTP
|
|
621
|
+
// request/response lines remain visible.
|
|
622
|
+
stdout = decoded.trim();
|
|
623
|
+
}
|
|
624
|
+
return { stdout, stderr };
|
|
625
|
+
}
|
|
626
|
+
function extractPytestHtmlFailureMessage(log) {
|
|
627
|
+
if (!log)
|
|
628
|
+
return "";
|
|
629
|
+
const decoded = decodeHtmlEntitiesDeep(log);
|
|
630
|
+
// pytest-html failure logs contain assertion lines prefixed with "E " and a
|
|
631
|
+
// trailing location line like "test_x.py:N: AssertionError". Prefer the
|
|
632
|
+
// explicit AssertionError/Error line; fall back to the last "E " line.
|
|
633
|
+
const assertionLine = decoded
|
|
634
|
+
.split(/\r?\n/)
|
|
635
|
+
.map((line) => line.trim())
|
|
636
|
+
.find((line) => /:\s*AssertionError/.test(line));
|
|
637
|
+
if (assertionLine)
|
|
638
|
+
return assertionLine.replace(/^.*?:\s*/, "");
|
|
639
|
+
const eLines = decoded
|
|
640
|
+
.split(/\r?\n/)
|
|
641
|
+
.filter((line) => /^E\s+/.test(line))
|
|
642
|
+
.map((line) => line.replace(/^E\s+/, "").trim());
|
|
643
|
+
if (eLines.length > 0)
|
|
644
|
+
return eLines[eLines.length - 1];
|
|
645
|
+
return "";
|
|
646
|
+
}
|
|
647
|
+
export function deriveBackendTestResult(input) {
|
|
648
|
+
assertNoSecrets("commandSummary", input.commandSummary);
|
|
649
|
+
const emptyJunitMeta = {
|
|
650
|
+
relativePath: input.junitRelativePath,
|
|
651
|
+
sha256: "0".repeat(64),
|
|
652
|
+
};
|
|
653
|
+
if (input.junitXml === null || input.junitXml === undefined) {
|
|
654
|
+
if (!input.allowMissingJunit) {
|
|
655
|
+
throw new Error("missing junit report");
|
|
656
|
+
}
|
|
657
|
+
const outcome = input.pytestExitCode === 0 ? "report-error" : "command-error";
|
|
658
|
+
const executionStatus = input.pytestExitCode === 0 ? "report-error" : "command-error";
|
|
659
|
+
const result = {
|
|
660
|
+
schemaVersion: 1,
|
|
661
|
+
executionStatus,
|
|
662
|
+
pytestExitCode: input.pytestExitCode,
|
|
663
|
+
collectionStatus: "unknown",
|
|
664
|
+
tests: 0,
|
|
665
|
+
passed: 0,
|
|
666
|
+
failed: 0,
|
|
667
|
+
error: 0,
|
|
668
|
+
skipped: 0,
|
|
669
|
+
collectedItemCount: 0,
|
|
670
|
+
setupStartedCount: 0,
|
|
671
|
+
businessTestBodyExecutedCount: 0,
|
|
672
|
+
setupErrorCount: 0,
|
|
673
|
+
testFailureCount: 0,
|
|
674
|
+
teardownErrorCount: 0,
|
|
675
|
+
junit: emptyJunitMeta,
|
|
676
|
+
commandSummary: input.commandSummary,
|
|
677
|
+
failures: [],
|
|
678
|
+
outcome,
|
|
679
|
+
};
|
|
680
|
+
return backendTestResultContractSchema.parse(result);
|
|
681
|
+
}
|
|
682
|
+
let parsed;
|
|
683
|
+
try {
|
|
684
|
+
parsed = parseJunitXml(input.junitXml);
|
|
685
|
+
}
|
|
686
|
+
catch (error) {
|
|
687
|
+
throw new Error(`invalid junit xml: ${error instanceof Error ? error.message : String(error)}`);
|
|
688
|
+
}
|
|
689
|
+
const sha256 = createHash("sha256").update(input.junitXml).digest("hex");
|
|
690
|
+
const exit = input.pytestExitCode;
|
|
691
|
+
const executionCounts = parsedExecutionCounts(parsed);
|
|
692
|
+
let executionStatus = "completed";
|
|
693
|
+
let collectionStatus = "ok";
|
|
694
|
+
let outcome = "passed";
|
|
695
|
+
const looksLikeCollection = exit === 2 ||
|
|
696
|
+
parsed.failures.some((f) => f.kind === "error" &&
|
|
697
|
+
/collect|import|syntax/i.test(`${f.name} ${f.message}`));
|
|
698
|
+
if (looksLikeCollection && (parsed.errors > 0 || exit >= 2)) {
|
|
699
|
+
executionStatus = "collection-error";
|
|
700
|
+
collectionStatus = "error";
|
|
701
|
+
outcome = "collection-error";
|
|
702
|
+
}
|
|
703
|
+
else if (executionCounts.setupErrorCount > 0) {
|
|
704
|
+
executionStatus = "setup-error";
|
|
705
|
+
collectionStatus = "ok";
|
|
706
|
+
outcome = "setup-error";
|
|
707
|
+
}
|
|
708
|
+
else if (executionCounts.teardownErrorCount > 0) {
|
|
709
|
+
executionStatus = "teardown-error";
|
|
710
|
+
collectionStatus = "ok";
|
|
711
|
+
outcome = "teardown-error";
|
|
712
|
+
}
|
|
713
|
+
else if (exit >= 2 && parsed.failed === 0 && parsed.errors === 0) {
|
|
714
|
+
executionStatus = "command-error";
|
|
715
|
+
collectionStatus = "unknown";
|
|
716
|
+
outcome = "command-error";
|
|
717
|
+
}
|
|
718
|
+
else if (parsed.failed > 0 || parsed.errors > 0 || exit === 1) {
|
|
719
|
+
executionStatus = "completed";
|
|
720
|
+
collectionStatus = "ok";
|
|
721
|
+
outcome = "completed-with-failures";
|
|
722
|
+
}
|
|
723
|
+
else if (exit === 0 && parsed.failed === 0 && parsed.errors === 0) {
|
|
724
|
+
executionStatus = "completed";
|
|
725
|
+
collectionStatus = "ok";
|
|
726
|
+
outcome = "passed";
|
|
727
|
+
}
|
|
728
|
+
else {
|
|
729
|
+
executionStatus = "command-error";
|
|
730
|
+
collectionStatus = "unknown";
|
|
731
|
+
outcome = "command-error";
|
|
732
|
+
}
|
|
733
|
+
const result = {
|
|
734
|
+
schemaVersion: 1,
|
|
735
|
+
executionStatus,
|
|
736
|
+
pytestExitCode: exit,
|
|
737
|
+
collectionStatus,
|
|
738
|
+
tests: parsed.tests,
|
|
739
|
+
passed: parsed.passed,
|
|
740
|
+
failed: parsed.failed,
|
|
741
|
+
error: parsed.errors,
|
|
742
|
+
skipped: parsed.skipped,
|
|
743
|
+
...executionCounts,
|
|
744
|
+
durationMs: parsed.durationMs,
|
|
745
|
+
junit: {
|
|
746
|
+
relativePath: input.junitRelativePath,
|
|
747
|
+
sha256,
|
|
748
|
+
},
|
|
749
|
+
commandSummary: input.commandSummary,
|
|
750
|
+
failures: parsed.failures.map((f) => ({
|
|
751
|
+
classname: f.classname || "unknown",
|
|
752
|
+
name: f.name || "unknown",
|
|
753
|
+
message: truncate(f.message || "failure"),
|
|
754
|
+
kind: f.kind,
|
|
755
|
+
...(f.nodeId ? { nodeId: f.nodeId } : {}),
|
|
756
|
+
...(f.caseId ? { caseId: f.caseId } : {}),
|
|
757
|
+
...(f.tpId ? { tpId: f.tpId } : {}),
|
|
758
|
+
...(f.phase ? { phase: f.phase } : {}),
|
|
759
|
+
})),
|
|
760
|
+
outcome,
|
|
761
|
+
};
|
|
762
|
+
return backendTestResultContractSchema.parse(result);
|
|
763
|
+
}
|
|
764
|
+
export function validateBackendTestResultJunitIntegrity(result, junitXml) {
|
|
765
|
+
backendTestResultContractSchema.parse(result);
|
|
766
|
+
const actualSha = createHash("sha256").update(junitXml).digest("hex");
|
|
767
|
+
if (result.junit.sha256 !== actualSha) {
|
|
768
|
+
throw new Error("junit sha256 mismatch against report content");
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
/**
|
|
772
|
+
* Deterministic classification constraints for Pi classifier (not the final label).
|
|
773
|
+
* Single-run failures must never suggest FlakyTest; collection/command never ProductBug.
|
|
774
|
+
*/
|
|
775
|
+
export function classifyCategoryHints(result) {
|
|
776
|
+
const forbidden = new Set();
|
|
777
|
+
const suggested = new Set();
|
|
778
|
+
// Single observation cannot prove flakiness.
|
|
779
|
+
forbidden.add("FlakyTest");
|
|
780
|
+
if (result.executionStatus === "collection-error" ||
|
|
781
|
+
result.executionStatus === "setup-error" ||
|
|
782
|
+
result.executionStatus === "teardown-error" ||
|
|
783
|
+
result.executionStatus === "command-error" ||
|
|
784
|
+
result.executionStatus === "report-error" ||
|
|
785
|
+
result.outcome === "collection-error" ||
|
|
786
|
+
result.outcome === "setup-error" ||
|
|
787
|
+
result.outcome === "teardown-error" ||
|
|
788
|
+
result.outcome === "command-error" ||
|
|
789
|
+
result.outcome === "report-error") {
|
|
790
|
+
forbidden.add("ProductBug");
|
|
791
|
+
suggested.add("EnvFailure");
|
|
792
|
+
suggested.add("Unknown");
|
|
793
|
+
if (["collection-error", "setup-error", "teardown-error"].includes(result.executionStatus)) {
|
|
794
|
+
suggested.add("TestBug");
|
|
795
|
+
}
|
|
796
|
+
return {
|
|
797
|
+
suggestedCategories: [...suggested],
|
|
798
|
+
forbiddenCategories: [...forbidden],
|
|
799
|
+
confidenceCap: 0.6,
|
|
800
|
+
};
|
|
801
|
+
}
|
|
802
|
+
if (result.outcome === "passed") {
|
|
803
|
+
return {
|
|
804
|
+
suggestedCategories: [],
|
|
805
|
+
forbiddenCategories: [
|
|
806
|
+
...forbidden,
|
|
807
|
+
"ProductBug",
|
|
808
|
+
"TestBug",
|
|
809
|
+
"EnvFailure",
|
|
810
|
+
],
|
|
811
|
+
confidenceCap: 1,
|
|
812
|
+
};
|
|
813
|
+
}
|
|
814
|
+
// Assertion failures: ProductBug / TestBug / Unknown allowed; not Flaky.
|
|
815
|
+
suggested.add("ProductBug");
|
|
816
|
+
suggested.add("TestBug");
|
|
817
|
+
suggested.add("Unknown");
|
|
818
|
+
return {
|
|
819
|
+
suggestedCategories: [...suggested],
|
|
820
|
+
forbiddenCategories: [...forbidden],
|
|
821
|
+
confidenceCap: 0.75,
|
|
822
|
+
};
|
|
823
|
+
}
|
|
824
|
+
async function readPytestExitCode(runDir, fromNodeId, exitRelativePath = "reports/backend-test-pytest-exit.txt") {
|
|
825
|
+
const exitPath = path.join(runDir, ...exitRelativePath.split("/"));
|
|
826
|
+
try {
|
|
827
|
+
const raw = (await readFile(exitPath, "utf8")).trim();
|
|
828
|
+
const code = Number(raw);
|
|
829
|
+
if (raw !== "" && Number.isInteger(code) && code >= 0 && code <= 255)
|
|
830
|
+
return code;
|
|
831
|
+
throw new Error(`invalid pytest exit evidence at ${exitPath}`);
|
|
832
|
+
}
|
|
833
|
+
catch (error) {
|
|
834
|
+
if (error.code !== "ENOENT")
|
|
835
|
+
throw error;
|
|
836
|
+
// Missing dedicated evidence may fall through to an explicit node marker.
|
|
837
|
+
}
|
|
838
|
+
const nodePath = path.join(runDir, `${fromNodeId}.json`);
|
|
839
|
+
try {
|
|
840
|
+
const record = JSON.parse(await readFile(nodePath, "utf8"));
|
|
841
|
+
const blob = `${record.stdout ?? ""}\n${record.stderr ?? ""}`;
|
|
842
|
+
const marker = blob.match(/pytestExitCode\s*=\s*(\d{1,3})/i);
|
|
843
|
+
if (marker) {
|
|
844
|
+
const code = Number(marker[1]);
|
|
845
|
+
if (Number.isInteger(code) && code >= 0 && code <= 255)
|
|
846
|
+
return code;
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
catch (error) {
|
|
850
|
+
if (error.code !== "ENOENT") {
|
|
851
|
+
throw new Error("invalid pytest exit evidence in execute node record");
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
throw new Error("missing valid pytest exit evidence");
|
|
855
|
+
}
|
|
856
|
+
/**
|
|
857
|
+
* Materialize Result v1 from a pytest-html 4.x self-contained report (Markdown-first
|
|
858
|
+
* 8-node pipeline). `junit.relativePath` records the HTML path for integrity hashing
|
|
859
|
+
* (same field used historically for JUnit XML path).
|
|
860
|
+
*/
|
|
861
|
+
export async function materializeBackendTestResultFromPytestHtml(input) {
|
|
862
|
+
const htmlRelativePath = input.htmlRelativePath ?? "reports/backend-test.html";
|
|
863
|
+
const artifactName = input.artifactName ?? "backend-test-result.json";
|
|
864
|
+
const outputDir = input.outputDir ?? "contracts";
|
|
865
|
+
if (!/^[a-z0-9][a-z0-9._-]*\.json$/.test(artifactName) ||
|
|
866
|
+
!/^[a-z0-9][a-z0-9._-]*$/.test(outputDir)) {
|
|
867
|
+
throw new Error("unsafe structured artifact path");
|
|
868
|
+
}
|
|
869
|
+
let html = input.htmlContent;
|
|
870
|
+
if (html === undefined) {
|
|
871
|
+
const htmlAbs = path.join(input.runDir, ...htmlRelativePath.split("/"));
|
|
872
|
+
try {
|
|
873
|
+
html = await readFile(htmlAbs, "utf8");
|
|
874
|
+
}
|
|
875
|
+
catch {
|
|
876
|
+
throw new Error(`missing pytest-html report at ${htmlRelativePath} (fail-closed for Result v1)`);
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
if (!html.trim()) {
|
|
880
|
+
throw new Error("invalid pytest-html report: empty report");
|
|
881
|
+
}
|
|
882
|
+
let parsed;
|
|
883
|
+
try {
|
|
884
|
+
parsed = parsePytestHtmlReport(html);
|
|
885
|
+
}
|
|
886
|
+
catch (error) {
|
|
887
|
+
throw new Error(`invalid pytest-html report: ${error instanceof Error ? error.message : String(error)}`);
|
|
888
|
+
}
|
|
889
|
+
const sha256 = createHash("sha256").update(html).digest("hex");
|
|
890
|
+
const exit = input.pytestExitCode;
|
|
891
|
+
const executionCounts = parsedExecutionCounts(parsed);
|
|
892
|
+
let executionStatus = "completed";
|
|
893
|
+
let collectionStatus = "ok";
|
|
894
|
+
let outcome = "passed";
|
|
895
|
+
const looksLikeCollection = exit === 2 ||
|
|
896
|
+
parsed.failures.some((f) => f.kind === "error" &&
|
|
897
|
+
/collect|import|syntax/i.test(`${f.name} ${f.message}`));
|
|
898
|
+
if (looksLikeCollection && (parsed.errors > 0 || exit >= 2)) {
|
|
899
|
+
executionStatus = "collection-error";
|
|
900
|
+
collectionStatus = "error";
|
|
901
|
+
outcome = "collection-error";
|
|
902
|
+
}
|
|
903
|
+
else if (executionCounts.setupErrorCount > 0) {
|
|
904
|
+
executionStatus = "setup-error";
|
|
905
|
+
collectionStatus = "ok";
|
|
906
|
+
outcome = "setup-error";
|
|
907
|
+
}
|
|
908
|
+
else if (executionCounts.teardownErrorCount > 0) {
|
|
909
|
+
executionStatus = "teardown-error";
|
|
910
|
+
collectionStatus = "ok";
|
|
911
|
+
outcome = "teardown-error";
|
|
912
|
+
}
|
|
913
|
+
else if (exit >= 2 && parsed.failed === 0 && parsed.errors === 0) {
|
|
914
|
+
executionStatus = "command-error";
|
|
915
|
+
collectionStatus = "unknown";
|
|
916
|
+
outcome = "command-error";
|
|
917
|
+
}
|
|
918
|
+
else if (parsed.failed > 0 || parsed.errors > 0 || exit === 1) {
|
|
919
|
+
executionStatus = "completed";
|
|
920
|
+
collectionStatus = "ok";
|
|
921
|
+
outcome = "completed-with-failures";
|
|
922
|
+
}
|
|
923
|
+
else if (exit === 0 && parsed.failed === 0 && parsed.errors === 0) {
|
|
924
|
+
executionStatus = "completed";
|
|
925
|
+
collectionStatus = "ok";
|
|
926
|
+
outcome = "passed";
|
|
927
|
+
}
|
|
928
|
+
else {
|
|
929
|
+
executionStatus = "command-error";
|
|
930
|
+
collectionStatus = "unknown";
|
|
931
|
+
outcome = "command-error";
|
|
932
|
+
}
|
|
933
|
+
const commandSummary = input.commandSummary ??
|
|
934
|
+
`PYTHONUTF8=1 PYTHONIOENCODING=utf-8 PYTHONDONTWRITEBYTECODE=1 python -m pytest -v -p no:cacheprovider --html=${htmlRelativePath} --self-contained-html`;
|
|
935
|
+
assertNoSecrets("commandSummary", commandSummary);
|
|
936
|
+
const result = backendTestResultContractSchema.parse({
|
|
937
|
+
schemaVersion: 1,
|
|
938
|
+
executionStatus,
|
|
939
|
+
pytestExitCode: exit,
|
|
940
|
+
collectionStatus,
|
|
941
|
+
tests: parsed.tests,
|
|
942
|
+
passed: parsed.passed,
|
|
943
|
+
failed: parsed.failed,
|
|
944
|
+
error: parsed.errors,
|
|
945
|
+
skipped: parsed.skipped,
|
|
946
|
+
...executionCounts,
|
|
947
|
+
durationMs: parsed.durationMs,
|
|
948
|
+
junit: {
|
|
949
|
+
relativePath: htmlRelativePath,
|
|
950
|
+
sha256,
|
|
951
|
+
},
|
|
952
|
+
commandSummary,
|
|
953
|
+
failures: parsed.failures.map((f) => ({
|
|
954
|
+
classname: f.classname || "unknown",
|
|
955
|
+
name: f.name || "unknown",
|
|
956
|
+
message: truncate(f.message || "failure"),
|
|
957
|
+
kind: f.kind,
|
|
958
|
+
...(f.nodeId ? { nodeId: f.nodeId } : {}),
|
|
959
|
+
...(f.caseId ? { caseId: f.caseId } : {}),
|
|
960
|
+
...(f.tpId ? { tpId: f.tpId } : {}),
|
|
961
|
+
...(f.phase ? { phase: f.phase } : {}),
|
|
962
|
+
})),
|
|
963
|
+
outcome,
|
|
964
|
+
});
|
|
965
|
+
const relativePath = path.posix.join(outputDir, artifactName);
|
|
966
|
+
const artifactPath = await writeDagRunJsonArtifact(input.runDir, relativePath, result);
|
|
967
|
+
const serialized = `${JSON.stringify(result, null, 2)}\n`;
|
|
968
|
+
return {
|
|
969
|
+
path: artifactPath,
|
|
970
|
+
sha256: createHash("sha256").update(serialized).digest("hex"),
|
|
971
|
+
schemaId: BACKEND_TEST_RESULT_SCHEMA_ID,
|
|
972
|
+
};
|
|
973
|
+
}
|
|
974
|
+
export async function materializeBackendTestResultFromRunDir(input) {
|
|
975
|
+
if (!/^[a-z0-9][a-z0-9._-]*\.json$/.test(input.artifactName) ||
|
|
976
|
+
!/^[a-z0-9][a-z0-9._-]*$/.test(input.outputDir)) {
|
|
977
|
+
throw new Error("unsafe structured artifact path");
|
|
978
|
+
}
|
|
979
|
+
const junitRelativePath = input.junitRelativePath ?? "reports/backend-test-junit.xml";
|
|
980
|
+
const junitAbs = path.join(input.runDir, ...junitRelativePath.split("/"));
|
|
981
|
+
let junitXml = null;
|
|
982
|
+
try {
|
|
983
|
+
junitXml = await readFile(junitAbs, "utf8");
|
|
984
|
+
}
|
|
985
|
+
catch {
|
|
986
|
+
junitXml = null;
|
|
987
|
+
}
|
|
988
|
+
if (junitXml === null) {
|
|
989
|
+
throw new Error(`missing junit report at ${junitRelativePath} (fail-closed for Result v1)`);
|
|
990
|
+
}
|
|
991
|
+
if (!junitXml.trim()) {
|
|
992
|
+
throw new Error("invalid junit xml: empty report");
|
|
993
|
+
}
|
|
994
|
+
const pytestExitCode = await readPytestExitCode(input.runDir, input.fromNodeId, input.junitRelativePath?.endsWith("-junit.xml")
|
|
995
|
+
? input.junitRelativePath.replace(/-junit\.xml$/, "-pytest-exit.txt")
|
|
996
|
+
: "reports/backend-test-pytest-exit.txt");
|
|
997
|
+
const commandSummary = `PYTHONUTF8=1 PYTHONIOENCODING=utf-8 PYTHONDONTWRITEBYTECODE=1 python -m pytest ${input.testRoot ?? "testcase"}/ -v -p no:cacheprovider --junitxml=${junitRelativePath}`;
|
|
998
|
+
let result;
|
|
999
|
+
try {
|
|
1000
|
+
result = deriveBackendTestResult({
|
|
1001
|
+
pytestExitCode,
|
|
1002
|
+
junitXml,
|
|
1003
|
+
junitRelativePath,
|
|
1004
|
+
commandSummary,
|
|
1005
|
+
});
|
|
1006
|
+
}
|
|
1007
|
+
catch (error) {
|
|
1008
|
+
throw new Error(`invalid junit/report: ${error instanceof Error ? error.message : String(error)}`);
|
|
1009
|
+
}
|
|
1010
|
+
// Integrity: stored sha must match bytes we read.
|
|
1011
|
+
validateBackendTestResultJunitIntegrity(result, junitXml);
|
|
1012
|
+
const relativePath = path.posix.join(input.outputDir, input.artifactName);
|
|
1013
|
+
const artifactPath = await writeDagRunJsonArtifact(input.runDir, relativePath, result);
|
|
1014
|
+
const serialized = `${JSON.stringify(result, null, 2)}\n`;
|
|
1015
|
+
return {
|
|
1016
|
+
path: artifactPath,
|
|
1017
|
+
sha256: createHash("sha256").update(serialized).digest("hex"),
|
|
1018
|
+
schemaId: BACKEND_TEST_RESULT_SCHEMA_ID,
|
|
1019
|
+
};
|
|
1020
|
+
}
|
|
1021
|
+
/** Shell snippet for backend-test-outcome-gate-shell (result.outcome authoritative). */
|
|
1022
|
+
export function buildBackendTestOutcomeGateShellSnippet(options) {
|
|
1023
|
+
const resultRelativePath = options?.resultRelativePath ?? "contracts/backend-test-result.json";
|
|
1024
|
+
return [
|
|
1025
|
+
'test -n "${HARNESS_DAG_RUN_DIR:-}" || { echo "missing HARNESS_DAG_RUN_DIR for backend-test outcome gate" >&2; exit 2; }',
|
|
1026
|
+
`RESULT="\${HARNESS_DAG_RUN_DIR}/${resultRelativePath}"`,
|
|
1027
|
+
'test -f "${RESULT}" || { echo "missing backend-test result: ${RESULT}" >&2; exit 2; }',
|
|
1028
|
+
`node -e 'const fs=require("fs");const r=JSON.parse(fs.readFileSync(process.argv[1],"utf8"));const outcome=String(r.outcome||"");const ok=outcome==="passed"&&Number(r.failed||0)===0&&Number(r.error||0)===0;console.log("backend-test outcome="+outcome+" passed="+r.passed+" failed="+r.failed+" error="+r.error+" executionStatus="+r.executionStatus);if(!ok){process.exit(1);}' "\${RESULT}"`,
|
|
1029
|
+
].join("; ");
|
|
1030
|
+
}
|