Skip to content

docs: add comprehensive interface mapping and fix migration guide#564

Draft
ryanbas21 wants to merge 1 commit intomainfrom
migration-guide
Draft

docs: add comprehensive interface mapping and fix migration guide#564
ryanbas21 wants to merge 1 commit intomainfrom
migration-guide

Conversation

@ryanbas21
Copy link
Copy Markdown
Collaborator

@ryanbas21 ryanbas21 commented Apr 6, 2026

https://pingidentity.atlassian.net/browse/SDKS-4884

Summary

  • Add tools/interface-mapping-validator — a CLI tool that validates and generates the interface_mapping.md and MIGRATION.md documents from a TypeScript mapping config + auto-discovered SDK exports
  • Migrate git hooks from Husky + lint-staged to Lefthook
  • Add CI step that validates interface mapping on PRs and posts a comment when out of sync

Interface Mapping Validator

Three CLI modes:

pnpm run mapping:validate    # Check for drift between docs and SDK exports
pnpm run mapping:generate    # Rebuild generated sections from config
pnpm run mapping:fix         # Patch existing tables (add missing, remove stale)

What it generates

Document Section Source
interface_mapping.md Section 0 (Quick Reference) SYMBOL_MAP config + auto-discovered callbacks + 1:1 name matches
interface_mapping.md Section 1 (Package Mapping) Renamed symbols from SYMBOL_MAP, grouped by target package
interface_mapping.md Section 5 (Callback Type Mapping) Auto-discovered from @forgerock/journey-client/types exports
MIGRATION.md Package Dependencies table Unique target packages from SYMBOL_MAP + PACKAGE_MAP

All other sections remain hand-authored.

Adding a new symbol

  1. Run pnpm run mapping:validate to see the drift report
  2. If auto-discovered (callback with same name) — nothing to do
  3. Otherwise — add entry to tools/interface-mapping-validator/src/mapping-config.ts
  4. Run pnpm run mapping:generate and commit

Architecture

97 tests, all passing. Modules: extractors (legacy, new-sdk, markdown), generator, writer, differ, fixer, reporter.

Lefthook Migration

  • Removed Husky + lint-staged
  • Added lefthook.yml with pre-commit (nx sync, typecheck/lint/build, format, interface mapping validation), commit-msg (commitlint), prepare-commit-msg (commitizen)
  • Interface mapping validation triggers when SDK package exports or mapping files change

CI Integration

  • Validates interface mapping on every PR
  • Posts/updates a sticky comment with drift report when out of sync
  • Auto-updates comment to "Up to Date" when fixed

Test plan

  • 97 unit + integration tests passing
  • pnpm run mapping:validate — 0 errors, warnings only for new SDK exports without legacy equivalents
  • pnpm run mapping:generate — regenerates all target sections, formats with prettier
  • Lefthook hooks install and execute correctly
  • CI workflow validates and posts comment on failure

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 6, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7e9f7fea-87f0-4e67-a19d-53142cec6a19

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch migration-guide

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 6, 2026

⚠️ No Changeset found

Latest commit: f0fefe0

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@ryanbas21 ryanbas21 force-pushed the migration-guide branch 2 times, most recently from b02a17e to 7ab96b1 Compare April 9, 2026 16:52
@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud bot commented Apr 9, 2026

View your CI Pipeline Execution ↗ for commit 7ab96b1

Command Status Duration Result
nx affected -t build lint test typecheck e2e-ci ❌ Failed 1m 56s View ↗

☁️ Nx Cloud last updated this comment at 2026-04-09 16:58:01 UTC

Copy link
Copy Markdown
Contributor

@nx-cloud nx-cloud bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nx Cloud is proposing a fix for your failed CI:

We fixed two lint errors in the newly added interface-mapping-validator tool: the package.json scripts were reordered alphabetically to satisfy the package-json/sort-collections rule, and the generateSections(...) call in generator.test.ts was reformatted to place each argument on its own line per Prettier's rules. These changes are purely stylistic and do not alter any logic or behaviour.

Tip

We verified this fix by re-running @forgerock/interface-mapping-validator:lint.

Suggested Fix changes
diff --git a/tools/interface-mapping-validator/package.json b/tools/interface-mapping-validator/package.json
index 04b604423..ee19e3a45 100644
--- a/tools/interface-mapping-validator/package.json
+++ b/tools/interface-mapping-validator/package.json
@@ -6,12 +6,12 @@
   "type": "module",
   "scripts": {
     "build": "pnpm nx nxBuild",
+    "generate": "tsx src/main.ts --generate",
     "lint": "pnpm nx nxLint",
     "test": "pnpm nx nxTest",
     "test:watch": "pnpm nx nxTest --watch",
     "validate": "tsx src/main.ts",
-    "validate:fix": "tsx src/main.ts --fix",
-    "generate": "tsx src/main.ts --generate"
+    "validate:fix": "tsx src/main.ts --fix"
   },
   "dependencies": {
     "ts-morph": "^25.0.0"
diff --git a/tools/interface-mapping-validator/src/generator.test.ts b/tools/interface-mapping-validator/src/generator.test.ts
index 6803441d3..92190c189 100644
--- a/tools/interface-mapping-validator/src/generator.test.ts
+++ b/tools/interface-mapping-validator/src/generator.test.ts
@@ -382,9 +382,14 @@ describe('generateSections', () => {
     });
 
     it('includes package map entries', () => {
-      const result = generateSections(makeLegacy([]), makeNewSdk([]), {}, {
-        '@forgerock/ping-protect': { new: '@forgerock/protect', note: 'Protect integration' },
-      });
+      const result = generateSections(
+        makeLegacy([]),
+        makeNewSdk([]),
+        {},
+        {
+          '@forgerock/ping-protect': { new: '@forgerock/protect', note: 'Protect integration' },
+        },
+      );
 
       expect(result.migrationDependencies).toContain('@forgerock/ping-protect');
       expect(result.migrationDependencies).toContain('@forgerock/protect');

Apply fix via Nx Cloud  Reject fix via Nx Cloud


Or Apply changes locally with:

npx nx-cloud apply-locally Tj02-Jp9E

Apply fix locally with your editor ↗   View interactive diff ↗



🎓 Learn more about Self-Healing CI on nx.dev

Add tools/interface-mapping-validator — a CLI tool that validates and
generates the interface_mapping.md and MIGRATION.md documents from a
TypeScript mapping config combined with auto-discovered SDK exports.

Three CLI modes:
- validate: check for drift between docs and SDK exports
- generate (--generate): rebuild sections 0, 1, 5 from config
- fix (--fix): patch existing tables

Also:
- Migrate git hooks from husky/lint-staged to lefthook
- Add CI step that validates interface mapping on PRs with auto-updating comments
- Add root-level scripts: pnpm run mapping:validate, pnpm run mapping:generate

97 tests, functional core / imperative shell architecture.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant