AI Slop Code RIsk Monitor

napi-rs/napi-rs

A framework for building compiled Node.js add-ons in Rust via Node-API

4.8 Low pattern signal View on GitHub

Maintenance and Governance Review

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.

4.8
Adjusted Signal
4.8
Raw Pattern Score
100%
Time Factor
2026-10-11
Last Push
8.0K
Stars
Rust
Language
151.5K
Lines of Code
535
Files
739
Pattern Hits
2026-10-12
Scan Date
0.01
HC Hit Rate

Risk Review · v3

Use each vector to guide manual verification of the underlying findings.

Cognitive Ownership Risk 18.9/100 · LOW

Can maintainers explain intent, assumptions, and trade-offs? 728 finding(s).

Hallucinated Dependency & Supply Chain Risk 2.5/100 · LOW

Are imports declared and package/API names verified? 6 finding(s).

Agent Over-Engineering Ratio 11.1/100 · LOW

Are wrappers, guards, and repeated structures necessary? 422 finding(s).

PR Review Velocity Impact 23.1/100 · LOW

Which changes need focused human review? 739 finding(s).

What These Metrics Mean

Adjusted Signal
Legacy pattern score normalized per 1,000 scanned lines and multiplied by the repository-level time factor. It is not an estimate of AI authorship.
Raw Pattern Score
Sum of severity- and context-weighted pattern findings before applying the time factor.
Time Factor
A coarse multiplier based on repository last-push metadata. It does not identify when individual code was written.
Pattern Hits
Count of configured pattern findings. Review each location and surrounding code before acting.
HC Hit Rate
High- and critical-severity findings per scanned file. Severity is a configured detector weight, not proof of a vulnerability or authorship.
Lines / Files
Scan coverage denominators used by the legacy normalized score.

Pattern-Signal History

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.

Severity Breakdown

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.

CRITICAL 5HIGH 0MEDIUM 6LOW 728

Directory Score Breakdown

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.

Pattern Findings

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.

Hyper-Verbose Identifiers417 hits · 342 pts
SeverityFileLineSnippetContext
LOWasync-runtime/index.d.ts127export declare function installCurrentThreadHosts(CODE
LOWasync-runtime/index.d.ts136export declare function registerWorkerdCurrentThreadTaskHost(CODE
LOWcli/codegen/index.ts83export function getOptionValidatorExpression(CODE
LOWcli/src/index.ts70export function createCreateNpmDirsCommand(CODE
LOWcli/src/index.ts84export function createUniversalizeCommand(args: string[]): UniversalizeCommand {CODE
LOWcli/src/def/artifacts.ts90export function applyDefaultArtifactsOptions(options: ArtifactsOptions) {CODE
LOWcli/src/def/universalize.ts68export function applyDefaultUniversalizeOptions(options: UniversalizeOptions) {CODE
LOWcli/src/def/rename.ts123export function applyDefaultRenameOptions(options: RenameOptions) {CODE
LOWcli/src/def/create-npm-dirs.ts78export function applyDefaultCreateNpmDirsOptions(CODE
LOWcli/src/def/version.ts67export function applyDefaultVersionOptions(options: VersionOptions) {CODE
LOWcli/src/def/pre-publish.ts143export function applyDefaultPrePublishOptions(options: PrePublishOptions) {CODE
LOWcli/src/utils/metadata.ts80export function getNapiDeriveDependentCrates(CODE
LOWcli/src/utils/metadata.ts112export function createCargoMetadataInvocation(CODE
LOWcli/src/utils/version.ts167function stabilizePrereleaseComparator(comparator: Comparator) {CODE
LOWcli/src/utils/typegen.ts32function asyncGeneratorDeclaration(name: string): string {CODE
LOWcli/src/utils/typegen.ts662function makeTypeImportMarkersUnique(CODE
LOWcli/src/utils/typegen.ts719function reallocateTypeImportMarkers(CODE
LOWcli/src/utils/typegen.ts792function preserveTypeImportMarkers(defs: TypeDefLine[]): TypeDefLine[] {CODE
LOWcli/src/utils/typegen.ts819export function rewriteTypeImportReferences(CODE
LOWcli/src/utils/typegen.ts911export function rebaseDeclarationSpecifiers(CODE
LOWcli/src/utils/typegen.ts964export function collectRelativeDeclarationSpecifiers(source: string): string[] {CODE
LOWcli/src/utils/typegen.ts1019export function commonJsDeclarationBarrier(source: string): string | undefined {CODE
LOWcli/src/utils/typegen.ts1188function collectRelativeDeclarationSpecifierReferences(CODE
LOWcli/src/utils/typegen.ts1275function createCollisionSafeIdentifier(CODE
LOWcli/src/utils/typegen.ts1323function typeImportReferenceMeaning(CODE
LOWcli/src/utils/typegen.ts1369function programOverDeclarationSource(CODE
LOWcli/src/utils/typegen.ts1435function throwDeclarationDiagnostics(CODE
LOWcli/src/utils/typegen.ts1570export function removeNodeStreamWebTypeImports(source: string): string {CODE
LOWcli/src/utils/typegen.ts1616export function rewriteUnboundNodeGlobalTypeQueries(source: string): string {CODE
LOWcli/src/utils/typegen.ts2025function leadingDeclarationPreambleEnd(CODE
LOW⚡cli/src/utils/misc.ts472function fileSystemReconciliationCapabilityRoot(path: string) {CODE
LOW⚡cli/src/utils/misc.ts479export function getPackageReconciliationRoot(CODE
LOW⚡cli/src/utils/misc.ts486export function resolvePackageReconciliationPaths(CODE
LOW⚡cli/src/utils/misc.ts1832function reconciliationCandidateName(path: string, token: string) {CODE
LOW⚡cli/src/utils/misc.ts1838function reconciliationCandidatePath(path: string, token: string) {CODE
LOW⚡cli/src/utils/misc.ts1842function reconciliationRetiredPath(path: string) {CODE
LOW⚡cli/src/utils/misc.ts1851async function acquireReconciliationLock(CODE
LOW⚡cli/src/utils/misc.ts3228function reconciliationCandidateCollisionError(path: string) {CODE
LOW⚡cli/src/utils/misc.ts3238function isReconciliationCandidateCollisionError(error: unknown) {CODE
LOW⚡cli/src/utils/misc.ts3245function reconciliationMetadataExistsError(path: string) {CODE
LOW⚡cli/src/utils/misc.ts3255function isUnsupportedReconciliationHardLinkError(error: unknown) {CODE
LOW⚡cli/src/utils/misc.ts3265function reconciliationHardLinkRequiredError(path: string, cause: unknown) {CODE
LOW⚡cli/src/utils/misc.ts3319function reconciliationPathCollisionError(path: string, message: string) {CODE
LOW⚡cli/src/utils/misc.ts3329function isReconciliationPathCollisionError(error: unknown) {CODE
LOW⚡cli/src/utils/misc.ts3336function isReconciliationLockToken(token: unknown): token is string {CODE
LOW⚡cli/src/utils/misc.ts3345function isValidProcessIncarnation(CODE
LOWcli/src/utils/misc.ts577export function getPackageReconciliationRoots({CODE
LOWcli/src/utils/misc.ts636export function managedPackagePathIsWithin(root: string, path: string) {CODE
LOWcli/src/utils/misc.ts646export function canonicalizeManagedPackagePath(path: string) {CODE
LOWcli/src/utils/misc.ts666function hasPackageWorkspaceBoundaryMarker(directory: string) {CODE
LOWcli/src/utils/misc.ts689function managedPackageBoundaryError(CODE
LOWcli/src/utils/misc.ts702export async function commitFileSystemTransaction(CODE
LOWcli/src/utils/misc.ts750async function commitFileSystemTransactionUnlocked(CODE
LOWcli/src/utils/misc.ts1458async function pathsReferToSameDirectoryEntry(CODE
LOWcli/src/utils/misc.ts1537async function readReconciliationMetadata(path: string, label: string) {CODE
LOWcli/src/utils/misc.ts1590async function canonicalizeReconciliationPath(path: string) {CODE
LOWcli/src/utils/misc.ts1611async function resolveReconciliationLockIdentities(CODE
LOWcli/src/utils/misc.ts1724async function assertReconciliationRequestedPathUnchanged(CODE
LOWcli/src/utils/misc.ts1750async function assertReconciliationAnchorUnchanged(CODE
LOWcli/src/utils/misc.ts1778async function assertReconciliationLockRootUnchanged(CODE
357 more matches not shown…
Over-Commented Block309 hits · 286 pts
SeverityFileLineSnippetContext
LOWcrates/async-runtime/Cargo.toml41# Cargo resolves target tables from `rustc --print cfg`, which is IDENTICAL forCOMMENT
LOWcrates/async-runtime/build.rs1/// Emit this crate's two first-party target cfgs.COMMENT
LOWcrates/async-runtime/src/adapter.rs281/// Return the effective async runtime configuration.COMMENT
LOWcrates/async-runtime/src/adapter.rs941 if let Some(inner) = registered_current_thread_task_host(id) {COMMENT
LOWcrates/async-runtime/src/adapter.rs961/// LIFETIME: each importing napi env registers its ownCOMMENT
LOWcrates/async-runtime/src/adapter.rs1061/// main-only process that would leave NO driver and every later CT sleepCOMMENT
LOWcrates/async-runtime/src/adapter.rs1081/// (aborted pre-check, raw `napi_closing`), and the JS coercion above canCOMMENT
LOWcrates/async-runtime/src/adapter.rs1781 // already pending at this task's first poll), so there is no hostCOMMENT
LOWcrates/async-runtime/src/adapter.rs1981 if let Some(inner) = registered_timer_host(id) {COMMENT
LOWcrates/async-runtime/src/js_callback.rs41 let value_type = napi::type_of!(env, napi_val)?;COMMENT
LOWcrates/async-runtime/src/lib.rs1//! A shared, tokio-free async runtime for napi-rs addons.COMMENT
LOWcrates/async-runtime/src/lib.rs21/// Maximum number of physical workers a scheduler owned by this crate mayCOMMENT
LOWcrates/async-runtime/src/sync.rs1//! The `Mutex` and `Condvar` this crate locks and waits with, and its threadCOMMENT
LOWcrates/async-runtime/src/sync.rs21//! The condvar wait cannot use std's `wait_timeout`: the timeout bounds onlyCOMMENT
LOWcrates/backend/src/typegen.rs81COMMENT
LOWcrates/backend/src/codegen/struct.rs41 js_name: &str,COMMENT
LOWcrates/backend/src/codegen/struct.rs61 Some(salt) => {COMMENT
LOWcrates/backend/src/codegen/fn.rs61 // future's finalize closure. Synchronous callbacks never know whether the value theyCOMMENT
LOWcrates/backend/src/codegen/fn.rs341 };COMMENT
LOWcrates/sys/src/wasi_heap_sync.rs1//! `wasm32-wasip1-threads` only: every thread's view of the shared memory size. Not a publicCOMMENT
LOWcrates/sys/src/wasi_heap_sync.rs21//! only set from the result of `memory.grow(0)` run on this thread, and memory never shrinks,COMMENT
LOWcrates/sys/src/wasi_heap_sync.rs41 sync::atomic::{AtomicU32, AtomicUsize, Ordering},COMMENT
LOWcrates/sys/src/wasi_thread_crash.rs1//! `wasm32-wasip1-threads` only: whether a wasm thread of this instance has died. Not a publicCOMMENT
LOWcrates/macro/src/parser/mod.rs81}COMMENT
LOWcrates/napi/build.rs1fn main() {COMMENT
LOWcrates/napi/src/wasi_heap_sync.rs1//! `wasm32-wasip1-threads` only: one lock around wasi-libc's allocator, so that a thread's viewCOMMENT
LOWcrates/napi/src/wasi_heap_sync.rs21//! LOCK (spin; sched_yield every 64 spins; never memory.atomic.wait)COMMENT
LOWcrates/napi/src/wasi_heap_sync.rs41//! without the trap handler).COMMENT
LOWcrates/napi/src/wasi_heap_sync.rs61//! holds.COMMENT
LOWcrates/napi/src/wasi_heap_sync.rs81//! The break never passes 2^31. Node's `node:wasi` (v24 and later) answers `EINVAL` (os error 28)COMMENT
LOWcrates/napi/src/wasi_heap_sync.rs101//! the memory in between. Below the reserve nothing grows. A threadsafe-function call, deferredCOMMENT
LOWcrates/napi/src/wasi_heap_sync.rs121//! same loads 1.6-3.2x faster than growing in dlmalloc's own small steps, so most of that gainCOMMENT
LOWcrates/napi/src/wasi_heap_sync.rs201#[inline]COMMENT
LOWcrates/napi/src/wasi_heap_sync.rs341///COMMENT
LOWcrates/napi/src/error.rs21COMMENT
LOWcrates/napi/src/error.rs41 pub(crate) maybe_ref: Option<std::sync::Arc<ErrorRef>>,COMMENT
LOWcrates/napi/src/error.rs61 // implementation can resolve `env`. Every access to `raw` is gated on it, so aCOMMENT
LOWcrates/napi/src/error.rs81// `ErrorRef::drop` releases on the owning thread directly, routes the releaseCOMMENT
LOWcrates/napi/src/error.rs341}COMMENT
LOWcrates/napi/src/error.rs361 /// so converting the `Error` back with [`ToNapiValue`] reproduces the originalCOMMENT
LOWcrates/napi/src/error.rs381 ///COMMENT
LOWcrates/napi/src/error.rs401 /// addon — degrades to an empty reason and absent cause; the retained valueCOMMENT
LOWcrates/napi/src/error.rs421 /// Identity is reproduced only when the `Error` is converted back on the envCOMMENT
LOWcrates/napi/src/error.rs441 /// [`Env::create_error`]: crate::Env::create_errorCOMMENT
LOWcrates/napi/src/error.rs461}COMMENT
LOWcrates/napi/src/error.rs601struct ReflectIntrinsics {COMMENT
LOWcrates/napi/src/error.rs621 // the only thread whose napi implementation can resolve the env at all.COMMENT
LOWcrates/napi/src/error.rs661/// non-`[[Get]]` read of the global, no fresh-realm primitiveCOMMENT
LOWcrates/napi/src/error.rs681/// * `gopd(probe, "data")` must yield a descriptor whose own `value` isCOMMENT
LOWcrates/napi/src/error.rs841/// global mid-capture. A `Reflect` that is missing, not an object, or without aCOMMENT
LOWcrates/napi/src/error.rs961 // first registration stays in place — Node aborts on a duplicateCOMMENT
LOWcrates/napi/src/error.rs981 // Empty slot, or a different env owned this thread before. In the latterCOMMENT
LOWcrates/napi/src/error.rs1041 });COMMENT
LOWcrates/napi/src/error.rs1121/// [`Error::from_unknown_without_coercion`] exists to avoid. Instead theCOMMENT
LOWcrates/napi/src/error.rs1341 .causeCOMMENT
LOWcrates/napi/src/error.rs1361 /// created before module registration — and for errors that hold no reference,COMMENT
LOWcrates/napi/src/error.rs1381 maybe_ref: Some(error_ref.clone()),COMMENT
LOWcrates/napi/src/error.rs1441/// Outlined helper for `#[napi(object)]` deserialization: decorate a field-getterCOMMENT
LOWcrates/napi/src/error.rs1521 }COMMENT
LOWcrates/napi/src/error.rs1721 // This is a conversion, not a constructor: it is what the promise andCOMMENT
249 more matches not shown…
Hallucination Indicators5 hits · 75 pts
SeverityFileLineSnippetContext
CRITICAL⚡cli/src/api/__tests__/new.spec.ts183 yamlObject.jobs.build.strategy.matrix.settings.some(CODE
CRITICAL⚡cli/src/api/__tests__/new.spec.ts188 yamlObject.jobs.build.strategy.matrix.settings.some(CODE
CRITICAL⚡cli/src/api/__tests__/new.spec.ts193 yamlObject.jobs.build.strategy.matrix.settings.some(CODE
CRITICAL⚡cli/src/api/__tests__/new.spec.ts198 yamlObject.jobs.build.strategy.matrix.settings.some(CODE
CRITICAL⚡cli/src/api/__tests__/new.spec.ts203 yamlObject.jobs.build.strategy.matrix.settings.some(CODE
Decorative Section Separators5 hits · 15 pts
SeverityFileLineSnippetContext
MEDIUMcli/src/utils/ohos-selfsign.ts46// ─────────────────────── byte read/write helpers ───────────────────────COMMENT
MEDIUMcli/src/utils/ohos-selfsign.ts87// ─────────────────── ELF pre-clean / normalize (not required for signing) ───────────────────COMMENT
MEDIUMcli/src/utils/ohos-selfsign.ts268// ─────────────────── algorithm core required for signing ───────────────────COMMENT
MEDIUMcli/src/utils/ohos-selfsign.ts466// ─────────────────── read-only validation (--check) ───────────────────COMMENT
MEDIUMcli/src/utils/ohos-selfsign.ts554// ─────────────────── file I/O layer ───────────────────COMMENT
Self-Referential Comments1 hit · 3 pts
SeverityFileLineSnippetContext
MEDIUM.github/workflows/release-crates.yml38 # Create a PR with the new versions and changelog, preparing the next release.COMMENT
Verbosity Indicators1 hit · 2 pts
SeverityFileLineSnippetContext
LOWcrates/napi/src/js_values/ser.rs148 // To avoid this, we need to check if the value fits into a smaller number type.COMMENT
Fake / Example Data1 hit · 1 pts
SeverityFileLineSnippetContext
LOWexamples/napi/__tests__/values.spec.ts1221 t.deepEqual(listObjKeys({ name: 'John Doe', age: 20 }), ['name', 'age'])CODE