install-plugin-deps skips plugin npm deps when root has a version-specific override (e.g. Agent's ajv@^8)

Open
#1,163 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
javascript, node.js
Domain
backend, tooling

Research direction

Start with scripts/install-plugin-deps.js, especially the override name collection around line 85 and the dependency filter around line 96; compare those checks with the root package.json overrides and Agent’s dependencies.npm declaration described in the issue. Trace how the script decides whether to install a plugin dependency. Done means version-specific overrides no longer cause unrelated requested versions to be skipped, and skipped dependencies produce a warning.

Written by the indexing model from the issue text.

Description

Summary

scripts/install-plugin-deps.js silently skips a plugin's declared npm dependency whenever the root package.json has an override for any version of that package. Version-specific override keys such as "ajv@^6" are reduced to the bare name (key.split("@")[0]), so a plugin that declares "ajv": "^8.17.1" in plugin.json dependencies.npm never gets it installed.

Concrete impact

The MMGIS-Plugins Agent backend declares "ajv": "^8.17.1" and calls require("ajv"). Because of the skip above, that dependency is never installed, and Agent resolves the root node_modules/ajv, which is 6.15.0. It's only there because of build and lint tooling (eslint/@eslint/eslintrc, old schema-utils copies under webpack loaders, and the webpack bundled inside georaster/georaster-stack). Core MMGIS itself never imports ajv.

The major version changes behaviour. With Agent's exact options ({ allErrors: true, strict: false, coerceTypes: true, useDefaults: true }) and a { type: "string", format: "date-time" } property:

ajv { t: "not a date" }
6.15.0 (what Agent gets today) rejected
8.20.0 (what Agent declares) accepted: Ajv 8 has no built-in formats without ajv-formats

So Agent's date-time validation works only by accident. Any change that moves ajv@8 to the top of node_modules (for example, eslint 9 flat config dropping @eslint/eslintrc) would disable it silently. This also led NASA-AMMOS/MMGIS-Plugins#13 to ship a plugin-local package.json/lockfile instead of using dependencies.npm.

Suggested fix

  1. In install-plugin-deps.js, skip a plugin dependency only when an override applies to the version range it requests. One way: a bare-name override ("ajv") matches every request, and a versioned key ("ajv@^6") matches only when the requested range intersects it (semver.intersects). Or skip nothing and let npm apply the overrides. Note that scoped versioned keys ("@scope/pkg@^1") currently aren't reduced to a name at all.
  2. Log a warning whenever a declared plugin dependency is skipped, instead of skipping silently.
  3. Separately, in MMGIS-Plugins: Agent should either add ajv-formats (and declare it) or pin the ajv major it actually relies on.
Dominant language
JavaScript
Stars
242
Forks
86
Avg merge
2d 1h
Merged PRs (30d)
15

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from NASA-AMMOS/MMGIS

All issues in NASA-AMMOS/MMGIS

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.