geospec 0.0.0 → 0.1.0-beta.2
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 +47 -0
- package/agent/geospec-authoring/SKILL.md +496 -0
- package/agent/geospec-authoring/api-classes.md +13 -0
- package/agent/geospec-authoring/api-constants.md +6 -0
- package/agent/geospec-authoring/api-functions.md +49 -0
- package/agent/geospec-authoring/api-index.md +362 -0
- package/agent/geospec-authoring/api-types.md +1700 -0
- package/agent/geospec-authoring/public-api-classes.md +22 -0
- package/agent/geospec-authoring/public-api-constants.md +19 -0
- package/agent/geospec-authoring/public-api-functions.md +196 -0
- package/agent/geospec-authoring/public-api-index.md +856 -0
- package/agent/geospec-authoring/public-api-types-2.md +1513 -0
- package/agent/geospec-authoring/public-api-types.md +2048 -0
- package/agent/resources.d.ts +19 -0
- package/agent/resources.js +26 -0
- package/agent/skills.d.cts +13 -0
- package/agent/skills.json +27 -0
- package/dist/assertion-client/client.d.mts +124 -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 +49 -0
- package/dist/create-geospec.mjs +1 -0
- package/dist/engine/client.d.mts +93 -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 +63 -0
- package/dist/model/export-intent.mjs +1 -0
- package/dist/model/index.d.mts +6 -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 +119 -0
- package/dist/model/native-model-loader.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 +207 -0
- package/dist/runner/collector.d.mts +62 -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 +6 -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/types.d.mts +743 -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 +146 -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
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
# geospec
|
|
2
|
+
|
|
3
|
+
GeoSpec is a CAD geometry testing library with one host-independent authoring API:
|
|
4
|
+
`loadModel` from `geospec/model` and `expectGeo` from `geospec`.
|
|
5
|
+
|
|
6
|
+
This package is the **matcher-API substrate** (Apache-2.0): the authoring DSL,
|
|
7
|
+
the selector language, the diagnostics and evidence schemas, the matcher
|
|
8
|
+
registry, and host integration. It executes no geometry on its own: every claim
|
|
9
|
+
is evaluated by the compiled
|
|
10
|
+
[`geospec-engine`](https://github.com/taucad/geospec/tree/main/packages/geospec-engine) core that
|
|
11
|
+
the host passes to the runner. Tau's desktop/browser composition and the
|
|
12
|
+
[`geospec` CLI](../geospec-engine/README.md) supply that engine. Authored tests
|
|
13
|
+
do not import or select an engine, and nothing registers one globally.
|
|
14
|
+
|
|
15
|
+
The following is a `*.geospec.ts` module for the CLI or Tau `test_model`:
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { describe, expectGeo, it } from 'geospec';
|
|
19
|
+
import { loadModel } from 'geospec/model';
|
|
20
|
+
|
|
21
|
+
const code = `
|
|
22
|
+
import { makeBaseBox } from 'replicad';
|
|
23
|
+
export default function main() {
|
|
24
|
+
return makeBaseBox(40, 20, 8);
|
|
25
|
+
}
|
|
26
|
+
`;
|
|
27
|
+
|
|
28
|
+
describe('bracket', () => {
|
|
29
|
+
it('has expected measurements', async () => {
|
|
30
|
+
const model = await loadModel({
|
|
31
|
+
code: { 'main.ts': code },
|
|
32
|
+
file: 'main.ts',
|
|
33
|
+
format: 'glb',
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
expectGeo(model).toHaveBoundingBox({ size: { x: 40, y: 20, z: 8 }, tolerance: 0.1 });
|
|
37
|
+
expectGeo(model).toHaveSurfaceArea({ value: 2560, tolerance: 10 });
|
|
38
|
+
expectGeo(model).toHaveVolume({ value: 6400, tolerance: 10 });
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Running specs
|
|
44
|
+
|
|
45
|
+
### Subjects and host lifetime
|
|
46
|
+
|
|
47
|
+
Await `loadModel`, then make synchronous `expectGeo` assertions. Its
|
|
48
|
+
`GeoSpecSubject` is opaque: do not read mesh fields, forge a subject hash, or
|
|
49
|
+
reuse a subject after its owning loader/run is disposed. The host retains the
|
|
50
|
+
source and parameter identity and owns geometry admission, reuse and release.
|
|
51
|
+
|
|
52
|
+
Standalone and Vitest hosts supply a managed loader through `createModelLoader`
|
|
53
|
+
and the existing host integration; `geospec/vitest` supplies the framework
|
|
54
|
+
adapter. Vitest's `describe`/`it` come from Vitest, while the helpers imported
|
|
55
|
+
from `geospec` above belong to GeoSpec's VM runner. Ordinary assertions remain
|
|
56
|
+
`expectGeo`; the optional Vitest `expect` extension has its own asynchronous
|
|
57
|
+
settlement contract. See the [host binding documentation](https://github.com/taucad/geospec/tree/main/packages/geospec-engine#readme).
|
|
58
|
+
|
|
59
|
+
Python uses `load_model`/`expect_geo` from `geospec`, with the wheel's pytest
|
|
60
|
+
plugin scope or a standalone `GeoSpecEngine` context. Tau `test_model` discovers
|
|
61
|
+
TypeScript/JavaScript tests, not Python files.
|
|
62
|
+
|
|
63
|
+
Read `runStatus`, complete accounting, discovery and source-lineage status when
|
|
64
|
+
interpreting a run. Unsupported, inconclusive, skipped and not-run requirements
|
|
65
|
+
are not passes. Compact `test_model` output can omit details; its retained
|
|
66
|
+
`fullResult` remains the complete result. An empty failures list alone is not
|
|
67
|
+
qualification, and filtered requirements remain outside the demonstrated scope.
|
|
68
|
+
|
|
69
|
+
### Runner configuration
|
|
70
|
+
|
|
71
|
+
Install [`@taucad/geospec-engine`](../geospec-engine) for its `geospec` CLI or
|
|
72
|
+
Node worker pool. To embed a serial runner, pass a compiled engine to
|
|
73
|
+
`createNativeGeoSpecRunner` from `geospec/runner/native`; it builds the native
|
|
74
|
+
model loader and releases every admitted subject after each run. These use the
|
|
75
|
+
same compiled composition. Other embeddings must qualify their actual binding,
|
|
76
|
+
input representation and supported domain; shared authoring syntax alone does
|
|
77
|
+
not establish verdict equivalence. The CLI's flags and pool options are
|
|
78
|
+
documented in that package's README.
|
|
79
|
+
|
|
80
|
+
The filters below are the shared vocabulary of the CLI, the embedded runners
|
|
81
|
+
and the Tau `test_model` tool:
|
|
82
|
+
|
|
83
|
+
- `files`: GeoSpec files or directory roots to run. Empty input recursively discovers from the project root.
|
|
84
|
+
- `include`: GeoSpec file include globs, defaulting to `["**/*.geospec.{ts,js}"]`
|
|
85
|
+
- `exclude`: GeoSpec file exclude globs
|
|
86
|
+
- `testNamePattern`: JavaScript regular expression matched against full `suite > test` names
|
|
87
|
+
- `testTimeout`: async test timeout in milliseconds
|
|
88
|
+
|
|
89
|
+
The host uses Tau runtime exports or already-exported GLB/glTF/STEP bytes. Authored tests use `loadModel` for both code and direct geometry inputs; low-level parsing/host APIs are not an alternate authored-test dialect.
|
|
90
|
+
|
|
91
|
+
Load failures carry structured diagnostics. Assertion reports retain the selected claim, evidence, provenance and diagnostics; inspect those reports rather than expecting mutable evidence fields on the opaque subject.
|
|
92
|
+
|
|
93
|
+
Keep each test readable with its own `loadModel()` call. Each load captures current source/parameter identity; hosts may reuse admitted computations only under matching identities. Do not assume a filename alone permits cross-file memoization:
|
|
94
|
+
|
|
95
|
+
```ts
|
|
96
|
+
import { describe, expectGeo, it } from 'geospec';
|
|
97
|
+
import { loadModel } from 'geospec/model';
|
|
98
|
+
|
|
99
|
+
describe('assembly', () => {
|
|
100
|
+
it('has no global part interference', async () => {
|
|
101
|
+
const model = await loadModel({ file: 'main.ts' });
|
|
102
|
+
expectGeo(model).toHaveNoComponentInterference({ tolerance: 0.1 });
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
it('keeps the ring and planet free of interference', async () => {
|
|
106
|
+
const model = await loadModel({ file: 'main.ts' });
|
|
107
|
+
expectGeo(model).toHaveNoComponentInterference({
|
|
108
|
+
tolerance: 0.05,
|
|
109
|
+
pairs: [{ left: /ring/i, right: /planet gear/i }],
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Production assembly suites can combine mesh-integrity, occurrence, spatial
|
|
116
|
+
relationship, and exact BRep assertions without adding domain-specific
|
|
117
|
+
matchers for each mechanical subsystem:
|
|
118
|
+
|
|
119
|
+
```ts
|
|
120
|
+
expectGeo(model).toHaveMeshIntegrity({
|
|
121
|
+
finitePositions: true,
|
|
122
|
+
degenerateTriangles: { count: 0 },
|
|
123
|
+
duplicateFaces: { count: 0 },
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
expectGeo(model).toHaveAssemblyOccurrences({
|
|
127
|
+
uniqueNames: true,
|
|
128
|
+
occurrences: [
|
|
129
|
+
{ name: 'Housing', count: 1 },
|
|
130
|
+
{ name: /^Fastener \d+$/, count: 8 },
|
|
131
|
+
],
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
expectGeo(model).toHaveSpatialRelationships({
|
|
135
|
+
relationships: [
|
|
136
|
+
{ id: 'shaft seats in bearing', kind: 'contact', subject: 'Shaft', target: 'Bearing', tolerance: 0.05 },
|
|
137
|
+
{ id: 'pin remains inside yoke', kind: 'containment', subject: 'Pin', target: 'Yoke', tolerance: 0.05 },
|
|
138
|
+
],
|
|
139
|
+
});
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Choose selectors supported by the admitted source. A qualified mesh `body`
|
|
143
|
+
selector identifies one material root with its cavity boundaries; disconnected
|
|
144
|
+
roots and islands inside cavities remain separate Bodies. Its `of` scope
|
|
145
|
+
matches the exact retained primitive label, including any ordinal suffix.
|
|
146
|
+
Inspect that label and preserve cardinality instead of guessing an occurrence
|
|
147
|
+
path. Mesh input does not invent assembly ancestry or analytic faces; missing
|
|
148
|
+
measure, probe or ordering evidence refuses, even through query negation.
|
|
149
|
+
The STEP Body index currently exposes per-occurrence solid aggregates, so do
|
|
150
|
+
not assume its Body count maps one-to-one to mesh material roots.
|
|
151
|
+
|
|
152
|
+
Whole-Body contact requires no interior overlap and boundary separation within
|
|
153
|
+
the declared inclusive tolerance. It does not establish a contact area or seal;
|
|
154
|
+
finite-face angular requirements need their actual analytic evidence.
|
|
155
|
+
|
|
156
|
+
Load STEP through the same authoring API:
|
|
157
|
+
|
|
158
|
+
```ts
|
|
159
|
+
import { loadModel } from 'geospec/model';
|
|
160
|
+
|
|
161
|
+
const subject = await loadModel({ file: 'part.step', format: 'step' });
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
For CAD source, `loadModel({ file: 'main.ts', format: 'step' })` asks the host to export STEP. The configured compiled engine admits the exact returned bytes through its OCCT binding. Export and source provenance do not by themselves certify a geometric requirement.
|
|
165
|
+
|
|
166
|
+
Measurement matchers currently support mesh evidence and prefer exact BRep evidence when it is present:
|
|
167
|
+
|
|
168
|
+
```ts
|
|
169
|
+
expectGeo(subject).toHaveSurfaceArea({ value: 12_345, tolerance: 1 });
|
|
170
|
+
expectGeo(subject).toHaveVolume({ value: 120_000, tolerance: 10 });
|
|
171
|
+
expectGeo(subject).toHaveMass({ value: 94.2, density: 0.000_785, tolerance: 0.5 });
|
|
172
|
+
expectGeo(subject).toHaveCenterOfMass({ point: { x: 0, y: 0, z: 10 }, tolerance: 0.05 });
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Initial BRep feature matchers are available when a loader provides BRep evidence:
|
|
176
|
+
|
|
177
|
+
```ts
|
|
178
|
+
import { loadModel } from 'geospec/model';
|
|
179
|
+
|
|
180
|
+
const subject = await loadModel({ file: 'main.ts', format: 'step' });
|
|
181
|
+
|
|
182
|
+
expectGeo(subject).toBeValidBrep({ maxTolerance: 0.01, closedShells: true });
|
|
183
|
+
expectGeo(subject).toHavePlanarFace({ normal: { x: 0, y: 0, z: 1 }, offset: 20, tolerance: 0.05 });
|
|
184
|
+
expectGeo(subject).toHaveCylindricalFace({ radius: 15, axis: 'z', tolerance: 0.05 });
|
|
185
|
+
expectGeo(subject).toHaveCircularHole({ diameter: 8, through: true, axis: 'z', center: { x: 25, y: 15 } });
|
|
186
|
+
expectGeo(subject).toHaveChamferFeature({ distance: 2, selection: 'outer top perimeter', tolerance: 0.05 });
|
|
187
|
+
expectGeo(subject).toHaveMinimumWallThickness({ value: { greaterThanOrEqual: 2 }, tolerance: 0.05 });
|
|
188
|
+
expectGeo(subject).toHaveVoidContinuity({
|
|
189
|
+
path: [{ occurrence: 'Throttle Body 1' }, { occurrence: 'Cylinder Head R' }],
|
|
190
|
+
material: ['Throttle Body 1', 'Intake Manifold 1', 'Cylinder Head R'],
|
|
191
|
+
minCrossSection: 900,
|
|
192
|
+
isolatedFrom: [[120, 0, 40]],
|
|
193
|
+
});
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
These are requirement examples, not a claim that every admitted model supports
|
|
197
|
+
them. `toHaveVoidContinuity` requires the declared path, material and isolation
|
|
198
|
+
proposition to be proved in a qualified domain. A sampled cross-section cannot
|
|
199
|
+
certify a continuous minimum: the general sampled profile refuses a requested
|
|
200
|
+
`minCrossSection`. Restricted nominal analytic domains have separate premises;
|
|
201
|
+
general mesh lumen, wall and motion qualification remains incomplete.
|
|
202
|
+
|
|
203
|
+
Likewise, watertight edge incidence does not prove manifold validity, a Boolean
|
|
204
|
+
fuse or material connectivity. Bounds and playback cannot certify contact,
|
|
205
|
+
clearance, containment or sealing. Preserve intended geometry and tolerances;
|
|
206
|
+
report unavailable evidence instead of replacing the requirement with a proxy.
|
|
207
|
+
|
|
208
|
+
The [canonical API index](agent/geospec-authoring/api-index.md) describes
|
|
209
|
+
ordinary authoring. The separate
|
|
210
|
+
[complete public API index](agent/geospec-authoring/public-api-index.md)
|
|
211
|
+
retains host and framework contracts. A low-level
|
|
212
|
+
`GeometrySubject` input is not interchangeable with the opaque subject returned
|
|
213
|
+
by canonical `loadModel`.
|
|
214
|
+
|
|
215
|
+
When a geometry assertion needs a parameter variant, pass that variant directly to `loadModel`. Omitting `parameters` exercises the defaults authored by the model:
|
|
216
|
+
|
|
217
|
+
```ts
|
|
218
|
+
import { describe, expectGeo, it } from 'geospec';
|
|
219
|
+
import { loadModel } from 'geospec/model';
|
|
220
|
+
|
|
221
|
+
describe('parameter variants', () => {
|
|
222
|
+
it('uses the model defaults', async () => {
|
|
223
|
+
const model = await loadModel({ file: 'main.ts' });
|
|
224
|
+
expectGeo(model).toHaveBoundingBox({ size: { x: 40 }, tolerance: 1 });
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
it('accepts an explicit width', async () => {
|
|
228
|
+
const width = 80;
|
|
229
|
+
const model = await loadModel({
|
|
230
|
+
file: 'main.ts',
|
|
231
|
+
parameters: { width },
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
expectGeo(model).toHaveBoundingBox({ size: { x: width }, tolerance: 1 });
|
|
235
|
+
});
|
|
236
|
+
});
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## License
|
|
240
|
+
|
|
241
|
+
**Apache-2.0.** This package is the permissive perimeter: your specs, your
|
|
242
|
+
models and your verdicts do not inherit this package's license. See
|
|
243
|
+
[Licensing](../../docs/licensing/overview.md) for the routing map
|
|
244
|
+
and the internal-use FAQ.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
Write tests before implementation; assert deterministic, measurable properties.
|
|
2
|
+
|
|
3
|
+
## Test shape
|
|
4
|
+
|
|
5
|
+
- Use `*.geospec.ts` or `*.geospec.js`. Import `describe`, `it` and `expectGeo` from `geospec`, and `loadModel` from `geospec/model`.
|
|
6
|
+
- Await `loadModel`, then assert synchronously with `expectGeo(model)`. The host supplies the compiled binding; authoring does not select an engine.
|
|
7
|
+
- Await or return the complete model-load chain from the test callback; detached future loads are not part of a completed test.
|
|
8
|
+
- Omit `parameters` for model-code defaults; use `{ file, parameters }` for variants. Loaded subjects are opaque.
|
|
9
|
+
|
|
10
|
+
Canonical TypeScript authoring:
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import { describe, expectGeo, it } from 'geospec';
|
|
14
|
+
import { loadModel } from 'geospec/model';
|
|
15
|
+
|
|
16
|
+
describe('main geometry', () => {
|
|
17
|
+
it('has the intended envelope', async () => {
|
|
18
|
+
const model = await loadModel({ file: 'main.ts', parameters: { width: 120 } });
|
|
19
|
+
expectGeo(model).toHaveBoundingBox({ size: { x: 120 }, tolerance: 1 });
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Specs are always TypeScript or JavaScript, whatever the model's kernel: `loadModel({ file })` evaluates `main.ts`, `main.tsx`, `main.py`, `main.scad`, `main.kcl` or `main.cs` through Tau's runtime. `test_model` discovers `*.geospec.ts` and `*.geospec.js` only.
|
|
25
|
+
|
|
26
|
+
Every matcher takes one expectation object:
|
|
27
|
+
|
|
28
|
+
- Wrong: `expectGeo(model).toHaveVolume(5000, { tolerance: 5 })`. Correct: `expectGeo(model).toHaveVolume({ value: 5000, tolerance: 5 })`.
|
|
29
|
+
- Wrong: `await expectGeo(model)…`. Correct: await `loadModel`, then assert synchronously.
|
|
30
|
+
- Wrong: exact-feature matchers on a mesh kernel (Manifold, JSCAD, OpenSCAD, PicoGK, PicoVoxel). Correct: `toBeValidBrep`, `toHaveTopologyCounts`, the face, hole, pattern, chamfer, fillet and wall-thickness matchers, `toHaveStepUnits`, `toHaveProductStructure` and `toHaveVoidContinuity` need STEP BRep evidence and report unsupported on meshes; assert meshes with bounds, volume, surface area, connected components and `toBeWatertight`.
|
|
31
|
+
|
|
32
|
+
## Coverage
|
|
33
|
+
|
|
34
|
+
Bounds and physical properties are insufficient. Cover major components, named features, variants, dimensions/positions, disjoint counts, closure, interference and supported exact features. Explicitly report unsupported requirements; proxies cannot fulfill them.
|
|
35
|
+
|
|
36
|
+
- `toHaveBoundingBox`: size/position.
|
|
37
|
+
- `toHaveConnectedComponents`: qualified material connectivity; visual touching cannot justify tolerance changes.
|
|
38
|
+
- `toBeWatertight`: closed edge incidence, not manifold validity, fusion or material connectivity. Bounds prove none of these. Missing evidence is unsupported.
|
|
39
|
+
- `toHaveSurfaceArea`, `toHaveVolume`, `toHaveCenterOfMass`, `toHaveMass`: physical measurements.
|
|
40
|
+
- `toHaveNoComponentInterference`: overlap; allow deliberate press fits.
|
|
41
|
+
- `loadModel({ file, format: 'step' })`: use BRep evidence for supported topology and feature assertions. Missing occurrence, interference, clearance, containment, lumen, wall, section or motion evidence is unsupported, not a pass or an envelope substitute.
|
|
42
|
+
|
|
43
|
+
Test assemblies and independent units; preserve sibling coverage when adding files. Non-top-level geometry needs kernel export/invocation, not test removal.
|
|
44
|
+
|
|
45
|
+
Fix geometry at its root; never weaken tolerances, delete assertions, or reduce detail to pass.
|
|
46
|
+
|
|
47
|
+
`public-api-index.md` covers the host and framework API; authoring needs only the Core API below and `api-*` files.
|