Skip to content

feat(enrichment): native-build / install-cost dependency analyzer - #1742

Merged
JSONbored merged 1 commit into
JSONbored:mainfrom
nickmopen:feat/enrichment-native-build
Jun 29, 2026
Merged

feat(enrichment): native-build / install-cost dependency analyzer#1742
JSONbored merged 1 commit into
JSONbored:mainfrom
nickmopen:feat/enrichment-native-build

Conversation

@nickmopen

Copy link
Copy Markdown
Contributor

Summary

Adds a REES analyzer (#1512) that flags the dependencies a PR adds/upgrades whose install does real work the manifest diff never shows — a hidden CI cold-start cost and a frequent cross-platform breakage source. Additive + fail-safe: fills its own nativeBuild findings key and degrades independently.

Detects (factual registry-metadata signals only)

  • npm — native addon: a version with gypfile: true, or an install/preinstall/postinstall script that runs a native toolchain (node-gyp, cmake-js, node-pre-gyp, prebuild…). When a prebuilt-binary path exists (node-pre-gyp/prebuild-install, or a binary field), the finding notes the compile is a fallback for an unmatched platform/Node ABI rather than guaranteed — so bcrypt/sqlite3-style packages aren't mischaracterized.
  • PyPI — sdist-only: a version that ships no bdist_wheel (only an sdist), so pip compiles from source on install.

These are objective properties read from the npm packument and the PyPI per-version JSON (not heuristics), so there are no fuzzy false positives. Unknown/non-ok registry responses fail safe (no finding).

Implementation (established review-enrichment/ pattern)

  1. NativeBuildFinding type + nativeBuild? key in src/types.ts
  2. src/analyzers/native-build.ts — pure helpers (npmNativeBuild, pypiSdistOnly) + scanNativeBuild(req, fetch, opts); reuses extractDependencyChanges
  3. Registered in the src/brief.ts ANALYZERS registry
  4. Public-safe block in src/render.ts (renders package@version + reason only)
  5. node:test units in a separate test/native-build.test.ts

Validation

From review-enrichment/ (Node 24):

npm test   # build + node --test: 164 pass / 0 fail (13 new native-build units)

Covers gypfile/native-tool detection, prebuilt-fallback nuance, pure-JS negatives, PyPI sdist-only vs wheel, Go/invalid-name skips, fetch 404/throw/abort fail-safe, and the rendered block.

Closes #1512

@nickmopen
nickmopen requested a review from JSONbored as a code owner June 29, 2026 11:53
@dosubot dosubot Bot added the size:L label Jun 29, 2026
@loopover-orb

loopover-orb Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Tip

🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩

✅ Gittensory review result - approve/merge recommended

Review updated: 2026-06-29 21:27:28 UTC

5 files · 1 AI reviewer · no blockers · readiness 55/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This adds a native-build enrichment analyzer, wires it into the analyzer registry, renders the new finding block, and covers the pure npm/PyPI helpers plus basic scan behavior. The implementation follows the existing best-effort analyzer shape and fails closed on registry errors. The main correctness gap is coverage of reachable production branches rather than the core analyzer logic itself.

Nits — 6 non-blocking
  • nit: review-enrichment/src/analyzers/native-build.ts:52 treats any script containing `prebuild` as native work, but `PREBUILT_TOOL_RE` only gives fallback nuance to `prebuild-install`, so packages using the `prebuild` CLI can be reported as guaranteed source compiles even when the install path is prebuilt-first.
  • nit: review-enrichment/test/native-build.test.ts:56 only checks the rendered package names, so it does not verify that `renderBrief` preserves the native-build reason text or sanitizes unsafe package/version content in this new block.
  • nit: review-enrichment/test/native-build.test.ts:130 covers an already-aborted signal but not an abort after one registry query, leaving the loop-break behavior in `scanNativeBuild` unexercised on the multi-change path.
  • In review-enrichment/src/analyzers/native-build.ts:52, either include `prebuild` in `PREBUILT_TOOL_RE` or split the reason logic so `prebuild` scripts are not over-described as unconditional source compiles.
  • Add a render test in review-enrichment/test/native-build.test.ts that asserts the native-build reason appears and that backticks/control characters in `package@​version` are sanitized through `safeCodeSpan`.
  • Readiness score is below the configured threshold — Use the readiness panel as advisory maintainer context; the score does not block this PR.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #1512
Related work ⚠️ 3 scoped overlaps Top overlaps are listed below; lower-confidence bulk is hidden.
Change scope ❌ 8/20 High review scope from cached public metadata (size label size:L; 1 linked issue).
Validation posture ❌ 5/25 Preflight is holding this PR; address the blocker before review.
Contributor workload ✅ 10/10 Author activity: 88 registered-repo PR(s), 59 merged, 1 issue(s).
Contributor context ✅ Confirmed Gittensor contributor nickmopen; Gittensor profile; 88 PR(s), 1 issue(s).
Gate result ✅ Passing No configured blocker found.
Review context
Contributor next steps
  • Review top overlaps.
  • Add a concise scope and risk note.
  • Fix the blocker.
  • Triage stale or unlinked PRs.
  • Refresh registry data or choose a registered active repo.
  • Check active issues and PRs before submitting.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.

  • Re-run Gittensory review

@loopover-orb loopover-orb Bot added gittensor gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. labels Jun 29, 2026
Add a REES analyzer that flags the dependencies a PR adds/upgrades whose install does real work the
manifest diff never shows — a hidden CI cold-start cost and a frequent cross-platform breakage source:

- npm: a version that compiles a native addon on install (gypfile, or an install/preinstall/postinstall
  script that runs node-gyp/cmake-js/etc). When a prebuilt-binary path exists (node-pre-gyp/prebuild or
  a `binary` field) the reason notes the compile is a fallback for an unmatched platform/ABI.
- PyPI: a version that ships no prebuilt wheel (sdist-only), so pip compiles from source on install.

Factual registry-metadata signals only (npm packument, PyPI per-version JSON) via an injected fetch;
non-ok/unknown states fail safe (no finding). Reuses extractDependencyChanges, registered in the brief
orchestrator, rendered as a public-safe block (package@version + reason). Tests in their own file.

Closes JSONbored#1512
@dosubot dosubot Bot added the lgtm label Jun 29, 2026
@JSONbored
JSONbored merged commit a0b54bd into JSONbored:main Jun 29, 2026
13 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in gittensory - v1 roadmap Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

feat(enrichment): Native-build / install-cost dependency flag

2 participants