Skip to content

Scaffold new catalog module for AIResource and add upstream plugin to…#3606

Open
johnmcollier wants to merge 2 commits into
redhat-developer:mainfrom
johnmcollier:addairesourcemodule
Open

Scaffold new catalog module for AIResource and add upstream plugin to…#3606
johnmcollier wants to merge 2 commits into
redhat-developer:mainfrom
johnmcollier:addairesourcemodule

Conversation

@johnmcollier

Copy link
Copy Markdown
Member

Hey, I just made a Pull Request!

This PR scaffolds a new backend module that extends the catalog, catalog-backend-module-ai-resource-extensions, to enable extensions to be delivered on top of the AIResource entity type.

Also enables the upstream AIResource catalog module in this workspace's dev environment

✔️ Checklist

  • A changeset describing the change and affected packages. (more info)
  • Added or Updated documentation
  • Tests for new functionality and regression tests for bug fixes
  • Screenshots attached (for UI changes)

… workspace

Signed-off-by: John Collier <jcollier@redhat.com>
Signed-off-by: John Collier <jcollier@redhat.com>
@rhdh-gh-app

rhdh-gh-app Bot commented Jun 26, 2026

Copy link
Copy Markdown

Important

This PR includes changes that affect public-facing API. Please ensure you are adding/updating documentation for new features or behavior.

Unnecessary Changesets

The following package(s) are private and do not need a changeset:

  • @red-hat-developer-hub/backstage-plugin-catalog-backend-module-catalog-backend-module-ai-resource-extensions

Changed Packages

Package Name Package Path Changeset Bump Current Version
backend workspaces/ai-integrations/packages/backend none v0.0.13
@red-hat-developer-hub/backstage-plugin-catalog-backend-module-catalog-backend-module-ai-resource-extensions workspaces/ai-integrations/plugins/catalog-backend-module-catalog-backend-module-ai-resource-extensions minor v0.1.0

@sonarqubecloud

Copy link
Copy Markdown

@rhdh-qodo-merge

Copy link
Copy Markdown

PR Summary by Qodo

Scaffold AIResource catalog extension module and enable ai-model in dev backend
✨ Enhancement ⚙️ Configuration changes 📝 Documentation 🕐 20-40 Minutes

Grey Divider

Description

• Scaffold a new catalog backend module package for AIResource extensions.
• Wire the new module and upstream ai-model module into the ai-integrations dev backend.
• Add changeset + API report to track the new package’s public surface and versioning.
Diagram

graph TD
  F["backend/package.json"] --> A["Dev backend (index.ts)"] --> B["Backend runtime"] --> C["Catalog backend"] --> D["Upstream ai-model module"]
  C --> E["AIResource ext module"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Enable upstream module only (defer custom module)
  • ➕ Less workspace maintenance (no new package boilerplate to keep in sync)
  • ➕ Avoids publishing/versioning overhead until extensions exist
  • ➖ No dedicated place to land AIResource-specific extension code when needed
  • ➖ Delays establishing the extension boundary/package API
2. Implement extensions via existing catalog extension points (processors/policies) within an existing package
  • ➕ Fewer packages; extensions live alongside existing catalog customization
  • ➕ Can reuse shared wiring and configuration patterns already present
  • ➖ Weaker modular boundary; harder to distribute/enable selectively
  • ➖ May couple AIResource work to unrelated catalog customization
3. Start with a minimal real extension (remove Hello World init)
  • ➕ Ensures the module proves the intended extension mechanism end-to-end
  • ➕ Avoids shipping placeholder logging in default startup paths
  • ➖ Requires defining the first concrete extension scope now
  • ➖ Slightly more upfront design work

Recommendation: The current scaffolding approach is fine for establishing a modular boundary, but consider removing/neutralizing the placeholder "Hello World!" init before merging (or replace it with a no-op) to avoid noisy logs in dev environments. Also consider whether the duplicated segment in the package name ("catalog-backend-module-catalog-backend-module-") is intentional—renaming later will be more disruptive due to changeset/API report/versioning.

Files changed (9) +145 / -0

Enhancement (3) +66 / -0
index.tsRegister upstream ai-model module and new AIResource extensions module +6/-0

Register upstream ai-model module and new AIResource extensions module

• Extends backend startup to add the upstream catalog ai-model module and the new AIResource extensions module to the backend feature set.

workspaces/ai-integrations/packages/backend/src/index.ts

index.tsExport the backend module as the package default +22/-0

Export the backend module as the package default

• Adds the public entrypoint that re-exports the created backend module from ./module as the default export.

workspaces/ai-integrations/plugins/catalog-backend-module-catalog-backend-module-ai-resource-extensions/src/index.ts

module.tsCreate catalog backend module scaffold for AIResource extensions +38/-0

Create catalog backend module scaffold for AIResource extensions

• Implements a Backstage backend module registered under the catalog plugin with an init hook that currently logs a placeholder message.

workspaces/ai-integrations/plugins/catalog-backend-module-catalog-backend-module-ai-resource-extensions/src/module.ts

Documentation (2) +18 / -0
README.mdAdd README for the new AIResource extensions module +5/-0

Add README for the new AIResource extensions module

• Adds a minimal README describing the purpose of the newly created catalog backend module package.

workspaces/ai-integrations/plugins/catalog-backend-module-catalog-backend-module-ai-resource-extensions/README.md

report.api.mdAdd API Extractor report for the new module’s public API +13/-0

Add API Extractor report for the new module’s public API

• Introduces an API report capturing the package’s exported default BackendFeature for API stability tracking.

workspaces/ai-integrations/plugins/catalog-backend-module-catalog-backend-module-ai-resource-extensions/report.api.md

Other (4) +61 / -0
short-insects-cut.mdAdd changeset for new AIResource catalog extension module +5/-0

Add changeset for new AIResource catalog extension module

• Introduces a changeset marking a minor release for the newly scaffolded catalog backend module package and documents the intent of the change.

workspaces/ai-integrations/.changeset/short-insects-cut.md

package.jsonAdd dependencies for upstream ai-model and new AIResource extensions module +2/-0

Add dependencies for upstream ai-model and new AIResource extensions module

• Adds the upstream @backstage catalog backend ai-model module dependency and the new workspace AIResource extensions backend module dependency so they can be imported by the dev backend.

workspaces/ai-integrations/packages/backend/package.json

.eslintrc.jsAdd ESLint config for the new backend module package +16/-0

Add ESLint config for the new backend module package

• Adds standard Backstage CLI ESLint configuration for the newly scaffolded module package.

workspaces/ai-integrations/plugins/catalog-backend-module-catalog-backend-module-ai-resource-extensions/.eslintrc.js

package.jsonScaffold package manifest for AIResource extensions backend module +38/-0

Scaffold package manifest for AIResource extensions backend module

• Defines the new backend plugin module package metadata, Backstage role configuration, build/test scripts, and core dependency on @backstage/backend-plugin-api.

workspaces/ai-integrations/plugins/catalog-backend-module-catalog-backend-module-ai-resource-extensions/package.json

@rhdh-qodo-merge

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (3) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Missing package metadata fields 🐞 Bug ⚙ Maintainability
Description
The new module package.json omits the standard "repository" metadata and "backstage.pluginPackages"
list that other backend modules in this repo provide. Repo scripts dereference
packageJson.repository.url/directory without null checks, so missing repository metadata can break
those automations for this package.
Code

workspaces/ai-integrations/plugins/catalog-backend-module-catalog-backend-module-ai-resource-extensions/package.json[R14-18]

+  "backstage": {
+    "role": "backend-plugin-module",
+    "pluginId": "catalog",
+    "pluginPackage": "@backstage/plugin-catalog-backend"
+  },
Relevance

⭐⭐⭐ High

Repo pattern: backend modules include repository and backstage.pluginPackages; seen in new packages
(e.g., #3574).

PR-#3574
PR-#3360

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new package.json lacks repository and backstage.pluginPackages, while other modules include
them; additionally, a repo script directly dereferences
pkg.packageJson.repository.url/.directory, demonstrating potential automation breakage when
repository is missing.

workspaces/ai-integrations/plugins/catalog-backend-module-catalog-backend-module-ai-resource-extensions/package.json[1-38]
workspaces/ai-integrations/plugins/catalog-backend-module-model-catalog/package.json[13-25]
scripts/list-backend-feature.js[48-65]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new backend module package.json is missing fields that other modules in this repo include (`repository` and `backstage.pluginPackages`). Some repo scripts assume `repository.url` and `repository.directory` exist.

## Issue Context
For example, `scripts/list-backend-feature.js` builds README links using `pkg.packageJson.repository.url` and `pkg.packageJson.repository.directory` without optional chaining.

## Fix Focus Areas
- workspaces/ai-integrations/plugins/catalog-backend-module-catalog-backend-module-ai-resource-extensions/package.json[1-38]
- scripts/list-backend-feature.js[48-65]
- workspaces/ai-integrations/plugins/catalog-backend-module-model-catalog/package.json[13-25]

## Proposed fix
- Add a `repository` object (type/url/directory) matching the pattern used by other packages in this workspace.
- Add `backstage.pluginPackages: ["<this package name>"]` to align with other backend modules’ metadata conventions.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Noisy startup Hello World 🐞 Bug ◔ Observability
Description
The new module unconditionally logs "Hello World!" at info level during backend initialization,
creating avoidable log noise and providing no operational value. Since the backend imports this
module unconditionally, the message will be emitted on every startup.
Code

workspaces/ai-integrations/plugins/catalog-backend-module-catalog-backend-module-ai-resource-extensions/src/module.ts[R31-36]

+      reg.registerInit({
+        deps: { logger: coreServices.logger },
+        async init({ logger }) {
+          logger.info('Hello World!');
+        },
+      });
Relevance

⭐⭐⭐ High

Team often removes/reduces noisy logs; accepted log-noise reductions in #1222 and #2393.

PR-#1222
PR-#2393

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The module’s init function emits an info log, and the backend entrypoint adds the module, proving it
will run and log on startup.

workspaces/ai-integrations/plugins/catalog-backend-module-catalog-backend-module-ai-resource-extensions/src/module.ts[30-36]
workspaces/ai-integrations/packages/backend/src/index.ts[74-85]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The module init logs `Hello World!` at `info` level on every backend startup.

## Issue Context
This module is added unconditionally in the ai-integrations backend entrypoint, so the log line will always appear.

## Fix Focus Areas
- workspaces/ai-integrations/plugins/catalog-backend-module-catalog-backend-module-ai-resource-extensions/src/module.ts[31-36]
- workspaces/ai-integrations/packages/backend/src/index.ts[79-85]

## Proposed fix
- Remove the log line entirely, or
- Change it to a more meaningful one-time startup message and/or downgrade to `logger.debug`, ideally behind a feature/config flag if it’s only for scaffolding.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Duplicated package name prefix 🐞 Bug ⚙ Maintainability
Description
The new module package name repeats the "catalog-backend-module" prefix
("...catalog-backend-module-catalog-backend-module-ai-resource-extensions"), while the moduleId is
"catalog-backend-module-ai-resource-extensions", diverging from the established pattern used by
other catalog backend modules. This inconsistency makes the module harder to discover/use and
propagates awkward import paths and symbol names throughout the workspace.
Code

workspaces/ai-integrations/plugins/catalog-backend-module-catalog-backend-module-ai-resource-extensions/package.json[2]

+  "name": "@red-hat-developer-hub/backstage-plugin-catalog-backend-module-catalog-backend-module-ai-resource-extensions",
Relevance

⭐⭐ Medium

No prior reviews about duplicated package-name prefixes; naming convention enforcement unclear.

PR-#3292
PR-#3360

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The package name includes a duplicated prefix, while the module’s moduleId uses the non-duplicated
form; existing catalog backend modules keep these aligned, indicating this is inconsistent with repo
conventions.

workspaces/ai-integrations/plugins/catalog-backend-module-catalog-backend-module-ai-resource-extensions/package.json[1-18]
workspaces/ai-integrations/plugins/catalog-backend-module-catalog-backend-module-ai-resource-extensions/src/module.ts[26-35]
workspaces/ai-integrations/plugins/catalog-backend-module-model-catalog/package.json[1-25]
workspaces/ai-integrations/plugins/catalog-backend-module-model-catalog/src/module.ts[29-33]
workspaces/ai-integrations/.changeset/short-insects-cut.md[1-3]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The newly scaffolded module package has an unintended duplicated name prefix (`catalog-backend-module-` appears twice) that doesn’t match the moduleId and differs from existing module naming conventions.

## Issue Context
Other catalog backend modules in this repo keep `package.json:name` and `moduleId` aligned (e.g., model-catalog). This new module’s `name`/folder/import path should be normalized now to avoid long-term inconsistency.

## Fix Focus Areas
- workspaces/ai-integrations/plugins/catalog-backend-module-catalog-backend-module-ai-resource-extensions/package.json[1-18]
- workspaces/ai-integrations/plugins/catalog-backend-module-catalog-backend-module-ai-resource-extensions/src/module.ts[26-35]
- workspaces/ai-integrations/.changeset/short-insects-cut.md[1-3]
- workspaces/ai-integrations/packages/backend/package.json[46-51]
- workspaces/ai-integrations/packages/backend/src/index.ts[79-84]

## Proposed fix
- Rename the package (and ideally the folder) to remove the duplicated prefix, e.g.:
 - `@red-hat-developer-hub/backstage-plugin-catalog-backend-module-ai-resource-extensions`
- Update all internal references:
 - changeset package key
 - backend workspace dependency and import
 - any generated API report artifacts as needed

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

@rhdh-qodo-merge rhdh-qodo-merge Bot added documentation Improvements or additions to documentation enhancement New feature or request labels Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request workspace/ai-integrations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant