ripex 0.3.1

Multi-language structural parsing and fact extraction.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
name: CI

on:
  push:
    branches: [main, master]
  pull_request:
    branches: [main, master]

permissions:
  contents: read

env:
  CARGO_TERM_COLOR: always

jobs:
  test:
    name: Build & Test
    runs-on: ${{ matrix.os }}
    timeout-minutes: 30
    permissions:
      contents: read
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, windows-latest, macos-latest]
        rust: [stable]

    steps:
      # actions/checkout v4.2.2
      - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262

      - name: Install Rust
        # dtolnay/rust-toolchain stable
        uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4
        with:
          toolchain: ${{ matrix.rust }}
          components: clippy, rustfmt

      - name: Cache cargo registry
        # actions/cache v4.2.0
        uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830
        with:
          path: ~/.cargo/registry
          key: ${{ runner.os }}-${{ matrix.rust }}-cargo-registry-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}
          restore-keys: |
            ${{ runner.os }}-${{ matrix.rust }}-cargo-registry-

      - name: Cache cargo build
        # actions/cache v4.2.0
        uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830
        with:
          path: target
          key: ${{ runner.os }}-${{ matrix.rust }}-cargo-build-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}
          restore-keys: |
            ${{ runner.os }}-${{ matrix.rust }}-cargo-build-

      - name: Check formatting
        run: cargo fmt --all -- --check

      - name: Build
        run: cargo build --locked --verbose

      - name: Test all targets and features
        run: cargo test --locked --all-targets --all-features --verbose

      - name: Clippy
        run: cargo clippy --locked --all-targets --all-features -- -D warnings

      - name: Generate per-language evidence report
        if: runner.os == 'Linux'
        run: cargo run --locked --example evidence_report --all-features -- target/ripex-evidence.md

      - name: Build (no-default-features, library only)
        run: cargo build --locked --no-default-features --features "lang-all"

      - name: Documentation
        if: runner.os == 'Linux'
        env:
          RUSTDOCFLAGS: -D warnings
        run: cargo doc --locked --no-deps --all-features

  features:
    name: Feature ${{ matrix.feature }}
    runs-on: ubuntu-latest
    timeout-minutes: 20
    permissions:
      contents: read
    env:
      RUSTFLAGS: -D warnings
    strategy:
      fail-fast: false
      matrix:
        feature:
          - cli
          - lang-all
          - lang-c
          - lang-cpp
          - lang-csharp
          - lang-go
          - lang-js
          - lang-python
          - lang-rust
          - serde
    steps:
      # actions/checkout v4.2.2
      - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
      - name: Install Rust
        # dtolnay/rust-toolchain stable
        uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4
        with:
          toolchain: stable
      - name: Cache feature build
        # actions/cache v4.2.0
        uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830
        with:
          path: target
          key: ${{ runner.os }}-${{ matrix.feature }}-cargo-build-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}
          restore-keys: |
            ${{ runner.os }}-${{ matrix.feature }}-cargo-build-
      - name: Check isolated feature
        run: cargo check --locked --no-default-features --features "${{ matrix.feature }}"
      - name: Run isolated integration tests
        # --tests runs integration targets; feature-gated language tests skip unavailable modules.
        run: cargo test --locked --no-default-features --features "${{ matrix.feature }}" --tests

  minimal:
    name: Minimal library
    runs-on: ubuntu-latest
    timeout-minutes: 15
    permissions:
      contents: read
    env:
      RUSTFLAGS: -D warnings
    steps:
      # actions/checkout v4.2.2
      - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
      - name: Install Rust
        # dtolnay/rust-toolchain stable
        uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4
        with:
          toolchain: stable
      - run: cargo check --locked --no-default-features --lib

  compiler-conformance:
    name: Compiler conformance corpus
    runs-on: ubuntu-latest
    timeout-minutes: 30
    permissions:
      contents: read
    steps:
      # actions/checkout v4.2.2
      - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
      - name: Install Rust
        # dtolnay/rust-toolchain stable
        uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4
        with:
          toolchain: stable
      - name: Install Go
        # actions/setup-go v5.3.0
        uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff
        with:
          go-version: stable
      - name: Install Node.js
        # actions/setup-node v4.2.0
        uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
        with:
          node-version: 22
      - name: Install Python
        # actions/setup-python v5.4.0
        uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
        with:
          python-version: '3.12'
      - name: Install latest .NET
        # actions/setup-dotnet v4.3.0
        uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9
        with:
          dotnet-version: '8.0.x'

      - name: Install language analyzers
        run: |
          npm ci --prefix tests/lang-test/javascript
          python -m pip install mypy

      - name: Build ripex
        run: cargo build --locked --all-features

      - name: Check C17 corpus
        run: target/debug/ripex check tests/lang-test/c --lang c --trusted-project
      - name: Check C++20 corpus
        run: target/debug/ripex check tests/lang-test/cpp --lang cpp --trusted-project
      - name: Check C# project
        run: target/debug/ripex check tests/lang-test/csharp --trusted-project
      - name: Check Go project
        run: target/debug/ripex check tests/lang-test/go --trusted-project
      - name: Check JavaScript project
        run: target/debug/ripex check tests/lang-test/javascript/src --lang javascript --trusted-project
      - name: Check TypeScript project
        run: target/debug/ripex check tests/lang-test/javascript/tsconfig.json --trusted-project
      - name: Check strict Python project
        run: target/debug/ripex check tests/lang-test/python/src --lang python --trusted-project
      - name: Check Rust project
        run: target/debug/ripex check tests/lang-test/rust --trusted-project

  fuzz-replay:
    name: Fuzz corpus replay (deterministic)
    runs-on: ubuntu-latest
    timeout-minutes: 15
    permissions:
      contents: read
    steps:
      # actions/checkout v4.2.2
      - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
      - name: Install nightly Rust
        # dtolnay/rust-toolchain nightly
        uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4
        with:
          toolchain: nightly
      - name: Install latest cargo-fuzz
        run: cargo +nightly install cargo-fuzz --version 0.13.2 --locked
      - name: Replay committed fuzz seeds
        working-directory: tests/fuzz
        shell: bash
        run: |
          set -euo pipefail
          if [[ ! -d corpus ]] || ! find corpus -type f -print -quit | grep -q .; then
            echo "::notice::No committed fuzz seeds found; deterministic replay skipped."
            exit 0
          fi
          for target in fuzz_all fuzz_js fuzz_python fuzz_go; do
            corpus_dir="corpus/$target"
            if [[ ! -d "$corpus_dir" ]]; then
              echo "::error::Missing committed corpus directory: $corpus_dir"
              exit 1
            fi
            echo "Replaying $target committed fuzz seeds"
            CARGOFLAGS=--locked cargo +nightly fuzz run --fuzz-dir . "$target" -- -runs=1 -timeout=5 -rss_limit_mb=512 -max_len=4096
          done
  fuzz:
    name: Fuzz (advisory crash / hang hunting)
    needs: fuzz-replay
    runs-on: ubuntu-latest
    timeout-minutes: 15
    # Randomized fuzzing is advisory and must not block ordinary PR validation.
    continue-on-error: true
    permissions:
      contents: read
    steps:
      # actions/checkout v4.2.2
      - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
      - name: Install nightly Rust
        # dtolnay/rust-toolchain nightly
        uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4
        with:
          toolchain: nightly
      - name: Install latest cargo-fuzz
        run: cargo +nightly install cargo-fuzz --version 0.13.2 --locked
      - name: Fuzz all parsers briefly
        working-directory: tests/fuzz
        shell: bash
        run: |
          # cargo-fuzz has no --locked flag; CARGOFLAGS locks its inner Cargo invocation.
          CARGOFLAGS=--locked cargo +nightly fuzz run --fuzz-dir . fuzz_all -- -max_total_time=60 -timeout=5 -rss_limit_mb=512 -max_len=4096
  node-bindings:
    name: Node bindings (${{ matrix.target }})
    runs-on: ${{ matrix.os }}
    timeout-minutes: 45
    permissions:
      contents: read
    strategy:
      fail-fast: false
      matrix:
        include:
          - os: ubuntu-latest
            target: x86_64-unknown-linux-gnu
            binary: ripex.linux-x64-gnu.node
            cross: "0"
            runtime: true
          - os: ubuntu-latest
            target: aarch64-unknown-linux-gnu
            binary: ripex.linux-arm64-gnu.node
            cross: "1"
            runtime: false
          - os: macos-14
            target: x86_64-apple-darwin
            binary: ripex.darwin-x64.node
            cross: "0"
            runtime: false
          - os: macos-14
            target: aarch64-apple-darwin
            binary: ripex.darwin-arm64.node
            cross: "0"
            runtime: true
          - os: windows-latest
            target: x86_64-pc-windows-msvc
            binary: ripex.win32-x64-msvc.node
            cross: "0"
            runtime: true

    steps:
      # actions/checkout v4.2.2
      - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
      - name: Install latest Node.js
        # actions/setup-node v4.2.0
        uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
        with:
          node-version: 22

      - name: Install latest pnpm
        run: npm install --global pnpm@10.28.2

      - name: Install latest Bun
        run: npm install --global bun@1.3.14
      - name: Install Rust 1.85.0 and target
        # dtolnay/rust-toolchain
        uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4
        with:
          toolchain: 1.85.0
          target: ${{ matrix.target }}

      - name: Install Node binding dependencies
        working-directory: bindings/node
        run: pnpm install --frozen-lockfile --ignore-scripts
      - name: Install aarch64 cross-compiler
        if: matrix.target == 'aarch64-unknown-linux-gnu'
        run: |
          sudo apt-get update
          sudo apt-get install -y gcc-aarch64-linux-gnu


      - name: Build Node binding
        working-directory: bindings/node
        env:
          NAPI_TARGET: ${{ matrix.target }}
          CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
        run: npm run build:release

      - name: Verify target binary and package metadata
        working-directory: bindings/node
        env:
          EXPECTED_BINARY: ${{ matrix.binary }}
          EXPECTED_TARGET: ${{ matrix.target }}
        shell: bash
        run: |
          set -euo pipefail
          node - "$EXPECTED_BINARY" "$EXPECTED_TARGET" <<'NODE'
          const fs = require('node:fs');
          const binary = process.argv[2];
          const target = process.argv[3];
          const binaries = fs.readdirSync('.')
            .filter((entry) => entry.endsWith('.node'))
            .filter((entry) => fs.statSync(entry).isFile())
            .sort();
          if (binaries.length !== 1 || binaries[0] !== binary) {
            throw new Error(`expected exactly ${binary}, found ${binaries.join(', ')}`);
          }
          const metadata = JSON.parse(fs.readFileSync('package.json', 'utf8'));
          const targets = metadata.napi?.targets;
          if (!Array.isArray(targets) || targets.length !== 5 || !targets.includes(target)) {
            throw new Error(`package.json does not declare target ${target}`);
          }
          if (metadata.scripts?.postinstall) {
            throw new Error('postinstall network/download hooks are forbidden');
          }
          NODE

      - name: Run native Node binding tests
        if: matrix.runtime == true
        working-directory: bindings/node
        run: npm test

      - name: Run Bun native smoke test
        if: matrix.runtime == true
        working-directory: bindings/node
        run: bun test test/index.bun.test.mjs
      - name: Check public TypeScript declarations
        if: matrix.runtime == true
        working-directory: bindings/node
        run: npm run test:types

      - name: Check package contents
        if: matrix.runtime == true
        working-directory: bindings/node
        run: npm run pack:dry

      - name: Upload Node binding artifact
        # actions/upload-artifact v4.6.0
        uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
        with:
          name: node-bindings-${{ matrix.target }}
          path: |
            bindings/node/${{ matrix.binary }}
            bindings/node/index.cjs
            bindings/node/index.js
            bindings/node/index.d.ts
          if-no-files-found: error
          retention-days: 7

  python-bindings:
    name: Python bindings (${{ matrix.os }})
    runs-on: ${{ matrix.os }}
    timeout-minutes: 30
    permissions:
      contents: read
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-14, windows-latest]
    steps:
      # actions/checkout v4.2.2
      - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262

      - name: Install Rust 1.85.0
        # dtolnay/rust-toolchain
        uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4
        with:
          toolchain: 1.85.0
          components: clippy, rustfmt

      - name: Install Python 3.12
        # actions/setup-python v5.4.0
        uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
        with:
          python-version: '3.12'

      - name: Install Python build and test dependencies
        run: |
          python -m pip install --upgrade pip
          python -m pip install "maturin>=1.5,<2.0" pytest pytest-asyncio mypy

      - name: Build and install Python bindings
        run: python -m pip install -e bindings/python

      - name: Run pytest test suite
        run: pytest -v bindings/python/tests

      - name: Check typing with mypy
        run: mypy --strict bindings/python/python/ripex bindings/python/tests