Skip to content

fix(2245): declare gray-matter as runtime dependency (srv boot crash) - #2278

Merged
jung-thomas merged 2 commits into
DEVfrom
fix/skill-bundle-gray-matter-runtime-dep
Sep 13, 2026
Merged

jung-thomas merged 2 commits into
DEVfrom
fix/skill-bundle-gray-matter-runtime-dep

Conversation

@jung-thomas

Copy link
Copy Markdown
Contributor

Problem

tutorials-srv crash-loops at boot on DEV (0/1 instances) with:

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'gray-matter'
  imported from /home/vcap/app/srv/lib/skill-bundle.js

srv/lib/skill-bundle.js — added in 43ead4c0 (feat #2245, "compose SKILL.md from tutorial source + stamp") — does import matter from 'gray-matter' at module top level, on the srv boot path. But gray-matter was declared only in devDependencies. Cloud Foundry installs production dependencies only (npm ci --omit=dev), so the package is absent at runtime and the process exits 1 on every restart.

This passed CI/tests because local + test installs include devDependencies (classic "undeclared runtime dep passes tests, crashes CF").

Fix

  • Move gray-matter from devDependencies → dependencies in package.json.
  • Regenerate package-lock.json (npm install --package-lock-only): promotes the root entry and removes the "dev": true marker from gray-matter and its now-prod-reachable transitive subtree (argparse, js-yaml@3, esprima, section-matter, extend-shallow, is-extendable, kind-of, sprintf-js, strip-bom-string).

Two-file diff, no code changes.

Scope check

Scanned all bare (non-relative) imports across srv/** against dev/prod dependency classification. gray-matter is the only newly-introduced dev-only import on the runtime path. vitest/express/happy-dom etc. appear only in srv/**/__tests__/; archiver, graphql, @modelcontextprotocol/sdk were already resolving in prior prod deploys.

Verification

The DEV deploy that surfaced this got past HDI/migration (the ChatSettings v19 fix from #2277 held — no column error) and cf deploy; it failed only because srv crashed at boot. After merge, redeploying DEV should bring tutorials-srv up and let the content-publish + smoke steps complete.

srv/lib/skill-bundle.js (added in 43ead4c, feat #2245) imports
gray-matter at module top-level, but it was only a devDependency.
CF installs prod-only, so tutorials-srv crash-loops at boot with
ERR_MODULE_NOT_FOUND: Cannot find package 'gray-matter'. Move it to
dependencies and mark its transitive subtree non-dev in the lockfile.
The static-guards job had only `contents: read`, unlike every other
npm-ci workflow (deploy, cds-build-staging, schema-drift, etc. all
declare `packages: read`). The npm cache masked it: on a cache hit the
private @sap-tutorials/cds-alert-notification tarball is already local,
so no registry read is needed. Any PR that changes package-lock.json
busts the cache key, forcing npm ci to re-download it, and the fallback
GITHUB_TOKEN 403s without packages: read. Align guards with siblings.
@jung-thomas
jung-thomas merged commit 11584b8 into DEV Sep 13, 2026
6 checks passed
@jung-thomas
jung-thomas deleted the fix/skill-bundle-gray-matter-runtime-dep branch September 13, 2026 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant