@bldrs-ai/conway 1.469.1386 → 1.471.1405
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/compiled/examples/browser-bundled.cjs +1 -1
- package/compiled/examples/cli-bundled.cjs +1 -1
- package/compiled/examples/cli-step-bundled.cjs +1 -1
- package/compiled/examples/validator-bundled.cjs +1 -1
- package/compiled/src/scripts/model_report_displacement.test.d.ts +2 -0
- package/compiled/src/scripts/model_report_displacement.test.d.ts.map +1 -0
- package/compiled/src/scripts/model_report_displacement.test.js +104 -0
- package/compiled/src/scripts/render_glb_paths.test.d.ts +2 -0
- package/compiled/src/scripts/render_glb_paths.test.d.ts.map +1 -0
- package/compiled/src/scripts/render_glb_paths.test.js +115 -0
- package/compiled/src/version/version.js +1 -1
- package/compiled/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -30,7 +30,7 @@ var import_node_process = require("node:process");
|
|
|
30
30
|
var readline = __toESM(require("node:readline"), 1);
|
|
31
31
|
|
|
32
32
|
// compiled/src/version/version.js
|
|
33
|
-
var versionString = "Conway v1.
|
|
33
|
+
var versionString = "Conway v1.471.1405";
|
|
34
34
|
|
|
35
35
|
// compiled/dependencies/conway-geom/interface/conway_geometry.js
|
|
36
36
|
var wasmType = "";
|
|
@@ -14965,7 +14965,7 @@ ${t5.join("\n")}` : "";
|
|
|
14965
14965
|
var import_process = require("process");
|
|
14966
14966
|
|
|
14967
14967
|
// compiled/src/version/version.js
|
|
14968
|
-
var versionString = "Conway v1.
|
|
14968
|
+
var versionString = "Conway v1.471.1405";
|
|
14969
14969
|
|
|
14970
14970
|
// compiled/dependencies/conway-geom/interface/conway_geometry.js
|
|
14971
14971
|
function pThreadsAllowed() {
|
|
@@ -15943,7 +15943,7 @@ var ParsingBuffer = class {
|
|
|
15943
15943
|
};
|
|
15944
15944
|
|
|
15945
15945
|
// compiled/src/version/version.js
|
|
15946
|
-
var versionString = "Conway v1.
|
|
15946
|
+
var versionString = "Conway v1.471.1405";
|
|
15947
15947
|
|
|
15948
15948
|
// compiled/dependencies/conway-geom/interface/conway_geometry.js
|
|
15949
15949
|
function pThreadsAllowed() {
|
|
@@ -944,7 +944,7 @@ var EntityTypesIfcCount = 909;
|
|
|
944
944
|
var entity_types_ifc_gen_default = EntityTypesIfc;
|
|
945
945
|
|
|
946
946
|
// compiled/src/version/version.js
|
|
947
|
-
var versionString = "Conway v1.
|
|
947
|
+
var versionString = "Conway v1.471.1405";
|
|
948
948
|
|
|
949
949
|
// compiled/dependencies/conway-geom/interface/conway_geometry.js
|
|
950
950
|
var wasmType = "";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model_report_displacement.test.d.ts","sourceRoot":"","sources":["../../../src/scripts/model_report_displacement.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { describe, expect, test } from '@jest/globals';
|
|
2
|
+
// @ts-expect-error -- an untyped .mjs helper beside the CLI it serves.
|
|
3
|
+
import { localCentre, placeCentre, robustCentre } from '../../../scripts/debug/displacement.mjs';
|
|
4
|
+
/* eslint-disable no-magic-numbers -- these are synthetic coordinates and
|
|
5
|
+
distances chosen to mirror the real model in conway#456. Naming each one
|
|
6
|
+
would obscure the shape the cases exist to express: a tight cluster near
|
|
7
|
+
the site origin plus one part flung far away. */
|
|
8
|
+
/**
|
|
9
|
+
* The scoring behind model_report.mjs's `displacement` stage (conway#456).
|
|
10
|
+
*
|
|
11
|
+
* The stage answers "which parts are flung away from where they belong",
|
|
12
|
+
* which the `mesh` stage cannot: `mesh` measures extent in MESH-LOCAL
|
|
13
|
+
* coordinates, so on an export that writes geometry directly in site
|
|
14
|
+
* coordinates every honest part looks displaced by its distance from the
|
|
15
|
+
* file origin.
|
|
16
|
+
*
|
|
17
|
+
* These cases use synthetic centres rather than a model, because the
|
|
18
|
+
* motivating file is 256 MB and private. What is worth pinning is the
|
|
19
|
+
* scoring, and the scoring is pure — which is why it lives in
|
|
20
|
+
* displacement.mjs rather than in the CLI script, whose module body runs
|
|
21
|
+
* the whole tool on import.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Column-major 4x4 translation, matching the walk tuple's layout.
|
|
25
|
+
*
|
|
26
|
+
* @param x Translation along x.
|
|
27
|
+
* @param y Translation along y.
|
|
28
|
+
* @param z Translation along z.
|
|
29
|
+
* @return The 16-element matrix.
|
|
30
|
+
*/
|
|
31
|
+
function translation(x, y, z) {
|
|
32
|
+
return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, x, y, z, 1];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A stub geometry over a fixed point list.
|
|
36
|
+
*
|
|
37
|
+
* @param points One [x, y, z] per vertex.
|
|
38
|
+
* @return Something with the getPoint() shape worldCentre reads.
|
|
39
|
+
*/
|
|
40
|
+
function geometryOf(points) {
|
|
41
|
+
return {
|
|
42
|
+
getPoint: (i) => ({ x: points[i][0], y: points[i][1], z: points[i][2] }),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
describe('displacement scoring', () => {
|
|
46
|
+
test('the robust centre ignores outliers rather than chasing them', () => {
|
|
47
|
+
// Nine parts clustered near the site origin, one flung far away — the
|
|
48
|
+
// shape of the motivating model, scaled down.
|
|
49
|
+
const centres = [
|
|
50
|
+
...Array.from({ length: 9 }, (_, i) => [578 + i, 763, 3]),
|
|
51
|
+
[-751, 1075, 1377],
|
|
52
|
+
];
|
|
53
|
+
const centre = robustCentre(centres);
|
|
54
|
+
// A MEAN would sit ~130 units off in x and ~137 in z, dragged by the
|
|
55
|
+
// single outlier; every honest part would then score as displaced and
|
|
56
|
+
// the outlier's own score would shrink. That inversion is the reason
|
|
57
|
+
// this is a median.
|
|
58
|
+
expect(centre[0]).toBeGreaterThan(577);
|
|
59
|
+
expect(centre[0]).toBeLessThan(587);
|
|
60
|
+
expect(centre[2]).toBeCloseTo(3, 6);
|
|
61
|
+
const distances = centres.map((each) => Math.hypot(each[0] - centre[0], each[1] - centre[1], each[2] - centre[2]));
|
|
62
|
+
const cluster = distances.slice(0, 9);
|
|
63
|
+
const outlier = distances[9];
|
|
64
|
+
// The signal the stage's `factor x median` threshold consumes: the
|
|
65
|
+
// outlier has to clear 8x the median by a wide margin, or it would be
|
|
66
|
+
// reported as ordinary.
|
|
67
|
+
const median = [...cluster].sort((a, b) => a - b)[Math.floor(cluster.length / 2)];
|
|
68
|
+
expect(outlier).toBeGreaterThan(median * 8);
|
|
69
|
+
});
|
|
70
|
+
test('a mesh centre is placed by its transform, not left local', () => {
|
|
71
|
+
// The defect this stage exists to fix in one assertion: identical local
|
|
72
|
+
// geometry at two different placements must score differently. Reading
|
|
73
|
+
// local coordinates would make these indistinguishable.
|
|
74
|
+
const unitBox = [[-1, -1, -1], [1, 1, 1]];
|
|
75
|
+
const local = localCentre(geometryOf(unitBox), 2);
|
|
76
|
+
const atOrigin = placeCentre(local, translation(0, 0, 0));
|
|
77
|
+
const farAway = placeCentre(local, translation(1000, 0, 0));
|
|
78
|
+
expect(atOrigin).toEqual([0, 0, 0]);
|
|
79
|
+
expect(farAway).toEqual([1000, 0, 0]);
|
|
80
|
+
});
|
|
81
|
+
test('an undefined transform means identity, not a skipped mesh', () => {
|
|
82
|
+
expect(placeCentre(localCentre(geometryOf([[2, 4, 6], [4, 8, 12]]), 2), undefined))
|
|
83
|
+
.toEqual([3, 6, 9]);
|
|
84
|
+
});
|
|
85
|
+
test('a wrong walk-tuple index throws rather than scoring NaN', () => {
|
|
86
|
+
// conway#456 names the transform as walked[1]; it is walked[0].
|
|
87
|
+
// Following the issue verbatim handed this an object, every
|
|
88
|
+
// multiplication produced NaN, Stage.record silently discarded every
|
|
89
|
+
// non-finite value, and the stage reported "N calls, 0 measured" — a
|
|
90
|
+
// clean-looking result manufactured by a bug. That is hazard 1 from the
|
|
91
|
+
// script's own header, so it has to be loud.
|
|
92
|
+
const notATransform = { someObject: true };
|
|
93
|
+
expect(() => placeCentre([0, 0, 0], notATransform)).toThrow(/walk tuple index/);
|
|
94
|
+
});
|
|
95
|
+
test('non-finite vertex data yields no centre rather than a NaN score', () => {
|
|
96
|
+
expect(localCentre(geometryOf([[0, 0, 0], [NaN, 0, 0]]), 2)).toBeUndefined();
|
|
97
|
+
});
|
|
98
|
+
test('a right-shaped transform holding NaN drops the mesh, and does not throw', () => {
|
|
99
|
+
// Data, not a programming error: one unusable placement must not take
|
|
100
|
+
// down the whole run and discard the other stages' reports.
|
|
101
|
+
const nanTransform = translation(NaN, 0, 0);
|
|
102
|
+
expect(placeCentre([1, 1, 1], nanTransform)).toBeUndefined();
|
|
103
|
+
});
|
|
104
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render_glb_paths.test.d.ts","sourceRoot":"","sources":["../../../src/scripts/render_glb_paths.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import os from 'os';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { execFileSync } from 'child_process';
|
|
5
|
+
import { describe, expect, test, beforeAll, afterAll } from '@jest/globals';
|
|
6
|
+
import { createRequire } from 'module';
|
|
7
|
+
/* eslint-disable @typescript-eslint/no-explicit-any -- render_glb.cjs is an
|
|
8
|
+
untyped CommonJS CLI script, loaded here through createRequire. */
|
|
9
|
+
/**
|
|
10
|
+
* Path resolution in scripts/render_glb.cjs (conway#457).
|
|
11
|
+
*
|
|
12
|
+
* The script accepts a comma-joined chunk list, and used to split on comma
|
|
13
|
+
* unconditionally — which tore a real path containing a comma into fragments
|
|
14
|
+
* and reported the first fragment as missing. Several models we ship are
|
|
15
|
+
* named that way, and `-g` keeps the source basename, so following
|
|
16
|
+
* scripts/debug/README.md on one of them failed.
|
|
17
|
+
*/
|
|
18
|
+
const require_ = createRequire(import.meta.url);
|
|
19
|
+
// Resolved from the repo root rather than relative to this file: the test
|
|
20
|
+
// runs from compiled/src/scripts, where a relative hop would land in
|
|
21
|
+
// compiled/scripts, which does not exist (scripts/ is not part of the tsc
|
|
22
|
+
// build). Jest's rootDir is the repo root.
|
|
23
|
+
const { resolveGlbPaths } = require_(path.resolve(process.cwd(), 'scripts/render_glb.cjs'));
|
|
24
|
+
let workDir;
|
|
25
|
+
/** A name in the shape that broke: a comma inside a single real filename. */
|
|
26
|
+
const COMMA_NAME = 'Wiesenplatz 7, 4057 Basel_test0.glb';
|
|
27
|
+
beforeAll(() => {
|
|
28
|
+
workDir = fs.mkdtempSync(path.join(os.tmpdir(), 'render-glb-paths-'));
|
|
29
|
+
fs.writeFileSync(path.join(workDir, COMMA_NAME), 'not-a-real-glb');
|
|
30
|
+
fs.writeFileSync(path.join(workDir, 'chunk0.glb'), 'not-a-real-glb');
|
|
31
|
+
fs.writeFileSync(path.join(workDir, 'chunk1.glb'), 'not-a-real-glb');
|
|
32
|
+
});
|
|
33
|
+
afterAll(() => {
|
|
34
|
+
fs.rmSync(workDir, { recursive: true, force: true });
|
|
35
|
+
});
|
|
36
|
+
describe('render_glb path resolution', () => {
|
|
37
|
+
test('a real path containing a comma resolves to itself (issue #457)', () => {
|
|
38
|
+
const target = path.join(workDir, COMMA_NAME);
|
|
39
|
+
// The regression: this used to come back as ['<dir>/Wiesenplatz 7',
|
|
40
|
+
// ' 4057 Basel_test0.glb'] and fail on the first, which reads as a
|
|
41
|
+
// missing file rather than as a parsing decision.
|
|
42
|
+
expect(resolveGlbPaths(target)).toEqual([target]);
|
|
43
|
+
});
|
|
44
|
+
test('a genuine chunk list still splits', () => {
|
|
45
|
+
const chunks = [
|
|
46
|
+
path.join(workDir, 'chunk0.glb'),
|
|
47
|
+
path.join(workDir, 'chunk1.glb'),
|
|
48
|
+
];
|
|
49
|
+
expect(resolveGlbPaths(chunks.join(','))).toEqual(chunks);
|
|
50
|
+
});
|
|
51
|
+
test('a JSON array resolves chunks whose names contain commas', () => {
|
|
52
|
+
// The case the literal-path rule alone cannot reach: a comma-named model
|
|
53
|
+
// large enough that the CLI splits it, so no single file bears the name.
|
|
54
|
+
// visual_diff_report.cjs passes this form.
|
|
55
|
+
const chunks = [
|
|
56
|
+
path.join(workDir, COMMA_NAME),
|
|
57
|
+
path.join(workDir, 'chunk0.glb'),
|
|
58
|
+
];
|
|
59
|
+
expect(resolveGlbPaths(JSON.stringify(chunks))).toEqual(chunks);
|
|
60
|
+
});
|
|
61
|
+
test('a JSON array with a missing member fails rather than rendering part', () => {
|
|
62
|
+
const chunks = [path.join(workDir, 'chunk0.glb'), path.join(workDir, 'gone.glb')];
|
|
63
|
+
expect(() => resolveGlbPaths(JSON.stringify(chunks))).toThrow(/gone\.glb/);
|
|
64
|
+
});
|
|
65
|
+
test('a trailing comma from a shell-built list still resolves', () => {
|
|
66
|
+
const target = path.join(workDir, 'chunk0.glb');
|
|
67
|
+
expect(resolveGlbPaths(`${target},`)).toEqual([target]);
|
|
68
|
+
});
|
|
69
|
+
test('a missing path names both readings rather than one fragment', () => {
|
|
70
|
+
const missing = path.join(workDir, 'Nowhere 1, 2345 Somewhere.glb');
|
|
71
|
+
// What the error says is the whole point of the issue: the old failure
|
|
72
|
+
// surfaced as ENOENT on "Nowhere 1", a string the caller never typed.
|
|
73
|
+
expect(() => resolveGlbPaths(missing)).toThrow(/No such GLB/);
|
|
74
|
+
expect(() => resolveGlbPaths(missing)).toThrow(/2-chunk list/);
|
|
75
|
+
});
|
|
76
|
+
test('a CLI failure surfaces its own message to visual_diff_report', () => {
|
|
77
|
+
// This contract spans two files and has no other guard. render_glb.cjs
|
|
78
|
+
// prints "Error: <message>"; visual_diff_report.cjs's
|
|
79
|
+
// childFailureDiagnostic picks the FIRST stderr line matching its regex
|
|
80
|
+
// and puts it in the PR comment's table cell. Letting Node throw
|
|
81
|
+
// uncaught instead degrades every render-failure cell to a source code
|
|
82
|
+
// frame, with the whole suite otherwise green.
|
|
83
|
+
//
|
|
84
|
+
// Scope, honestly: this pins the END-TO-END result, not each mechanism.
|
|
85
|
+
// Removing the "Error:" prefix alone keeps it passing, because the stack
|
|
86
|
+
// printed after the message opens with an "Error:" line that matches the
|
|
87
|
+
// same regex. Both are kept because a non-Error throw has no stack.
|
|
88
|
+
const script = path.resolve(process.cwd(), 'scripts/render_glb.cjs');
|
|
89
|
+
const missing = path.join(workDir, 'Nowhere 1, 2345 Somewhere.glb');
|
|
90
|
+
let stderr = '';
|
|
91
|
+
try {
|
|
92
|
+
execFileSync(process.execPath, [script, missing, path.join(workDir, 'out.png')], { stdio: 'pipe' });
|
|
93
|
+
}
|
|
94
|
+
catch (err) {
|
|
95
|
+
stderr = (err.stderr ?? '').toString();
|
|
96
|
+
}
|
|
97
|
+
// The regex is copied from visual_diff_report.cjs:138 deliberately — the
|
|
98
|
+
// point is to fail here if either side drifts.
|
|
99
|
+
const picked = stderr.split('\n').filter(Boolean).find((line) => /error|cannot|not found|bad option|unexpected/i.test(line));
|
|
100
|
+
expect(picked).toMatch(/No such GLB/);
|
|
101
|
+
expect(picked).toContain('Nowhere 1, 2345 Somewhere.glb');
|
|
102
|
+
// And the stack still reaches the job log, which is a separate consumer.
|
|
103
|
+
expect(stderr).toMatch(/at resolveGlbPaths/);
|
|
104
|
+
});
|
|
105
|
+
test('a chunk list with one missing member does not silently render the rest', () => {
|
|
106
|
+
const spec = [
|
|
107
|
+
path.join(workDir, 'chunk0.glb'),
|
|
108
|
+
path.join(workDir, 'absent.glb'),
|
|
109
|
+
].join(',');
|
|
110
|
+
// Rendering the surviving chunk would drop part of the model and look
|
|
111
|
+
// like a geometry regression in the visual diff, which is worse than
|
|
112
|
+
// failing.
|
|
113
|
+
expect(() => resolveGlbPaths(spec)).toThrow(/absent\.glb/);
|
|
114
|
+
});
|
|
115
|
+
});
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
// only the first segment (major) is meaningful and is the one CI carries forward.
|
|
6
6
|
// Must stay in `vN.N.N` shape: the CI stamp regex, scripts/updateVersion.mjs, and
|
|
7
7
|
// statistics.ts all match `v\d+\.\d+\.\d+`.
|
|
8
|
-
const versionString = 'Conway v1.
|
|
8
|
+
const versionString = 'Conway v1.471.1405';
|
|
9
9
|
export { versionString };
|