@hailstails/hone 0.1.0-pre.6 → 0.1.0-pre.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -8
- package/api/audit.d.ts +3 -0
- package/api/audit.js +10 -0
- package/api/rule-set.js +0 -0
- package/api/testing.d.ts +5 -0
- package/api/testing.js +211 -0
- package/chunks/chunk-3LCKBX5T.js +2134 -0
- package/chunks/{chunk-LOYT2AGY.js → chunk-MYX7GAVM.js} +2 -1
- package/chunks/{chunk-MVK5KFJI.js → chunk-NRXSM7BY.js} +1 -0
- package/chunks/{chunk-XB4PCY3Q.js → chunk-P3NLETF5.js} +1 -1
- package/chunks/{chunk-ET5EBSJX.js → chunk-POZL7G62.js} +1 -1
- package/core/check/tool-command.js +34 -2095
- package/core/conformance/conformance-testing-types.d.ts +28 -0
- package/core/conformance/conformance-types.d.ts +7 -0
- package/docs/extending.md +18 -8
- package/mechanisms/audit/runner/runner.js +3 -3
- package/mechanisms/eslint/runner/runner.js +3 -3
- package/package.json +7 -3
- package/api/audit.mjs +0 -1
- package/api/rule-set.mjs +0 -1
package/README.md
CHANGED
|
@@ -232,14 +232,15 @@ With the ESLint mechanism selected, a packaged install's projection imports each
|
|
|
232
232
|
|
|
233
233
|
## Public type entries
|
|
234
234
|
|
|
235
|
-
The package has
|
|
235
|
+
The package has three public entries for TypeScript. `@hailstails/hone/rule-set` holds types only, so importing it adds no code to a build; import it with `import type`. `@hailstails/hone/audit` adds one value to its types, and `@hailstails/hone/testing` is for a team's own tests.
|
|
236
236
|
|
|
237
237
|
| Entry | Status | What it is for |
|
|
238
238
|
| --- | --- | --- |
|
|
239
239
|
| `@hailstails/hone/rule-set` | Stable | The shapes of `discipline.json`, `piece.json` and an ESLint piece's `settings`, for a team writing its own rule set. Identifiers and paths are plain strings: Hone checks them when it reads the files. |
|
|
240
|
-
| `@hailstails/hone/audit` | Experimental | The types for writing an audit walker piece, `WalkerPiece` and what it needs, including `PieceFailure`, the failures a piece may return. Clause addresses and file paths reach a piece from Hone, already checked, and a piece passes them back unchanged. It may change in a minor release. |
|
|
240
|
+
| `@hailstails/hone/audit` | Experimental | The types for writing an audit walker piece, `WalkerPiece` and what it needs, including `PieceFailure`, the failures a piece may return. Clause addresses and file paths reach a piece from Hone, already checked, and a piece passes them back unchanged. Its one value, `folderScope`, tells a piece whether a file sits in a generated folder. It may change in a minor release. |
|
|
241
|
+
| `@hailstails/hone/testing` | Experimental | Runs a team audit clause's `cases` through its piece with the installed audit runner (`clauseConformanceOf`), and hands a test the clause bound as `hone check` binds it (`clauseUnderTestOf`) and a checked file path (`repoPathOf`). Hone does not run these tests itself. It may change in a minor release. |
|
|
241
242
|
|
|
242
|
-
|
|
243
|
+
Each resolves with `moduleResolution` `"nodenext"` or `"bundler"`. `install-proof` type-checks a team piece and rule set against them, and checks that a wrongly typed field fails: on TypeScript 4.8.4 from an ES module with `"nodenext"` (4.8 has no `"bundler"`), and on 6.0.3 from an ES module with both and from a CommonJS file. A CommonJS file (`.cts`, or `.ts` in a package that is not `"type": "module"`) can import these types on TypeScript 5.8 or later with `module` `"nodenext"`. With `module` `"node16"`, and on TypeScript 5.3 to 5.7, the import needs `with { "resolution-mode": "import" }`, and older versions reject it. These CommonJS figures were checked once by hand, on 5.8.2, 5.3.3 and 6.0.3 with `"node16"`; `install-proof` checks only the 6.0.3 CommonJS case with `"nodenext"`. `@hailstails/hone/audit` names TypeScript's own syntax types, so it needs the `typescript` the repository already installs as a peer. No other path in the package is a public TypeScript entry.
|
|
243
244
|
|
|
244
245
|
## Runtime
|
|
245
246
|
|
|
@@ -330,19 +331,32 @@ To prepare a release, create a new branch at the tip of `main` and run `pnpm run
|
|
|
330
331
|
- On a pre-release, a change no larger than the one the pre-release is numbered towards moves to the next pre-release number; a larger one starts the next version's first pre-release. On a stable release, the change increments the version.
|
|
331
332
|
- The release stays on the latest tag's channel. Pass `stable` to finish a pre-release as its stable version, or `pre-release` to start a pre-release line from a stable one.
|
|
332
333
|
|
|
333
|
-
It then writes a section for that version at the top of `CHANGELOG.md`, grouping the subjects under Breaking changes, Features, Fixes and Other changes, and sets `version` in `package.json`. It refuses, changing nothing, when no subject follows the tag, when a merge commit does, when `package.json` is not at the tag's version, or when the changelog already has the new version. A subject that is not a Conventional Commits subject is named on standard error and counted as a patch under Other changes, or as a major under Breaking changes when its message has a breaking footer, so check its place before opening the pull request. If writing the second file fails, it restores the first. The script only edits those two files: it never commits, tags, pushes or publishes. Open the release pull request with the title `chore(release): <version>`.
|
|
334
|
+
It then writes a section for that version at the top of `CHANGELOG.md`, grouping the subjects under Breaking changes, Features, Fixes and Other changes, and sets `version` in `package.json`. It refuses, changing nothing, when no subject follows the tag, when a merge commit does, when `package.json` is not at the tag's version, or when the changelog already has the new version. A subject that is not a Conventional Commits subject is named on standard error and counted as a patch under Other changes, or as a major under Breaking changes when its message has a breaking footer, so check its place before opening the pull request. If writing the second file fails, it restores the first. The script only edits those two files: it never commits, tags, pushes or publishes. Open the release pull request with the title `chore(release): <version>`. Merging it is the release: no tag is pushed by hand and nothing is run after the merge. `.github/CODEOWNERS` makes the owner, `@HailsTails`, the code owner of `package.json`, `CHANGELOG.md`, `.github/workflows/`, `.github/CODEOWNERS` itself, the `scripts/release-*` scripts, `scripts/published-manifest.ts`, which writes the published `package.json`, `core/values/tool-identity.ts`, which names the package and its repository, and `pnpm-workspace.yaml`, which holds the `minimumReleaseAge` the release job installs under, so a release pull request, or any change to how a release is made, needs her code-owner approval before it can merge. That also covers every change to `package.json`, dependency updates included, since the version a release is triggered by lives there.
|
|
334
335
|
|
|
335
336
|
`CHANGELOG.md` names versions, so it stays in the repository and out of the package; the shipped pages link to it on GitHub.
|
|
336
337
|
|
|
337
|
-
|
|
338
|
+
The release workflow, `release.yml`, starts on a push to `main` that changes `package.json`. Its first job runs `scripts/release-state-command.ts` with the pushed commit, `package.json` as pushed, `package.json` as it was before the push, and the `v*` tags `git ls-remote` lists on the repository. It prints the tag `v<version>` for the pushed version and one of three states. `version-unchanged`: the push leaves the version as it was. `already-released`: the tag already names the pushed commit, as when a finished release run is run again. `unreleased`: the push changes the version and no tag has its name. It refuses, failing the run and printing no state, when either `package.json` has no readable version, when the pushed version is not `major.minor.patch` with an optional `-<identifier>.<number>`, when it cannot read the listed tags, or when the version's tag already names a different commit. That last refusal is how a `v<version>` tag made by hand, or a version set back to one released earlier, shows up instead of silently passing for a release; delete the tag if the workflow did not make it, or prepare a new version. Only `unreleased` runs the rest of the workflow; the other two end the run there, successfully, with the release and staging jobs skipped. A push that leaves `package.json` alone does not start the workflow at all.
|
|
339
|
+
|
|
340
|
+
For an unreleased version, the release job runs `check`, `package-determinism` and `install-proof` on the pushed commit, packs the tarball with `pack-package`, records the tarball's name and SHA-256 as outputs of the release job, and creates a GitHub release for `v<version>` at that commit with the tarball attached. Creating the release creates the tag: the tag is the record that the version is released. `gh release create` creates that release as a draft, uploads the tarball and only then publishes it, which is when the tag is made, so with immutable releases on, the tarball is attached before the release's assets and tag become immutable, and a run that fails before then leaves no tag. When a tag of that name already exists, GitHub attaches the release to it and ignores the commit asked for, so the release job then reads the tag back from the repository with `scripts/release-tag-command.ts` and fails unless it names the pushed commit. A tag made by hand on another commit while the job ran therefore stops the run before anything is staged on npm; the failure says to delete that GitHub release and release a new version with a new release pull request, since re-running would find the tag on the wrong commit and refuse. The `release tags` ruleset leaves creating `v*` tags open, so the workflow's own token can make the tag, and restricts updating and deleting them. A tag or release made with the workflow's own token starts no other workflow, and no workflow here starts on a tag. `scripts/release-text-command.ts` prints the release's title from the identity and the tag, its notes, which name the npm install command under its dist-tag and the attached tarball but no version, and its dist-tag: `next` when the version has a pre-release part such as `-pre.1` before any `+` build metadata, otherwise `latest`. The release is marked as a pre-release exactly when its dist-tag is `next`, and the step stops if any of the three cannot be printed. The release does not wait on npm.
|
|
338
341
|
|
|
339
342
|
A version reaches npm in four steps:
|
|
340
343
|
|
|
341
|
-
1. The
|
|
344
|
+
1. The merged release pull request creates the GitHub release and its tag, as above.
|
|
342
345
|
2. A second job downloads that release's tarball, refuses it unless its SHA-256 equals the one the release job recorded in the same run, and stages it with `npm stage publish` under the release job's dist-tag. A staged version is held by npm and cannot be installed. Its dist-tag is fixed when it is staged.
|
|
343
346
|
3. The npm owner approves it, on npmjs.com under `@hailstails/hone`, Staged Packages, or with `npm stage approve <stage-id>`. Approval needs the owner's two-factor sign-in, so CI cannot approve.
|
|
344
347
|
4. The version is published under its dist-tag and installable.
|
|
345
348
|
|
|
346
|
-
The second job runs in the GitHub environment `npm`, which accepts only `
|
|
349
|
+
The second job runs in the GitHub environment `npm`, which accepts only the `main` branch, and only when the repository variable `NPM_PUBLISH` is `enabled`; with any other value, or none, it is skipped and the release is unaffected. It authenticates by npm trusted publishing, so no npm token is stored. The trusted publisher is saved on npmjs.com under `@hailstails/hone`, Settings, Trusted publishing, GitHub Actions, as: user `HailsTails`, repository `hone`, workflow filename `release.yml`, environment `npm`, with both allowed actions, "npm publish" and "npm dist-tag", unticked, so CI can only stage. The published `package.json` carries `repository`, `homepage` and `bugs` from the identity's repository, which trusted publishing matches against this repository, and `publishConfig.access` `public`, because npm otherwise publishes a scoped package as restricted. `build-package` fails if a shipped page names a versioned tarball of the package, at any version, or the version in `package.json`, with or without a leading `v`, so a page cannot name the current version and go stale on the next release.
|
|
350
|
+
|
|
351
|
+
npm does not check a trusted publisher when it is saved, and one that has not completed a successful publish within 2 days of being added expires and can no longer be used or edited. npm's documentation does not say whether a staged publish counts as that first publish, so save the trusted publisher only just before merging a release pull request, and approve the staged version within the same 2 days. A re-run of an older release run stages a version npm already has, so it cannot complete that first publish.
|
|
352
|
+
|
|
353
|
+
Re-running a release run never releases a version twice. Re-running all its jobs runs the first job again, which finds the tag and ends the run. When the release job failed before publishing the release, there is no tag, so re-running the run releases that same commit. When only the staging job failed, re-run the failed jobs: the staging job runs again with the outputs of the release job it followed, and npm refuses a version it already holds.
|
|
354
|
+
|
|
355
|
+
The release relies on these repository settings, which only the owner changes:
|
|
356
|
+
|
|
357
|
+
- The `main` ruleset requires a pull request with one approval, squash merging only, and "Require review from Code Owners" on, so `.github/CODEOWNERS` holds.
|
|
358
|
+
- The `release tags` ruleset restricts updating and deleting `v*` tags but not creating them, so the release job's own token can create the tag. A tag publishes nothing: no workflow starts on a tag, and the environment `npm` does not accept one.
|
|
359
|
+
- The environment `npm` accepts only the `main` branch.
|
|
360
|
+
- The repository variable `NPM_PUBLISH` is `enabled` for the staging job to run.
|
|
347
361
|
|
|
348
|
-
|
|
362
|
+
Merging the release pull request does not make the version installable: staging on npm still waits for the owner's approval there, as step 3 above says.
|
package/api/audit.d.ts
CHANGED
|
@@ -9,3 +9,6 @@ export type { RepoPath } from "../core/values/repo-path-types.js";
|
|
|
9
9
|
export type { Result } from "../core/values/result.js";
|
|
10
10
|
export type { CommentRange, SyntaxApi, SyntaxNode, SyntaxTree } from "../mechanisms/audit/runner/typescript-parse.js";
|
|
11
11
|
export type { PieceHit, PreparedFileCheck, PreparedWalkerCheck, SourceObservers, WalkerFile, WalkerPiece, WalkerRepository } from "../mechanisms/audit/runner/walker-piece.js";
|
|
12
|
+
export declare const folderScope: (request: {
|
|
13
|
+
readonly file: string;
|
|
14
|
+
}) => "generated" | "authored";
|
package/api/audit.js
ADDED
package/api/rule-set.js
ADDED
|
File without changes
|
package/api/testing.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ClauseConformanceOf, ClauseUnderTestOf, RepoPathOf } from "../core/conformance/conformance-testing-types.js";
|
|
2
|
+
export type { CaseUnderTest, ClauseRequest, ClauseUnderTest, ConformanceFailure, ConformanceSetupFailure, ConformanceSetupFailureKind, } from "../core/conformance/conformance-testing-types.js";
|
|
3
|
+
export declare const clauseConformanceOf: ClauseConformanceOf;
|
|
4
|
+
export declare const clauseUnderTestOf: ClauseUnderTestOf;
|
|
5
|
+
export declare const repoPathOf: RepoPathOf;
|
package/api/testing.js
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defaultClauseSettings,
|
|
3
|
+
installRootOfApiEntry,
|
|
4
|
+
loadFailureDetail,
|
|
5
|
+
loadRunner,
|
|
6
|
+
rejectedCall,
|
|
7
|
+
runnerInvalidOutput
|
|
8
|
+
} from "../chunks/chunk-3LCKBX5T.js";
|
|
9
|
+
import {
|
|
10
|
+
caseVerdictSchema,
|
|
11
|
+
runnerResultSchema
|
|
12
|
+
} from "../chunks/chunk-MYX7GAVM.js";
|
|
13
|
+
import {
|
|
14
|
+
readDisciplineFile,
|
|
15
|
+
readPieceFile
|
|
16
|
+
} from "../chunks/chunk-POZL7G62.js";
|
|
17
|
+
import {
|
|
18
|
+
createDefaultFileTextPort,
|
|
19
|
+
createDefaultModuleLoaderPort,
|
|
20
|
+
createDefaultPathPort,
|
|
21
|
+
moduleExtensionOf,
|
|
22
|
+
repoPathSchema
|
|
23
|
+
} from "../chunks/chunk-NRXSM7BY.js";
|
|
24
|
+
import {
|
|
25
|
+
clauseAddressSchema,
|
|
26
|
+
external_exports,
|
|
27
|
+
mechanismIdSchema
|
|
28
|
+
} from "../chunks/chunk-NCDYOPHG.js";
|
|
29
|
+
import "../chunks/chunk-NZLE2WMY.js";
|
|
30
|
+
|
|
31
|
+
// core/conformance/clause-under-test.ts
|
|
32
|
+
var setupFailed = (error) => ({ outcome: "failed", error });
|
|
33
|
+
var unloadable = (request) => setupFailed({ kind: "rule-set-unloadable", detail: loadFailureDetail(request) });
|
|
34
|
+
var boundClauseOf = (request) => {
|
|
35
|
+
const address = clauseAddressSchema.safeParse(request.clause);
|
|
36
|
+
if (!address.success) {
|
|
37
|
+
return setupFailed({ kind: "address-invalid", detail: request.clause });
|
|
38
|
+
}
|
|
39
|
+
const ruleSetRoot = request.path.resolve({ path: request.ruleSetRoot });
|
|
40
|
+
if (ruleSetRoot.outcome === "failed") {
|
|
41
|
+
return setupFailed({ kind: "rule-set-unloadable", detail: `${request.ruleSetRoot} does not resolve: ${ruleSetRoot.error.kind}` });
|
|
42
|
+
}
|
|
43
|
+
const reading = { fileText: request.fileText, path: request.path, ruleSetRoot: ruleSetRoot.value };
|
|
44
|
+
const discipline = readDisciplineFile({ ...reading, discipline: address.data.discipline });
|
|
45
|
+
if (discipline.outcome === "failed") {
|
|
46
|
+
return unloadable({ failure: discipline.error });
|
|
47
|
+
}
|
|
48
|
+
const definition = discipline.value.clauses.find(
|
|
49
|
+
(clause) => clause.id === address.data.clause && clause.kind === "mechanical"
|
|
50
|
+
);
|
|
51
|
+
if (definition === void 0) {
|
|
52
|
+
return setupFailed({ kind: "clause-not-mechanical", detail: request.clause });
|
|
53
|
+
}
|
|
54
|
+
if (!definition.mechanisms.includes(request.mechanism)) {
|
|
55
|
+
return unloadable({ failure: { kind: "mechanism-not-allowed", address: request.clause, mechanism: request.mechanism } });
|
|
56
|
+
}
|
|
57
|
+
const piece = readPieceFile({ ...reading, mechanism: request.mechanism, discipline: discipline.value });
|
|
58
|
+
if (piece.outcome === "failed") {
|
|
59
|
+
return unloadable({ failure: piece.error });
|
|
60
|
+
}
|
|
61
|
+
const entry = piece.value.clauses.find((candidate) => candidate.clause === address.data.clause);
|
|
62
|
+
if (entry === void 0) {
|
|
63
|
+
return unloadable({ failure: { kind: "piece-missing", address: request.clause, mechanism: request.mechanism } });
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
outcome: "ok",
|
|
67
|
+
value: {
|
|
68
|
+
clause: {
|
|
69
|
+
address: address.data,
|
|
70
|
+
anchor: definition.anchor,
|
|
71
|
+
pieceRoot: request.path.join({ segments: [ruleSetRoot.value, "mechanisms", request.mechanism, address.data.discipline] }),
|
|
72
|
+
settings: entry.settings,
|
|
73
|
+
clauseSettings: defaultClauseSettings({ declarations: entry.clauseSettings })
|
|
74
|
+
},
|
|
75
|
+
cases: [...definition.cases.flag, ...definition.cases.allow]
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
var clauseUnderTestOf = (request) => {
|
|
80
|
+
const bound = boundClauseOf(request);
|
|
81
|
+
if (bound.outcome === "failed") {
|
|
82
|
+
return bound;
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
outcome: "ok",
|
|
86
|
+
value: {
|
|
87
|
+
clause: bound.value.clause,
|
|
88
|
+
cases: bound.value.cases.map((sourceCase) => ({ name: sourceCase.name, file: sourceCase.fileName, source: sourceCase.source }))
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
var repoPathOf = (request) => {
|
|
93
|
+
const file = repoPathSchema.safeParse(request.file);
|
|
94
|
+
return file.success ? { outcome: "ok", value: file.data } : setupFailed({ kind: "file-invalid", detail: request.file });
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
// core/conformance/conformance.ts
|
|
98
|
+
var caseVerdictsResultSchema = runnerResultSchema({
|
|
99
|
+
value: external_exports.array(caseVerdictSchema).readonly()
|
|
100
|
+
});
|
|
101
|
+
var lineSet = (request) => [...new Set(request.lines)].toSorted((left, right) => left - right);
|
|
102
|
+
var verdictsNaming = (request) => request.verdicts.filter((verdict) => verdict.caseName === request.caseName);
|
|
103
|
+
var unmatchedVerdict = (request) => {
|
|
104
|
+
const missing = request.cases.find(
|
|
105
|
+
(sourceCase) => verdictsNaming({ verdicts: request.verdicts, caseName: sourceCase.name }).length !== 1
|
|
106
|
+
);
|
|
107
|
+
if (missing !== void 0) {
|
|
108
|
+
return `case ${missing.name} has no single verdict`;
|
|
109
|
+
}
|
|
110
|
+
const unknown = request.verdicts.find(
|
|
111
|
+
(verdict) => !request.cases.some((sourceCase) => sourceCase.name === verdict.caseName)
|
|
112
|
+
);
|
|
113
|
+
return unknown === void 0 ? void 0 : `a verdict names the unknown case ${unknown.caseName}`;
|
|
114
|
+
};
|
|
115
|
+
var caseConformance = (request) => {
|
|
116
|
+
const { sourceCase } = request;
|
|
117
|
+
const expectedLines = lineSet({ lines: sourceCase.expectedLines });
|
|
118
|
+
const flaggedLines = lineSet({
|
|
119
|
+
lines: verdictsNaming({ verdicts: request.verdicts, caseName: sourceCase.name }).flatMap(
|
|
120
|
+
(verdict) => verdict.flaggedLines
|
|
121
|
+
)
|
|
122
|
+
});
|
|
123
|
+
if (expectedLines.join(" ") === flaggedLines.join(" ")) {
|
|
124
|
+
return [];
|
|
125
|
+
}
|
|
126
|
+
return [{ clause: request.clause.address, caseName: sourceCase.name, expectedLines, flaggedLines }];
|
|
127
|
+
};
|
|
128
|
+
var conformanceOf = (request) => {
|
|
129
|
+
const parsed = caseVerdictsResultSchema.safeParse(request.returned);
|
|
130
|
+
if (!parsed.success) {
|
|
131
|
+
return runnerInvalidOutput({ detail: external_exports.prettifyError(parsed.error) });
|
|
132
|
+
}
|
|
133
|
+
if (parsed.data.outcome === "failed") {
|
|
134
|
+
return parsed.data;
|
|
135
|
+
}
|
|
136
|
+
const verdicts = parsed.data.value;
|
|
137
|
+
const unmatched = unmatchedVerdict({ verdicts, cases: request.cases });
|
|
138
|
+
if (unmatched !== void 0) {
|
|
139
|
+
return runnerInvalidOutput({ detail: unmatched });
|
|
140
|
+
}
|
|
141
|
+
return {
|
|
142
|
+
outcome: "ok",
|
|
143
|
+
value: request.cases.flatMap((sourceCase) => caseConformance({ sourceCase, verdicts, clause: request.clause }))
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
var checkConformance = (request) => Promise.resolve().then(() => request.runner.conform({ clause: request.clause, cases: request.cases })).then(
|
|
147
|
+
(returned) => conformanceOf({ returned, clause: request.clause, cases: request.cases }),
|
|
148
|
+
(thrown) => rejectedCall({ thrown })
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
// core/conformance/clause-conformance.ts
|
|
152
|
+
var clauseConformanceOf = async (request) => {
|
|
153
|
+
const bound = boundClauseOf(request);
|
|
154
|
+
if (bound.outcome === "failed") {
|
|
155
|
+
return bound;
|
|
156
|
+
}
|
|
157
|
+
const runner = await loadRunner(request);
|
|
158
|
+
if (runner.outcome === "failed") {
|
|
159
|
+
return { outcome: "failed", error: { kind: "runner-unloadable", detail: loadFailureDetail({ failure: runner.error }) } };
|
|
160
|
+
}
|
|
161
|
+
const conformance = await checkConformance({ clause: bound.value.clause, cases: bound.value.cases, runner: runner.value });
|
|
162
|
+
return conformance.outcome === "failed" ? {
|
|
163
|
+
outcome: "failed",
|
|
164
|
+
error: {
|
|
165
|
+
kind: "runner-refused",
|
|
166
|
+
detail: loadFailureDetail({ failure: { kind: "runner-failed", mechanism: request.mechanism, failure: conformance.error } })
|
|
167
|
+
}
|
|
168
|
+
} : conformance;
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
// core/conformance/conformance-testing.ts
|
|
172
|
+
var createConformanceTesting = (ports) => ({
|
|
173
|
+
clauseConformanceOf: (request) => {
|
|
174
|
+
const installRoot = installRootOfApiEntry({ path: ports.path, moduleUrl: ports.moduleUrl });
|
|
175
|
+
if (installRoot.outcome === "failed") {
|
|
176
|
+
return Promise.resolve({
|
|
177
|
+
outcome: "failed",
|
|
178
|
+
error: { kind: "runner-unloadable", detail: loadFailureDetail({ failure: installRoot.error }) }
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
return clauseConformanceOf({
|
|
182
|
+
ruleSetRoot: request.ruleSetRoot,
|
|
183
|
+
clause: request.clause,
|
|
184
|
+
mechanism: ports.mechanism,
|
|
185
|
+
fileText: ports.fileText,
|
|
186
|
+
path: ports.path,
|
|
187
|
+
modules: ports.modules,
|
|
188
|
+
installRoot: installRoot.value,
|
|
189
|
+
moduleExtension: moduleExtensionOf({ moduleUrl: ports.moduleUrl })
|
|
190
|
+
});
|
|
191
|
+
},
|
|
192
|
+
clauseUnderTestOf: (request) => clauseUnderTestOf({ ruleSetRoot: request.ruleSetRoot, clause: request.clause, mechanism: ports.mechanism, fileText: ports.fileText, path: ports.path }),
|
|
193
|
+
repoPathOf
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
// api/testing.ts
|
|
197
|
+
var testing = createConformanceTesting({
|
|
198
|
+
mechanism: mechanismIdSchema.parse("audit"),
|
|
199
|
+
moduleUrl: import.meta.url,
|
|
200
|
+
fileText: createDefaultFileTextPort({}),
|
|
201
|
+
path: createDefaultPathPort({}),
|
|
202
|
+
modules: createDefaultModuleLoaderPort({})
|
|
203
|
+
});
|
|
204
|
+
var clauseConformanceOf2 = testing.clauseConformanceOf;
|
|
205
|
+
var clauseUnderTestOf2 = testing.clauseUnderTestOf;
|
|
206
|
+
var repoPathOf2 = testing.repoPathOf;
|
|
207
|
+
export {
|
|
208
|
+
clauseConformanceOf2 as clauseConformanceOf,
|
|
209
|
+
clauseUnderTestOf2 as clauseUnderTestOf,
|
|
210
|
+
repoPathOf2 as repoPathOf
|
|
211
|
+
};
|