@qvac/translation-nmtcpp 0.24.0 → 0.25.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -69,6 +69,7 @@ This library simplifies the process of running various translation models within
69
69
  - [JavaScript Tests](#javascript-tests)
70
70
  - [C++ Tests](#c-tests)
71
71
  - [npm Commands (Recommended - Cross-Platform)](#npm-commands-recommended---cross-platform)
72
+ - [Fuzz Testing (Linux)](#fuzz-testing-linux)
72
73
  - [Glossary](#glossary)
73
74
  - [Resources](#resources)
74
75
  - [Contributing](#contributing)
@@ -1152,6 +1153,38 @@ npm run coverage:cpp # Complete coverage workflow
1152
1153
  npm run test:all # Run both JavaScript and C++ tests
1153
1154
  ```
1154
1155
 
1156
+ ### Fuzz Testing (Linux)
1157
+
1158
+ The GGML weight-header fuzz target tests dimensions, bounded strings, counts and
1159
+ tensor types without loading a model or linking the Fabric runtime. It uses full
1160
+ ASan and LeakSanitizer (`detect_leaks=1:abort_on_error=1`). Install the package
1161
+ dependencies and use the repository's locked Bare toolchain and vcpkg setup,
1162
+ just as for native C++ builds.
1163
+
1164
+ ```bash
1165
+ npm run fuzz # Build and run all bounded fuzz properties and seeds
1166
+ npm run fuzz:build # Build bounded mode only
1167
+ npm run fuzz:run # Run the existing bounded build
1168
+ npm run fuzz:continuous -- --fuzz_for 30m
1169
+ # Select a different property; place the selector before binary flags:
1170
+ npm run fuzz:continuous -- NmtWeightHeaderFuzz.BoundedStringNeverCrashes --fuzz_for=30m
1171
+ ```
1172
+
1173
+ `fuzz:continuous` rebuilds with coverage-guided fuzzing enabled. It runs until
1174
+ interrupted unless `--fuzz_for` supplies a time limit. `fuzz:build:continuous`
1175
+ builds that mode without running it. Both `--flag=value` and `--flag value` are
1176
+ forwarded to the binary. For explicit passthrough, use a second separator:
1177
+ `npm run fuzz:continuous -- -- --fuzz_for 30m` (npm consumes the first `--`).
1178
+
1179
+ Fuzz builds use `build-fuzz/` and `test/fuzz/vcpkg.json`; model tests and their
1180
+ coverage files stay in `build/`. The separate trees keep FuzzTest's ASan Abseil
1181
+ apart from production NMT's Abseil. Do not enable `BUILD_TESTING` and
1182
+ `BUILD_FUZZING` in the same tree. `coverage:cpp:build` builds both trees, and
1183
+ `coverage:cpp:run` runs fuzz before the model tests, so CI exercises this target
1184
+ before collecting the model-test coverage report. See
1185
+ [Native Addon Fuzz Testing](../../docs/architecture/ADDON-FUZZING.md) for the
1186
+ shared design.
1187
+
1155
1188
  ## Glossary
1156
1189
 
1157
1190
  - **Bare** – Lightweight, modular JavaScript runtime for desktop and mobile. [Docs](https://docs.pears.com/reference/bare-overview.html)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qvac/translation-nmtcpp",
3
- "version": "0.24.0",
3
+ "version": "0.25.1",
4
4
  "description": "translation addon for qvac",
5
5
  "addon": true,
6
6
  "engines": {
@@ -35,12 +35,17 @@
35
35
  "test:dts": "npm run test:types",
36
36
  "test:types": "npm run typecheck && npm run check:generated && npm run test:types:consumer",
37
37
  "test:types:consumer": "tsc --noEmit -p test/types/tsconfig.cjs.json && tsc --noEmit -p test/types/tsconfig.esm.json",
38
- "test:scripts": "node --test scripts/__tests__/run-cpp-tests.test.js",
39
- "test:cpp:build": "bare-make generate -D BUILD_TESTING=ON -D USE_BERGAMOT=ON && bare-make build --target addon-test",
38
+ "test:scripts": "node --test scripts/__tests__/run-cpp-tests.test.js scripts/__tests__/run-cpp-fuzz.test.js",
39
+ "test:cpp:build": "bare-make generate -D BUILD_TESTING=ON -D BUILD_FUZZING=OFF -D USE_BERGAMOT=ON && bare-make build --target addon-test",
40
40
  "test:cpp:run": "npm run test:scripts && node scripts/run-cpp-tests.js",
41
41
  "test:cpp": "npm run test:cpp:build && npm run test:cpp:run",
42
- "coverage:cpp:build": "bare-make generate -D BUILD_TESTING=ON -D ENABLE_COVERAGE=ON && bare-make build --target addon-test",
43
- "coverage:cpp:run": "npm run test:scripts && LLVM_PROFILE_FILE=default.profraw node scripts/run-cpp-tests.js",
42
+ "fuzz:build": "bare-make generate -b build-fuzz -D BUILD_FUZZING=ON -D BUILD_TESTING=OFF -D FUZZTEST_FUZZING_MODE=OFF && bare-make build -b build-fuzz --target nmt-weight-header-fuzz",
43
+ "fuzz:build:continuous": "bare-make generate -b build-fuzz -D BUILD_FUZZING=ON -D BUILD_TESTING=OFF -D FUZZTEST_FUZZING_MODE=ON && bare-make build -b build-fuzz --target nmt-weight-header-fuzz",
44
+ "fuzz:run": "node scripts/run-cpp-fuzz.js --build-dir build-fuzz",
45
+ "fuzz": "npm run fuzz:build && npm run fuzz:run",
46
+ "fuzz:continuous": "npm run fuzz:build:continuous && node scripts/run-cpp-fuzz.js --build-dir build-fuzz --continuous",
47
+ "coverage:cpp:build": "bare-make generate -D BUILD_TESTING=ON -D BUILD_FUZZING=OFF -D ENABLE_COVERAGE=ON && bare-make build --target addon-test && npm run fuzz:build",
48
+ "coverage:cpp:run": "npm run test:scripts && npm run fuzz:run && LLVM_PROFILE_FILE=default.profraw node scripts/run-cpp-tests.js",
44
49
  "coverage:cpp:summary": "cd build/addon/tests && llvm-cov report ./addon-test --instr-profile=coverage.profdata -ignore-filename-regex='(tests|build|node_modules|gtest|gmock|\\.vcpkg|/usr)/' > coverage-summary.txt",
45
50
  "coverage:cpp:report": "cd build/addon/tests/ && ls -lha && llvm-profdata merge -sparse default.profraw -o coverage.profdata && llvm-cov show ./addon-test -instr-profile=coverage.profdata -format=html -output-dir=coverage-html -ignore-filename-regex='(tests|build|node_modules|gtest|gmock|\\.vcpkg|/usr)/' && llvm-cov export ./addon-test -instr-profile=coverage.profdata -format=lcov -ignore-filename-regex='(tests|build|node_modules|gtest|gmock|\\.vcpkg|/usr)/' > lcov.info && npm run coverage:cpp:summary",
46
51
  "coverage:cpp": "npm run coverage:cpp:build && npm run coverage:cpp:run && npm run coverage:cpp:report",
@@ -78,14 +83,15 @@
78
83
  "bugs": "https://github.com/tetherto/qvac/issues",
79
84
  "homepage": "https://qvac.tether.io",
80
85
  "devDependencies": {
81
- "@qvac/fabric-android-arm64": "^0.26.0",
82
- "@qvac/fabric-ios": "^0.26.0",
86
+ "@qvac/fabric-android-arm64": "^0.29.0",
87
+ "@qvac/fabric-ios": "^0.29.0",
83
88
  "@qvac/registry-client": "^0.6.1",
84
89
  "@types/node": "^24.2.1",
85
90
  "bare-fetch": "^3.0.1",
86
91
  "bare-stream": "^2.7.0",
87
92
  "brittle": "^3.4.0",
88
93
  "cmake-bare": "^1.9.0",
94
+ "cmake-npm": "^1.1.2",
89
95
  "cmake-vcpkg": "^1.1.0",
90
96
  "eslint": "^9.39.4",
91
97
  "eslint-import-resolver-typescript": "^4.4.5",
@@ -98,7 +104,7 @@
98
104
  },
99
105
  "dependencies": {
100
106
  "@qvac/error": "^0.1.0",
101
- "@qvac/fabric": "^0.26.0",
107
+ "@qvac/fabric": "^0.29.0",
102
108
  "@qvac/infer-base": "^0.8.0",
103
109
  "@qvac/logging": "^0.1.0",
104
110
  "bare-fs": "^4.5.1",
@@ -108,16 +114,16 @@
108
114
  "bare-url": "^2.1.6"
109
115
  },
110
116
  "optionalDependencies": {
111
- "@qvac/fabric-linux-x64": "^0.26.0",
112
- "@qvac/fabric-linux-arm64": "^0.26.0",
113
- "@qvac/fabric-darwin-arm64": "^0.26.0",
114
- "@qvac/fabric-darwin-x64": "^0.26.0",
115
- "@qvac/fabric-win32-x64": "^0.26.0"
117
+ "@qvac/fabric-linux-x64": "^0.29.0",
118
+ "@qvac/fabric-linux-arm64": "^0.29.0",
119
+ "@qvac/fabric-darwin-arm64": "^0.29.0",
120
+ "@qvac/fabric-darwin-x64": "^0.29.0",
121
+ "@qvac/fabric-win32-x64": "^0.29.0"
116
122
  },
117
123
  "peerDependencies": {
118
124
  "bare-fetch": "^3.0.1",
119
- "@qvac/fabric-android-arm64": "^0.26.0",
120
- "@qvac/fabric-ios": "^0.26.0"
125
+ "@qvac/fabric-android-arm64": "^0.29.0",
126
+ "@qvac/fabric-ios": "^0.29.0"
121
127
  },
122
128
  "peerDependenciesMeta": {
123
129
  "bare-fetch": {
@@ -7,7 +7,7 @@
7
7
  ],
8
8
  "current_versions": [
9
9
  {
10
- "version": "0.24"
10
+ "version": "0.25.1"
11
11
  }
12
12
  ],
13
13
  "exported_symbols": [
@@ -7,7 +7,7 @@
7
7
  ],
8
8
  "current_versions": [
9
9
  {
10
- "version": "0.24"
10
+ "version": "0.25.1"
11
11
  }
12
12
  ],
13
13
  "exported_symbols": [
@@ -7,7 +7,7 @@
7
7
  ],
8
8
  "current_versions": [
9
9
  {
10
- "version": "0.24"
10
+ "version": "0.25.1"
11
11
  }
12
12
  ],
13
13
  "exported_symbols": [
@@ -7,7 +7,7 @@
7
7
  ],
8
8
  "current_versions": [
9
9
  {
10
- "version": "0.24"
10
+ "version": "0.25.1"
11
11
  }
12
12
  ],
13
13
  "exported_symbols": [
@@ -7,7 +7,7 @@
7
7
  ],
8
8
  "current_versions": [
9
9
  {
10
- "version": "0.24"
10
+ "version": "0.25.1"
11
11
  }
12
12
  ],
13
13
  "exported_symbols": [