redhat-developer / redhat-developer/rhdh-plugins

Add entity provider implementation conventions to ai-integrations AGENTS.md

Open Beginner friendly
#4,781 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation ready-for-triage ready-to-code Review effort 1/5 workspace/ai-integrations
Dominant language
TypeScript
Stars
48
Forks
120
Avg merge
2d 6h
Merged PRs (30d)
337

Description

What happened

PR #4779 added two entity provider packages (OCI skills and npx skills) to the ai-integrations workspace. The fullsend review (run 35003220422) found 10 issues (4 medium, 6 low), mostly about cross-provider inconsistencies — the OCI provider was missing timeouts, size limits, and pagination that the npx provider implements. However, the review missed three confirmed bugs: (1) the OCI source-location annotation uses oci: format instead of url:oci://, which the repo's own collectOciErrors.ts validator rejects at ingestion time; (2) both providers' type: 'full' mutations with per-item error handling can delete all healthy entities on transient failures; (3) missing yarn.lock entries. SonarQube also failed the quality gate on 6.9% code duplication (threshold: 3%). The ai-integrations workspace AGENTS.md has general backend conventions (service-to-service auth, config visibility, ConfigReader edge cases) but nothing about entity provider implementation patterns.

What could go better

The root cause of both the flagged issues and the missed bugs is the absence of documented entity provider conventions in the workspace AGENTS.md. The review agent found inconsistencies between the two providers but lacked context about what the correct patterns are — particularly the Backstage url: prefix requirement for source-location annotations, which is enforced by existing code (collectOciErrors.ts) but not documented anywhere agents can reference. Seven of the 10 review findings and all 3 missed bugs map directly to undocumented entity provider conventions. The workspace already has 11 plugins including an existing entity provider (catalog-backend-module-model-catalog) with proper patterns, but these conventions are implicit rather than documented. Confidence is high: the evidence is verified against the code, and the pattern is clear — undocumented conventions lead to inconsistent implementations and review blind spots.

Proposed change

Add an "Entity provider conventions" section to workspaces/ai-integrations/AGENTS.md documenting: (1) Source-location format: All backstage.io/source-location annotations must use Backstage location-ref format with url: prefix (e.g., url:oci://registry/image not oci:registry/image), as enforced by collectOciErrors.ts. (2) Mutation error handling: Providers using type: 'full' must guard against emitting empty entity arrays on transient failures — if all individual skill fetches fail but the index/repository list succeeds, skip the mutation rather than replacing the catalog with an empty set. (3) Per-request timeout: Use AbortController with a 30-second timeout on individual HTTP requests, matching the npx-skills pattern. (4) Response size limits: Buffer and check response body size before JSON parsing, using the MAX_ARTIFACT_BYTES pattern. (5) Pagination: List API endpoints must handle pagination tokens/cursors. (6) Shared patterns: Common entity-building logic, fetch helpers, and name-normalization should live in catalog-ai-skills-common to reduce duplication across providers. (7) Reference implementation: Point to catalog-backend-module-model-catalog and its config.d.ts as the convention model for new providers.

Validation criteria

The next 3 entity provider PRs in the ai-integrations workspace should not have source-location format issues, missing timeout/size-limit patterns, or unsafe full-mutation semantics flagged by the review agent. The SonarQube duplication gate should pass when new providers follow the shared-pattern guidance.


Generated by retro agent from https://github.com/redhat-developer/rhdh-plugins/pull/4779

Contributor guide

Open the contributing guide

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.

Research direction

Start with workspaces/ai-integrations/AGENTS.md and compare its existing backend conventions with collectOciErrors.ts, the npx-skills provider, and catalog-backend-module-model-catalog/config.d.ts. Document the requested source-location, mutation safety, timeout, size-limit, pagination, shared-code, and reference patterns. Done means the conventions are present and the next entity-provider review can use this section.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.