Add Backstage catalog-model utility preference to ai-integrations AGENTS.md
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 82/100
- Issue type
- Documentation
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- typescript
- Domain
- documentation
Research direction
Start with workspaces/ai-integrations/AGENTS.md and review its existing guidance sections. Add the proposed “Backstage conventions” section covering parseLocationRef, annotation constants, parseEntityRef, stringifyEntityRef, and checking @backstage/catalog-model before custom parsing. Done means the documented guidance addresses the listed utilities and avoids manual type:target parsing when parseLocationRef is available.
Written by the indexing model from the issue text.
Description
What happened
On PR #3956, the code agent implemented OCI validation by manually splitting type:target location-ref strings with indexOf(':'). This manual parsing did not trim whitespace before comparing the type component, causing leading whitespace on a backstage.io/source-location annotation to silently skip OCI validation. The human reviewer (comment) identified that parseLocationRef from @backstage/catalog-model handles trimming, error cases, and type/target extraction correctly — it is the standard upstream utility for exactly this purpose. The fix agent then adopted parseLocationRef in commit 5b65088, resolving the issue. If the code agent had used parseLocationRef from the start, the whitespace bypass bug and subsequent fix rounds would have been avoided. The ai-integrations AGENTS.md has no mention of preferring upstream Backstage utilities.
What could go better
The code agent had no guidance to prefer upstream @backstage/catalog-model utilities over manual implementations. The workspace AGENTS.md covers build commands, architecture, and spec conventions but does not mention the standard Backstage catalog-model utilities that plugins in this workspace should use. This is a high-confidence gap: parseLocationRef, ANNOTATION_SOURCE_LOCATION, parseEntityRef, and similar utilities are foundational to Backstage plugin development and are used throughout the monorepo. Instructing the code agent to prefer these would prevent a recurring class of bugs where manual string parsing misses edge cases the upstream utility handles.
Proposed change
Add a "Backstage conventions" section to workspaces/ai-integrations/AGENTS.md instructing the agent to prefer upstream @backstage/catalog-model utilities over manual implementations. Specifically:
- When parsing location references (e.g.,
backstage.io/source-locationannotation values), useparseLocationReffrom@backstage/catalog-modelinstead of manualtype:targetstring splitting. - Use the exported constants
ANNOTATION_SOURCE_LOCATION,ANNOTATION_LOCATION, etc. from@backstage/catalog-modelinstead of defining local string constants. - When parsing entity references, use
parseEntityRef/stringifyEntityReffrom@backstage/catalog-model. - Before implementing custom parsing for any Backstage-convention string format, check
@backstage/catalog-modelexports for an existing utility.
Example addition to AGENTS.md:
## Backstage conventions
Prefer upstream utilities from `@backstage/catalog-model` over manual implementations:
- `parseLocationRef` for `type:target` location-ref strings
- `ANNOTATION_SOURCE_LOCATION` / `ANNOTATION_LOCATION` for annotation key constants
- `parseEntityRef` / `stringifyEntityRef` for entity ref strings
Before writing custom parsing for Backstage-convention string formats, check `@backstage/catalog-model` exports.
Validation criteria
On the next 3 code agent PRs in the ai-integrations workspace that involve Backstage location refs or entity refs, the code agent uses upstream utilities from @backstage/catalog-model instead of manual string splitting. Zero instances of manual type:target parsing when parseLocationRef is available.
Generated by retro agent from https://github.com/redhat-developer/rhdh-plugins/pull/3956
- Dominant language
- TypeScript
- Stars
- 48
- Forks
- 120
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 333
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from redhat-developer/rhdh-plugins
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
redhat-developer/rhdh-plugins#4887 · 2 comments ·
-
feature fullsend ready-for-triage Review effort 1/5 triaged
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
redhat-developer/rhdh-plugins#4799 · 2 comments ·
-
Add Backstage entity provider design concepts to ai-integrations AGENTS.md for specification review Opendocumentation ready-for-triage ready-to-code Review effort 1/5 workspace/ai-integrations
Difficulty 1/5 Under an hour Newbie friendliness 88/100
redhat-developer/rhdh-plugins#4788 · 5 comments ·
-
documentation ready-for-triage ready-to-code Review effort 1/5 workspace/ai-integrations
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
redhat-developer/rhdh-plugins#4781 · 3 comments ·
-
documentation ready-for-triage ready-to-code Review effort 1/5 workspace/scorecard
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
redhat-developer/rhdh-plugins#4777 · 3 comments ·
All issues in redhat-developer/rhdh-plugins
Similar issues
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 91/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100