A framework for building compiled Node.js add-ons in Rust via Node-API
This report summarizes scanner evidence for napi-rs/napi-rs, a Rust project with 7,967 GitHub stars. SynthScan examined 151,473 lines of code across 535 source files, recording 739 pattern matches distributed across 7 syntactic categories. The legacy adjusted pattern signal is 4.8 (Low pattern signal); it is not an authorship estimate.
Use the findings to ask whether maintainers can explain intent, verify dependencies, simplify unnecessary scaffolding, and focus review effort. Risk Payload v1 adds ownership, supply-chain, over-engineering, and review-effort vectors when available. These are prompts for human verification, not probabilities, security findings, or measured maintenance costs.
Use each vector to guide manual verification of the underlying findings.
Can maintainers explain intent, assumptions, and trade-offs? 728 finding(s).
Are imports declared and package/API names verified? 6 finding(s).
Are wrappers, guards, and repeated structures necessary? 422 finding(s).
Which changes need focused human review? 739 finding(s).
This chart tracks the legacy adjusted pattern score across scan runs. Changes can reflect source changes, scan coverage, or detector/scoring versions; they do not measure AI adoption or prove that a team refactored code. Compare runs only when their scoring versions are compatible. The dashed line tracks the raw pattern-hit count.
Groups findings by configured severity weight. Severity is not a confidence estimate, security rating, or proof that a package is missing. Verify imports against the project's manifests and inspect each finding in its local design context.
This horizontal bar chart shows where configured pattern scores accumulate across directories. Treat the bars as locations to inspect, not as evidence of authorship or code quality. Use the file-level findings to decide whether a directory needs a focused ownership, dependency, complexity, or review check.
The scanner identified 739 distinct pattern matches across 7 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a detector match to inspect in context. Expand any category row to inspect the individual file paths, line numbers, code snippets, and the lexical context (CODE, COMMENT, or STRING) in which each match was detected.
Reading the findings table: The Severity column indicates the configured finding weight (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — legacy comment-context matches receive a ×1.5 score weight. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier under the legacy scoring model.
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | async-runtime/index.d.ts | 127 | export declare function installCurrentThreadHosts( | CODE |
| LOW | async-runtime/index.d.ts | 136 | export declare function registerWorkerdCurrentThreadTaskHost( | CODE |
| LOW | cli/codegen/index.ts | 83 | export function getOptionValidatorExpression( | CODE |
| LOW | cli/src/index.ts | 70 | export function createCreateNpmDirsCommand( | CODE |
| LOW | cli/src/index.ts | 84 | export function createUniversalizeCommand(args: string[]): UniversalizeCommand { | CODE |
| LOW | cli/src/def/artifacts.ts | 90 | export function applyDefaultArtifactsOptions(options: ArtifactsOptions) { | CODE |
| LOW | cli/src/def/universalize.ts | 68 | export function applyDefaultUniversalizeOptions(options: UniversalizeOptions) { | CODE |
| LOW | cli/src/def/rename.ts | 123 | export function applyDefaultRenameOptions(options: RenameOptions) { | CODE |
| LOW | cli/src/def/create-npm-dirs.ts | 78 | export function applyDefaultCreateNpmDirsOptions( | CODE |
| LOW | cli/src/def/version.ts | 67 | export function applyDefaultVersionOptions(options: VersionOptions) { | CODE |
| LOW | cli/src/def/pre-publish.ts | 143 | export function applyDefaultPrePublishOptions(options: PrePublishOptions) { | CODE |
| LOW | cli/src/utils/metadata.ts | 80 | export function getNapiDeriveDependentCrates( | CODE |
| LOW | cli/src/utils/metadata.ts | 112 | export function createCargoMetadataInvocation( | CODE |
| LOW | cli/src/utils/version.ts | 167 | function stabilizePrereleaseComparator(comparator: Comparator) { | CODE |
| LOW | cli/src/utils/typegen.ts | 32 | function asyncGeneratorDeclaration(name: string): string { | CODE |
| LOW | cli/src/utils/typegen.ts | 662 | function makeTypeImportMarkersUnique( | CODE |
| LOW | cli/src/utils/typegen.ts | 719 | function reallocateTypeImportMarkers( | CODE |
| LOW | cli/src/utils/typegen.ts | 792 | function preserveTypeImportMarkers(defs: TypeDefLine[]): TypeDefLine[] { | CODE |
| LOW | cli/src/utils/typegen.ts | 819 | export function rewriteTypeImportReferences( | CODE |
| LOW | cli/src/utils/typegen.ts | 911 | export function rebaseDeclarationSpecifiers( | CODE |
| LOW | cli/src/utils/typegen.ts | 964 | export function collectRelativeDeclarationSpecifiers(source: string): string[] { | CODE |
| LOW | cli/src/utils/typegen.ts | 1019 | export function commonJsDeclarationBarrier(source: string): string | undefined { | CODE |
| LOW | cli/src/utils/typegen.ts | 1188 | function collectRelativeDeclarationSpecifierReferences( | CODE |
| LOW | cli/src/utils/typegen.ts | 1275 | function createCollisionSafeIdentifier( | CODE |
| LOW | cli/src/utils/typegen.ts | 1323 | function typeImportReferenceMeaning( | CODE |
| LOW | cli/src/utils/typegen.ts | 1369 | function programOverDeclarationSource( | CODE |
| LOW | cli/src/utils/typegen.ts | 1435 | function throwDeclarationDiagnostics( | CODE |
| LOW | cli/src/utils/typegen.ts | 1570 | export function removeNodeStreamWebTypeImports(source: string): string { | CODE |
| LOW | cli/src/utils/typegen.ts | 1616 | export function rewriteUnboundNodeGlobalTypeQueries(source: string): string { | CODE |
| LOW | cli/src/utils/typegen.ts | 2025 | function leadingDeclarationPreambleEnd( | CODE |
| LOW⚡ | cli/src/utils/misc.ts | 472 | function fileSystemReconciliationCapabilityRoot(path: string) { | CODE |
| LOW⚡ | cli/src/utils/misc.ts | 479 | export function getPackageReconciliationRoot( | CODE |
| LOW⚡ | cli/src/utils/misc.ts | 486 | export function resolvePackageReconciliationPaths( | CODE |
| LOW⚡ | cli/src/utils/misc.ts | 1832 | function reconciliationCandidateName(path: string, token: string) { | CODE |
| LOW⚡ | cli/src/utils/misc.ts | 1838 | function reconciliationCandidatePath(path: string, token: string) { | CODE |
| LOW⚡ | cli/src/utils/misc.ts | 1842 | function reconciliationRetiredPath(path: string) { | CODE |
| LOW⚡ | cli/src/utils/misc.ts | 1851 | async function acquireReconciliationLock( | CODE |
| LOW⚡ | cli/src/utils/misc.ts | 3228 | function reconciliationCandidateCollisionError(path: string) { | CODE |
| LOW⚡ | cli/src/utils/misc.ts | 3238 | function isReconciliationCandidateCollisionError(error: unknown) { | CODE |
| LOW⚡ | cli/src/utils/misc.ts | 3245 | function reconciliationMetadataExistsError(path: string) { | CODE |
| LOW⚡ | cli/src/utils/misc.ts | 3255 | function isUnsupportedReconciliationHardLinkError(error: unknown) { | CODE |
| LOW⚡ | cli/src/utils/misc.ts | 3265 | function reconciliationHardLinkRequiredError(path: string, cause: unknown) { | CODE |
| LOW⚡ | cli/src/utils/misc.ts | 3319 | function reconciliationPathCollisionError(path: string, message: string) { | CODE |
| LOW⚡ | cli/src/utils/misc.ts | 3329 | function isReconciliationPathCollisionError(error: unknown) { | CODE |
| LOW⚡ | cli/src/utils/misc.ts | 3336 | function isReconciliationLockToken(token: unknown): token is string { | CODE |
| LOW⚡ | cli/src/utils/misc.ts | 3345 | function isValidProcessIncarnation( | CODE |
| LOW | cli/src/utils/misc.ts | 577 | export function getPackageReconciliationRoots({ | CODE |
| LOW | cli/src/utils/misc.ts | 636 | export function managedPackagePathIsWithin(root: string, path: string) { | CODE |
| LOW | cli/src/utils/misc.ts | 646 | export function canonicalizeManagedPackagePath(path: string) { | CODE |
| LOW | cli/src/utils/misc.ts | 666 | function hasPackageWorkspaceBoundaryMarker(directory: string) { | CODE |
| LOW | cli/src/utils/misc.ts | 689 | function managedPackageBoundaryError( | CODE |
| LOW | cli/src/utils/misc.ts | 702 | export async function commitFileSystemTransaction( | CODE |
| LOW | cli/src/utils/misc.ts | 750 | async function commitFileSystemTransactionUnlocked( | CODE |
| LOW | cli/src/utils/misc.ts | 1458 | async function pathsReferToSameDirectoryEntry( | CODE |
| LOW | cli/src/utils/misc.ts | 1537 | async function readReconciliationMetadata(path: string, label: string) { | CODE |
| LOW | cli/src/utils/misc.ts | 1590 | async function canonicalizeReconciliationPath(path: string) { | CODE |
| LOW | cli/src/utils/misc.ts | 1611 | async function resolveReconciliationLockIdentities( | CODE |
| LOW | cli/src/utils/misc.ts | 1724 | async function assertReconciliationRequestedPathUnchanged( | CODE |
| LOW | cli/src/utils/misc.ts | 1750 | async function assertReconciliationAnchorUnchanged( | CODE |
| LOW | cli/src/utils/misc.ts | 1778 | async function assertReconciliationLockRootUnchanged( | CODE |
| 357 more matches not shown… | ||||
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | crates/async-runtime/Cargo.toml | 41 | # Cargo resolves target tables from `rustc --print cfg`, which is IDENTICAL for | COMMENT |
| LOW | crates/async-runtime/build.rs | 1 | /// Emit this crate's two first-party target cfgs. | COMMENT |
| LOW | crates/async-runtime/src/adapter.rs | 281 | /// Return the effective async runtime configuration. | COMMENT |
| LOW | crates/async-runtime/src/adapter.rs | 941 | if let Some(inner) = registered_current_thread_task_host(id) { | COMMENT |
| LOW | crates/async-runtime/src/adapter.rs | 961 | /// LIFETIME: each importing napi env registers its own | COMMENT |
| LOW | crates/async-runtime/src/adapter.rs | 1061 | /// main-only process that would leave NO driver and every later CT sleep | COMMENT |
| LOW | crates/async-runtime/src/adapter.rs | 1081 | /// (aborted pre-check, raw `napi_closing`), and the JS coercion above can | COMMENT |
| LOW | crates/async-runtime/src/adapter.rs | 1781 | // already pending at this task's first poll), so there is no host | COMMENT |
| LOW | crates/async-runtime/src/adapter.rs | 1981 | if let Some(inner) = registered_timer_host(id) { | COMMENT |
| LOW | crates/async-runtime/src/js_callback.rs | 41 | let value_type = napi::type_of!(env, napi_val)?; | COMMENT |
| LOW | crates/async-runtime/src/lib.rs | 1 | //! A shared, tokio-free async runtime for napi-rs addons. | COMMENT |
| LOW | crates/async-runtime/src/lib.rs | 21 | /// Maximum number of physical workers a scheduler owned by this crate may | COMMENT |
| LOW | crates/async-runtime/src/sync.rs | 1 | //! The `Mutex` and `Condvar` this crate locks and waits with, and its thread | COMMENT |
| LOW | crates/async-runtime/src/sync.rs | 21 | //! The condvar wait cannot use std's `wait_timeout`: the timeout bounds only | COMMENT |
| LOW | crates/backend/src/typegen.rs | 81 | COMMENT | |
| LOW | crates/backend/src/codegen/struct.rs | 41 | js_name: &str, | COMMENT |
| LOW | crates/backend/src/codegen/struct.rs | 61 | Some(salt) => { | COMMENT |
| LOW | crates/backend/src/codegen/fn.rs | 61 | // future's finalize closure. Synchronous callbacks never know whether the value they | COMMENT |
| LOW | crates/backend/src/codegen/fn.rs | 341 | }; | COMMENT |
| LOW | crates/sys/src/wasi_heap_sync.rs | 1 | //! `wasm32-wasip1-threads` only: every thread's view of the shared memory size. Not a public | COMMENT |
| LOW | crates/sys/src/wasi_heap_sync.rs | 21 | //! only set from the result of `memory.grow(0)` run on this thread, and memory never shrinks, | COMMENT |
| LOW | crates/sys/src/wasi_heap_sync.rs | 41 | sync::atomic::{AtomicU32, AtomicUsize, Ordering}, | COMMENT |
| LOW | crates/sys/src/wasi_thread_crash.rs | 1 | //! `wasm32-wasip1-threads` only: whether a wasm thread of this instance has died. Not a public | COMMENT |
| LOW | crates/macro/src/parser/mod.rs | 81 | } | COMMENT |
| LOW | crates/napi/build.rs | 1 | fn main() { | COMMENT |
| LOW | crates/napi/src/wasi_heap_sync.rs | 1 | //! `wasm32-wasip1-threads` only: one lock around wasi-libc's allocator, so that a thread's view | COMMENT |
| LOW | crates/napi/src/wasi_heap_sync.rs | 21 | //! LOCK (spin; sched_yield every 64 spins; never memory.atomic.wait) | COMMENT |
| LOW | crates/napi/src/wasi_heap_sync.rs | 41 | //! without the trap handler). | COMMENT |
| LOW | crates/napi/src/wasi_heap_sync.rs | 61 | //! holds. | COMMENT |
| LOW | crates/napi/src/wasi_heap_sync.rs | 81 | //! The break never passes 2^31. Node's `node:wasi` (v24 and later) answers `EINVAL` (os error 28) | COMMENT |
| LOW | crates/napi/src/wasi_heap_sync.rs | 101 | //! the memory in between. Below the reserve nothing grows. A threadsafe-function call, deferred | COMMENT |
| LOW | crates/napi/src/wasi_heap_sync.rs | 121 | //! same loads 1.6-3.2x faster than growing in dlmalloc's own small steps, so most of that gain | COMMENT |
| LOW | crates/napi/src/wasi_heap_sync.rs | 201 | #[inline] | COMMENT |
| LOW | crates/napi/src/wasi_heap_sync.rs | 341 | /// | COMMENT |
| LOW | crates/napi/src/error.rs | 21 | COMMENT | |
| LOW | crates/napi/src/error.rs | 41 | pub(crate) maybe_ref: Option<std::sync::Arc<ErrorRef>>, | COMMENT |
| LOW | crates/napi/src/error.rs | 61 | // implementation can resolve `env`. Every access to `raw` is gated on it, so a | COMMENT |
| LOW | crates/napi/src/error.rs | 81 | // `ErrorRef::drop` releases on the owning thread directly, routes the release | COMMENT |
| LOW | crates/napi/src/error.rs | 341 | } | COMMENT |
| LOW | crates/napi/src/error.rs | 361 | /// so converting the `Error` back with [`ToNapiValue`] reproduces the original | COMMENT |
| LOW | crates/napi/src/error.rs | 381 | /// | COMMENT |
| LOW | crates/napi/src/error.rs | 401 | /// addon — degrades to an empty reason and absent cause; the retained value | COMMENT |
| LOW | crates/napi/src/error.rs | 421 | /// Identity is reproduced only when the `Error` is converted back on the env | COMMENT |
| LOW | crates/napi/src/error.rs | 441 | /// [`Env::create_error`]: crate::Env::create_error | COMMENT |
| LOW | crates/napi/src/error.rs | 461 | } | COMMENT |
| LOW | crates/napi/src/error.rs | 601 | struct ReflectIntrinsics { | COMMENT |
| LOW | crates/napi/src/error.rs | 621 | // the only thread whose napi implementation can resolve the env at all. | COMMENT |
| LOW | crates/napi/src/error.rs | 661 | /// non-`[[Get]]` read of the global, no fresh-realm primitive | COMMENT |
| LOW | crates/napi/src/error.rs | 681 | /// * `gopd(probe, "data")` must yield a descriptor whose own `value` is | COMMENT |
| LOW | crates/napi/src/error.rs | 841 | /// global mid-capture. A `Reflect` that is missing, not an object, or without a | COMMENT |
| LOW | crates/napi/src/error.rs | 961 | // first registration stays in place — Node aborts on a duplicate | COMMENT |
| LOW | crates/napi/src/error.rs | 981 | // Empty slot, or a different env owned this thread before. In the latter | COMMENT |
| LOW | crates/napi/src/error.rs | 1041 | }); | COMMENT |
| LOW | crates/napi/src/error.rs | 1121 | /// [`Error::from_unknown_without_coercion`] exists to avoid. Instead the | COMMENT |
| LOW | crates/napi/src/error.rs | 1341 | .cause | COMMENT |
| LOW | crates/napi/src/error.rs | 1361 | /// created before module registration — and for errors that hold no reference, | COMMENT |
| LOW | crates/napi/src/error.rs | 1381 | maybe_ref: Some(error_ref.clone()), | COMMENT |
| LOW | crates/napi/src/error.rs | 1441 | /// Outlined helper for `#[napi(object)]` deserialization: decorate a field-getter | COMMENT |
| LOW | crates/napi/src/error.rs | 1521 | } | COMMENT |
| LOW | crates/napi/src/error.rs | 1721 | // This is a conversion, not a constructor: it is what the promise and | COMMENT |
| 249 more matches not shown… | ||||
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| CRITICAL⚡ | cli/src/api/__tests__/new.spec.ts | 183 | yamlObject.jobs.build.strategy.matrix.settings.some( | CODE |
| CRITICAL⚡ | cli/src/api/__tests__/new.spec.ts | 188 | yamlObject.jobs.build.strategy.matrix.settings.some( | CODE |
| CRITICAL⚡ | cli/src/api/__tests__/new.spec.ts | 193 | yamlObject.jobs.build.strategy.matrix.settings.some( | CODE |
| CRITICAL⚡ | cli/src/api/__tests__/new.spec.ts | 198 | yamlObject.jobs.build.strategy.matrix.settings.some( | CODE |
| CRITICAL⚡ | cli/src/api/__tests__/new.spec.ts | 203 | yamlObject.jobs.build.strategy.matrix.settings.some( | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM | cli/src/utils/ohos-selfsign.ts | 46 | // ─────────────────────── byte read/write helpers ─────────────────────── | COMMENT |
| MEDIUM | cli/src/utils/ohos-selfsign.ts | 87 | // ─────────────────── ELF pre-clean / normalize (not required for signing) ─────────────────── | COMMENT |
| MEDIUM | cli/src/utils/ohos-selfsign.ts | 268 | // ─────────────────── algorithm core required for signing ─────────────────── | COMMENT |
| MEDIUM | cli/src/utils/ohos-selfsign.ts | 466 | // ─────────────────── read-only validation (--check) ─────────────────── | COMMENT |
| MEDIUM | cli/src/utils/ohos-selfsign.ts | 554 | // ─────────────────── file I/O layer ─────────────────── | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM | .github/workflows/release-crates.yml | 38 | # Create a PR with the new versions and changelog, preparing the next release. | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | crates/napi/src/js_values/ser.rs | 148 | // To avoid this, we need to check if the value fits into a smaller number type. | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | examples/napi/__tests__/values.spec.ts | 1221 | t.deepEqual(listObjKeys({ name: 'John Doe', age: 20 }), ['name', 'age']) | CODE |