@intentius/chant 0.124.55 → 0.124.56
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/dist/ci-agent.d.ts.map +1 -1
- package/dist/ci-agent.js +1 -2
- package/dist/ci-audit/attribution.d.ts +111 -0
- package/dist/ci-audit/attribution.d.ts.map +1 -0
- package/dist/ci-audit/attribution.js +194 -0
- package/dist/ci-audit/audit-log.d.ts +144 -0
- package/dist/ci-audit/audit-log.d.ts.map +1 -0
- package/dist/ci-audit/audit-log.js +149 -0
- package/dist/ci-audit/index.d.ts +12 -0
- package/dist/ci-audit/index.d.ts.map +1 -0
- package/dist/ci-audit/index.js +12 -0
- package/dist/ci-audit/unrecorded.d.ts +74 -0
- package/dist/ci-audit/unrecorded.d.ts.map +1 -0
- package/dist/ci-audit/unrecorded.js +95 -0
- package/dist/ci-audit.d.ts +3 -0
- package/dist/ci-audit.d.ts.map +1 -0
- package/dist/ci-audit.js +2 -0
- package/dist/ci-control.d.ts.map +1 -1
- package/dist/ci-control.js +3 -4
- package/dist/ci-estate.d.ts +24 -0
- package/dist/ci-estate.d.ts.map +1 -1
- package/dist/ci-estate.js +1 -2
- package/dist/ci-identity.d.ts.map +1 -1
- package/dist/ci-identity.js +2 -3
- package/dist/ci-job-guard.d.ts +139 -0
- package/dist/ci-job-guard.d.ts.map +1 -0
- package/dist/ci-job-guard.js +287 -0
- package/dist/ci-jobs.d.ts +7 -0
- package/dist/ci-jobs.d.ts.map +1 -1
- package/dist/ci-jobs.js +7 -0
- package/dist/ci-product-words.d.ts +7 -1
- package/dist/ci-product-words.d.ts.map +1 -1
- package/dist/ci-product-words.js +38 -4
- package/dist/ci-product.d.ts +35 -0
- package/dist/ci-product.d.ts.map +1 -1
- package/dist/ci-product.js +38 -3
- package/dist/ci-respond-run.d.ts +73 -0
- package/dist/ci-respond-run.d.ts.map +1 -0
- package/dist/ci-respond-run.js +247 -0
- package/dist/ci-respond.d.ts +189 -0
- package/dist/ci-respond.d.ts.map +1 -0
- package/dist/ci-respond.js +285 -0
- package/dist/cli/handlers/audit-log.d.ts +12 -0
- package/dist/cli/handlers/audit-log.d.ts.map +1 -0
- package/dist/cli/handlers/audit-log.js +81 -0
- package/dist/cli/handlers/build.d.ts +7 -0
- package/dist/cli/handlers/build.d.ts.map +1 -1
- package/dist/cli/handlers/build.js +81 -0
- package/dist/cli/handlers/ci-check-job.d.ts +11 -0
- package/dist/cli/handlers/ci-check-job.d.ts.map +1 -0
- package/dist/cli/handlers/ci-check-job.js +27 -0
- package/dist/cli/handlers/ci-check.d.ts.map +1 -1
- package/dist/cli/handlers/ci-check.js +38 -9
- package/dist/cli/handlers/e2e-safe-run.d.ts +12 -0
- package/dist/cli/handlers/e2e-safe-run.d.ts.map +1 -0
- package/dist/cli/handlers/e2e-safe-run.js +23 -0
- package/dist/cli/handlers/pr.d.ts +5 -0
- package/dist/cli/handlers/pr.d.ts.map +1 -1
- package/dist/cli/handlers/pr.js +259 -4
- package/dist/cli/handlers/run-wave.js +89 -1
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +56 -2
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +107 -0
- package/dist/cli/registry.d.ts +38 -0
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/components/adoption.d.ts.map +1 -1
- package/dist/components/adoption.js +1 -2
- package/dist/components/capability.d.ts +37 -0
- package/dist/components/capability.d.ts.map +1 -1
- package/dist/components/capability.js +25 -0
- package/dist/components/check-hooks.d.ts +4 -1
- package/dist/components/check-hooks.d.ts.map +1 -1
- package/dist/components/check-steps.d.ts +74 -0
- package/dist/components/check-steps.d.ts.map +1 -0
- package/dist/components/check-steps.js +102 -0
- package/dist/components/ci-services.d.ts.map +1 -1
- package/dist/components/ci-services.js +1 -2
- package/dist/components/driver.d.ts +12 -0
- package/dist/components/driver.d.ts.map +1 -1
- package/dist/components/driver.js +35 -1
- package/dist/components/groups.d.ts.map +1 -1
- package/dist/components/groups.js +4 -3
- package/dist/components/pr-env-ledger.d.ts.map +1 -1
- package/dist/components/pr-env-ledger.js +1 -2
- package/dist/components/pr-environment.d.ts +1 -1
- package/dist/components/pr-environment.d.ts.map +1 -1
- package/dist/components/pr-environment.js +1 -1
- package/dist/components/pr-pipeline.d.ts +129 -3
- package/dist/components/pr-pipeline.d.ts.map +1 -1
- package/dist/components/pr-pipeline.js +153 -17
- package/dist/components/pr-run.d.ts +8 -0
- package/dist/components/pr-run.d.ts.map +1 -1
- package/dist/components/pr-run.js +9 -4
- package/dist/components/product-pipeline.d.ts +35 -2
- package/dist/components/product-pipeline.d.ts.map +1 -1
- package/dist/components/product-pipeline.js +24 -5
- package/dist/components/wave-plan.d.ts +8 -0
- package/dist/components/wave-plan.d.ts.map +1 -1
- package/dist/components/wave-plan.js +18 -2
- package/dist/e2e-harness/bucket.d.ts +21 -0
- package/dist/e2e-harness/bucket.d.ts.map +1 -0
- package/dist/e2e-harness/bucket.js +61 -0
- package/dist/e2e-harness/claim.d.ts +70 -0
- package/dist/e2e-harness/claim.d.ts.map +1 -0
- package/dist/e2e-harness/claim.js +98 -0
- package/dist/e2e-harness/driver.d.ts +64 -0
- package/dist/e2e-harness/driver.d.ts.map +1 -0
- package/dist/e2e-harness/driver.js +243 -0
- package/dist/e2e-harness/forgejo.d.ts +77 -0
- package/dist/e2e-harness/forgejo.d.ts.map +1 -0
- package/dist/e2e-harness/forgejo.js +205 -0
- package/dist/e2e-harness/git.d.ts +32 -0
- package/dist/e2e-harness/git.d.ts.map +1 -0
- package/dist/e2e-harness/git.js +67 -0
- package/dist/e2e-harness/index.d.ts +22 -0
- package/dist/e2e-harness/index.d.ts.map +1 -0
- package/dist/e2e-harness/index.js +48 -0
- package/dist/e2e-harness/jobs.d.ts +8 -0
- package/dist/e2e-harness/jobs.d.ts.map +1 -0
- package/dist/e2e-harness/jobs.js +34 -0
- package/dist/e2e-harness/pins.d.ts +45 -0
- package/dist/e2e-harness/pins.d.ts.map +1 -0
- package/dist/e2e-harness/pins.js +44 -0
- package/dist/e2e-harness/ports.d.ts +113 -0
- package/dist/e2e-harness/ports.d.ts.map +1 -0
- package/dist/e2e-harness/ports.js +4 -0
- package/dist/e2e-harness/reports.d.ts +45 -0
- package/dist/e2e-harness/reports.d.ts.map +1 -0
- package/dist/e2e-harness/reports.js +57 -0
- package/dist/e2e-harness/safe-run-cli.d.ts +17 -0
- package/dist/e2e-harness/safe-run-cli.d.ts.map +1 -0
- package/dist/e2e-harness/safe-run-cli.js +43 -0
- package/dist/e2e-harness/safe-run.d.ts +61 -0
- package/dist/e2e-harness/safe-run.d.ts.map +1 -0
- package/dist/e2e-harness/safe-run.js +172 -0
- package/dist/e2e-harness/scenario.d.ts +11 -0
- package/dist/e2e-harness/scenario.d.ts.map +1 -0
- package/dist/e2e-harness/scenario.js +89 -0
- package/dist/e2e-harness/schemas/demo-cycle.schema.json +282 -0
- package/dist/e2e-harness/schemas/demo-step.schema.json +245 -0
- package/dist/e2e-harness/schemas/e2e-claim-row.schema.json +33 -0
- package/dist/e2e-harness/schemas/e2e-claims.schema.json +18 -0
- package/dist/e2e-harness/schemas/e2e-scenario.schema.json +150 -0
- package/dist/e2e-harness/schemas/index.d.ts +191 -0
- package/dist/e2e-harness/schemas/index.d.ts.map +1 -0
- package/dist/e2e-harness/schemas/index.js +62 -0
- package/dist/e2e-harness/stack.d.ts +124 -0
- package/dist/e2e-harness/stack.d.ts.map +1 -0
- package/dist/e2e-harness/stack.js +207 -0
- package/dist/e2e-harness/steps.d.ts +11 -0
- package/dist/e2e-harness/steps.d.ts.map +1 -0
- package/dist/e2e-harness/steps.js +22 -0
- package/dist/e2e-harness.d.ts +3 -0
- package/dist/e2e-harness.d.ts.map +1 -0
- package/dist/e2e-harness.js +2 -0
- package/dist/exit-codes.d.ts +7 -1
- package/dist/exit-codes.d.ts.map +1 -1
- package/dist/exit-codes.js +7 -1
- package/dist/lexicon.d.ts +46 -0
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/lifecycle/gate-ledger.d.ts.map +1 -1
- package/dist/lifecycle/gate-ledger.js +2 -3
- package/dist/lifecycle/gated-request.d.ts.map +1 -1
- package/dist/lifecycle/gated-request.js +1 -2
- package/dist/lifecycle/query.d.ts.map +1 -1
- package/dist/lifecycle/query.js +4 -5
- package/dist/lifecycle/release-catalog.d.ts.map +1 -1
- package/dist/lifecycle/release-catalog.js +1 -1
- package/dist/lifecycle/release-ledger.d.ts.map +1 -1
- package/dist/lifecycle/release-ledger.js +1 -2
- package/dist/lifecycle/release-status.d.ts +20 -0
- package/dist/lifecycle/release-status.d.ts.map +1 -1
- package/dist/lifecycle/release-status.js +1 -22
- package/dist/lifecycle/wave-plans.d.ts +23 -7
- package/dist/lifecycle/wave-plans.d.ts.map +1 -1
- package/dist/lifecycle/wave-plans.js +9 -2
- package/dist/op/approval-status.d.ts +103 -0
- package/dist/op/approval-status.d.ts.map +1 -0
- package/dist/op/approval-status.js +197 -0
- package/dist/op/index.d.ts +1 -1
- package/dist/op/index.d.ts.map +1 -1
- package/dist/op/index.js +1 -1
- package/dist/op/op-waves-capability-spec.d.ts +8 -0
- package/dist/op/op-waves-capability-spec.d.ts.map +1 -1
- package/dist/op/op-waves-capability-spec.js +21 -0
- package/dist/op/op-waves-release.d.ts.map +1 -1
- package/dist/op/op-waves-release.js +1 -2
- package/dist/op/op-waves-run.d.ts +7 -2
- package/dist/op/op-waves-run.d.ts.map +1 -1
- package/dist/op/op-waves-run.js +96 -4
- package/dist/op/op-waves-stand-down.d.ts.map +1 -1
- package/dist/op/op-waves-stand-down.js +1 -2
- package/dist/op/op-waves.d.ts +35 -0
- package/dist/op/op-waves.d.ts.map +1 -1
- package/dist/op/op-waves.js +46 -6
- package/dist/op/runtime.d.ts +4 -0
- package/dist/op/runtime.d.ts.map +1 -1
- package/dist/op/runtime.js +2 -3
- package/dist/otlp.d.ts.map +1 -1
- package/dist/otlp.js +1 -2
- package/dist/parallelism.d.ts +17 -0
- package/dist/parallelism.d.ts.map +1 -0
- package/dist/parallelism.js +33 -0
- package/dist/policy-source.d.ts.map +1 -1
- package/dist/policy-source.js +1 -2
- package/dist/pr-forge.d.ts.map +1 -1
- package/dist/pr-forge.js +56 -39
- package/dist/pr-loop.d.ts +9 -0
- package/dist/pr-loop.d.ts.map +1 -1
- package/dist/pr-loop.js +22 -3
- package/dist/pr-merge.d.ts +64 -0
- package/dist/pr-merge.d.ts.map +1 -0
- package/dist/pr-merge.js +78 -0
- package/dist/pr-post.d.ts +70 -1
- package/dist/pr-post.d.ts.map +1 -1
- package/dist/pr-post.js +116 -5
- package/dist/pr-report-url.d.ts.map +1 -1
- package/dist/pr-report-url.js +1 -2
- package/dist/release-floors.d.ts +1 -1
- package/dist/release-floors.js +1 -1
- package/dist/run-event.d.ts.map +1 -1
- package/dist/run-event.js +1 -2
- package/dist/scheduled-op-cloud.d.ts +32 -0
- package/dist/scheduled-op-cloud.d.ts.map +1 -0
- package/dist/scheduled-op-cloud.js +69 -0
- package/dist/wave-runtime.mjs +340 -327
- package/dist/workspace/ci-lock-grain.d.ts +5 -0
- package/dist/workspace/ci-lock-grain.d.ts.map +1 -1
- package/dist/workspace/ci-lock-grain.js +1 -7
- package/dist/workspace/ci-run.d.ts.map +1 -1
- package/dist/workspace/ci-run.js +5 -1
- package/dist/workspace/pr-report.schema.json +5 -0
- package/package.json +1 -1
- package/src/ci-agent.ts +1 -2
- package/src/ci-audit/__fixtures__/cloudtrail-lookup-bucket.json +37 -0
- package/src/ci-audit/__fixtures__/cloudtrail-writes-window.json +59 -0
- package/src/ci-audit/attribution.ts +260 -0
- package/src/ci-audit/audit-log.ts +220 -0
- package/src/ci-audit/ci-audit.test.ts +175 -0
- package/src/ci-audit/index.ts +15 -0
- package/src/ci-audit/unrecorded.ts +140 -0
- package/src/ci-audit.ts +2 -0
- package/src/ci-control.ts +3 -4
- package/src/ci-estate.ts +1 -2
- package/src/ci-identity-database.test.ts +2 -3
- package/src/ci-identity-targets.test.ts +1 -3
- package/src/ci-identity.ts +2 -3
- package/src/ci-job-guard.test.ts +154 -0
- package/src/ci-job-guard.ts +319 -0
- package/src/ci-jobs.ts +8 -0
- package/src/ci-product-comment-targets.test.ts +45 -0
- package/src/ci-product-words.ts +35 -6
- package/src/ci-product.ts +55 -3
- package/src/ci-respond-run.ts +291 -0
- package/src/ci-respond.test.ts +264 -0
- package/src/ci-respond.ts +412 -0
- package/src/cli/handlers/audit-log.ts +74 -0
- package/src/cli/handlers/build-pr-loop-flags.test.ts +98 -0
- package/src/cli/handlers/build.ts +69 -0
- package/src/cli/handlers/ci-check-job.test.ts +114 -0
- package/src/cli/handlers/ci-check-job.ts +33 -0
- package/src/cli/handlers/ci-check.ts +38 -8
- package/src/cli/handlers/e2e-safe-run.ts +27 -0
- package/src/cli/handlers/pr-plan-comment-targets.test.ts +166 -0
- package/src/cli/handlers/pr-plan-flags.test.ts +161 -0
- package/src/cli/handlers/pr.ts +228 -4
- package/src/cli/handlers/run-wave.ts +79 -1
- package/src/cli/main.test.ts +1 -1
- package/src/cli/main.ts +56 -2
- package/src/cli/parse-args.ts +77 -0
- package/src/cli/registry.ts +38 -0
- package/src/components/adoption.ts +1 -2
- package/src/components/capability.ts +50 -0
- package/src/components/check-hooks.ts +4 -1
- package/src/components/check-steps.test.ts +70 -0
- package/src/components/check-steps.ts +158 -0
- package/src/components/ci-services.ts +1 -2
- package/src/components/driver.ts +35 -1
- package/src/components/groups.ts +4 -2
- package/src/components/plan-flags.test.ts +46 -0
- package/src/components/pr-comment-preview-targets.test.ts +34 -0
- package/src/components/pr-env-ledger.ts +1 -2
- package/src/components/pr-env-run-bundle.test.ts +0 -20
- package/src/components/pr-environment.ts +1 -1
- package/src/components/pr-pipeline-runners.test.ts +80 -0
- package/src/components/pr-pipeline.ts +232 -17
- package/src/components/pr-run.ts +17 -6
- package/src/components/pr-stale-job.test.ts +34 -0
- package/src/components/product-pipeline.ts +50 -8
- package/src/components/wave-plan.ts +18 -2
- package/src/e2e-harness/__project__/chant.config.ts +4 -0
- package/src/e2e-harness/__project__/src/compose.ts +33 -0
- package/src/e2e-harness/bucket.ts +69 -0
- package/src/e2e-harness/claim.test.ts +150 -0
- package/src/e2e-harness/claim.ts +140 -0
- package/src/e2e-harness/driver.test.ts +304 -0
- package/src/e2e-harness/driver.ts +294 -0
- package/src/e2e-harness/forgejo.ts +267 -0
- package/src/e2e-harness/git.ts +96 -0
- package/src/e2e-harness/index.ts +50 -0
- package/src/e2e-harness/jobs.ts +35 -0
- package/src/e2e-harness/pins.ts +52 -0
- package/src/e2e-harness/ports.ts +130 -0
- package/src/e2e-harness/reports.ts +79 -0
- package/src/e2e-harness/safe-run-cli.test.ts +102 -0
- package/src/e2e-harness/safe-run-cli.ts +54 -0
- package/src/e2e-harness/safe-run.ts +198 -0
- package/src/e2e-harness/scenario.ts +89 -0
- package/src/e2e-harness/schemas/README.md +62 -0
- package/src/e2e-harness/schemas/demo-cycle.schema.json +282 -0
- package/src/e2e-harness/schemas/demo-step.schema.json +245 -0
- package/src/e2e-harness/schemas/e2e-claim-row.schema.json +33 -0
- package/src/e2e-harness/schemas/e2e-claims.schema.json +18 -0
- package/src/e2e-harness/schemas/e2e-scenario.schema.json +150 -0
- package/src/e2e-harness/schemas/index.ts +220 -0
- package/src/e2e-harness/schemas.test.ts +145 -0
- package/src/e2e-harness/stack.test.ts +124 -0
- package/src/e2e-harness/stack.ts +306 -0
- package/src/e2e-harness/steps.ts +30 -0
- package/src/e2e-harness.ts +2 -0
- package/src/exit-codes.test.ts +3 -2
- package/src/exit-codes.ts +7 -1
- package/src/gate-decision-bundle.test.ts +0 -2
- package/src/lexicon.ts +48 -0
- package/src/lifecycle/control-entries-ledger.test.ts +2 -3
- package/src/lifecycle/gate-ledger.ts +2 -3
- package/src/lifecycle/gated-request.ts +1 -2
- package/src/lifecycle/query.ts +4 -5
- package/src/lifecycle/release-catalog.test.ts +3 -4
- package/src/lifecycle/release-catalog.ts +1 -1
- package/src/lifecycle/release-ledger.ts +1 -2
- package/src/lifecycle/release-status.test.ts +3 -4
- package/src/lifecycle/release-status.ts +1 -2
- package/src/lifecycle/wave-plans.ts +33 -5
- package/src/op/approval-status.test.ts +134 -0
- package/src/op/approval-status.ts +235 -0
- package/src/op/gate-review.test.ts +2 -1
- package/src/op/index.ts +2 -0
- package/src/op/op-waves-after-plan.test.ts +12 -0
- package/src/op/op-waves-capability-spec.ts +20 -0
- package/src/op/op-waves-parallelism.test.ts +89 -0
- package/src/op/op-waves-pull-request.test.ts +78 -1
- package/src/op/op-waves-release.ts +1 -2
- package/src/op/op-waves-run.ts +94 -4
- package/src/op/op-waves-stand-down.ts +1 -2
- package/src/op/op-waves.ts +63 -6
- package/src/op/runtime.ts +6 -3
- package/src/otlp.ts +1 -2
- package/src/parallelism.test.ts +38 -0
- package/src/parallelism.ts +33 -0
- package/src/policy-source.ts +1 -2
- package/src/pr-forge-bundle.test.ts +1 -1
- package/src/pr-forge.ts +54 -35
- package/src/pr-loop-bundle.test.ts +1 -1
- package/src/pr-loop-narrowed.test.ts +63 -0
- package/src/pr-loop.ts +30 -3
- package/src/pr-merge.test.ts +100 -0
- package/src/pr-merge.ts +105 -0
- package/src/pr-post-stale.test.ts +163 -0
- package/src/pr-post.ts +159 -5
- package/src/pr-report-url.ts +1 -2
- package/src/product-subpaths-plain-node.e2e.test.ts +1 -0
- package/src/release-floors.ts +1 -1
- package/src/run-event.ts +1 -2
- package/src/scheduled-op-cloud.ts +68 -0
- package/src/stage-hooks-bundle.test.ts +0 -2
- package/src/workspace/ci-lock-grain.ts +1 -2
- package/src/workspace/ci-run.ts +5 -1
- package/src/workspace/pr-report.schema.json +5 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://intentius.io/chant/schemas/e2e-harness/e2e-scenario/v1/e2e-scenario.schema.json",
|
|
4
|
+
"title": "e2e harness scenario",
|
|
5
|
+
"description": "One scenario of the e2e harness (chant#4587): a repo tree, the pull request steps the driver takes in order, and the outcomes each step must show, read from chant's own reports and run ledger. A scenario proves one claim, with a plain run that must pass and a BREAK arm that must be caught. Version 1: a field is only ever added within contract 1, and a new field is optional.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["$schema", "contract", "id", "product", "claim", "tree", "reportUrl", "steps", "break"],
|
|
8
|
+
"additionalProperties": false,
|
|
9
|
+
"properties": {
|
|
10
|
+
"$schema": { "const": "https://intentius.io/chant/schemas/e2e-harness/e2e-scenario/v1/e2e-scenario.schema.json" },
|
|
11
|
+
"contract": { "const": 1 },
|
|
12
|
+
"id": { "$ref": "#/$defs/name", "description": "The scenario's id, such as tg-estate-overlap. Rows cite it." },
|
|
13
|
+
"product": { "$ref": "#/$defs/name", "description": "The product that drives it: terragucci, plywood, sql-yodeler, or chant for its own demo." },
|
|
14
|
+
"claim": { "type": "string", "minLength": 1, "description": "The claim id the scenario records a row for." },
|
|
15
|
+
"title": { "type": "string" },
|
|
16
|
+
"tree": {
|
|
17
|
+
"type": "object",
|
|
18
|
+
"description": "The repo the forge serves: a base tree, and the overlays the steps copy over it. Paths are relative to the scenario file.",
|
|
19
|
+
"required": ["base"],
|
|
20
|
+
"additionalProperties": false,
|
|
21
|
+
"properties": {
|
|
22
|
+
"base": { "type": "string", "minLength": 1 },
|
|
23
|
+
"overlays": { "type": "string", "minLength": 1 }
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"env": { "type": "string", "description": "The chant environment the pipeline runs (--env), which the ledger records runs under. Default local." },
|
|
27
|
+
"reportUrl": { "type": "string", "pattern": "^s3://[^/]+/.+", "description": "The pipeline's --report-url, where pr-plan.json and pr-apply.json land." },
|
|
28
|
+
"limits": {
|
|
29
|
+
"type": "object",
|
|
30
|
+
"description": "Seconds each kind of step may take, over the harness's defaults.",
|
|
31
|
+
"propertyNames": { "$ref": "#/$defs/do" },
|
|
32
|
+
"additionalProperties": { "type": "integer", "minimum": 1 }
|
|
33
|
+
},
|
|
34
|
+
"steps": {
|
|
35
|
+
"type": "array",
|
|
36
|
+
"minItems": 1,
|
|
37
|
+
"items": { "$ref": "#/$defs/step" }
|
|
38
|
+
},
|
|
39
|
+
"break": {
|
|
40
|
+
"type": "object",
|
|
41
|
+
"description": "The BREAK arm: the same steps with the claim's subject broken. The run must be caught, meaning one of the outcomes does not hold. env carries BREAK=1 to the pipeline; an overlay may stand in for or add to it.",
|
|
42
|
+
"required": ["env"],
|
|
43
|
+
"additionalProperties": false,
|
|
44
|
+
"properties": {
|
|
45
|
+
"env": {
|
|
46
|
+
"type": "object",
|
|
47
|
+
"required": ["BREAK"],
|
|
48
|
+
"properties": { "BREAK": { "const": "1" } },
|
|
49
|
+
"additionalProperties": { "type": "string" }
|
|
50
|
+
},
|
|
51
|
+
"overlay": { "type": "string", "minLength": 1, "description": "An overlay copied over every pull request of the break run, after the step's own." },
|
|
52
|
+
"note": { "type": "string", "description": "What the break changes, in a sentence." }
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"$defs": {
|
|
57
|
+
"name": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]*$" },
|
|
58
|
+
"do": { "enum": ["open", "open-concurrent", "plan", "approve", "merge", "apply", "out-of-band", "kill-job"] },
|
|
59
|
+
"step": {
|
|
60
|
+
"type": "object",
|
|
61
|
+
"required": ["id", "do"],
|
|
62
|
+
"properties": {
|
|
63
|
+
"id": { "$ref": "#/$defs/name" },
|
|
64
|
+
"do": { "$ref": "#/$defs/do" },
|
|
65
|
+
"label": { "type": "string" },
|
|
66
|
+
"expect": { "type": "array", "items": { "$ref": "#/$defs/outcome" } }
|
|
67
|
+
},
|
|
68
|
+
"oneOf": [
|
|
69
|
+
{
|
|
70
|
+
"type": "object",
|
|
71
|
+
"properties": {
|
|
72
|
+
"do": { "enum": ["open", "open-concurrent"] },
|
|
73
|
+
"branch": { "type": "string", "minLength": 1 },
|
|
74
|
+
"overlay": { "type": "string", "minLength": 1 },
|
|
75
|
+
"title": { "type": "string", "minLength": 1 },
|
|
76
|
+
"body": { "type": "string" }
|
|
77
|
+
},
|
|
78
|
+
"required": ["branch", "overlay", "title"]
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"type": "object",
|
|
82
|
+
"properties": {
|
|
83
|
+
"do": { "enum": ["plan", "approve", "merge"] },
|
|
84
|
+
"pull": { "$ref": "#/$defs/name", "description": "The id of the open step whose pull request this is." }
|
|
85
|
+
},
|
|
86
|
+
"required": ["pull"]
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"type": "object",
|
|
90
|
+
"properties": {
|
|
91
|
+
"do": { "const": "apply" },
|
|
92
|
+
"merge": { "$ref": "#/$defs/name", "description": "The id of the merge step whose commit the apply runs on." }
|
|
93
|
+
},
|
|
94
|
+
"required": ["merge"]
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"type": "object",
|
|
98
|
+
"properties": {
|
|
99
|
+
"do": { "const": "out-of-band" },
|
|
100
|
+
"command": { "type": "array", "minItems": 1, "items": { "type": "string" } }
|
|
101
|
+
},
|
|
102
|
+
"required": ["command"]
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"type": "object",
|
|
106
|
+
"properties": {
|
|
107
|
+
"do": { "const": "kill-job" },
|
|
108
|
+
"match": { "type": "string", "minLength": 1, "description": "Part of the job container's name; the newest running job when absent." }
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
]
|
|
112
|
+
},
|
|
113
|
+
"outcome": {
|
|
114
|
+
"type": "object",
|
|
115
|
+
"description": "One thing a step must show. report reads the step's pr-plan.json or pr-apply.json; ledger reads the run records the scenario added; comment and issue read the forge; exit is an out-of-band command's exit code.",
|
|
116
|
+
"minProperties": 1,
|
|
117
|
+
"maxProperties": 1,
|
|
118
|
+
"additionalProperties": false,
|
|
119
|
+
"properties": {
|
|
120
|
+
"report": {
|
|
121
|
+
"type": "object",
|
|
122
|
+
"additionalProperties": false,
|
|
123
|
+
"properties": {
|
|
124
|
+
"status": { "type": "string" },
|
|
125
|
+
"components": { "type": "object", "additionalProperties": { "type": "string" } },
|
|
126
|
+
"only": { "type": "boolean", "description": "components names every component the report has." }
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
"ledger": {
|
|
130
|
+
"type": "object",
|
|
131
|
+
"required": ["op"],
|
|
132
|
+
"additionalProperties": false,
|
|
133
|
+
"properties": {
|
|
134
|
+
"op": { "type": "string" },
|
|
135
|
+
"status": { "enum": ["ok", "fail", "gated", "waiting"] },
|
|
136
|
+
"count": { "type": "integer", "minimum": 0 }
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
"comment": { "type": "string", "minLength": 1, "description": "Text one of the step's pull request comments holds." },
|
|
140
|
+
"issue": {
|
|
141
|
+
"type": "object",
|
|
142
|
+
"required": ["title"],
|
|
143
|
+
"additionalProperties": false,
|
|
144
|
+
"properties": { "title": { "type": "string", "minLength": 1 }, "open": { "type": "boolean" } }
|
|
145
|
+
},
|
|
146
|
+
"exit": { "type": "integer" }
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The e2e harness's contracts (chant#4587) and their validators: the fan-out
|
|
3
|
+
* demo's demo-step/v1 and demo-cycle/v1 (#4085 section 3, #4092, moved here
|
|
4
|
+
* from examples/fan-out-estate/demo/schemas), and the harness's own
|
|
5
|
+
* e2e-scenario/v1, e2e-claim-row/v1 and e2e-claims/v1. The schemas are the
|
|
6
|
+
* source of truth; the types follow them.
|
|
7
|
+
*/
|
|
8
|
+
import { createRequire } from "node:module";
|
|
9
|
+
import { loadAjv2020 } from "../../workspace/ajv2020";
|
|
10
|
+
|
|
11
|
+
const require = createRequire(import.meta.url);
|
|
12
|
+
const stepSchema = require("./demo-step.schema.json") as object;
|
|
13
|
+
const cycleSchema = require("./demo-cycle.schema.json") as object;
|
|
14
|
+
const scenarioSchema = require("./e2e-scenario.schema.json") as object;
|
|
15
|
+
const claimRowSchema = require("./e2e-claim-row.schema.json") as object;
|
|
16
|
+
const claimsSchema = require("./e2e-claims.schema.json") as object;
|
|
17
|
+
|
|
18
|
+
export const DEMO_STEP_SCHEMA = "https://intentius.io/chant/schemas/demo/demo-step/v1/demo-step.schema.json";
|
|
19
|
+
export const DEMO_CYCLE_SCHEMA = "https://intentius.io/chant/schemas/demo/demo-cycle/v1/demo-cycle.schema.json";
|
|
20
|
+
export const E2E_SCENARIO_SCHEMA = "https://intentius.io/chant/schemas/e2e-harness/e2e-scenario/v1/e2e-scenario.schema.json";
|
|
21
|
+
export const E2E_CLAIM_ROW_SCHEMA = "https://intentius.io/chant/schemas/e2e-harness/e2e-claim-row/v1/e2e-claim-row.schema.json";
|
|
22
|
+
export const E2E_CLAIMS_SCHEMA = "https://intentius.io/chant/schemas/e2e-harness/e2e-claims/v1/e2e-claims.schema.json";
|
|
23
|
+
|
|
24
|
+
// ── demo-step/v1 and demo-cycle/v1 ────────────────────────────────────
|
|
25
|
+
|
|
26
|
+
export const DEMO_STEPS = [
|
|
27
|
+
"pull-request",
|
|
28
|
+
"planned",
|
|
29
|
+
"waiting",
|
|
30
|
+
"approved",
|
|
31
|
+
"merged",
|
|
32
|
+
"applying",
|
|
33
|
+
"failed",
|
|
34
|
+
"resumed",
|
|
35
|
+
"applied",
|
|
36
|
+
"reset",
|
|
37
|
+
"stalled",
|
|
38
|
+
] as const;
|
|
39
|
+
|
|
40
|
+
export type DemoStepName = (typeof DEMO_STEPS)[number];
|
|
41
|
+
|
|
42
|
+
export interface DemoChapter {
|
|
43
|
+
n: number;
|
|
44
|
+
of: number;
|
|
45
|
+
headline: string;
|
|
46
|
+
short: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Keys are reportKey(pr, commit) from pr-report-url.ts, below `url`. */
|
|
50
|
+
export interface DemoReports {
|
|
51
|
+
url: string;
|
|
52
|
+
plan?: string;
|
|
53
|
+
apply?: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** A call-out a viewer may show as a modal at the step. */
|
|
57
|
+
export interface DemoHighlight {
|
|
58
|
+
title: string;
|
|
59
|
+
body: string;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface DemoStep {
|
|
63
|
+
$schema: string;
|
|
64
|
+
contract: 1;
|
|
65
|
+
demo: string;
|
|
66
|
+
cycle: number;
|
|
67
|
+
step: DemoStepName;
|
|
68
|
+
repo?: string;
|
|
69
|
+
scenario?: string;
|
|
70
|
+
name?: string;
|
|
71
|
+
title?: string;
|
|
72
|
+
label?: string;
|
|
73
|
+
highlight?: DemoHighlight | null;
|
|
74
|
+
chapter?: DemoChapter | null;
|
|
75
|
+
started_at?: string;
|
|
76
|
+
at?: string;
|
|
77
|
+
next?: { action?: string; from?: string; at?: string };
|
|
78
|
+
pull?: number | null;
|
|
79
|
+
commit?: string;
|
|
80
|
+
reports?: DemoReports;
|
|
81
|
+
cycle_reports?: DemoCycleReport[];
|
|
82
|
+
about?: { changes?: string; watch?: string; shows?: string };
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface DemoCycleStep extends Omit<DemoStep, "$schema" | "contract" | "demo" | "cycle" | "at"> {
|
|
86
|
+
$schema?: string;
|
|
87
|
+
contract?: 1;
|
|
88
|
+
demo?: string;
|
|
89
|
+
cycle?: number;
|
|
90
|
+
at: string;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface DemoCycleReport {
|
|
94
|
+
stage: "plan" | "apply";
|
|
95
|
+
pr: number;
|
|
96
|
+
commit: string;
|
|
97
|
+
key: string;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface DemoCycle {
|
|
101
|
+
$schema: string;
|
|
102
|
+
contract: 1;
|
|
103
|
+
demo: string;
|
|
104
|
+
cycle: number;
|
|
105
|
+
repo?: string;
|
|
106
|
+
started?: string;
|
|
107
|
+
ended?: string;
|
|
108
|
+
steps: DemoCycleStep[];
|
|
109
|
+
reports?: DemoCycleReport[];
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// ── e2e-scenario/v1 ───────────────────────────────────────────────────
|
|
113
|
+
|
|
114
|
+
export const SCENARIO_STEP_KINDS = ["open", "open-concurrent", "plan", "approve", "merge", "apply", "out-of-band", "kill-job"] as const;
|
|
115
|
+
export type ScenarioStepKind = (typeof SCENARIO_STEP_KINDS)[number];
|
|
116
|
+
|
|
117
|
+
/** One thing a step must show. Exactly one key is set. */
|
|
118
|
+
export type ScenarioOutcome =
|
|
119
|
+
| { report: { status?: string; components?: Record<string, string>; only?: boolean } }
|
|
120
|
+
| { ledger: { op: string; status?: "ok" | "fail" | "gated" | "waiting"; count?: number } }
|
|
121
|
+
| { comment: string }
|
|
122
|
+
| { issue: { title: string; open?: boolean } }
|
|
123
|
+
| { exit: number };
|
|
124
|
+
|
|
125
|
+
interface StepBase {
|
|
126
|
+
id: string;
|
|
127
|
+
label?: string;
|
|
128
|
+
expect?: ScenarioOutcome[];
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export type ScenarioStep =
|
|
132
|
+
| (StepBase & { do: "open" | "open-concurrent"; branch: string; overlay: string; title: string; body?: string })
|
|
133
|
+
| (StepBase & { do: "plan" | "approve" | "merge"; pull: string })
|
|
134
|
+
| (StepBase & { do: "apply"; merge: string })
|
|
135
|
+
| (StepBase & { do: "out-of-band"; command: string[] })
|
|
136
|
+
| (StepBase & { do: "kill-job"; match?: string });
|
|
137
|
+
|
|
138
|
+
export interface Scenario {
|
|
139
|
+
$schema: string;
|
|
140
|
+
contract: 1;
|
|
141
|
+
id: string;
|
|
142
|
+
product: string;
|
|
143
|
+
claim: string;
|
|
144
|
+
title?: string;
|
|
145
|
+
tree: { base: string; overlays?: string };
|
|
146
|
+
env?: string;
|
|
147
|
+
reportUrl: string;
|
|
148
|
+
limits?: Partial<Record<ScenarioStepKind, number>>;
|
|
149
|
+
steps: ScenarioStep[];
|
|
150
|
+
break: { env: { BREAK: "1" } & Record<string, string>; overlay?: string; note?: string };
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// ── e2e-claim-row/v1 and e2e-claims/v1 ────────────────────────────────
|
|
154
|
+
|
|
155
|
+
export type PlainVerdict = "pass" | "fail";
|
|
156
|
+
export type BreakVerdict = "caught" | "missed" | "stalled";
|
|
157
|
+
|
|
158
|
+
export interface ClaimRow {
|
|
159
|
+
$schema: string;
|
|
160
|
+
contract: 1;
|
|
161
|
+
product: string;
|
|
162
|
+
productCommit: string;
|
|
163
|
+
scenario: string;
|
|
164
|
+
claim: string;
|
|
165
|
+
engine: { binary: string; version: string };
|
|
166
|
+
floci: string;
|
|
167
|
+
chant?: string;
|
|
168
|
+
date: string;
|
|
169
|
+
plain: PlainVerdict;
|
|
170
|
+
break: BreakVerdict;
|
|
171
|
+
safeRun: "CLEAN";
|
|
172
|
+
runUrl?: string;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export interface ClaimsDoc {
|
|
176
|
+
$schema: string;
|
|
177
|
+
contract: 1;
|
|
178
|
+
product: string;
|
|
179
|
+
rows: ClaimRow[];
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// ── validators ────────────────────────────────────────────────────────
|
|
183
|
+
|
|
184
|
+
export type Validation<T> = { ok: true; value: T } | { ok: false; errors: string[] };
|
|
185
|
+
|
|
186
|
+
type ValidateFn = ((data: unknown) => boolean) & {
|
|
187
|
+
errors?: { instancePath: string; message?: string }[] | null;
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
interface AjvInstance {
|
|
191
|
+
addSchema(schema: object): unknown;
|
|
192
|
+
getSchema(id: string): unknown;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
let ajv: AjvInstance | undefined;
|
|
196
|
+
|
|
197
|
+
function validatorFor(id: string): ValidateFn {
|
|
198
|
+
if (!ajv) {
|
|
199
|
+
const Ajv = loadAjv2020();
|
|
200
|
+
const made = new Ajv({ allErrors: true, strict: true }) as unknown as AjvInstance;
|
|
201
|
+
for (const s of [stepSchema, cycleSchema, scenarioSchema, claimRowSchema, claimsSchema]) made.addSchema(s);
|
|
202
|
+
ajv = made;
|
|
203
|
+
}
|
|
204
|
+
const fn = ajv.getSchema(id) as ValidateFn | undefined;
|
|
205
|
+
if (!fn) throw new Error(`no schema ${id}`);
|
|
206
|
+
return fn;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
function check<T>(id: string, data: unknown): Validation<T> {
|
|
210
|
+
const fn = validatorFor(id);
|
|
211
|
+
if (fn(data)) return { ok: true, value: data as T };
|
|
212
|
+
const errors = (fn.errors ?? []).map((e) => `${e.instancePath || "/"} ${e.message ?? "is invalid"}`);
|
|
213
|
+
return { ok: false, errors };
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export const validateDemoStep = (data: unknown): Validation<DemoStep> => check(DEMO_STEP_SCHEMA, data);
|
|
217
|
+
export const validateDemoCycle = (data: unknown): Validation<DemoCycle> => check(DEMO_CYCLE_SCHEMA, data);
|
|
218
|
+
export const validateScenario = (data: unknown): Validation<Scenario> => check(E2E_SCENARIO_SCHEMA, data);
|
|
219
|
+
export const validateClaimRow = (data: unknown): Validation<ClaimRow> => check(E2E_CLAIM_ROW_SCHEMA, data);
|
|
220
|
+
export const validateClaims = (data: unknown): Validation<ClaimsDoc> => check(E2E_CLAIMS_SCHEMA, data);
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The harness's contracts (chant#4587): e2e-scenario/v1 and its lint, which
|
|
3
|
+
* refuses a scenario with no claim id or no BREAK arm, and e2e-claim-row/v1
|
|
4
|
+
* and e2e-claims/v1. demo-step/v1 and demo-cycle/v1 keep their own tests in
|
|
5
|
+
* examples/fan-out-estate/demo/schemas/index.test.ts.
|
|
6
|
+
*/
|
|
7
|
+
import { describe, expect, test } from "vitest";
|
|
8
|
+
import { lintScenario } from "./scenario";
|
|
9
|
+
import {
|
|
10
|
+
E2E_CLAIMS_SCHEMA,
|
|
11
|
+
E2E_CLAIM_ROW_SCHEMA,
|
|
12
|
+
E2E_SCENARIO_SCHEMA,
|
|
13
|
+
validateClaimRow,
|
|
14
|
+
validateClaims,
|
|
15
|
+
validateDemoStep,
|
|
16
|
+
validateScenario,
|
|
17
|
+
type ClaimRow,
|
|
18
|
+
} from "./schemas/index";
|
|
19
|
+
import { FLOCI_DIGEST } from "./pins";
|
|
20
|
+
|
|
21
|
+
const scenario = (): Record<string, unknown> => ({
|
|
22
|
+
$schema: E2E_SCENARIO_SCHEMA,
|
|
23
|
+
contract: 1,
|
|
24
|
+
id: "tg-estate-overlap",
|
|
25
|
+
product: "terragucci",
|
|
26
|
+
claim: "choudoufu/rows-overlap",
|
|
27
|
+
tree: { base: "trees/estate", overlays: "trees/overlays" },
|
|
28
|
+
reportUrl: "s3://terragucci-e2e/estate/reports",
|
|
29
|
+
steps: [
|
|
30
|
+
{ id: "one", do: "open", branch: "e2e/one", overlay: "one", title: "One" },
|
|
31
|
+
{ id: "two", do: "open-concurrent", branch: "e2e/two", overlay: "two", title: "Two" },
|
|
32
|
+
{ id: "one-plan", do: "plan", pull: "one", expect: [{ report: { status: "planned" } }] },
|
|
33
|
+
{ id: "one-merge", do: "merge", pull: "one" },
|
|
34
|
+
{ id: "one-apply", do: "apply", merge: "one-merge", expect: [{ report: { status: "applied", components: { a: "applied" }, only: true } }] },
|
|
35
|
+
],
|
|
36
|
+
break: { env: { BREAK: "1" }, note: "the second apply takes the first's rows" },
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const at = (findings: { at: string; message: string }[]) => findings.map((f) => f.at);
|
|
40
|
+
|
|
41
|
+
describe("e2e-scenario/v1 and its lint", () => {
|
|
42
|
+
test("a scenario with a claim, steps that expect something and a BREAK arm lints clean", () => {
|
|
43
|
+
expect(validateScenario(scenario()).ok).toBe(true);
|
|
44
|
+
expect(lintScenario(scenario())).toEqual([]);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test("refuses a scenario with no claim id", () => {
|
|
48
|
+
const s = scenario();
|
|
49
|
+
delete s.claim;
|
|
50
|
+
expect(lintScenario(s)).toContainEqual({ at: "/claim", message: "the scenario has no claim id, so its run would record a row for nothing" });
|
|
51
|
+
expect(lintScenario({ ...scenario(), claim: " " }).map((f) => f.at)).toContain("/claim");
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test("refuses a scenario with no BREAK arm, or one that does not set BREAK=1", () => {
|
|
55
|
+
const s = scenario();
|
|
56
|
+
delete s.break;
|
|
57
|
+
expect(lintScenario(s)).toContainEqual({ at: "/break", message: "the scenario has no BREAK arm, so nothing shows its outcomes can fail" });
|
|
58
|
+
expect(at(lintScenario({ ...scenario(), break: { env: { BREAK: "0" } } }))).toContain("/break/env/BREAK");
|
|
59
|
+
expect(at(lintScenario({ ...scenario(), break: { overlay: "broken" } }))).toContain("/break/env/BREAK");
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
test("refuses steps that name a pull request or a merge no earlier step made", () => {
|
|
63
|
+
const s = scenario();
|
|
64
|
+
const steps = s.steps as Array<Record<string, unknown>>;
|
|
65
|
+
steps[2] = { id: "one-plan", do: "plan", pull: "nobody", expect: [{ report: { status: "planned" } }] };
|
|
66
|
+
steps[4] = { id: "one-apply", do: "apply", merge: "one", expect: [{ exit: 0 }] };
|
|
67
|
+
const findings = lintScenario(s);
|
|
68
|
+
expect(findings).toContainEqual({ at: "/steps/2/pull", message: "plan names nobody, which is not an earlier open step" });
|
|
69
|
+
expect(findings).toContainEqual({ at: "/steps/4/merge", message: "apply names one, which is not an earlier merge step" });
|
|
70
|
+
expect(findings).toContainEqual({ at: "/steps/4/expect/0", message: "an exit outcome belongs on an out-of-band step" });
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
test("refuses a scenario that checks nothing, a repeated id and a lone open-concurrent", () => {
|
|
74
|
+
const s = scenario();
|
|
75
|
+
s.steps = [
|
|
76
|
+
{ id: "x", do: "open-concurrent", branch: "x", overlay: "x", title: "X" },
|
|
77
|
+
{ id: "x", do: "kill-job" },
|
|
78
|
+
];
|
|
79
|
+
expect(lintScenario(s)).toEqual([
|
|
80
|
+
{ at: "/steps/0/do", message: "open-concurrent opens beside the step before it, which must be an open" },
|
|
81
|
+
{ at: "/steps/1/id", message: "step id x is used twice" },
|
|
82
|
+
{ at: "/steps", message: "no step expects anything, so the plain run would pass and the BREAK run could never be caught" },
|
|
83
|
+
]);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
test("the schema refuses an unknown step, a step missing its fields and an outcome with two keys", () => {
|
|
87
|
+
for (const bad of [
|
|
88
|
+
{ id: "s", do: "deploy" },
|
|
89
|
+
{ id: "s", do: "open", branch: "b", title: "T" },
|
|
90
|
+
{ id: "s", do: "plan", pull: "one", expect: [{ exit: 0, comment: "x" }] },
|
|
91
|
+
]) {
|
|
92
|
+
const s = scenario();
|
|
93
|
+
(s.steps as unknown[]).push(bad);
|
|
94
|
+
expect(validateScenario(s).ok, JSON.stringify(bad)).toBe(false);
|
|
95
|
+
expect(lintScenario(s).length).toBeGreaterThan(0);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
const row = (over: Partial<ClaimRow> = {}): ClaimRow => ({
|
|
101
|
+
$schema: E2E_CLAIM_ROW_SCHEMA,
|
|
102
|
+
contract: 1,
|
|
103
|
+
product: "terragucci",
|
|
104
|
+
productCommit: "e962b2c0000000000000000000000000000000aa",
|
|
105
|
+
scenario: "tg-estate-overlap",
|
|
106
|
+
claim: "choudoufu/rows-overlap",
|
|
107
|
+
engine: { binary: "choudoufu", version: "0.31.0" },
|
|
108
|
+
floci: FLOCI_DIGEST,
|
|
109
|
+
date: "2026-10-28",
|
|
110
|
+
plain: "pass",
|
|
111
|
+
break: "caught",
|
|
112
|
+
safeRun: "CLEAN",
|
|
113
|
+
...over,
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
describe("e2e-claim-row/v1 and e2e-claims/v1", () => {
|
|
117
|
+
test("a row carries the product and its commit, the engine binary and version, the floci digest, the date and both verdicts", () => {
|
|
118
|
+
expect(validateClaimRow(row())).toEqual({ ok: true, value: row() });
|
|
119
|
+
const required = (JSON.parse(JSON.stringify(row())) as Record<string, unknown>);
|
|
120
|
+
for (const k of ["product", "productCommit", "engine", "floci", "date", "plain", "break", "safeRun"]) {
|
|
121
|
+
const r = { ...required };
|
|
122
|
+
delete r[k];
|
|
123
|
+
expect(validateClaimRow(r).ok, k).toBe(false);
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
test("refuses a short commit, a tag in place of a digest, a verdict it does not know and a scan that was not CLEAN", () => {
|
|
128
|
+
expect(validateClaimRow(row({ productCommit: "e962b2c" })).ok).toBe(false);
|
|
129
|
+
expect(validateClaimRow(row({ floci: "63d8f1ed" })).ok).toBe(false);
|
|
130
|
+
expect(validateClaimRow({ ...row(), plain: "ok" }).ok).toBe(false);
|
|
131
|
+
expect(validateClaimRow({ ...row(), safeRun: "REAL-CLOUD" }).ok).toBe(false);
|
|
132
|
+
expect(validateClaimRow({ ...row(), date: "28 Oct 2026" }).ok).toBe(false);
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
test("a product's claims are its rows", () => {
|
|
136
|
+
expect(validateClaims({ $schema: E2E_CLAIMS_SCHEMA, contract: 1, product: "terragucci", rows: [row()] }).ok).toBe(true);
|
|
137
|
+
expect(validateClaims({ $schema: E2E_CLAIMS_SCHEMA, contract: 1, product: "terragucci", rows: [{ ...row(), break: "maybe" }] }).ok).toBe(false);
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
test("demo-step/v1 validates from the harness as it did from the demo", () => {
|
|
141
|
+
const step = { $schema: "https://intentius.io/chant/schemas/demo/demo-step/v1/demo-step.schema.json", contract: 1, demo: "fan-out-estate", cycle: 1, step: "planned" };
|
|
142
|
+
expect(validateDemoStep(step).ok).toBe(true);
|
|
143
|
+
expect(validateDemoStep({ ...step, step: "exploded" }).ok).toBe(false);
|
|
144
|
+
});
|
|
145
|
+
});
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The harness's compose project (chant#4587): the services harnessStack
|
|
3
|
+
* gives, the one pin file they read, the runner's config, and ./project/
|
|
4
|
+
* built with `chant build` on the docker lexicon. Nothing here starts a
|
|
5
|
+
* container.
|
|
6
|
+
*/
|
|
7
|
+
import { mkdtempSync, readFileSync, rmSync } from "node:fs";
|
|
8
|
+
import { tmpdir } from "node:os";
|
|
9
|
+
import { join, resolve } from "node:path";
|
|
10
|
+
import { load } from "js-yaml";
|
|
11
|
+
import { afterAll, beforeAll, describe, expect, test } from "vitest";
|
|
12
|
+
import { runCommandInProcess } from "../cli/main";
|
|
13
|
+
import { harnessProjectDir } from "./index";
|
|
14
|
+
import { pickJobContainer } from "./jobs";
|
|
15
|
+
import { CLICKHOUSE_IMAGE, FLOCI_CHANGE_SET_IMAGE, FLOCI_DIGEST, FLOCI_IMAGE, FORGEJO_IMAGE, FORGEJO_RUNNER_IMAGE, POSTGRES_IMAGE } from "./pins";
|
|
16
|
+
import { forgejoRunnerConfig, harnessStack, harnessUrls } from "./stack";
|
|
17
|
+
|
|
18
|
+
const repo = resolve(import.meta.dirname, "..", "..", "..", "..");
|
|
19
|
+
const tmp = mkdtempSync(join(tmpdir(), "chant-e2e-stack-test-"));
|
|
20
|
+
afterAll(() => rmSync(tmp, { recursive: true, force: true }));
|
|
21
|
+
|
|
22
|
+
describe("the harness's pins", () => {
|
|
23
|
+
test("floci is held at 5ec92ae8, the build choudoufu and plunge pin (lex00/floci#265 for the move)", () => {
|
|
24
|
+
expect(FLOCI_DIGEST).toBe("sha256:5ec92ae8046445d62c0009590dd09f04560886e5a5ef31248cb3fcc09b2961ec");
|
|
25
|
+
expect(FLOCI_IMAGE).toBe(`ghcr.io/lex00/floci@${FLOCI_DIGEST}`);
|
|
26
|
+
expect(FLOCI_CHANGE_SET_IMAGE).toContain("sha256:63d8f1ed");
|
|
27
|
+
expect(readFileSync(join(import.meta.dirname, "pins.ts"), "utf8")).toContain("lex00/floci#265");
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
test("Forgejo 16.0.5 and forgejo-runner 13.2.0", () => {
|
|
31
|
+
expect(FORGEJO_IMAGE).toBe("codeberg.org/forgejo/forgejo:16.0.5");
|
|
32
|
+
expect(FORGEJO_RUNNER_IMAGE).toBe("data.forgejo.org/forgejo/runner:13.2.0");
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
test("the sql servers are the ones the sql lexicon pins", () => {
|
|
36
|
+
const pin = readFileSync(join(repo, "lexicons", "sql", "src", "spec", "pin.ts"), "utf8");
|
|
37
|
+
const version = /CLICKHOUSE_VERSION = "([^"]+)"/.exec(pin)![1];
|
|
38
|
+
const digest = /CLICKHOUSE_IMAGE_DIGEST = "([^"]+)"/.exec(pin)![1];
|
|
39
|
+
expect(CLICKHOUSE_IMAGE).toBe(`clickhouse/clickhouse-server:${version}@${digest}`);
|
|
40
|
+
const pg = readFileSync(join(repo, "lexicons", "sql", "src", "spec", "postgres-pin.ts"), "utf8");
|
|
41
|
+
const [, pgVersion, pgDigest] = /major: 18, version: "([^"]+)", digest: "([^"]+)"/.exec(pg)!;
|
|
42
|
+
expect(POSTGRES_IMAGE).toBe(`postgres:${pgVersion}@${pgDigest}`);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
describe("harnessStack", () => {
|
|
47
|
+
const h = harnessStack({ project: "bench-a", envPrefix: "BENCH_A" });
|
|
48
|
+
|
|
49
|
+
test("names the network, the containers and the volumes after the project", () => {
|
|
50
|
+
expect(h.network).toEqual({ name: "bench-a" });
|
|
51
|
+
expect(Object.values(h.services).map((s) => s.container_name)).toEqual(["bench-a-floci", "bench-a-forgejo", "bench-a-forgejo-runner", "bench-a-clickhouse", "bench-a-postgres"]);
|
|
52
|
+
expect(h.volumes).toEqual({ forgejoData: { name: "bench-a-forgejo-data" }, runnerData: { name: "bench-a-runner-data" } });
|
|
53
|
+
for (const s of Object.values(h.services)) expect(Object.keys(s.networks)).toEqual(["harness"]);
|
|
54
|
+
expect(() => harnessStack({ project: "Bench A" })).toThrow(/not a compose project name/);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
test("binds host ports to 127.0.0.1, moved by the prefix's variables", () => {
|
|
58
|
+
expect(h.services.floci.ports).toEqual(["127.0.0.1:${BENCH_A_FLOCI_PORT:-4591}:4566"]);
|
|
59
|
+
expect(h.services.forgejo.ports).toEqual(["127.0.0.1:${BENCH_A_FORGEJO_PORT:-3391}:3000"]);
|
|
60
|
+
expect(h.services.forgejoRunner.ports).toBeUndefined();
|
|
61
|
+
expect(harnessUrls(h, { BENCH_A_FORGEJO_PORT: "4000" }).forgejo).toBe("http://localhost:4000");
|
|
62
|
+
expect(harnessStack({ project: "demo", bind: null }).services.floci.ports).toEqual(["${CHANT_E2E_FLOCI_PORT:-4591}:4566"]);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
test("runs forgejo-runner with the docker executor after Forgejo is healthy, and Actions on", () => {
|
|
66
|
+
const r = h.services.forgejoRunner;
|
|
67
|
+
expect(r.image).toBe(FORGEJO_RUNNER_IMAGE);
|
|
68
|
+
expect(r.volumes).toContain("/var/run/docker.sock:/var/run/docker.sock");
|
|
69
|
+
expect(r.depends_on).toEqual({ forgejo: { condition: "service_healthy" } });
|
|
70
|
+
expect(r.command!.at(-1)).toContain("forgejo-runner daemon -c /data/config.yml");
|
|
71
|
+
expect(h.services.forgejo.environment!.FORGEJO__actions__ENABLED).toBe("true");
|
|
72
|
+
expect(harnessStack({ project: "x", forgejoActions: false }).services.forgejo.environment!.FORGEJO__actions__ENABLED).toBe("false");
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
test("puts the sql emulator behind the sql profile, and nothing else", () => {
|
|
76
|
+
expect(h.services.clickhouse.profiles).toEqual(["sql"]);
|
|
77
|
+
expect(h.services.postgres.profiles).toEqual(["sql"]);
|
|
78
|
+
for (const k of ["floci", "forgejo", "forgejoRunner"] as const) expect(h.services[k].profiles).toBeUndefined();
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
test("the runner's config puts every job on the project network, with floci for AWS", () => {
|
|
82
|
+
const text = forgejoRunnerConfig({ network: "bench-a", uuid: "u-1", token: "t-1", jobImage: "node:22-bookworm" });
|
|
83
|
+
const doc = load(text) as { container: { network: string; valid_volumes: string[] }; runner: { envs: Record<string, string>; labels: string[] }; server: { connections: { forgejo: { uuid: string; url: string } } } };
|
|
84
|
+
expect(doc.container.network).toBe("bench-a");
|
|
85
|
+
expect(doc.container.valid_volumes).toEqual([]);
|
|
86
|
+
expect(doc.runner.envs.AWS_ENDPOINT_URL).toBe("http://floci:4566");
|
|
87
|
+
expect(doc.runner.labels).toEqual(["docker:docker://node:22-bookworm", "ubuntu-latest:docker://node:22-bookworm"]);
|
|
88
|
+
expect(doc.server.connections.forgejo).toMatchObject({ uuid: "u-1", url: "http://forgejo:3000/" });
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
test("kill-job picks the newest forgejo-runner job container that matches", () => {
|
|
92
|
+
const ps = ["2026-10-28 10:02\tFORGEJO-ACTIONS-TASK-9_WORKFLOW-pr_JOB-pr-apply", "2026-10-28 10:01\tFORGEJO-ACTIONS-TASK-8_WORKFLOW-pr_JOB-pr-plan", "2026-10-28 09:00\tbench-a-floci"];
|
|
93
|
+
expect(pickJobContainer(ps)).toBe("FORGEJO-ACTIONS-TASK-9_WORKFLOW-pr_JOB-pr-apply");
|
|
94
|
+
expect(pickJobContainer(ps, "pr-plan")).toBe("FORGEJO-ACTIONS-TASK-8_WORKFLOW-pr_JOB-pr-plan");
|
|
95
|
+
expect(pickJobContainer(ps, "drift")).toBeNull();
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
interface ComposeDoc {
|
|
100
|
+
services: Record<string, { image: string; ports?: string[]; profiles?: string[]; networks: Record<string, unknown>; container_name: string }>;
|
|
101
|
+
networks: Record<string, { name: string }>;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
describe("the harness's chant project", () => {
|
|
105
|
+
let doc: ComposeDoc;
|
|
106
|
+
|
|
107
|
+
beforeAll(async () => {
|
|
108
|
+
const out = join(tmp, "compose.yaml");
|
|
109
|
+
expect(await runCommandInProcess(["build", join(harnessProjectDir(), "src"), "--lexicon", "docker", "-o", out])).toBe(0);
|
|
110
|
+
doc = load(readFileSync(out, "utf8")) as ComposeDoc;
|
|
111
|
+
}, 60_000);
|
|
112
|
+
|
|
113
|
+
test("builds floci, Forgejo and forgejo-runner on one network, the sql emulator behind its profile", () => {
|
|
114
|
+
expect(Object.keys(doc.services).sort()).toEqual(["clickhouse", "floci", "forgejo", "forgejoRunner", "postgres"]);
|
|
115
|
+
expect(doc.networks.harness!.name).toBe("chant-e2e");
|
|
116
|
+
for (const s of Object.values(doc.services)) expect(Object.keys(s.networks)).toEqual(["harness"]);
|
|
117
|
+
expect(doc.services.floci!.image).toBe(FLOCI_IMAGE);
|
|
118
|
+
expect(doc.services.forgejo!.image).toBe(FORGEJO_IMAGE);
|
|
119
|
+
expect(doc.services.forgejoRunner!.image).toBe(FORGEJO_RUNNER_IMAGE);
|
|
120
|
+
expect(doc.services.clickhouse!.profiles).toEqual(["sql"]);
|
|
121
|
+
expect(doc.services.postgres!.profiles).toEqual(["sql"]);
|
|
122
|
+
expect(doc.services.floci!.ports).toEqual(["127.0.0.1:${CHANT_E2E_FLOCI_PORT:-4591}:4566"]);
|
|
123
|
+
});
|
|
124
|
+
});
|