geospec 0.0.0 → 0.1.0-beta.3
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/LICENSE +201 -0
- package/README.md +244 -0
- package/agent/doctrine.md +55 -0
- package/agent/geospec-authoring/SKILL.md +495 -0
- package/agent/geospec-authoring/api-classes.md +13 -0
- package/agent/geospec-authoring/api-constants.md +16 -0
- package/agent/geospec-authoring/api-functions.md +57 -0
- package/agent/geospec-authoring/api-index.md +377 -0
- package/agent/geospec-authoring/api-types.md +1788 -0
- package/agent/geospec-authoring/public-api-classes.md +22 -0
- package/agent/geospec-authoring/public-api-constants.md +51 -0
- package/agent/geospec-authoring/public-api-functions.md +215 -0
- package/agent/geospec-authoring/public-api-index.md +893 -0
- package/agent/geospec-authoring/public-api-types-2.md +1560 -0
- package/agent/geospec-authoring/public-api-types-3.md +217 -0
- package/agent/geospec-authoring/public-api-types.md +1948 -0
- package/agent/resources.d.ts +19 -0
- package/agent/resources.js +27 -0
- package/agent/skills.d.cts +13 -0
- package/agent/skills.json +28 -0
- package/dist/assertion-client/client.d.mts +134 -0
- package/dist/assertion-client/client.mjs +2 -0
- package/dist/assertion-client/index.d.mts +5 -0
- package/dist/assertion-client/index.mjs +1 -0
- package/dist/config/index.d.mts +3 -0
- package/dist/config/index.mjs +1 -0
- package/dist/config/node/index.d.mts +3 -0
- package/dist/config/node/index.mjs +1 -0
- package/dist/config/node/load.d.mts +19 -0
- package/dist/config/node/load.mjs +1 -0
- package/dist/config/tau-project-artifact.d.mts +54 -0
- package/dist/config/tau-project-artifact.mjs +3 -0
- package/dist/config/types.d.mts +57 -0
- package/dist/config/validate.mjs +1 -0
- package/dist/create-geospec.d.mts +50 -0
- package/dist/create-geospec.mjs +1 -0
- package/dist/engine/client.d.mts +113 -0
- package/dist/engine/client.mjs +1 -0
- package/dist/engine/index.d.mts +3 -0
- package/dist/engine/index.mjs +1 -0
- package/dist/engine/matchers.d.mts +70 -0
- package/dist/engine/matchers.mjs +1 -0
- package/dist/engine/pmi.types.d.mts +78 -0
- package/dist/engine/protocol.d.mts +20 -0
- package/dist/engine/protocol.mjs +1 -0
- package/dist/geometry-unit.d.mts +12 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.mjs +1 -0
- package/dist/mesh/index.d.mts +4 -0
- package/dist/mesh/index.mjs +1 -0
- package/dist/mesh/types.d.mts +575 -0
- package/dist/model/errors.d.mts +20 -0
- package/dist/model/errors.mjs +2 -0
- package/dist/model/export-intent.d.mts +79 -0
- package/dist/model/export-intent.mjs +1 -0
- package/dist/model/index.d.mts +7 -0
- package/dist/model/index.mjs +1 -0
- package/dist/model/load-model.d.mts +25 -0
- package/dist/model/load-model.mjs +1 -0
- package/dist/model/native-model-loader.d.mts +142 -0
- package/dist/model/native-model-loader.mjs +1 -0
- package/dist/model/region-scope.d.mts +23 -0
- package/dist/model/region-scope.mjs +1 -0
- package/dist/model/subject-assertions.mjs +1 -0
- package/dist/model/subject.d.mts +11 -0
- package/dist/model/subject.mjs +1 -0
- package/dist/model/types.d.mts +254 -0
- package/dist/runner/collector.d.mts +64 -0
- package/dist/runner/collector.mjs +2 -0
- package/dist/runner/discovery.d.mts +93 -0
- package/dist/runner/discovery.mjs +1 -0
- package/dist/runner/filter.d.mts +50 -0
- package/dist/runner/filter.mjs +1 -0
- package/dist/runner/index.d.mts +7 -0
- package/dist/runner/index.mjs +1 -0
- package/dist/runner/native/index.d.mts +4 -0
- package/dist/runner/native/index.mjs +1 -0
- package/dist/runner/native/native-pool-grants.d.mts +21 -0
- package/dist/runner/native/native-pool-grants.mjs +1 -0
- package/dist/runner/native/native-serial-runner.d.mts +29 -0
- package/dist/runner/native/native-serial-runner.mjs +1 -0
- package/dist/runner/pool/pool-messages.d.mts +94 -0
- package/dist/runner/run-geospec-module.d.mts +13 -0
- package/dist/runner/run-geospec-module.mjs +47 -0
- package/dist/runner/timeout-codes.d.mts +45 -0
- package/dist/runner/timeout-codes.mjs +1 -0
- package/dist/runner/types.d.mts +776 -0
- package/dist/runner/worker/index.d.mts +4 -0
- package/dist/runner/worker/index.mjs +1 -0
- package/dist/runner/worker/no-matching-tests-issue.d.mts +12 -0
- package/dist/runner/worker/no-matching-tests-issue.mjs +1 -0
- package/dist/runner/worker/runner-types.d.mts +167 -0
- package/dist/runner/worker/serial-runner.mjs +1 -0
- package/dist/selector/types.d.mts +271 -0
- package/dist/step/types.d.mts +134 -0
- package/dist/vitest/adapter.d.mts +56 -0
- package/dist/vitest/adapter.mjs +3 -0
- package/dist/vitest/index.d.mts +4 -0
- package/dist/vitest/index.mjs +1 -0
- package/package.json +114 -5
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
//#region src/runner/discovery.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Default file globs used by GeoSpec test discovery.
|
|
4
|
+
*
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
declare const defaultGeoSpecInclude: readonly ["**/*.geospec.{ts,js}"];
|
|
8
|
+
/**
|
|
9
|
+
* Directories skipped by recursive GeoSpec discovery unless callers provide
|
|
10
|
+
* their own ignored-directory list.
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
declare const defaultGeoSpecIgnoredDirectories: readonly [".git", "node_modules", "dist", "coverage", ".tau/cache", ".tau/artifacts", ".tau/transcripts"];
|
|
15
|
+
/**
|
|
16
|
+
* File kind returned by a GeoSpec discovery filesystem.
|
|
17
|
+
*
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
type GeoSpecDiscoveryFileKind = 'file' | 'directory';
|
|
21
|
+
/**
|
|
22
|
+
* Minimal stat object required for recursive GeoSpec test discovery.
|
|
23
|
+
*
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
type GeoSpecDiscoveryFileStat = {
|
|
27
|
+
kind: GeoSpecDiscoveryFileKind;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Minimal filesystem contract used by GeoSpec test discovery.
|
|
31
|
+
*
|
|
32
|
+
* Browser workers, Node CLI hosts, and embedded runners adapt their native
|
|
33
|
+
* filesystem APIs to this shape so discovery has one shared behavior.
|
|
34
|
+
*
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
37
|
+
type GeoSpecDiscoveryFileSystem = {
|
|
38
|
+
readdir(path: string): Promise<readonly string[]>;
|
|
39
|
+
stat(path: string): Promise<GeoSpecDiscoveryFileStat>;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Options for recursive GeoSpec test discovery.
|
|
43
|
+
*
|
|
44
|
+
* `files` accepts either exact `*.geospec.ts` / `*.geospec.js` files or
|
|
45
|
+
* directory roots. When omitted, discovery starts at `projectPath`.
|
|
46
|
+
*
|
|
47
|
+
* `include` and `exclude` are Vitest-style file globs applied to
|
|
48
|
+
* project-relative GeoSpec paths after `files` roots have been expanded.
|
|
49
|
+
*
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
52
|
+
type DiscoverGeoSpecFilesOptions = {
|
|
53
|
+
filesystem: GeoSpecDiscoveryFileSystem;
|
|
54
|
+
projectPath: string;
|
|
55
|
+
files?: readonly string[];
|
|
56
|
+
include?: readonly string[];
|
|
57
|
+
exclude?: readonly string[];
|
|
58
|
+
ignoredDirectories?: readonly string[];
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Result returned by recursive GeoSpec test discovery.
|
|
62
|
+
*
|
|
63
|
+
* `files` are project-relative, sorted, and de-duplicated. `unmatchedRoots`
|
|
64
|
+
* contains requested file or directory roots that did not select any GeoSpec
|
|
65
|
+
* files.
|
|
66
|
+
*
|
|
67
|
+
* @public
|
|
68
|
+
*/
|
|
69
|
+
type GeoSpecDiscoveryResult = {
|
|
70
|
+
files: string[];
|
|
71
|
+
unmatchedRoots: string[];
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Return true when a project-relative path names a GeoSpec test file.
|
|
75
|
+
*
|
|
76
|
+
* @param path - Project-relative path to inspect.
|
|
77
|
+
* @returns True when the path ends with `.geospec.ts` or `.geospec.js`.
|
|
78
|
+
* @public
|
|
79
|
+
*/
|
|
80
|
+
declare const isGeoSpecTestFile: (path: string) => boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Discover GeoSpec test files from exact files or directory roots.
|
|
83
|
+
*
|
|
84
|
+
* The returned `files` are project-relative paths suitable for
|
|
85
|
+
* `runGeoSpecModule` and runner factory APIs.
|
|
86
|
+
*
|
|
87
|
+
* @param options - Discovery options containing a filesystem adapter and project roots.
|
|
88
|
+
* @returns Sorted, de-duplicated project-relative GeoSpec files plus unmatched roots.
|
|
89
|
+
* @public
|
|
90
|
+
*/
|
|
91
|
+
declare const discoverGeoSpecFiles: (options: DiscoverGeoSpecFilesOptions) => Promise<GeoSpecDiscoveryResult>;
|
|
92
|
+
//#endregion
|
|
93
|
+
export { DiscoverGeoSpecFilesOptions, GeoSpecDiscoveryFileKind, GeoSpecDiscoveryFileStat, GeoSpecDiscoveryFileSystem, GeoSpecDiscoveryResult, defaultGeoSpecIgnoredDirectories, defaultGeoSpecInclude, discoverGeoSpecFiles, isGeoSpecTestFile };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{assertRootedPath as e}from"@taucad/runtime/kernel";const t=[`**/*.geospec.{ts,js}`],n=[`.git`,`node_modules`,`dist`,`coverage`,`.tau/cache`,`.tau/artifacts`,`.tau/transcripts`],r=/\.geospec\.(?:ts|js)$/u,i=e=>e.replaceAll(`\\`,`/`).replaceAll(/\/+/gu,`/`).replace(/^\.\//u,``),a=e=>{let t=i(e);return!t||t===`.`?``:t===`/`?t:t.replace(/\/$/u,``)},o=(t,n)=>{let r=e(t);return r===``?n:n===``?r:`${n.replace(/\/$/u,``)}/${r}`},s=(e,t)=>{let n=i(e).replace(/\/$/u,``);if(t===``)return n;let r=t.endsWith(`/`)?t:`${t}/`;return n===t?``:n.startsWith(r)?n.slice(r.length):n},c=e=>e.replaceAll(/[|\\{}()[\]^$+?.]/gu,String.raw`\$&`),l=e=>{let t=i(e),n=`^`;for(let e=0;e<t.length;){let r=t[e];if(r===void 0)break;let i=t[e+1];if(r===`*`&&i===`*`){t[e+2]===`/`?(n+=String.raw`(?:.*\/)?`,e+=3):(n+=`.*`,e+=2);continue}if(r===`*`){n+=`[^/]*`,e+=1;continue}if(r===`?`){n+=`[^/]`,e+=1;continue}if(r===`{`){let r=t.indexOf(`}`,e+1);if(r!==-1){let i=t.slice(e+1,r).split(`,`).map(e=>c(e));n+=`(?:${i.join(`|`)})`,e=r+1;continue}}n+=r===`/`?String.raw`\/`:c(r),e+=1}return RegExp(`${n}$`,`u`)},u=(e,t)=>l(t).test(i(e)),d=(e,t)=>t.some(t=>u(e,t)),f=(e,t)=>{let n=i(e).replace(/\/$/u,``),r=n.split(`/`).at(-1)??n;return t.has(n)||t.has(r)},p=e=>{if(typeof e!=`object`||!e)return!1;let t=`code`in e?e.code:void 0,n=`name`in e?e.name:void 0,r=e instanceof Error?e.message:``;return t===`ENOENT`||t===`ENOTDIR`||n===`NotFoundError`||r.startsWith(`ENOENT:`)||r.startsWith(`ENOTDIR:`)},m=e=>r.test(i(e)),h=async e=>{let t=await e.filesystem.readdir(e.directoryPath),n=[];for(let r of t){let t=e.directoryPath===``?r:`${e.directoryPath}/${r}`,i=s(t,e.projectPath);if((await e.filesystem.stat(t)).kind===`directory`){f(i,e.ignoredDirectories)||n.push(t);continue}m(i)&&e.selectedFiles.add(i)}n.sort((e,t)=>e.localeCompare(t));for(let t of n)await h({...e,directoryPath:t})},g=async e=>{let t=new Set,n=o(e.root,e.projectPath),r;try{r=await e.filesystem.stat(n)}catch(e){if(p(e))return[];throw e}if(r.kind===`file`){let r=s(n,e.projectPath);return m(r)&&t.add(r),[...t]}let i=s(n,e.projectPath);return i&&f(i,e.ignoredDirectories)?[]:(await h({filesystem:e.filesystem,directoryPath:n,projectPath:e.projectPath,ignoredDirectories:e.ignoredDirectories,selectedFiles:t}),[...t])},_=async e=>{let r=a(e.projectPath),o=e.include&&e.include.length>0?e.include:t,s=e.exclude??[],c=new Set(e.ignoredDirectories??n),l=e.files&&e.files.length>0?e.files:[``],u=new Set,f=[];for(let t of l){let n=await g({filesystem:e.filesystem,projectPath:r,root:t,ignoredDirectories:c});if(n.length===0){f.push(i(t)||`.`);continue}for(let e of n)u.add(e)}return{files:[...u].filter(e=>d(e,o)&&!d(e,s)).sort((e,t)=>e.localeCompare(t)),unmatchedRoots:f}};export{n as defaultGeoSpecIgnoredDirectories,t as defaultGeoSpecInclude,_ as discoverGeoSpecFiles,m as isGeoSpecTestFile};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { GeoSpecTestCase } from "./types.mjs";
|
|
2
|
+
import { VmIssue } from "@taucad/esbuild/vm";
|
|
3
|
+
//#region src/runner/filter.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Compiled Vitest-style test-name pattern used by a GeoSpec run.
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
type GeoSpecTestNamePattern = RegExp;
|
|
10
|
+
/**
|
|
11
|
+
* Compile a Vitest-style test-name pattern once for a GeoSpec run.
|
|
12
|
+
*
|
|
13
|
+
* String inputs are JavaScript regular expression sources matched against the
|
|
14
|
+
* full `suite > test` name. `RegExp` inputs are used as-is.
|
|
15
|
+
*
|
|
16
|
+
* @param testNamePattern - Optional regex source or precompiled expression.
|
|
17
|
+
* @returns A compiled pattern or a structured issue when the source is invalid.
|
|
18
|
+
*
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
declare const compileGeoSpecTestNamePattern: (testNamePattern: string | RegExp | undefined) => {
|
|
22
|
+
success: true;
|
|
23
|
+
pattern?: GeoSpecTestNamePattern;
|
|
24
|
+
} | {
|
|
25
|
+
success: false;
|
|
26
|
+
issue: VmIssue;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Return true when a collected GeoSpec test matches the supplied compiled
|
|
30
|
+
* Vitest-style test-name pattern.
|
|
31
|
+
*
|
|
32
|
+
* @public
|
|
33
|
+
*
|
|
34
|
+
* @param test - collected test metadata.
|
|
35
|
+
* @param testNamePattern - optional compiled regex.
|
|
36
|
+
* @returns whether the test should be included.
|
|
37
|
+
*/
|
|
38
|
+
declare const matchesGeoSpecTestName: (test: Pick<GeoSpecTestCase, "suite" | "name">, testNamePattern: GeoSpecTestNamePattern | undefined) => boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Filter collected GeoSpec tests by compiled test-name pattern.
|
|
41
|
+
*
|
|
42
|
+
* @public
|
|
43
|
+
*
|
|
44
|
+
* @param tests - collected tests.
|
|
45
|
+
* @param testNamePattern - optional compiled regex.
|
|
46
|
+
* @returns tests that match the filter.
|
|
47
|
+
*/
|
|
48
|
+
declare const filterGeoSpecTests: (tests: readonly GeoSpecTestCase[], testNamePattern: GeoSpecTestNamePattern | undefined) => GeoSpecTestCase[];
|
|
49
|
+
//#endregion
|
|
50
|
+
export { GeoSpecTestNamePattern, compileGeoSpecTestNamePattern, filterGeoSpecTests, matchesGeoSpecTestName };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=e=>[...e.suite,e.name].join(` > `),t=e=>{if(e===void 0||typeof e==`string`&&e.trim()===``)return{success:!0};if(e instanceof RegExp)return{success:!0,pattern:e};try{return{success:!0,pattern:new RegExp(e,`u`)}}catch(t){return{success:!1,issue:{code:`INVALID_GEOSPEC_TEST_NAME_PATTERN`,message:`testNamePattern is not a valid JavaScript regular expression.`,severity:`error`,type:`runtime`,details:{testNamePattern:e,reason:t instanceof Error?t.message:String(t)}}}}},n=(t,n)=>!n||(n.lastIndex=0,n.test(e(t))),r=(e,t)=>e.filter(e=>n(e,t));export{t as compileGeoSpecTestNamePattern,r as filterGeoSpecTests,n as matchesGeoSpecTestName};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { GeoSpecAssemblyOccurrenceExpectation, GeoSpecAssemblyOccurrencesExpectation, GeoSpecAssertion, GeoSpecAxisExpectation, GeoSpecBoundingBoxExpectation, GeoSpecCenterOfMassExpectation, GeoSpecChamferFeatureExpectation, GeoSpecCircularHoleExpectation, GeoSpecCircularHolePatternExpectation, GeoSpecComponentInterferenceAllowance, GeoSpecComponentInterferenceExpectation, GeoSpecComponentInterferencePairExpectation, GeoSpecConnectedComponentsExpectation, GeoSpecCylindricalFaceExpectation, GeoSpecFilletFeatureExpectation, GeoSpecGeometrySelector, GeoSpecMassExpectation, GeoSpecMatcher, GeoSpecMeshIntegrityExpectation, GeoSpecMinimumWallThicknessExpectation, GeoSpecModuleBundleCache, GeoSpecNumericExpectation, GeoSpecPlanarFaceExpectation, GeoSpecPointExpectation, GeoSpecProductStructureExpectation, GeoSpecRunFailure, GeoSpecRunResult, GeoSpecRunSuccess, GeoSpecSpatialRelationshipExpectation, GeoSpecSpatialRelationshipsExpectation, GeoSpecStepUnitsExpectation, GeoSpecSurfaceAreaExpectation, GeoSpecTestCase, GeoSpecTestEvent, GeoSpecTestStatus, GeoSpecTopologyCountsExpectation, GeoSpecValidBrepExpectation, GeoSpecVolumeExpectation, RunGeoSpecModuleOptions } from "./types.mjs";
|
|
2
|
+
import { GeoSpecTestNamePattern, compileGeoSpecTestNamePattern, filterGeoSpecTests, matchesGeoSpecTestName } from "./filter.mjs";
|
|
3
|
+
import { GeoSpecAssertionError, GeoSpecCollector, GeoSpecCollectorOptions, clearCollectorGlobals, createCollector, installCollector } from "./collector.mjs";
|
|
4
|
+
import { DiscoverGeoSpecFilesOptions, GeoSpecDiscoveryFileKind, GeoSpecDiscoveryFileStat, GeoSpecDiscoveryFileSystem, GeoSpecDiscoveryResult, defaultGeoSpecIgnoredDirectories, defaultGeoSpecInclude, discoverGeoSpecFiles, isGeoSpecTestFile } from "./discovery.mjs";
|
|
5
|
+
import { runGeoSpecModule } from "./run-geospec-module.mjs";
|
|
6
|
+
import { GeoSpecTimeoutCode, geoSpecTimeoutCode, isGeoSpecTimeoutCode } from "./timeout-codes.mjs";
|
|
7
|
+
export { type DiscoverGeoSpecFilesOptions, type GeoSpecAssemblyOccurrenceExpectation, type GeoSpecAssemblyOccurrencesExpectation, type GeoSpecAssertion, GeoSpecAssertionError, type GeoSpecAxisExpectation, type GeoSpecBoundingBoxExpectation, type GeoSpecCenterOfMassExpectation, type GeoSpecChamferFeatureExpectation, type GeoSpecCircularHoleExpectation, type GeoSpecCircularHolePatternExpectation, type GeoSpecCollector, type GeoSpecCollectorOptions, type GeoSpecComponentInterferenceAllowance, type GeoSpecComponentInterferenceExpectation, type GeoSpecComponentInterferencePairExpectation, type GeoSpecConnectedComponentsExpectation, type GeoSpecCylindricalFaceExpectation, type GeoSpecDiscoveryFileKind, type GeoSpecDiscoveryFileStat, type GeoSpecDiscoveryFileSystem, type GeoSpecDiscoveryResult, type GeoSpecFilletFeatureExpectation, type GeoSpecGeometrySelector, type GeoSpecMassExpectation, type GeoSpecMatcher, type GeoSpecMeshIntegrityExpectation, type GeoSpecMinimumWallThicknessExpectation, type GeoSpecModuleBundleCache, type GeoSpecNumericExpectation, type GeoSpecPlanarFaceExpectation, type GeoSpecPointExpectation, type GeoSpecProductStructureExpectation, type GeoSpecRunFailure, type GeoSpecRunResult, type GeoSpecRunSuccess, type GeoSpecSpatialRelationshipExpectation, type GeoSpecSpatialRelationshipsExpectation, type GeoSpecStepUnitsExpectation, type GeoSpecSurfaceAreaExpectation, type GeoSpecTestCase, type GeoSpecTestEvent, type GeoSpecTestNamePattern, type GeoSpecTestStatus, type GeoSpecTimeoutCode, type GeoSpecTopologyCountsExpectation, type GeoSpecValidBrepExpectation, type GeoSpecVolumeExpectation, type RunGeoSpecModuleOptions, clearCollectorGlobals, compileGeoSpecTestNamePattern, createCollector, defaultGeoSpecIgnoredDirectories, defaultGeoSpecInclude, discoverGeoSpecFiles, filterGeoSpecTests, geoSpecTimeoutCode, installCollector, isGeoSpecTestFile, isGeoSpecTimeoutCode, matchesGeoSpecTestName, runGeoSpecModule };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{compileGeoSpecTestNamePattern as e,filterGeoSpecTests as t,matchesGeoSpecTestName as n}from"./filter.mjs";import{geoSpecTimeoutCode as r,isGeoSpecTimeoutCode as i}from"./timeout-codes.mjs";import{GeoSpecAssertionError as a,clearCollectorGlobals as o,createCollector as s,installCollector as c}from"./collector.mjs";import{defaultGeoSpecIgnoredDirectories as l,defaultGeoSpecInclude as u,discoverGeoSpecFiles as d,isGeoSpecTestFile as f}from"./discovery.mjs";import{runGeoSpecModule as p}from"./run-geospec-module.mjs";export{a as GeoSpecAssertionError,o as clearCollectorGlobals,e as compileGeoSpecTestNamePattern,s as createCollector,l as defaultGeoSpecIgnoredDirectories,u as defaultGeoSpecInclude,d as discoverGeoSpecFiles,t as filterGeoSpecTests,r as geoSpecTimeoutCode,c as installCollector,f as isGeoSpecTestFile,i as isGeoSpecTimeoutCode,n as matchesGeoSpecTestName,p as runGeoSpecModule};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { CreateGeoSpecNativeModelLoaderOptions, GeoSpecNativeLoadModelOptions, GeoSpecNativeModelEngine, GeoSpecNativeModelLoader, GeoSpecNativeModelResource, GeoSpecNativeModelSubject, GeoSpecNativeSourceReader, ManagedGeoSpecNativeModelLoader, createGeoSpecNativeModelLoader } from "../../model/native-model-loader.mjs";
|
|
2
|
+
import { GeoSpecNativeRunnerAssertions, GeoSpecNativeRunnerOptions, createNativeGeoSpecRunner } from "./native-serial-runner.mjs";
|
|
3
|
+
import { allocateNativePoolGrants } from "./native-pool-grants.mjs";
|
|
4
|
+
export { type CreateGeoSpecNativeModelLoaderOptions, type GeoSpecNativeLoadModelOptions, type GeoSpecNativeModelEngine, type GeoSpecNativeModelLoader, type GeoSpecNativeModelResource, type GeoSpecNativeModelSubject, type GeoSpecNativeRunnerAssertions, type GeoSpecNativeRunnerOptions, type GeoSpecNativeSourceReader, type ManagedGeoSpecNativeModelLoader, allocateNativePoolGrants, createGeoSpecNativeModelLoader, createNativeGeoSpecRunner };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createGeoSpecNativeModelLoader as e}from"../../model/native-model-loader.mjs";import{createNativeGeoSpecRunner as t}from"./native-serial-runner.mjs";import{allocateNativePoolGrants as n}from"./native-pool-grants.mjs";export{n as allocateNativePoolGrants,e as createGeoSpecNativeModelLoader,t as createNativeGeoSpecRunner};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/runner/native/native-pool-grants.d.ts
|
|
2
|
+
/** Deterministic caller-inclusive permits for the host-composed compiled worker pool. @module */
|
|
3
|
+
/**
|
|
4
|
+
* Assign a bounded CPU budget across already-selected worker isolates.
|
|
5
|
+
* The omitted budget is one permit per worker. A native pool must pass each
|
|
6
|
+
* returned grant to the engine it constructs inside the corresponding worker.
|
|
7
|
+
* A grant above one is admissible only for an engine with its own OCCT
|
|
8
|
+
* library instance: native workers that are threads of one process share one,
|
|
9
|
+
* so such a pool must use one worker or one permit per worker.
|
|
10
|
+
*
|
|
11
|
+
* @param options - Worker count, optional total budget, and host CPU cap.
|
|
12
|
+
* @returns Grants in worker creation order.
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
declare const allocateNativePoolGrants: (options: {
|
|
16
|
+
workers: number;
|
|
17
|
+
budget?: number;
|
|
18
|
+
hostCap: number;
|
|
19
|
+
}) => readonly number[];
|
|
20
|
+
//#endregion
|
|
21
|
+
export { allocateNativePoolGrants };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=e=>{let{workers:t,hostCap:n}=e,r=e.budget??t;if(!Number.isSafeInteger(t)||!Number.isSafeInteger(r)||!Number.isSafeInteger(n)||t<1||r<t||r>n)throw RangeError(`Native pool requires positive workers and a caller-inclusive budget between workers and the host cap.`);let i=Math.floor(r/t),a=r%t;return Array.from({length:t},(e,t)=>i+ +(t<a))};export{e as allocateNativePoolGrants};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { CreateGeoSpecNativeModelLoaderOptions, GeoSpecNativeModelEngine, ManagedGeoSpecNativeModelLoader } from "../../model/native-model-loader.mjs";
|
|
2
|
+
import { GeoSpecAssertionClientOptions } from "../../assertion-client/client.mjs";
|
|
3
|
+
import "../../assertion-client/index.mjs";
|
|
4
|
+
import { GeoSpecRunner, GeoSpecRunnerOptions } from "../worker/runner-types.mjs";
|
|
5
|
+
import "../worker/index.mjs";
|
|
6
|
+
//#region src/runner/native/native-serial-runner.d.ts
|
|
7
|
+
/** Native assertion options whose engine can also admit and release subjects. @public */
|
|
8
|
+
type GeoSpecNativeRunnerAssertions = Omit<GeoSpecAssertionClientOptions, 'engine'> & {
|
|
9
|
+
readonly engine: GeoSpecNativeModelEngine;
|
|
10
|
+
};
|
|
11
|
+
/** Options for the native serial runner. @public */
|
|
12
|
+
type GeoSpecNativeRunnerOptions = Omit<GeoSpecRunnerOptions, 'nativeAssertions' | 'nativeModelLoader'> & {
|
|
13
|
+
/** Actual protocol-3 engine used by authored assertions. */
|
|
14
|
+
readonly nativeAssertions: GeoSpecNativeRunnerAssertions;
|
|
15
|
+
/** Optional managed loader; the runner releases its subjects after every run. */
|
|
16
|
+
readonly nativeModelLoader?: ManagedGeoSpecNativeModelLoader;
|
|
17
|
+
/** Defaults used when the runner constructs its own native loader. */
|
|
18
|
+
readonly model?: Omit<CreateGeoSpecNativeModelLoaderOptions, 'engine'>;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Compose compiled assertion and model bindings with the SDK's serial lifecycle.
|
|
22
|
+
*
|
|
23
|
+
* @param options - VM filesystem, native engine/client options and model defaults.
|
|
24
|
+
* @returns The ordinary GeoSpec runner lifecycle and event contract.
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
declare const createNativeGeoSpecRunner: (options: GeoSpecNativeRunnerOptions) => GeoSpecRunner;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { GeoSpecNativeRunnerAssertions, GeoSpecNativeRunnerOptions, createNativeGeoSpecRunner };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createGeoSpecNativeModelLoader as e}from"../../model/native-model-loader.mjs";import{createSerialGeoSpecRunner as t}from"../worker/serial-runner.mjs";const n=new TextDecoder(`utf-8`,{fatal:!0}),r=(e,t)=>{let r=JSON.parse(n.decode(e));if(typeof r!=`object`||!r||!(`plan`in r))throw TypeError(`Native GeoSpec assertion requires a plan with admitted subjects.`);let{plan:i}=r;if(typeof i!=`object`||!i||!(`subjects`in i)||!Array.isArray(i.subjects)||i.subjects.length===0)throw TypeError(`Native GeoSpec assertion requires admitted subjects.`);for(let e of i.subjects){if(typeof e!=`object`||!e)throw TypeError(`Native GeoSpec assertion requires admitted subjects.`);let n=`subjectHash`in e;if(n===`contentHash`in e)throw TypeError(`Native GeoSpec assertion requires one admitted subject identity.`);let r=n?e.subjectHash:`contentHash`in e?e.contentHash:void 0;if(typeof r!=`string`||!t.has(r))throw TypeError(`Native GeoSpec subject was not admitted by this run.`)}},i=i=>{let a=i.nativeModelLoader??e({...i.model,engine:i.nativeAssertions.engine,...i.nativeAssertions.maximumWorkUnitLimit===void 0?{}:{maximumWorkUnitLimit:i.nativeAssertions.maximumWorkUnitLimit}}),o=new Set,s=Object.assign(async e=>{let t=await a(e);return o.add(t.subjectHash),t},{async releaseAll(){try{await a.releaseAll()}finally{o.clear()}}}),c=i.nativeAssertions.engine,l={evaluateClaim(e){return r(e,o),c.evaluateClaim(e)},processRequest(e){let t=JSON.parse(n.decode(e));return typeof t==`object`&&t&&`method`in t&&t.method===`submitClaims`&&r(e,o),c.processRequest(e)},ingestSubject:(e,t,n)=>c.ingestSubject(e,t,n),subjectHandle:e=>c.subjectHandle(e),releaseSubject:e=>c.releaseSubject(e)},u=t({filesystem:i.filesystem,nativeAssertions:{...i.nativeAssertions,engine:l},nativeModelLoader:s,...i.builtinModules===void 0?{}:{builtinModules:i.builtinModules}});return{...u,async close(){try{await u.close()}finally{o.clear()}}}};export{i as createNativeGeoSpecRunner};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { GeoSpecRunResult } from "../types.mjs";
|
|
2
|
+
//#region src/runner/pool/pool-messages.d.ts
|
|
3
|
+
/** One schedulable work unit.
|
|
4
|
+
*
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
type GeoSpecPoolShard = {
|
|
8
|
+
/** Stable shard id, unique within one pool run. */
|
|
9
|
+
id: number;
|
|
10
|
+
/** GeoSpec file this shard executes. */
|
|
11
|
+
file: string;
|
|
12
|
+
/** Exact-test pattern for split shards (R3: `(file, testNamePattern)` work units). */
|
|
13
|
+
testNamePattern?: string;
|
|
14
|
+
};
|
|
15
|
+
/** Host → worker messages. */
|
|
16
|
+
/** @public */
|
|
17
|
+
type GeoSpecPoolHostMessage = {
|
|
18
|
+
type: 'initialize';
|
|
19
|
+
} | {
|
|
20
|
+
type: 'run-shard';
|
|
21
|
+
shard: GeoSpecPoolShard;
|
|
22
|
+
testNamePattern?: string;
|
|
23
|
+
testTimeout?: number;
|
|
24
|
+
matcherWallBackstop?: number;
|
|
25
|
+
forensic?: boolean;
|
|
26
|
+
} | {
|
|
27
|
+
/** List-only collection pass: register tests, run no bodies (R3 splitting). */
|
|
28
|
+
type: 'list-tests';
|
|
29
|
+
shardId: number;
|
|
30
|
+
file: string;
|
|
31
|
+
testTimeout?: number;
|
|
32
|
+
matcherWallBackstop?: number;
|
|
33
|
+
forensic?: boolean;
|
|
34
|
+
} | {
|
|
35
|
+
type: 'shutdown';
|
|
36
|
+
};
|
|
37
|
+
/** Worker → host messages. */
|
|
38
|
+
/** @public */
|
|
39
|
+
type GeoSpecPoolWorkerMessage = {
|
|
40
|
+
type: 'ready';
|
|
41
|
+
} | {
|
|
42
|
+
type: 'initialized';
|
|
43
|
+
} | {
|
|
44
|
+
type: 'initialization-error';
|
|
45
|
+
message: string;
|
|
46
|
+
} | {
|
|
47
|
+
type: 'file-start';
|
|
48
|
+
shardId: number;
|
|
49
|
+
file: string;
|
|
50
|
+
} | {
|
|
51
|
+
type: 'forensic';
|
|
52
|
+
shardId: number;
|
|
53
|
+
name: string;
|
|
54
|
+
value: number;
|
|
55
|
+
unit: 'milliseconds' | 'count';
|
|
56
|
+
} | {
|
|
57
|
+
type: 'tests-listed';
|
|
58
|
+
shardId: number;
|
|
59
|
+
file: string;
|
|
60
|
+
names: string[];
|
|
61
|
+
} | {
|
|
62
|
+
type: 'list-error';
|
|
63
|
+
shardId: number;
|
|
64
|
+
file: string;
|
|
65
|
+
message: string;
|
|
66
|
+
} | {
|
|
67
|
+
type: 'shard-complete';
|
|
68
|
+
shardId: number;
|
|
69
|
+
file: string;
|
|
70
|
+
result: GeoSpecRunResult;
|
|
71
|
+
durationMs: number;
|
|
72
|
+
primaryLoadKey?: string;
|
|
73
|
+
/** Worker-isolate resident memory at completion (heap + external), bytes. */
|
|
74
|
+
workerMemoryBytes?: number;
|
|
75
|
+
} | {
|
|
76
|
+
type: 'shard-error';
|
|
77
|
+
shardId: number;
|
|
78
|
+
file: string;
|
|
79
|
+
message: string;
|
|
80
|
+
};
|
|
81
|
+
/** Minimal worker handle the host-agnostic pool drives (Node or Web Worker). */
|
|
82
|
+
/** @public */
|
|
83
|
+
type GeoSpecPoolWorkerHandle = {
|
|
84
|
+
postMessage(message: GeoSpecPoolHostMessage): void;
|
|
85
|
+
onMessage(listener: (message: GeoSpecPoolWorkerMessage) => void): void;
|
|
86
|
+
onExit(listener: (details: {
|
|
87
|
+
unexpected: boolean;
|
|
88
|
+
message?: string;
|
|
89
|
+
}) => void): void;
|
|
90
|
+
/** Hard-stop the worker thread (R11 watchdog primitive). */
|
|
91
|
+
terminate(): Promise<void> | void;
|
|
92
|
+
};
|
|
93
|
+
//#endregion
|
|
94
|
+
export { GeoSpecPoolHostMessage, GeoSpecPoolShard, GeoSpecPoolWorkerHandle, GeoSpecPoolWorkerMessage };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GeoSpecRunResult, RunGeoSpecModuleOptions } from "./types.mjs";
|
|
2
|
+
//#region src/runner/run-geospec-module.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Execute an ESM GeoSpec module using the shared Tau VM substrate.
|
|
5
|
+
*
|
|
6
|
+
* @param options - filesystem and test entry path.
|
|
7
|
+
* @returns collected test cases or structured VM issues.
|
|
8
|
+
*
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
declare function runGeoSpecModule(options: RunGeoSpecModuleOptions): Promise<GeoSpecRunResult>;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { runGeoSpecModule };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import{bindGeoSpecSubject as e,rawSubjectResidency as t,resolveGeoSpecSubject as n}from"../model/subject.mjs";import{createGeoSpecAssertionClient as r}from"../assertion-client/client.mjs";import{GeoSpecModelLoadError as i}from"../model/errors.mjs";import{compileGeoSpecTestNamePattern as a,filterGeoSpecTests as o}from"./filter.mjs";import{createCollector as s}from"./collector.mjs";import{sha256Bytes as c}from"@taucad/runtime/kernel";import{createEsbuildModuleVm as l}from"@taucad/esbuild/vm";const u=`__GEOSPEC_RUN_BINDINGS__`,d=globalThis,f=()=>`geospec-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,p=e=>JSON.stringify(Object.entries(e.builtinModules??{}).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>[e,t.version,t.globalName,t.code])),m=(e,t)=>e.byteLength===t.byteLength&&e.every((e,n)=>e===t[n]),h=(e,t)=>e instanceof Uint8Array&&t instanceof Uint8Array?m(e,t):e===t,g=async(e,{question:t,path:n})=>t===`exists`?e.exists(n):t===`utf8`?e.readFile(n,`utf8`):e.readFile(n),_=async(e,t)=>(await Promise.all(t.map(async t=>{try{return h(await g(e,t),t.answer)}catch{return!1}}))).every(Boolean),v=e=>{let t=new Map,n=!0,r=async(e,r,i)=>{try{let a=await i,o=t.get(`${e}:${r}`);return o===void 0?t.set(`${e}:${r}`,{question:e,path:r,answer:a instanceof Uint8Array?Uint8Array.from(a):a}):n&&=h(o.answer,a),a}catch(e){throw n=!1,e}};return{filesystem:{exists:async t=>r(`exists`,t,e.exists(t)),readFile:(async(t,n)=>n===`utf8`?r(`utf8`,t,e.readFile(t,`utf8`)):r(`bytes`,t,e.readFile(t))),writeFile:async(t,n)=>e.writeFile(t,n),ensureDir:async t=>e.ensureDir(t)},reads:()=>n?[...t.values()]:void 0,observed:()=>[...t.values()]}},y=async e=>{let t=e.bundleCache?.get(e.entryPath);if(!(t===void 0||t.builtinIdentity!==p(e)||!await _(e.filesystem,t.bundlerReads)))return t},b=()=>{let e=d[u];if(e)return e;let t=new Map;return d[u]=t,t},x=e=>`
|
|
2
|
+
const getRunBinding = () => {
|
|
3
|
+
const binding = globalThis.${u}?.get(${JSON.stringify(e)});
|
|
4
|
+
if (!binding) {
|
|
5
|
+
throw new Error('GeoSpec runner binding is not active. Run the module through runGeoSpecModule().');
|
|
6
|
+
}
|
|
7
|
+
return binding;
|
|
8
|
+
};
|
|
9
|
+
`,S=e=>`
|
|
10
|
+
${x(e)}
|
|
11
|
+
|
|
12
|
+
export const describe = (name, fn) => getRunBinding().collector.describe(name, fn);
|
|
13
|
+
describe.skip = (name, fn) => getRunBinding().collector.describeSkip(name, fn);
|
|
14
|
+
|
|
15
|
+
export const it = (name, fn) => getRunBinding().collector.it(name, fn);
|
|
16
|
+
it.skip = (name, fn) => getRunBinding().collector.itSkip(name, fn);
|
|
17
|
+
|
|
18
|
+
export const test = it;
|
|
19
|
+
export const expectGeo = (subject, options) => getRunBinding().collector.expectGeo(subject, options);
|
|
20
|
+
`,C=e=>`
|
|
21
|
+
${x(e)}
|
|
22
|
+
export const GeoSpecModelLoadError = getRunBinding().geoSpecModelLoadError;
|
|
23
|
+
|
|
24
|
+
export const loadModel = async (options) => {
|
|
25
|
+
const binding = getRunBinding();
|
|
26
|
+
const loader = binding.nativeModelLoader;
|
|
27
|
+
if (typeof loader !== 'function') {
|
|
28
|
+
throw new GeoSpecModelLoadError([
|
|
29
|
+
{
|
|
30
|
+
code: 'GEOSPEC_MODEL_LOADER_UNAVAILABLE',
|
|
31
|
+
severity: 'error',
|
|
32
|
+
message: 'No GeoSpec model loader is active for this runner.',
|
|
33
|
+
suggestion: 'Run this test through the GeoSpec CLI or Tau browser test runner.',
|
|
34
|
+
},
|
|
35
|
+
]);
|
|
36
|
+
}
|
|
37
|
+
return loader(options);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const createModelLoader = (defaults = {}) => {
|
|
41
|
+
const factory = getRunBinding().createModelLoader;
|
|
42
|
+
if (typeof factory !== 'function') {
|
|
43
|
+
throw new GeoSpecModelLoadError([{ code: 'GEOSPEC_MODEL_LOADER_UNAVAILABLE', severity: 'error', message: 'No managed GeoSpec model loader is active for this runner.' }]);
|
|
44
|
+
}
|
|
45
|
+
return factory(defaults);
|
|
46
|
+
};
|
|
47
|
+
`;async function w(m){let h=a(m.testNamePattern);if(!h.success)return{success:!1,issues:[h.issue]};let g=v(m.filesystem),_=await l({filesystem:g.filesystem}),x=s({...m.matcherWallBackstop===void 0?{}:{matcherWallBackstop:m.matcherWallBackstop},...m.forensic===void 0?{}:{forensic:m.forensic},...m.onTestEvent===void 0?{}:{onTestEvent:m.onTestEvent},nativeAssertions:m.nativeAssertions}),w=await y(m),T=f(),E=b(),D=new Set,O=[],k=async()=>{do{let e=[...D];await Promise.allSettled(e);for(let t of e)D.delete(t)}while(D.size>0)},A=m.nativeModelLoader,j=r(m.nativeAssertions),M=!0,N=A===void 0?void 0:n=>{let r=O.length,a=`${T}:load:${r+1}`;O.push({loadId:a,status:`unavailable`});let o=(async()=>{try{let i=await A(n),{load:o,...s}=i,c=t(i),l=o===void 0?void 0:{...structuredClone(o),loadId:a};return O[r]={loadId:a,status:l?.status??`unavailable`,subject:s,...l===void 0?{}:{evidence:l}},e({engine:m.nativeAssertions.engine,client:j,identity:s,...l===void 0?{}:{load:l},isLive:()=>M,...c===void 0?{}:{ensureResident:c}})}catch(e){throw O[r]={loadId:a,status:`failed`,error:e instanceof Error?e.message:String(e),...e instanceof i?{diagnostics:e.diagnostics}:{}},e}})();return D.add(o.catch(()=>void 0)),D.add(o),o};E.set(T,{collector:x,geoSpecModelLoadError:i,...N?{nativeModelLoader:N}:{},...N?{createModelLoader:t=>{if(t.engine!==void 0||t.readSource!==void 0)throw TypeError(`Authored VM model defaults cannot replace the admitting host.`);let r=0,i=new Set,a=new Set,o,s=async i=>{let o=r,s=await N({...t,...i}),c=n(s);return c.lease!==void 0&&a.add(c.lease),e({...c,isLive:()=>c.isLive()&&r===o})},c=e=>{let t=s(e);return i.add(t),t},l=async()=>{do{let e=[...i];await Promise.allSettled(e);for(let t of e)i.delete(t)}while(i.size>0);r+=1;let e=[];for(let t of a)try{t.dispose(),a.delete(t)}catch(t){e.push(t)}if(e.length>0)throw AggregateError(e,`GeoSpec model scope disposal failed.`)};return Object.assign(c,{dispose(){return o??=l().finally(()=>{o=void 0}),o}})}}:{}}),_.registerModule(`geospec`,{version:`0.0.0-poc`,code:S(T)}),_.registerModule(`geospec/model`,{version:`0.0.0-poc`,code:C(T)});for(let[e,t]of Object.entries(m.builtinModules??{}))_.registerModule(e,t);try{let e=w?.bundle??await _.bundle(m.entryPath);if(!e.success)return{success:!1,issues:e.issues,bundle:e};let t=g.reads();m.bundleCache!==void 0&&w===void 0&&t!==void 0&&m.bundleCache.set(m.entryPath,{builtinIdentity:p(m),runToken:T,bundle:e,bundlerReads:t});let n=await _.execute(w===void 0?e.code:e.code.replaceAll(w.runToken,T)),r=async()=>{let t={},n=g.reads()!==void 0;for(let e of w?.bundlerReads??g.observed()){if(e.question===`exists`||typeof e.answer==`boolean`)continue;let r=await c(typeof e.answer==`string`?new TextEncoder().encode(e.answer):e.answer);n&&=t[e.path]===void 0||t[e.path]===`sha256:${r}`,t[e.path]=`sha256:${r}`}let r=new Map(Object.entries(t));for(let e of O){let{evidence:t}=e;for(let e of t?.exportOptions===void 0?t?.artifacts??[]:[])if(e.sourcePath!==void 0){let t=`sha256:${e.sha256}`;n&&=!r.has(e.sourcePath)||r.get(e.sourcePath)===t,r.set(e.sourcePath,t)}if(t?.sourcePath!==void 0&&t.exportOptions===void 0){let e=t.artifacts[0];if(e!==void 0){let i=`sha256:${e.sha256}`;n&&=!r.has(t.sourcePath)||r.get(t.sourcePath)===i,r.set(t.sourcePath,i)}}for(let[t,i]of Object.entries(e.evidence?.sourceRevision?.files??{}))n&&=!r.has(t)||r.get(t)===i,r.set(t,i)}return{status:n?O.some(e=>e.status!==`complete`)?`unavailable`:`complete`:`mixed`,modules:[{entryPath:m.entryPath,bundleSha256:await c(new TextEncoder().encode(w===void 0?e.code:e.code.replaceAll(w.runToken,T))),files:t,consistent:n}],loads:O}},i=e=>({discovered:x.tests.length,selected:e,completed:x.tests.filter(e=>e.status!==`not-run`&&e.status!==`skipped`).length,passed:x.tests.filter(e=>e.status===`passed`).length,failed:x.tests.filter(e=>e.status===`failed`).length,unsupported:x.tests.filter(e=>e.status===`unsupported`).length,inconclusive:x.tests.filter(e=>e.status===`inconclusive`).length,skipped:x.tests.filter(e=>e.status===`skipped`).length,notRun:x.tests.filter(e=>e.status===`not-run`).length});if(!n.success)return await k(),{success:!1,issues:n.issues,bundle:e,tests:x.tests,accounting:i(0),lineage:await r()};if(m.collectOnly===!0)return await x.waitForCompletion(m.testTimeout,/(?!)/u),await k(),{success:!0,passed:!1,tests:x.tests,bundle:e,accounting:i(0),lineage:await r()};await x.waitForCompletion(m.testTimeout,h.pattern),await k();let a=o(x.tests,h.pattern),s=await r();return{success:!0,passed:s.status===`complete`&&a.every(e=>e.status===`passed`||e.status===`skipped`),tests:a,bundle:e,accounting:i(a.length),lineage:s}}finally{await k(),M=!1,E.delete(T),E.size===0&&Reflect.deleteProperty(d,u),_.dispose()}}export{w as runGeoSpecModule};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
//#region src/runner/timeout-codes.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* One timeout vocabulary for every GeoSpec host.
|
|
4
|
+
*
|
|
5
|
+
* GeoSpec has three wall-clock bounds, and each host reports the ones it
|
|
6
|
+
* applies with the same code, so a spec that times out reads the same whether
|
|
7
|
+
* it ran in the browser worker, the Node pool or the CLI:
|
|
8
|
+
*
|
|
9
|
+
* | Code | Bound | Set by | Hosts |
|
|
10
|
+
* | ----------------------- | --------------------------------------------- | --------------------------------------------- | --------------------- |
|
|
11
|
+
* | `GEOSPEC_TEST_TIMEOUT` | One test's async body | `test_model.testTimeout`, CLI `--test-timeout` | Every host |
|
|
12
|
+
* | `GEOSPEC_SHARD_TIMEOUT` | One pool shard; its worker is terminated | CLI `--shard-timeout`, pool `shardTimeout` | Node pool |
|
|
13
|
+
* | `GEOSPEC_RUN_TIMEOUT` | One whole run; completed requirements survive | The host's run budget | Browser worker runner |
|
|
14
|
+
*
|
|
15
|
+
* None of them is a geometry verdict: a timed-out requirement is never a pass,
|
|
16
|
+
* and the deterministic work-unit budget inside the engine (`MATCHER_TIMEOUT`)
|
|
17
|
+
* is a separate, non-wall-clock refusal.
|
|
18
|
+
*
|
|
19
|
+
* @module
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Codes for GeoSpec wall-clock timeouts, one per bound.
|
|
23
|
+
*
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
declare const geoSpecTimeoutCode: {
|
|
27
|
+
/** A test's async body outlived `testTimeout` / `--test-timeout`. */
|
|
28
|
+
readonly test: "GEOSPEC_TEST_TIMEOUT";
|
|
29
|
+
/** A pool shard outlived the non-verdict `--shard-timeout` watchdog. */
|
|
30
|
+
readonly shard: "GEOSPEC_SHARD_TIMEOUT";
|
|
31
|
+
/** A whole run outlived its host run budget. */
|
|
32
|
+
readonly run: "GEOSPEC_RUN_TIMEOUT";
|
|
33
|
+
};
|
|
34
|
+
/** One GeoSpec timeout code. @public */
|
|
35
|
+
type GeoSpecTimeoutCode = (typeof geoSpecTimeoutCode)[keyof typeof geoSpecTimeoutCode];
|
|
36
|
+
/**
|
|
37
|
+
* Whether a diagnostic or issue code belongs to the GeoSpec timeout family.
|
|
38
|
+
*
|
|
39
|
+
* @param code - Any diagnostic or issue code.
|
|
40
|
+
* @returns True for {@link geoSpecTimeoutCode} values.
|
|
41
|
+
* @public
|
|
42
|
+
*/
|
|
43
|
+
declare const isGeoSpecTimeoutCode: (code: string) => code is GeoSpecTimeoutCode;
|
|
44
|
+
//#endregion
|
|
45
|
+
export { GeoSpecTimeoutCode, geoSpecTimeoutCode, isGeoSpecTimeoutCode };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e={test:`GEOSPEC_TEST_TIMEOUT`,shard:`GEOSPEC_SHARD_TIMEOUT`,run:`GEOSPEC_RUN_TIMEOUT`},t=new Set(Object.values(e)),n=e=>t.has(e);export{e as geoSpecTimeoutCode,n as isGeoSpecTimeoutCode};
|