@hailstails/hone 2.0.0-pre.3 → 2.0.0-pre.5
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/ADOPTING.md +9 -20
- package/CHANGELOG.md +104 -0
- package/MIGRATING.md +18 -9
- package/README.md +15 -17
- package/chunks/chunk-3CWFUD5B.js +38 -0
- package/chunks/chunk-4AJQHZ7I.js +191 -0
- package/chunks/chunk-5AKHEW6V.js +15 -0
- package/chunks/{chunk-L7BGRC6D.js → chunk-6LTJRJOE.js} +1 -1
- package/chunks/chunk-75XWZYNN.js +64 -0
- package/chunks/{chunk-ASUN4AVC.js → chunk-BISP2JOL.js} +73 -9
- package/chunks/chunk-COQMPHWZ.js +37 -0
- package/chunks/chunk-D6645WPB.js +6 -0
- package/chunks/chunk-DJMF6JIM.js +42 -0
- package/chunks/chunk-EBX57Z3V.js +8 -0
- package/chunks/chunk-EFUWHLZK.js +426 -0
- package/chunks/chunk-FHVNKG5Q.js +19 -0
- package/chunks/{chunk-NRIQD3PI.js → chunk-FRE5IA3C.js} +3 -5
- package/chunks/{chunk-OKLYWD2Z.js → chunk-GMLT3MHO.js} +262 -257
- package/chunks/{chunk-QP5TLOBY.js → chunk-HVZVKZPW.js} +12 -9
- package/chunks/chunk-LEFM7OPS.js +41 -0
- package/chunks/chunk-LNMDMRGQ.js +51 -0
- package/chunks/chunk-M4VSJ27S.js +139 -0
- package/chunks/{chunk-RGSHTPLA.js → chunk-MBEDAFVC.js} +3 -11
- package/chunks/chunk-ND3EOGDK.js +2350 -0
- package/chunks/chunk-ONDBACCR.js +14332 -0
- package/chunks/chunk-OO5KV7KN.js +17 -0
- package/chunks/chunk-SKDQ3QJD.js +75 -0
- package/chunks/chunk-U6W65ZOF.js +86 -0
- package/chunks/chunk-W5OIAUDW.js +18 -0
- package/chunks/{chunk-GNOMK7CR.js → chunk-WPEOCLTP.js} +495 -52
- package/chunks/chunk-X73RZUPO.js +63 -0
- package/chunks/chunk-XE2KKWYH.js +45 -0
- package/chunks/chunk-XNIXPQQ5.js +179 -0
- package/chunks/chunk-YONPKP3C.js +15 -0
- package/docs/adding-a-discipline-or-mechanism.md +1 -1
- package/docs/extending.md +7 -388
- package/methods/lenses/function-first.md +2 -2
- package/package.json +7 -6
- package/rules/README.md +7 -5
- package/rules/SPIRIT.md +1 -1
- package/rules/numbers.md +4 -4
- package/rules/principles/no-leak-across-a-boundary.md +1 -1
- package/rules/principles.md +1 -1
- package/rules/record-kinds/authorised-location.md +1 -1
- package/rules/records.md +11 -19
- package/rules/rules.md +5 -5
- package/rules/sources.md +6 -7
- package/rules/typescript/checks.md +280 -394
- package/rules/typescript/recipes/adapter-per-outside-party.md +10 -5
- package/rules/typescript/recipes/assert-to-narrow.md +114 -4
- package/rules/typescript/recipes/closure-factory.md +5 -5
- package/rules/typescript/recipes/companion-test-file.md +5 -3
- package/rules/typescript/recipes/composed-orchestrator.md +6 -4
- package/rules/typescript/recipes/composition-root.md +5 -3
- package/rules/typescript/recipes/{bounded-context-generic.md → constrained-context-generic.md} +6 -4
- package/rules/typescript/recipes/copy-never-write-in.md +6 -4
- package/rules/typescript/recipes/declared-not-bundled.md +5 -3
- package/rules/typescript/recipes/dependency-record.md +5 -3
- package/rules/typescript/recipes/domain-vocabulary-list.md +5 -3
- package/rules/typescript/recipes/entity-module.md +8 -5
- package/rules/typescript/recipes/exact-pins-and-a-lock-file.md +5 -3
- package/rules/typescript/recipes/extension-outside-the-vendored-code.md +5 -3
- package/rules/typescript/recipes/failure-asserted-as-a-value.md +44 -4
- package/rules/typescript/recipes/failure-mapping-at-the-adapter.md +8 -5
- package/rules/typescript/recipes/fix-the-declaration-not-the-value.md +5 -3
- package/rules/typescript/recipes/functional-iteration.md +8 -3
- package/rules/typescript/recipes/guard-clauses.md +5 -3
- package/rules/typescript/recipes/integration-test-owns-its-scratch.md +5 -3
- package/rules/typescript/recipes/integration-test-suffix.md +5 -3
- package/rules/typescript/recipes/it-each-over-typed-rows.md +117 -0
- package/rules/typescript/recipes/map-out-at-the-adapter.md +36 -4
- package/rules/typescript/recipes/meaning-in-names-not-comments.md +5 -5
- package/rules/typescript/recipes/named-exported-type.md +5 -3
- package/rules/typescript/recipes/narrow-ports.md +5 -3
- package/rules/typescript/recipes/one-argument-object.md +8 -3
- package/rules/typescript/recipes/{port-in-the-domain.md → port-in-a-module-of-its-own.md} +7 -5
- package/rules/typescript/recipes/ports-in-the-argument.md +5 -3
- package/rules/typescript/recipes/repo-scripts-only.md +5 -3
- package/rules/typescript/recipes/result-union.md +5 -5
- package/rules/typescript/recipes/screaming-folders.md +5 -5
- package/rules/typescript/recipes/shared-strict-base-config.md +5 -5
- package/rules/typescript/recipes/stub-with-vi-fn.md +130 -0
- package/rules/typescript/recipes/tagged-union-and-exhaustive-switch.md +5 -3
- package/rules/typescript/recipes/whole-words.md +5 -3
- package/rules/typescript/recipes/whole-written-out-expectation.md +284 -4
- package/rules/typescript/recipes/world-values-through-a-port.md +5 -3
- package/rules/typescript/recipes/zod-at-the-producers-adapter.md +8 -3
- package/rules/typescript/recipes.md +567 -21
- package/rules/typescript/symptoms/ambient-randomness/random-call.md +10 -0
- package/rules/typescript/symptoms/ambient-randomness.md +1 -1
- package/rules/typescript/symptoms/answer-set-in-a-hook/hook-answer.md +10 -0
- package/rules/typescript/symptoms/answer-set-in-a-hook.md +1 -1
- package/rules/typescript/symptoms/assertion-outside-a-test-body/assertion-site.md +10 -0
- package/rules/typescript/symptoms/assertion-outside-a-test-body.md +25 -0
- package/rules/typescript/symptoms/branch-in-a-test/test-body.md +10 -184
- package/rules/typescript/symptoms/branch-in-a-test.md +11 -1
- package/rules/typescript/symptoms/built-unit-called-in-place/call-of-a-call.md +10 -0
- package/rules/typescript/symptoms/built-unit-called-in-place.md +25 -0
- package/rules/typescript/symptoms/claimed-type/non-null-assertions.md +1 -1
- package/rules/typescript/symptoms/code-or-prose-read-as-text-in-a-test/raw-read.md +10 -0
- package/rules/typescript/symptoms/code-or-prose-read-as-text-in-a-test.md +31 -0
- package/rules/typescript/symptoms/computed-value-in-a-test/test-body.md +26 -117
- package/rules/typescript/symptoms/computed-value-in-a-test.md +1 -1
- package/rules/typescript/symptoms/date-used-directly.md +1 -1
- package/rules/typescript/symptoms/default-for-a-required-value.md +1 -1
- package/rules/typescript/symptoms/double-with-a-body/logic-in-a-passed-function.md +2 -19
- package/rules/typescript/symptoms/double-with-a-body/stub-implementation.md +2 -2
- package/rules/typescript/symptoms/double-with-a-body.md +1 -1
- package/rules/typescript/symptoms/export-from-a-test/test-file-export.md +10 -0
- package/rules/typescript/symptoms/export-from-a-test.md +33 -0
- package/rules/typescript/symptoms/failure-shaped-as-success/empty-catch.md +10 -0
- package/rules/typescript/symptoms/failure-shaped-as-success.md +1 -1
- package/rules/typescript/symptoms/floating-version/version-selector.md +10 -0
- package/rules/typescript/symptoms/inherited-environment-in-a-subprocess/git-spawn-environment.md +2 -2
- package/rules/typescript/symptoms/inner-layer-imports-outer.md +1 -1
- package/rules/typescript/symptoms/library-class-built-in-place.md +1 -1
- package/rules/typescript/symptoms/loop-keyword/loop-statement.md +1 -1
- package/rules/typescript/symptoms/many-spellings-of-one-concept/test-call-aliases.md +10 -0
- package/rules/typescript/symptoms/many-spellings-of-one-concept.md +3 -2
- package/rules/typescript/symptoms/module-or-global-patched/module-mock-call.md +4 -4
- package/rules/typescript/symptoms/no-lock-file/committed-lock-file.md +12 -0
- package/rules/typescript/symptoms/outside-import-past-a-boundary/import-or-require.md +1 -0
- package/rules/typescript/symptoms/outside-import-past-a-boundary.md +5 -4
- package/rules/typescript/symptoms/outside-type-in-a-signature.md +2 -2
- package/rules/typescript/symptoms/{port-outside-the-domain.md → port-beside-its-adapter.md} +2 -2
- package/rules/typescript/symptoms/port-named-for-a-mechanism.md +1 -1
- package/rules/typescript/symptoms/process-global-used-in-place/debugger-statement.md +10 -0
- package/rules/typescript/symptoms/process-global-used-in-place/direct-global-use.md +14 -0
- package/rules/typescript/symptoms/process-global-used-in-place.md +2 -2
- package/rules/typescript/symptoms/prose-in-code/comment-prose.md +12 -0
- package/rules/typescript/symptoms/rebinding/test-body.md +1 -18
- package/rules/typescript/symptoms/rebinding.md +11 -1
- package/rules/typescript/symptoms/schema-past-its-adapter.md +2 -2
- package/rules/typescript/symptoms/test-switched-off/skipped-tests.md +3 -6
- package/rules/typescript/symptoms/test-switched-off.md +1 -1
- package/rules/typescript/symptoms/text-past-its-reader/test-body.md +2 -17
- package/rules/typescript/symptoms/text-past-its-reader.md +1 -1
- package/rules/typescript/symptoms/throw-between-our-units/throw-statement.md +10 -0
- package/rules/typescript/symptoms/throw-or-catch-in-a-test/throw-statement.md +1 -1
- package/rules/typescript/symptoms/throw-or-catch-in-a-test/try-block.md +1 -25
- package/rules/typescript/symptoms/tool-fetched-at-run-time/fetch-command.md +10 -0
- package/rules/typescript/symptoms/type-declared-in-a-test/test-type-declaration.md +10 -0
- package/rules/typescript/symptoms/type-declared-in-a-test.md +33 -0
- package/rules/typescript/symptoms/unasserted-call.md +1 -1
- package/rules/typescript/symptoms/unit-without-a-running-test/companion-test-file.md +2 -2
- package/rules/typescript/symptoms/wide-input/unread-parameter.md +10 -0
- package/rules/typescript/symptoms/wide-input.md +3 -2
- package/rules/typescript/symptoms.md +210 -148
- package/src/application/conformance/conformance-testing-types.d.ts +13 -16
- package/src/domain/language-layer/authored-item-types.d.ts +66 -0
- package/src/domain/language-layer/catalogue-name.d.ts +5 -0
- package/src/domain/language-layer/check-address-text.d.ts +12 -0
- package/src/domain/rule-set/authored-rule-set-types.d.ts +31 -32
- package/src/domain/rule-set/clause-address-types.d.ts +4 -3
- package/src/domain/rule-set/rule-set-name-of.d.ts +10 -0
- package/src/domain/runner/check-binding.d.ts +18 -0
- package/src/domain/runner/check-observations.d.ts +39 -0
- package/src/domain/runner/conformance-types.d.ts +8 -2
- package/src/domain/runner/runner-result-types.d.ts +1 -2
- package/src/domain/settings/test-files.d.ts +7 -0
- package/src/eslint-plugin.js +45 -39
- package/src/hone.js +16 -13716
- package/src/infrastructure/disciplines-file/version-one-names.json +4 -5
- package/src/infrastructure/engines/eslint/authored-class-or-this/static-members-only/piece.json +0 -6
- package/src/infrastructure/engines/eslint/long-function/function-length/piece.json +0 -6
- package/src/infrastructure/engines/eslint/runner/pieces/eslint-piece-settings-types.d.ts +2 -0
- package/src/infrastructure/engines/eslint/runner/runner.js +1001 -1234
- package/src/infrastructure/engines/eslint/test-switched-off/focused-tests/README.md +0 -3
- package/src/infrastructure/engines/eslint/test-switched-off/focused-tests/eslint-plugin.js +33 -21
- package/src/infrastructure/engines/eslint/test-switched-off/skipped-tests/piece.json +11 -4
- package/src/infrastructure/engines/eslint/test-switched-off/skipped-tests/skipped-tests.examples.json +28 -0
- package/src/infrastructure/engines/eslint/untyped-value/implicit-any-let/piece.json +0 -2
- package/src/infrastructure/engines/eslint/wide-input/unread-parameter/eslint-plugin.js +94 -0
- package/src/infrastructure/engines/eslint/wide-input/unread-parameter/piece.json +11 -0
- package/src/infrastructure/engines/eslint/wide-input/unread-parameter/unread-parameter.examples.json +48 -0
- package/src/infrastructure/engines/walker/ambient-randomness/random-call/ambient-randomness.js +109 -0
- package/src/infrastructure/engines/walker/ambient-randomness/random-call/piece.json +9 -0
- package/src/infrastructure/engines/walker/ambient-randomness/random-call/random-call.examples.json +48 -0
- package/src/infrastructure/engines/walker/answer-set-in-a-hook/hook-answer/hook-answer.examples.json +42 -0
- package/src/infrastructure/engines/walker/answer-set-in-a-hook/hook-answer/hook-answers.js +72 -0
- package/src/infrastructure/engines/walker/answer-set-in-a-hook/hook-answer/piece.json +9 -0
- package/src/infrastructure/engines/walker/assertion-outside-a-test-body/assertion-site/assertion-site.examples.json +30 -0
- package/src/infrastructure/engines/walker/assertion-outside-a-test-body/assertion-site/assertion-site.js +123 -0
- package/src/infrastructure/engines/walker/assertion-outside-a-test-body/assertion-site/piece.json +9 -0
- package/src/infrastructure/engines/walker/authored-class-or-this/class-keyword/class-syntax.js +3 -3
- package/src/infrastructure/engines/walker/boolean-in-a-signature/boolean-annotation/boolean-signatures.js +7 -5
- package/src/infrastructure/engines/walker/branch-in-a-test/test-body/test-body-logic.js +192 -147
- package/src/infrastructure/engines/walker/built-unit-called-in-place/call-of-a-call/call-of-a-call.examples.json +24 -0
- package/src/infrastructure/engines/walker/built-unit-called-in-place/call-of-a-call/call-of-a-call.js +34 -0
- package/src/infrastructure/engines/walker/built-unit-called-in-place/call-of-a-call/piece.json +9 -0
- package/src/infrastructure/engines/walker/claimed-type/cast-to-any/any-cast.js +6 -4
- package/src/infrastructure/engines/walker/claimed-type/unlisted-cast-site/cast-expressions.js +6 -4
- package/src/infrastructure/engines/walker/code-or-prose-read-as-text-in-a-test/raw-read/piece.json +9 -0
- package/src/infrastructure/engines/walker/code-or-prose-read-as-text-in-a-test/raw-read/raw-read.examples.json +30 -0
- package/src/infrastructure/engines/walker/code-or-prose-read-as-text-in-a-test/raw-read/raw-read.js +166 -0
- package/src/infrastructure/engines/walker/computed-value-in-a-test/test-body/piece.json +0 -10
- package/src/infrastructure/engines/walker/date-used-directly/clock-sources/clock-sources.js +4 -4
- package/src/infrastructure/engines/walker/default-on-a-closed-union/default-arm/switch-defaults.js +8 -6
- package/src/infrastructure/engines/walker/double-with-a-body/logic-in-a-passed-function/piece.json +0 -10
- package/src/infrastructure/engines/walker/double-with-a-body/stub-implementation/dependency-isolation.js +9 -14
- package/src/infrastructure/engines/walker/drawer-path/drawer-names/categorical-paths.js +4 -4
- package/src/infrastructure/engines/walker/export-from-a-test/test-file-export/piece.json +9 -0
- package/src/infrastructure/engines/walker/export-from-a-test/test-file-export/test-file-export.examples.json +30 -0
- package/src/infrastructure/engines/walker/export-from-a-test/test-file-export/test-file-export.js +31 -0
- package/src/infrastructure/engines/walker/failure-shaped-as-success/empty-catch/empty-catch.examples.json +18 -0
- package/src/infrastructure/engines/walker/failure-shaped-as-success/empty-catch/empty-catch.js +32 -0
- package/src/infrastructure/engines/walker/failure-shaped-as-success/empty-catch/piece.json +9 -0
- package/src/infrastructure/engines/walker/floating-version/version-selector/piece.json +9 -0
- package/src/infrastructure/engines/walker/floating-version/version-selector/version-selector.examples.json +54 -0
- package/src/infrastructure/engines/walker/floating-version/version-selector/version-selector.js +75 -0
- package/src/infrastructure/engines/walker/inherited-environment-in-a-subprocess/git-spawn-environment/hermetic-git-spawns.js +8 -17
- package/src/infrastructure/engines/walker/loop-keyword/loop-statement/loops.js +8 -6
- package/src/infrastructure/engines/walker/many-spellings-of-one-concept/test-call-aliases/piece.json +9 -0
- package/src/infrastructure/engines/walker/many-spellings-of-one-concept/test-call-aliases/test-call-aliases.examples.json +36 -0
- package/src/infrastructure/engines/walker/many-spellings-of-one-concept/test-call-aliases/test-call-aliases.js +67 -0
- package/src/infrastructure/engines/walker/module-or-global-patched/module-mock-call/module-mock-call.examples.json +34 -0
- package/src/infrastructure/engines/walker/module-or-global-patched/module-mock-call/module-mocking.js +64 -16
- package/src/infrastructure/engines/walker/module-or-global-patched/module-mock-call/piece.json +5 -1
- package/src/infrastructure/engines/walker/no-lock-file/committed-lock-file/committed-lock-file.examples.json +24 -0
- package/src/infrastructure/engines/walker/no-lock-file/committed-lock-file/committed-lock-file.js +41 -0
- package/src/infrastructure/engines/walker/no-lock-file/committed-lock-file/piece.json +9 -0
- package/src/infrastructure/engines/walker/outside-import-past-a-boundary/import-or-require/import-boundaries.js +18 -16
- package/src/infrastructure/engines/walker/outside-import-past-a-boundary/import-or-require/piece.json +1 -1
- package/src/infrastructure/engines/walker/process-global-used-in-place/debugger-statement/debugger-statement.examples.json +18 -0
- package/src/infrastructure/engines/walker/process-global-used-in-place/debugger-statement/debugger-statement.js +17 -0
- package/src/infrastructure/engines/walker/process-global-used-in-place/debugger-statement/piece.json +9 -0
- package/src/infrastructure/engines/walker/process-global-used-in-place/direct-global-use/direct-global-use.examples.json +63 -0
- package/src/infrastructure/engines/walker/process-global-used-in-place/direct-global-use/piece.json +13 -0
- package/src/infrastructure/engines/walker/process-global-used-in-place/direct-global-use/process-global-used-in-place.js +126 -0
- package/src/infrastructure/engines/walker/prose-in-code/comment-prose/comment-prose.examples.json +42 -0
- package/src/infrastructure/engines/walker/prose-in-code/comment-prose/piece.json +16 -0
- package/src/infrastructure/engines/walker/prose-in-code/comment-prose/prose-in-code.js +90 -0
- package/src/infrastructure/engines/walker/rebinding/test-body/piece.json +0 -10
- package/src/infrastructure/engines/walker/runner/pieces/walker-piece.d.ts +7 -5
- package/src/infrastructure/engines/walker/runner/runner.js +268 -79
- package/src/infrastructure/engines/walker/runner/toolchain/typescript-parse.d.ts +3 -0
- package/src/infrastructure/engines/walker/shorthand-name/identifier-names/identifier-names.js +12 -7
- package/src/infrastructure/engines/walker/strictness-weakened/exact-optional-property-types/piece.json +0 -10
- package/src/infrastructure/engines/walker/strictness-weakened/no-fallthrough-cases-in-switch/piece.json +0 -10
- package/src/infrastructure/engines/walker/strictness-weakened/no-implicit-override/piece.json +0 -10
- package/src/infrastructure/engines/walker/strictness-weakened/no-property-access-from-index-signature/piece.json +0 -10
- package/src/infrastructure/engines/walker/strictness-weakened/no-unchecked-indexed-access/piece.json +0 -10
- package/src/infrastructure/engines/walker/strictness-weakened/strict/compiler-overrides.js +30 -52
- package/src/infrastructure/engines/walker/strictness-weakened/use-unknown-in-catch-variables/piece.json +0 -10
- package/src/infrastructure/engines/walker/text-past-its-reader/test-body/piece.json +0 -10
- package/src/infrastructure/engines/walker/throw-between-our-units/throw-statement/piece.json +9 -0
- package/src/infrastructure/engines/walker/throw-between-our-units/throw-statement/throw-statement.examples.json +36 -0
- package/src/infrastructure/engines/walker/throw-between-our-units/throw-statement/throws-in-production.js +12 -0
- package/src/infrastructure/engines/walker/throw-or-catch-in-a-test/throw-statement/throw-statement.examples.json +6 -6
- package/src/infrastructure/engines/walker/throw-or-catch-in-a-test/throw-statement/throws-in-tests.js +5 -44
- package/src/infrastructure/engines/walker/throw-or-catch-in-a-test/try-block/piece.json +0 -10
- package/src/infrastructure/engines/walker/tool-fetched-at-run-time/fetch-command/fetch-command.examples.json +42 -0
- package/src/infrastructure/engines/walker/tool-fetched-at-run-time/fetch-command/fetch-command.js +152 -0
- package/src/infrastructure/engines/walker/tool-fetched-at-run-time/fetch-command/piece.json +9 -0
- package/src/infrastructure/engines/walker/type-declared-in-a-test/test-type-declaration/piece.json +9 -0
- package/src/infrastructure/engines/walker/type-declared-in-a-test/test-type-declaration/test-type-declaration.examples.json +36 -0
- package/src/infrastructure/engines/walker/type-declared-in-a-test/test-type-declaration/test-type-declaration.js +141 -0
- package/src/infrastructure/engines/walker/type-derived-from-code/factory-return-types/factory-return-types.js +8 -6
- package/src/infrastructure/engines/walker/unit-without-a-running-test/companion-test-file/export-test-sibling.js +16 -10
- package/src/infrastructure/engines/walker/untracked-escape/directive-pointers/comments-directives.js +18 -64
- package/src/infrastructure/engines/walker/write-into-a-parameter/parameter-mutation/parameter-mutation.js +7 -5
- package/src/measure-engines.process.js +80 -0
- package/src/rule-set.d.ts +2 -1
- package/src/testing.d.ts +2 -4
- package/src/testing.js +173 -314
- package/src/{audit.d.ts → walker.d.ts} +13 -8
- package/src/walker.js +28 -0
- package/chunks/chunk-5HRMJ4O2.js +0 -608
- package/chunks/chunk-IX2VZTBO.js +0 -887
- package/chunks/chunk-K2W3D3NB.js +0 -17
- package/chunks/chunk-M6SOGWT7.js +0 -82
- package/chunks/chunk-Q62Y25WS.js +0 -843
- package/chunks/chunk-R75QELTA.js +0 -481
- package/chunks/chunk-RANAKCTW.js +0 -31
- package/chunks/chunk-TNY2PASL.js +0 -38
- package/chunks/chunk-UJONWHA4.js +0 -22
- package/docs/output-contract.md +0 -1155
- package/rules/record-kinds/boundary-record.md +0 -9
- package/rules/typescript/recipes/iteach-over-typed-rows.md +0 -18
- package/rules/typescript/recipes/stub-with-vifn.md +0 -20
- package/src/audit.js +0 -18
- package/src/domain/runner/runner-module-types.d.ts +0 -15
package/src/testing.js
CHANGED
|
@@ -1,246 +1,113 @@
|
|
|
1
1
|
import {
|
|
2
|
-
createDefaultEnginePort,
|
|
3
2
|
defaultClauseSettings,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
rejectedCall,
|
|
4
|
+
runnerEnginesOver,
|
|
5
|
+
runnerInvalidOutput,
|
|
6
|
+
runnerModuleAt
|
|
7
|
+
} from "../chunks/chunk-EFUWHLZK.js";
|
|
7
8
|
import {
|
|
8
9
|
installRootOfApiEntry,
|
|
9
|
-
loadFailureDetail
|
|
10
|
-
|
|
11
|
-
} from "../chunks/chunk-IX2VZTBO.js";
|
|
10
|
+
loadFailureDetail
|
|
11
|
+
} from "../chunks/chunk-XNIXPQQ5.js";
|
|
12
12
|
import {
|
|
13
|
-
|
|
14
|
-
checkNamesOf,
|
|
15
|
-
clauseCasesSchema,
|
|
16
|
-
parsedJson,
|
|
13
|
+
checkPieceOf,
|
|
17
14
|
readNamedPiece,
|
|
18
|
-
|
|
19
|
-
} from "../chunks/chunk-
|
|
20
|
-
import
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
teamRuleSetOf
|
|
16
|
+
} from "../chunks/chunk-4AJQHZ7I.js";
|
|
17
|
+
import {
|
|
18
|
+
caseVerdictSchema,
|
|
19
|
+
runnerResultSchema
|
|
20
|
+
} from "../chunks/chunk-BISP2JOL.js";
|
|
21
|
+
import "../chunks/chunk-FRE5IA3C.js";
|
|
23
22
|
import "../chunks/chunk-Z6JHBNDS.js";
|
|
24
23
|
import {
|
|
24
|
+
TOOL_RULE_SET,
|
|
25
|
+
checkAddressOfNames,
|
|
26
|
+
checkNamesOf,
|
|
27
|
+
clauseCasesSchema,
|
|
25
28
|
createDefaultFileTextPort,
|
|
26
29
|
createDefaultModuleLoaderPort,
|
|
27
30
|
createDefaultPathPort,
|
|
28
31
|
isRepoPath,
|
|
29
|
-
moduleExtensionOf
|
|
30
|
-
|
|
32
|
+
moduleExtensionOf,
|
|
33
|
+
parsedJson,
|
|
34
|
+
sourceCaseSchema
|
|
35
|
+
} from "../chunks/chunk-WPEOCLTP.js";
|
|
31
36
|
import {
|
|
32
|
-
clauseAddressOf,
|
|
33
37
|
gatheredOutcomes
|
|
34
|
-
} from "../chunks/chunk-
|
|
38
|
+
} from "../chunks/chunk-YONPKP3C.js";
|
|
39
|
+
import "../chunks/chunk-OO5KV7KN.js";
|
|
40
|
+
import "../chunks/chunk-RANIXNWY.js";
|
|
35
41
|
import "../chunks/chunk-DGOLOS5A.js";
|
|
36
42
|
|
|
37
43
|
// src/domain/runner/edition-runs.ts
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
const editions = [
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
];
|
|
46
|
-
return editions.map((edition) => ({
|
|
47
|
-
clause: { ...request.clause, edition },
|
|
48
|
-
cases: request.cases.filter(
|
|
49
|
-
(sourceCase) => caseEditionOf({ sourceCase, clause: request.clause }) === edition
|
|
50
|
-
)
|
|
51
|
-
})).filter((run) => run.cases.length > 0);
|
|
44
|
+
var casesByEdition = (request) => {
|
|
45
|
+
const caseEditionOf = (sourceCase) => sourceCase.edition ?? request.defaultEdition;
|
|
46
|
+
const editions = /* @__PURE__ */ new Set([request.defaultEdition, ...request.cases.map(caseEditionOf)]);
|
|
47
|
+
return [...editions].flatMap((edition) => {
|
|
48
|
+
const cases = request.cases.filter((sourceCase) => caseEditionOf(sourceCase) === edition);
|
|
49
|
+
return cases.length === 0 ? [] : [{ edition, cases }];
|
|
50
|
+
});
|
|
52
51
|
};
|
|
53
52
|
|
|
54
|
-
// src/application/conformance/
|
|
55
|
-
var
|
|
53
|
+
// src/application/conformance/check-conformance.ts
|
|
54
|
+
var ruleSetInvalid = (request) => ({
|
|
56
55
|
outcome: "failed",
|
|
57
|
-
error
|
|
58
|
-
});
|
|
59
|
-
var unloadable = (request) => setupFailed({
|
|
60
|
-
kind: "rule-set-unloadable",
|
|
61
|
-
detail: request.loadFailureDetail({ failure: request.failure })
|
|
56
|
+
error: { kind: "rule-set-invalid", detail: request.detail }
|
|
62
57
|
});
|
|
63
|
-
var
|
|
64
|
-
const {
|
|
65
|
-
const
|
|
66
|
-
if (
|
|
67
|
-
return
|
|
68
|
-
|
|
69
|
-
const ruleSetRoot = request.path.resolve({ path: request.ruleSetRoot });
|
|
70
|
-
if (ruleSetRoot.outcome === "failed") {
|
|
71
|
-
return setupFailed({
|
|
72
|
-
kind: "rule-set-unloadable",
|
|
73
|
-
detail: `${request.ruleSetRoot} does not resolve: ${ruleSetRoot.error.kind}`
|
|
58
|
+
var placedTeamRuleSet = (request) => {
|
|
59
|
+
const { name, root } = request.ruleSet;
|
|
60
|
+
const identity = teamRuleSetOf({ name });
|
|
61
|
+
if (identity === void 0) {
|
|
62
|
+
return ruleSetInvalid({
|
|
63
|
+
detail: `${name} is not a team rule set name: use lower-case letters, digits and hyphens, and not ${TOOL_RULE_SET}`
|
|
74
64
|
});
|
|
75
65
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
discipline: address.discipline
|
|
80
|
-
});
|
|
81
|
-
if (held.outcome === "failed") {
|
|
82
|
-
return unloadable({ failure: held.error, loadFailureDetail: loadFailureDetail2 });
|
|
83
|
-
}
|
|
84
|
-
if (held.value.held === "absent") {
|
|
85
|
-
return unloadable({
|
|
86
|
-
failure: { kind: "unknown-discipline", address: request.clause },
|
|
87
|
-
loadFailureDetail: loadFailureDetail2
|
|
66
|
+
if (!isRepoPath(root)) {
|
|
67
|
+
return ruleSetInvalid({
|
|
68
|
+
detail: `the root ${root} of rule set ${name} is not a path inside the repository`
|
|
88
69
|
});
|
|
89
70
|
}
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
);
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
if (
|
|
98
|
-
return
|
|
99
|
-
failure: {
|
|
100
|
-
kind: "mechanism-not-allowed",
|
|
101
|
-
address: request.clause,
|
|
102
|
-
mechanism: request.mechanism
|
|
103
|
-
},
|
|
104
|
-
loadFailureDetail: loadFailureDetail2
|
|
105
|
-
});
|
|
71
|
+
const resolved = request.path.resolve({ path: root });
|
|
72
|
+
return resolved.outcome === "failed" ? ruleSetInvalid({
|
|
73
|
+
detail: `the root ${root} of rule set ${name} does not resolve, because the working directory cannot be used`
|
|
74
|
+
}) : { outcome: "ok", value: { identity, root: resolved.value } };
|
|
75
|
+
};
|
|
76
|
+
var placedRuleSet = (request) => request.ruleSet === TOOL_RULE_SET ? { outcome: "ok", value: { identity: TOOL_RULE_SET, root: request.installRoot } } : placedTeamRuleSet({ ruleSet: request.ruleSet, path: request.path });
|
|
77
|
+
var examplesOf = (request) => {
|
|
78
|
+
if (checkNamesOf({ text: request.check }) === void 0) {
|
|
79
|
+
return { outcome: "failed", error: { kind: "address-invalid", detail: request.check } };
|
|
106
80
|
}
|
|
107
|
-
const
|
|
108
|
-
|
|
81
|
+
const placed = placedRuleSet(request);
|
|
82
|
+
if (placed.outcome === "failed") return placed;
|
|
83
|
+
const read = request.examples.read({
|
|
109
84
|
installRoot: request.installRoot,
|
|
110
|
-
|
|
111
|
-
|
|
85
|
+
ruleSetRoot: placed.value.root,
|
|
86
|
+
check: request.check,
|
|
87
|
+
engine: request.engine
|
|
112
88
|
});
|
|
113
|
-
if (
|
|
114
|
-
return
|
|
115
|
-
}
|
|
116
|
-
const entry = piece.value.clauses.find((candidate) => candidate.clause === address.clause);
|
|
117
|
-
if (entry === void 0) {
|
|
118
|
-
return unloadable({
|
|
119
|
-
failure: { kind: "piece-missing", address: request.clause, mechanism: request.mechanism },
|
|
120
|
-
loadFailureDetail: loadFailureDetail2
|
|
121
|
-
});
|
|
89
|
+
if (read.outcome === "ok") {
|
|
90
|
+
return { outcome: "ok", value: { ...read.value, ruleSet: placed.value.identity } };
|
|
122
91
|
}
|
|
123
92
|
return {
|
|
124
|
-
outcome: "ok",
|
|
125
|
-
value: {
|
|
126
|
-
clause: {
|
|
127
|
-
address,
|
|
128
|
-
anchor: definition.anchor,
|
|
129
|
-
pieceRoot: entry.pieceRoot,
|
|
130
|
-
settings: entry.settings,
|
|
131
|
-
clauseSettings: defaultClauseSettings({ declarations: entry.clauseSettings }),
|
|
132
|
-
edition: entry.editions.default
|
|
133
|
-
},
|
|
134
|
-
cases: [...definition.cases.flag, ...definition.cases.allow]
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
};
|
|
138
|
-
var clauseUnderTestOf = (request) => {
|
|
139
|
-
const bound = boundClauseOf(request);
|
|
140
|
-
if (bound.outcome === "failed") {
|
|
141
|
-
return bound;
|
|
142
|
-
}
|
|
143
|
-
return {
|
|
144
|
-
outcome: "ok",
|
|
145
|
-
value: {
|
|
146
|
-
clause: bound.value.clause,
|
|
147
|
-
cases: bound.value.cases.map((sourceCase) => ({
|
|
148
|
-
name: sourceCase.name,
|
|
149
|
-
file: sourceCase.fileName,
|
|
150
|
-
source: sourceCase.source,
|
|
151
|
-
edition: sourceCase.edition ?? bound.value.clause.edition
|
|
152
|
-
}))
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
};
|
|
156
|
-
var repoPathOf = (request) => {
|
|
157
|
-
return isRepoPath(request.file) ? { outcome: "ok", value: request.file } : setupFailed({ kind: "file-invalid", detail: request.file });
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
// src/application/conformance/conforming-runner.ts
|
|
161
|
-
var NO_CHECKS_RUNNER_FOR_CONFORMANCE_DETAIL = "the runner module exports no checksRunner, which version 2 conformance needs of an engine that runs through a native tool";
|
|
162
|
-
var conformingRunnerOf = (request) => {
|
|
163
|
-
const { runner, checksRunner } = request.engine;
|
|
164
|
-
if (runner.exceptionPath === "standalone") {
|
|
165
|
-
return { outcome: "ok", value: runner };
|
|
166
|
-
}
|
|
167
|
-
return checksRunner === void 0 ? {
|
|
168
|
-
outcome: "failed",
|
|
169
|
-
error: { kind: "runner-unloadable", detail: NO_CHECKS_RUNNER_FOR_CONFORMANCE_DETAIL }
|
|
170
|
-
} : { outcome: "ok", value: checksRunner };
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
// src/application/conformance/clause-conformance.ts
|
|
174
|
-
var clauseConformanceOf = async (request) => {
|
|
175
|
-
const bound = boundClauseOf(request);
|
|
176
|
-
if (bound.outcome === "failed") {
|
|
177
|
-
return bound;
|
|
178
|
-
}
|
|
179
|
-
return conformBoundClause({
|
|
180
|
-
location: request,
|
|
181
|
-
engine: request.engine,
|
|
182
|
-
loadFailureDetail: request.loadFailureDetail,
|
|
183
|
-
bound: bound.value
|
|
184
|
-
});
|
|
185
|
-
};
|
|
186
|
-
var conformBoundClause = async (request) => {
|
|
187
|
-
const engine = await request.engine.load(request.location);
|
|
188
|
-
if (engine.outcome === "failed") {
|
|
189
|
-
return {
|
|
190
|
-
outcome: "failed",
|
|
191
|
-
error: {
|
|
192
|
-
kind: "runner-unloadable",
|
|
193
|
-
detail: request.loadFailureDetail({ failure: engine.error })
|
|
194
|
-
}
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
const runner = conformingRunnerOf({ engine: engine.value });
|
|
198
|
-
if (runner.outcome === "failed") {
|
|
199
|
-
return runner;
|
|
200
|
-
}
|
|
201
|
-
const conformance = gatheredOutcomes({
|
|
202
|
-
outcomes: await Promise.all(
|
|
203
|
-
editionRunsOf(request.bound).map(
|
|
204
|
-
(run) => request.engine.conform({ clause: run.clause, cases: run.cases, runner: runner.value })
|
|
205
|
-
)
|
|
206
|
-
)
|
|
207
|
-
});
|
|
208
|
-
return conformance.outcome === "failed" ? {
|
|
209
93
|
outcome: "failed",
|
|
210
94
|
error: {
|
|
211
|
-
kind: "
|
|
212
|
-
detail: request.loadFailureDetail({
|
|
213
|
-
failure: {
|
|
214
|
-
kind: "runner-failed",
|
|
215
|
-
mechanism: request.location.mechanism,
|
|
216
|
-
failure: conformance.error
|
|
217
|
-
}
|
|
218
|
-
})
|
|
219
|
-
}
|
|
220
|
-
} : conformance;
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
// src/application/conformance/check-conformance.ts
|
|
224
|
-
var examplesOf = (request) => {
|
|
225
|
-
const read = request.examples.read(request);
|
|
226
|
-
return read.outcome === "failed" ? {
|
|
227
|
-
outcome: "failed",
|
|
228
|
-
error: {
|
|
229
|
-
kind: "rule-set-unloadable",
|
|
95
|
+
kind: read.error.kind === "piece-missing" ? "check-missing" : "rule-set-unloadable",
|
|
230
96
|
detail: request.loadFailureDetail({ failure: read.error })
|
|
231
97
|
}
|
|
232
|
-
}
|
|
98
|
+
};
|
|
233
99
|
};
|
|
234
100
|
var checkUnderTestOf = (request) => {
|
|
235
101
|
const read = examplesOf(request);
|
|
236
102
|
if (read.outcome === "failed") {
|
|
237
103
|
return read;
|
|
238
104
|
}
|
|
239
|
-
const { check, engine } = request;
|
|
105
|
+
const { ruleSet, check, engine } = request;
|
|
240
106
|
const { piece, examples: examples2 } = read.value;
|
|
241
107
|
return {
|
|
242
108
|
outcome: "ok",
|
|
243
109
|
value: {
|
|
110
|
+
ruleSet,
|
|
244
111
|
check,
|
|
245
112
|
engine,
|
|
246
113
|
examples: examples2.map((example) => ({
|
|
@@ -252,86 +119,54 @@ var checkUnderTestOf = (request) => {
|
|
|
252
119
|
}
|
|
253
120
|
};
|
|
254
121
|
};
|
|
255
|
-
var checkConformanceOf = (request) => {
|
|
122
|
+
var checkConformanceOf = async (request) => {
|
|
256
123
|
const read = examplesOf(request);
|
|
257
|
-
if (read.outcome === "failed")
|
|
258
|
-
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
return Promise.resolve({
|
|
124
|
+
if (read.outcome === "failed") return read;
|
|
125
|
+
const mechanism = request.engine;
|
|
126
|
+
const runner = await request.enginePort.load({ ...request, mechanism });
|
|
127
|
+
if (runner.outcome === "failed") {
|
|
128
|
+
return {
|
|
263
129
|
outcome: "failed",
|
|
264
130
|
error: {
|
|
265
|
-
kind: "
|
|
266
|
-
detail: request.loadFailureDetail({ failure:
|
|
131
|
+
kind: "runner-unloadable",
|
|
132
|
+
detail: request.loadFailureDetail({ failure: runner.error })
|
|
267
133
|
}
|
|
268
|
-
}
|
|
134
|
+
};
|
|
269
135
|
}
|
|
270
|
-
const { piece, examples: examples2 } = read.value;
|
|
271
|
-
const
|
|
272
|
-
address:
|
|
136
|
+
const { piece, examples: examples2, ruleSet } = read.value;
|
|
137
|
+
const binding = {
|
|
138
|
+
address: request.check,
|
|
139
|
+
ruleSet,
|
|
140
|
+
engine: mechanism,
|
|
273
141
|
anchor: piece.anchor,
|
|
274
142
|
pieceRoot: piece.pieceRoot,
|
|
275
143
|
settings: piece.settings,
|
|
276
|
-
|
|
144
|
+
forms: piece.forms,
|
|
145
|
+
checkSettings: defaultClauseSettings({ declarations: piece.declarations }),
|
|
277
146
|
edition: piece.editions.default
|
|
278
147
|
};
|
|
279
|
-
const
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
148
|
+
const conformed = gatheredOutcomes({
|
|
149
|
+
outcomes: await Promise.all(
|
|
150
|
+
casesByEdition({ cases: examples2, defaultEdition: binding.edition }).map(
|
|
151
|
+
({ edition, cases }) => request.enginePort.conform({
|
|
152
|
+
binding: { ...binding, edition },
|
|
153
|
+
cases,
|
|
154
|
+
runner: runner.value
|
|
155
|
+
})
|
|
156
|
+
)
|
|
157
|
+
)
|
|
285
158
|
});
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
outcome: "failed",
|
|
294
|
-
error: {
|
|
295
|
-
kind: "runner-unloadable",
|
|
296
|
-
detail: ports.loadFailureDetail({ failure: ports.installRoot.error })
|
|
297
|
-
}
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
|
-
return clauseConformanceOf({
|
|
301
|
-
ruleSetRoot: request.ruleSetRoot,
|
|
302
|
-
clause: request.clause,
|
|
303
|
-
mechanism: ports.mechanism,
|
|
304
|
-
ruleSetFiles: ports.ruleSetFiles,
|
|
305
|
-
loadFailureDetail: ports.loadFailureDetail,
|
|
306
|
-
path: ports.path,
|
|
307
|
-
modules: ports.modules,
|
|
308
|
-
engine: ports.engine,
|
|
309
|
-
installRoot: ports.installRoot.value,
|
|
310
|
-
moduleExtension: moduleExtensionOf({ moduleUrl: ports.moduleUrl })
|
|
311
|
-
});
|
|
312
|
-
},
|
|
313
|
-
clauseUnderTestOf: (request) => {
|
|
314
|
-
if (ports.installRoot.outcome === "failed") {
|
|
315
|
-
return {
|
|
316
|
-
outcome: "failed",
|
|
317
|
-
error: {
|
|
318
|
-
kind: "rule-set-unloadable",
|
|
319
|
-
detail: ports.loadFailureDetail({ failure: ports.installRoot.error })
|
|
320
|
-
}
|
|
321
|
-
};
|
|
159
|
+
return conformed.outcome === "ok" ? conformed : {
|
|
160
|
+
outcome: "failed",
|
|
161
|
+
error: {
|
|
162
|
+
kind: "runner-refused",
|
|
163
|
+
detail: request.loadFailureDetail({
|
|
164
|
+
failure: { kind: "runner-failed", mechanism, failure: conformed.error }
|
|
165
|
+
})
|
|
322
166
|
}
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
mechanism: ports.mechanism,
|
|
327
|
-
ruleSetFiles: ports.ruleSetFiles,
|
|
328
|
-
loadFailureDetail: ports.loadFailureDetail,
|
|
329
|
-
path: ports.path,
|
|
330
|
-
installRoot: ports.installRoot.value
|
|
331
|
-
});
|
|
332
|
-
},
|
|
333
|
-
repoPathOf
|
|
334
|
-
});
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
var repoPathOf = ({ file }) => isRepoPath(file) ? { outcome: "ok", value: file } : { outcome: "failed", error: { kind: "file-invalid", detail: file } };
|
|
335
170
|
|
|
336
171
|
// src/infrastructure/content-files/rule-sets/named-check-examples.ts
|
|
337
172
|
import { z } from "zod";
|
|
@@ -365,18 +200,9 @@ var readExamplesDocument = (request) => {
|
|
|
365
200
|
var exampleChecksOf = (request) => {
|
|
366
201
|
const owner = request.piece.exampleOwner;
|
|
367
202
|
const ownerAddress = checkAddressOfNames(owner);
|
|
368
|
-
const declaredOwner = ownerAddress === request.check ? { outcome: "ok", value: request.piece } : readNamedPiece({
|
|
369
|
-
...request,
|
|
370
|
-
...owner,
|
|
371
|
-
ruleSetRoot: request.installRoot,
|
|
372
|
-
mechanism: request.engine
|
|
373
|
-
});
|
|
374
|
-
if (declaredOwner.outcome === "failed") {
|
|
375
|
-
return declaredOwner;
|
|
376
|
-
}
|
|
377
203
|
const addresses = /* @__PURE__ */ new Set([
|
|
378
204
|
ownerAddress,
|
|
379
|
-
...Object.values(
|
|
205
|
+
...Object.values(request.piece.forms).map(checkAddressOfNames)
|
|
380
206
|
]);
|
|
381
207
|
if (!addresses.has(request.check)) {
|
|
382
208
|
return malformed({
|
|
@@ -414,7 +240,7 @@ var examplesForCheck = (request) => {
|
|
|
414
240
|
const unsupported = selected.find(
|
|
415
241
|
({ edition }) => edition !== void 0 && !declared.includes(edition)
|
|
416
242
|
);
|
|
417
|
-
return unsupported === void 0 ? { outcome: "ok", value: { piece: request.piece, examples: selected } } : malformed({
|
|
243
|
+
return unsupported === void 0 ? { outcome: "ok", value: { piece: checkPieceOf(request.piece), examples: selected } } : malformed({
|
|
418
244
|
path: path2,
|
|
419
245
|
detail: `example ${unsupported.name} selects edition ${unsupported.edition} outside the declaration`
|
|
420
246
|
});
|
|
@@ -424,12 +250,7 @@ var readExamples = (request) => {
|
|
|
424
250
|
if (names === void 0) {
|
|
425
251
|
return { outcome: "failed", error: { kind: "unknown-clause", address: request.check } };
|
|
426
252
|
}
|
|
427
|
-
const piece = readNamedPiece({
|
|
428
|
-
...request,
|
|
429
|
-
...names,
|
|
430
|
-
ruleSetRoot: request.installRoot,
|
|
431
|
-
mechanism: request.engine
|
|
432
|
-
});
|
|
253
|
+
const piece = readNamedPiece({ ...request, ...names, mechanism: request.engine });
|
|
433
254
|
if (piece.outcome === "failed") {
|
|
434
255
|
return piece;
|
|
435
256
|
}
|
|
@@ -449,22 +270,73 @@ var readExamples = (request) => {
|
|
|
449
270
|
});
|
|
450
271
|
};
|
|
451
272
|
var createNamedCheckExamplesRepository = (ports) => ({
|
|
452
|
-
read: (request) => readExamples({ ...ports, ...request })
|
|
453
|
-
runnerAddress: ({ installRoot: installRoot2, check }) => {
|
|
454
|
-
const legacy = readInstalledNames({ ...ports, installRoot: installRoot2 });
|
|
455
|
-
if (legacy.outcome === "failed") {
|
|
456
|
-
return legacy;
|
|
457
|
-
}
|
|
458
|
-
const address = legacy.value.clauseOfCheck.get(check);
|
|
459
|
-
return address === void 0 ? { outcome: "failed", error: { kind: "unknown-clause", address: check } } : { outcome: "ok", value: address };
|
|
460
|
-
}
|
|
273
|
+
read: (request) => readExamples({ ...ports, ...request })
|
|
461
274
|
});
|
|
462
275
|
|
|
463
|
-
// src/infrastructure/
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
276
|
+
// src/infrastructure/engines/protocol/conformance.ts
|
|
277
|
+
import { z as z2 } from "zod";
|
|
278
|
+
var caseVerdictsResultSchema = runnerResultSchema({
|
|
279
|
+
value: z2.array(caseVerdictSchema).readonly()
|
|
467
280
|
});
|
|
281
|
+
var lineSet = (request) => [...new Set(request.lines)].toSorted((left, right) => left - right);
|
|
282
|
+
var verdictsNaming = (request) => request.verdicts.filter((verdict) => verdict.caseName === request.caseName);
|
|
283
|
+
var unmatchedVerdict = (request) => {
|
|
284
|
+
const missing = request.cases.find(
|
|
285
|
+
(sourceCase) => verdictsNaming({ verdicts: request.verdicts, caseName: sourceCase.name }).length !== 1
|
|
286
|
+
);
|
|
287
|
+
if (missing !== void 0) {
|
|
288
|
+
return `case ${missing.name} has no single verdict`;
|
|
289
|
+
}
|
|
290
|
+
const unknown = request.verdicts.find(
|
|
291
|
+
(verdict) => !request.cases.some((sourceCase) => sourceCase.name === verdict.caseName)
|
|
292
|
+
);
|
|
293
|
+
return unknown === void 0 ? void 0 : `a verdict names the unknown case ${unknown.caseName}`;
|
|
294
|
+
};
|
|
295
|
+
var caseConformance = (request) => {
|
|
296
|
+
const { sourceCase } = request;
|
|
297
|
+
const expectedLines = lineSet({ lines: sourceCase.expectedLines });
|
|
298
|
+
const flaggedLines = lineSet({
|
|
299
|
+
lines: verdictsNaming({ verdicts: request.verdicts, caseName: sourceCase.name }).flatMap(
|
|
300
|
+
(verdict) => verdict.flaggedLines
|
|
301
|
+
)
|
|
302
|
+
});
|
|
303
|
+
if (expectedLines.join(" ") === flaggedLines.join(" ")) {
|
|
304
|
+
return [];
|
|
305
|
+
}
|
|
306
|
+
return [{ caseName: sourceCase.name, expectedLines, flaggedLines }];
|
|
307
|
+
};
|
|
308
|
+
var conformanceOf = (request) => {
|
|
309
|
+
const parsed = caseVerdictsResultSchema.safeParse(request.returned);
|
|
310
|
+
if (!parsed.success) {
|
|
311
|
+
return runnerInvalidOutput({ detail: z2.prettifyError(parsed.error) });
|
|
312
|
+
}
|
|
313
|
+
if (parsed.data.outcome === "failed") {
|
|
314
|
+
return parsed.data;
|
|
315
|
+
}
|
|
316
|
+
const verdicts = parsed.data.value;
|
|
317
|
+
const unmatched = unmatchedVerdict({ verdicts, cases: request.cases });
|
|
318
|
+
if (unmatched !== void 0) {
|
|
319
|
+
return runnerInvalidOutput({ detail: unmatched });
|
|
320
|
+
}
|
|
321
|
+
return {
|
|
322
|
+
outcome: "ok",
|
|
323
|
+
value: request.cases.flatMap((sourceCase) => caseConformance({ sourceCase, verdicts }))
|
|
324
|
+
};
|
|
325
|
+
};
|
|
326
|
+
var compareCases = async (request) => Promise.resolve().then(request.act).then(
|
|
327
|
+
(returned) => conformanceOf({ returned, cases: request.cases }),
|
|
328
|
+
(thrown) => rejectedCall({ thrown })
|
|
329
|
+
);
|
|
330
|
+
var namedCheckConformance = async (request) => {
|
|
331
|
+
const compared = await compareCases({
|
|
332
|
+
...request,
|
|
333
|
+
act: () => request.runner.conform({ binding: request.binding, cases: request.cases })
|
|
334
|
+
});
|
|
335
|
+
return compared.outcome === "failed" ? compared : {
|
|
336
|
+
outcome: "ok",
|
|
337
|
+
value: compared.value.map((failure) => ({ ...failure, check: request.binding.address }))
|
|
338
|
+
};
|
|
339
|
+
};
|
|
468
340
|
|
|
469
341
|
// src/testing.ts
|
|
470
342
|
var path = createDefaultPathPort({});
|
|
@@ -472,21 +344,9 @@ var moduleUrl = import.meta.url;
|
|
|
472
344
|
var installRoot = installRootOfApiEntry({ path, moduleUrl });
|
|
473
345
|
var fileText = createDefaultFileTextPort({});
|
|
474
346
|
var modules = createDefaultModuleLoaderPort({});
|
|
475
|
-
var enginePort = createDefaultEnginePort({});
|
|
476
347
|
var examples = createNamedCheckExamplesRepository({ fileText, path });
|
|
477
|
-
var
|
|
478
|
-
|
|
479
|
-
moduleUrl,
|
|
480
|
-
installRoot,
|
|
481
|
-
ruleSetFiles: createRuleSetFileReader({ fileText, path }),
|
|
482
|
-
loadFailureDetail,
|
|
483
|
-
path,
|
|
484
|
-
modules,
|
|
485
|
-
engine: enginePort
|
|
486
|
-
});
|
|
487
|
-
var clauseConformanceOf2 = testing.clauseConformanceOf;
|
|
488
|
-
var clauseUnderTestOf2 = testing.clauseUnderTestOf;
|
|
489
|
-
var repoPathOf2 = testing.repoPathOf;
|
|
348
|
+
var { namedEngine } = runnerEnginesOver({ runnerModuleOf: runnerModuleAt });
|
|
349
|
+
var repoPathOf2 = repoPathOf;
|
|
490
350
|
var checkUnderTestOf2 = (request) => installRoot.outcome === "failed" ? {
|
|
491
351
|
outcome: "failed",
|
|
492
352
|
error: {
|
|
@@ -496,6 +356,7 @@ var checkUnderTestOf2 = (request) => installRoot.outcome === "failed" ? {
|
|
|
496
356
|
} : checkUnderTestOf({
|
|
497
357
|
...request,
|
|
498
358
|
installRoot: installRoot.value,
|
|
359
|
+
path,
|
|
499
360
|
examples,
|
|
500
361
|
loadFailureDetail
|
|
501
362
|
});
|
|
@@ -512,13 +373,11 @@ var checkConformanceOf2 = (request) => installRoot.outcome === "failed" ? Promis
|
|
|
512
373
|
loadFailureDetail,
|
|
513
374
|
path,
|
|
514
375
|
modules,
|
|
515
|
-
enginePort,
|
|
376
|
+
enginePort: { load: namedEngine.load, conform: namedCheckConformance },
|
|
516
377
|
moduleExtension: moduleExtensionOf({ moduleUrl })
|
|
517
378
|
});
|
|
518
379
|
export {
|
|
519
380
|
checkConformanceOf2 as checkConformanceOf,
|
|
520
381
|
checkUnderTestOf2 as checkUnderTestOf,
|
|
521
|
-
clauseConformanceOf2 as clauseConformanceOf,
|
|
522
|
-
clauseUnderTestOf2 as clauseUnderTestOf,
|
|
523
382
|
repoPathOf2 as repoPathOf
|
|
524
383
|
};
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
+
import type { TestFiles } from "./domain/settings/test-files.js";
|
|
2
|
+
export type { CheckBinding, CheckSettingValues } from "./domain/runner/check-binding.js";
|
|
3
|
+
export type { CheckAddressText } from "./domain/language-layer/check-address-text.js";
|
|
1
4
|
export type { PieceFailure } from "./domain/runner/piece-failure-types.js";
|
|
2
|
-
export type { ClauseSettingValues, RunnerClause } from "./domain/runner/runner-module-types.js";
|
|
3
5
|
export type { ReadonlyJsonValue } from "./domain/settings/json-values/json-value.js";
|
|
4
6
|
export type { Edition, EditionReach } from "./domain/rule-set/edition-types.js";
|
|
5
|
-
export type {
|
|
7
|
+
export type { Remedy } from "./domain/runner/runner-result-types.js";
|
|
6
8
|
export type { Anchor, AnchorKind } from "./domain/finding/anchor.js";
|
|
7
|
-
export type {
|
|
8
|
-
export type {
|
|
9
|
+
export type { RuleSetIdentity } from "./domain/rule-set/clause-address-types.js";
|
|
10
|
+
export type { RuleSetName } from "./domain/rule-set/identifier-types.js";
|
|
9
11
|
export type { RepoPath } from "./domain/repository/repo-path-types.js";
|
|
12
|
+
export type { TestFiles } from "./domain/settings/test-files.js";
|
|
10
13
|
export type { Result } from "./domain/result.js";
|
|
11
14
|
export type { CommentRange, SyntaxApi, SyntaxNode, SyntaxTree, } from "./infrastructure/engines/walker/runner/toolchain/typescript-parse.js";
|
|
12
15
|
export type { PieceHit, PreparedFileCheck, PreparedWalkerCheck, SourceObservers, WalkerDisk, WalkerFile, WalkerPiece, WalkerRepository, } from "./infrastructure/engines/walker/runner/pieces/walker-piece.js";
|
|
@@ -14,7 +17,9 @@ export declare const folderScope: (request: {
|
|
|
14
17
|
readonly file: string;
|
|
15
18
|
}) => "generated" | "authored";
|
|
16
19
|
export declare const editionReaches: (request: {
|
|
17
|
-
readonly edition: import("./
|
|
18
|
-
readonly introducedIn: import("./
|
|
19
|
-
}) => import("./
|
|
20
|
-
export declare const isEdition: (text: string) => text is import("./
|
|
20
|
+
readonly edition: import("./walker.js").Edition;
|
|
21
|
+
readonly introducedIn: import("./walker.js").Edition;
|
|
22
|
+
}) => import("./walker.js").EditionReach;
|
|
23
|
+
export declare const isEdition: (text: string) => text is import("./walker.js").Edition;
|
|
24
|
+
export declare const isRuleSetName: (text: string) => text is import("./walker.js").RuleSetName;
|
|
25
|
+
export declare const DEFAULT_TEST_FILES: TestFiles;
|
package/src/walker.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
folderScope
|
|
3
|
+
} from "../chunks/chunk-COQMPHWZ.js";
|
|
4
|
+
import {
|
|
5
|
+
DEFAULT_TEST_FILES
|
|
6
|
+
} from "../chunks/chunk-D6645WPB.js";
|
|
7
|
+
import {
|
|
8
|
+
isRuleSetName
|
|
9
|
+
} from "../chunks/chunk-OO5KV7KN.js";
|
|
10
|
+
import {
|
|
11
|
+
editionReaches,
|
|
12
|
+
isEdition
|
|
13
|
+
} from "../chunks/chunk-RANIXNWY.js";
|
|
14
|
+
import "../chunks/chunk-DGOLOS5A.js";
|
|
15
|
+
|
|
16
|
+
// src/walker.ts
|
|
17
|
+
var folderScope2 = folderScope;
|
|
18
|
+
var editionReaches2 = editionReaches;
|
|
19
|
+
var isEdition2 = isEdition;
|
|
20
|
+
var isRuleSetName2 = isRuleSetName;
|
|
21
|
+
var DEFAULT_TEST_FILES2 = DEFAULT_TEST_FILES;
|
|
22
|
+
export {
|
|
23
|
+
DEFAULT_TEST_FILES2 as DEFAULT_TEST_FILES,
|
|
24
|
+
editionReaches2 as editionReaches,
|
|
25
|
+
folderScope2 as folderScope,
|
|
26
|
+
isEdition2 as isEdition,
|
|
27
|
+
isRuleSetName2 as isRuleSetName
|
|
28
|
+
};
|