Skip to content

chore(tutorials): CLI-deprecation rules + promotion lint + OS-fallback doc fix + MCP slicer import fix - #3033

Merged
jung-thomas merged 4 commits into
DEVfrom
worktree-clidoc-mcp-polish
Nov 6, 2026
Merged

jung-thomas merged 4 commits into
DEVfrom
worktree-clidoc-mcp-polish

Conversation

@jung-thomas

Copy link
Copy Markdown
Contributor

Summary

Four small independent cleanups in one PR:

C1 — Expanded CLI-deprecation lint rules (spec task 4.4)

Adds 5 new advisory rules to scripts/lint-rules/data/cli-deprecations.json (all severity 'warning', never block builds):

Rule Removed/deprecated in
cf map-route --hostname CF CLI v8
cf create-route --hostname CF CLI v8
cf push --no-route CF CLI v8
cds run @sap/cds 6 (deprecated for cds watch)
npm install -g @sap/cds @sap/cds-dk 7 (should be @sap/cds-dk)

Also adds a quarterly-review reminder header comment to scripts/lint-rules/deprecated-cli.ts (per spec task 4.4) with links to official changelogs and documents the needsOwnerReview interface field.

Rules needing owner review (marked "needsOwnerReview": true in the JSON — these fire at 'warning' but need confirmation against official changelogs):

  • cf map-route --hostname — parallel to existing --hostname removal, high confidence but not independently verified against CF CLI v8 release notes
  • cf create-route --hostname — same reasoning
  • cf push --no-route — same reasoning
  • cds run — deprecated in favour of cds watch, but exact version not confirmed
  • npm install -g @sap/cds — @sap/cds-dk installs the cds CLI, @sap/cds is runtime-only, but exact "deprecated since" version needs owner verification

C2 — New promotion-warning lint rule (advisory 'notice' severity)

Adds promotionWarningRule to scripts/lint-rules/authoring-aids.ts, registered in the RULES array in scripts/lint-tutorial-markdown.ts.

Assumption (flagged for confirmation): The rule detects :::promotion-warning container directive blocks in PROD tutorial source. Semantics assumed analogous to :::qa-only — an author-placed "do not promote without resolving this" marker. The :::promotion-warning directive has not yet been deployed to the platform; this rule pre-declares the lint gate for when authors begin using the pattern. The exact directive syntax may need adjusting once it ships. Owners: confirm the pattern or adjust before promoting this rule beyond DEV.

Severity is 'notice' (below 'warning'), which means it is advisory only and never blocks a build even with --strict.

C3 — Fix stale §3.5.2 doc (OS option-tab fallback behavior)

docs/authors/writing-tutorials.md §3.5.2 still described the pre-#2820 "closest match" fallback ("No Linux instructions for this step — showing macOS."). Since commit e82393c (#2820) the platform performs exact-match-only rendering: if the chosen OS has no panel in a step group, it shows "No <OS> instructions for this step." — no substitution. Updated to describe the current behavior.

D — Fix MCP slicer latent static-import bug (#3029 pattern)

packages/mcp/tutorial-step-slicer.js had a static import { renderDirectivesAsText } from '../../scripts/parsers/directives.js'. At CF runtime, scripts/parsers/ is not deployed into gen/srv, so this fails. It was masked by KG_STEP_SLICER_ENABLED defaulting off and the srv/lib shim's bundle fallback.

Applied the same fix #3029 used in freshness-detector.js: replace the static import with a memoised lazy await import() that tries the workspace path first and falls back to the pre-built _shared/parsers.bundle.mjs (already created by scripts/bundle-shared.cjs).

How tested

  • npx tsx scripts/run-static-guards.ts — 17/17 checks pass (180s)
  • npx vitest run scripts/lint-rules/__tests__/ — all lint rule tests pass (8 new for C2 promotion-warning rule, all existing tests unchanged)
  • npx vitest run test/unit/tutorial-step-slicer*.test.js — 18/18 pass after D fix
  • C3 is a doc-only change (no runtime behavior)

Deploy scope

Backend only (srv/* changes) + docs (docs/authors/). No approuter, no Hugo changes. No schema migrations. No feature flags — all changes are defensive (lint rules advisory-only, import fix fail-open).

C1/C2 lint rules: 'warning'/'notice' severity — they MUST NOT and DO NOT fail builds.
D: KG_STEP_SLICER_ENABLED defaults off in all environments; fix takes effect when the flag is enabled.

…stitution placeholder (#2820)

§3.5.2 previously described the pre-#2820 "closest match" fallback (show macOS when
Linux is missing, with a banner saying so). Since commit e82393c (#2820) the platform
performs exact-match-only rendering: if the chosen OS has no panel in a step group it
shows a 'No <OS> instructions for this step.' placeholder instead of substituting
another OS's content. Update the doc to reflect the current behavior.
…time (#3029 pattern)

`packages/mcp/tutorial-step-slicer.js` statically imported `renderDirectivesAsText`
from `../../scripts/parsers/directives.js` (a TypeScript source file). This mirrors
the bug fixed in `freshness-detector.js` by #3029: `scripts/parsers/` is NOT deployed
into `gen/srv` at `cds build` time, so the static import fails at CF runtime — masked
today by `KG_STEP_SLICER_ENABLED` defaulting off and the `srv/lib` shim's bundle
fallback.

Apply the same fix: replace the static import with a memoised lazy `await import()`
that tries the workspace path first, catches on failure, and falls back to the
pre-built `_shared/parsers.bundle.mjs` (already created by `scripts/bundle-shared.cjs`
as part of the #3029 fix). The `collectTroubleshootEntries` static import remains —
it is inlined by esbuild when building `mcp.bundle.mjs` and is not affected by this
path at CF runtime.

Unit tests: 18/18 pass.
…pec task 4.4)

Adds 5 new entries to cli-deprecations.json (all advisory 'warning', never
block builds):

  cf map-route --hostname     — CF v8 removal (parallel to existing --hostname rule)
  cf create-route --hostname  — CF v8 removal (same migration guide)
  cf push --no-route          — CF v8 removal (use no-route: true in manifest.yml)
  cds run                     — deprecated in favour of cds watch
  npm install -g @sap/cds     — should be @sap/cds-dk for the cds CLI

Rules marked needsOwnerReview: true in the JSON need owner confirmation against
official changelogs before being treated as authoritative. They still fire at
'warning' level — advisory only.

Also adds a quarterly-review reminder comment header to deprecated-cli.ts
(spec task 4.4) with links to official CF, CAP, BTP, and MBT changelogs, and
documents the needsOwnerReview interface field.

Existing 4 rules and all tests unchanged (4/4 pass).
…cated-CLI rule)

Adds a new advisory lint rule `promotion-warning-in-prod-source` to
`scripts/lint-rules/authoring-aids.ts`, registered in the `RULES` array in
`scripts/lint-tutorial-markdown.ts`.

The rule fires at `'notice'` severity (below 'warning' — never blocks a build
even with --strict) when PROD tutorial source contains a `:::promotion-warning`
container directive. This is analogous to the existing `:::qa-only` rule but
targets a separate authoring-time marker: an author-placed "do not promote"
annotation indicating a specific concern that should be resolved before the
tutorial reaches production readers.

Assumption (flagged for owner confirmation): the `:::promotion-warning` directive
has not yet been deployed to the platform as of this change; this rule pre-declares
the lint gate for when authors begin using the pattern. The exact directive syntax
may need adjusting once it ships — owners should verify and drop this note.

Tests: 8/8 pass (3 new for promotionWarningRule, 5 pre-existing unchanged).
@jung-thomas
jung-thomas merged commit f6e1bd1 into DEV Nov 6, 2026
3 of 4 checks passed
@jung-thomas
jung-thomas deleted the worktree-clidoc-mcp-polish branch November 6, 2026 16:31
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