feat(#3694): add AIResource spec.scope validation#3742
feat(#3694): add AIResource spec.scope validation#3742fullsend-ai-coder[bot] wants to merge 4 commits into
Conversation
Add RHDH-specific spec.scope extension support for AIResource entities. The AIResourceScopeValidator CatalogProcessor validates that spec.scope, when present, is one of 'organization', 'product', or 'team'. Omitting spec.scope is valid. Invalid values produce actionable errors naming the field, received value, and accepted values. Changes: - AIResourceScopeValidator processor in preProcessEntity validates spec.scope on AIResource entities only - module.ts registers the processor via catalogProcessingExtensionPoint - index.ts exports the validator, type, and constants for reuse - 16 tests covering valid, invalid, omitted scope, error quality, and non-AIResource pass-through Closes #3694 Assisted-by: Claude Opus 4.6
|
Important This PR includes changes that affect public-facing API. Please ensure you are adding/updating documentation for new features or behavior. Changed Packages
|
|
/fs-fix Fix the failing CI checks |
|
🤖 Finished Fix · ✅ Success · Started 8:26 PM UTC · Completed 8:41 PM UTC |
Change makeAIResource spec parameter type from Record<string, unknown> to Entity['spec'] to match the Entity type definition, fixing TS2322 type-check CI failure. Addresses review feedback on #3742 Assisted-by: Claude Opus 4.6
🔧 Fix agent — iteration 1 (human-triggered)Fixed failing CI type-check (TS2322) by correcting the spec parameter type in the test helper function. The change is a single-line type annotation fix with no behavioral impact. Fixed (1):
Tests: passed Updated by fullsend fix agent |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3742 +/- ##
=======================================
Coverage 54.59% 54.60%
=======================================
Files 2360 2362 +2
Lines 90121 90145 +24
Branches 25204 25207 +3
=======================================
+ Hits 49204 49223 +19
- Misses 40672 40687 +15
+ Partials 245 235 -10
*This pull request uses carry forward flags. Click here to find out more. Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
|
/fs-fix Fix the failing API reports error on the CI check |
|
🤖 Finished Fix · ✅ Success · Started 8:53 PM UTC · Completed 9:06 PM UTC |
Regenerate report.api.md to include AIResourceScopeValidator, VALID_AI_RESOURCE_SCOPES, and AIResourceScope type exports that were added in the PR but missing from the API report, causing CI to fail. Addresses review feedback on #3742 Assisted-by: Claude Opus 4.6
🔧 Fix agent — iteration 2 (human-triggered)Regenerated the API report file to reflect the new public exports added by the PR. The report.api.md was outdated and only contained the default module export, while index.ts now also exports AIResourceScopeValidator, VALID_AI_RESOURCE_SCOPES, and the AIResourceScope type. Running yarn build:api-reports updated the report, and re-running it confirms no further changes are needed. All 16 tests pass. Fixed (1):
Tests: passed Updated by fullsend fix agent |
|
/fs-review |
|
🤖 Finished Review · ✅ Success · Started 9:36 PM UTC · Completed 9:50 PM UTC |
ReviewVerdict: comment · 2 medium, 6 low findings The PR correctly implements AIResource No critical or high severity issues were found. The medium-severity findings are about naming convention consistency and documentation — they are worth addressing but do not block the PR. Medium1. Naming convention:
|
|
/fs-fix address review feedback |
|
🤖 Finished Fix · ✅ Success · Started 1:15 AM UTC · Completed 1:33 AM UTC |
- Rename AIResourceScopeValidator to AIResourceScopeProcessor to match repo naming convention for CatalogProcessor implementations (finding 1) - Update README from scaffold placeholder to document module purpose, valid scope values, and public API surface (finding 2) - Add test for scope: null edge case (finding 3) - Add test for entity with no spec property (finding 4) - Sanitize error message: truncate to 200 chars and strip control characters from reflected user input (finding 5) - Update index.ts JSDoc tag from @public to @packageDocumentation to match sibling module convention (finding 7) - Add new changeset describing the validation feature (finding 8) - Regenerate API report for renamed class Addresses review feedback on #3742 Assisted-by: Claude Opus 4.6
🔧 Fix agent — iteration 3 (human-triggered)Addressed 7 of 8 review findings. Disagreed with 1 (test file location in processors/ subdirectory - deferred until a second processor is added). Key changes: renamed AIResourceScopeValidator to AIResourceScopeProcessor for convention consistency, added 2 edge-case tests, sanitized error message input, updated README and JSDoc, created feature changeset. Fixed (7):
Disagreed (1):
Tests: passed Decision points
Updated by fullsend fix agent |
|



Add RHDH-specific spec.scope extension support for AIResource entities. The AIResourceScopeValidator CatalogProcessor validates that spec.scope, when present, is one of 'organization', 'product', or 'team'. Omitting spec.scope is valid. Invalid values produce actionable errors naming the field, received value, and accepted values.
Changes:
spec.scope on AIResource entities only
and non-AIResource pass-through
Assisted-by: Claude Opus 4.6
Closes #3694
Post-script verification
agent/3694-airesource-spec-scope)3e8f96f5479023ed9fcb89b5f373ba8d26b42474..HEAD)