Skip to content

Comments

Added isLoadTested and grafana link field to the promote request API#282

Open
shubhangi-raj-meesho wants to merge 2 commits intodevelopfrom
dev/enable-loadtest-checkbox
Open

Added isLoadTested and grafana link field to the promote request API#282
shubhangi-raj-meesho wants to merge 2 commits intodevelopfrom
dev/enable-loadtest-checkbox

Conversation

@shubhangi-raj-meesho
Copy link
Contributor

@shubhangi-raj-meesho shubhangi-raj-meesho commented Feb 12, 2026


📌 Summary

Added an isLoadTested field to the promote request API. When a user submits a request to promote a model from the INT environment to PROD, they can indicate whether the model has been load tested. If marked as load tested, the corresponding Grafana link must be provided. This link will be visible to the admin while reviewing the model promotion request. Updated the relevant structs to support this change.


Testing

Tested on the custodian setup confirms that the additional fields do not impact other API endpoints and are working as expected.


📂 Modules Affected

  • [✅] horizon (Real-time systems / networking)
  • online-feature-store (Feature serving infra)
  • trufflebox-ui (Admin panel / UI)
  • infra (Docker, CI/CD, GCP/AWS setup)
  • docs (Documentation updates)
  • Other: ___________

✅ Type of Change

  • [ ✅] Feature addition
  • Bug fix
  • Infra / build system change
  • Performance improvement
  • Refactor
  • Documentation
  • Other: ___________

Summary by CodeRabbit

Release Notes

  • New Features
    • Added support for load testing information in promotion requests, including fields to track load test status and result links
    • Implemented validation to ensure load test result links are provided when marking deployments as load tested during promotion

@shubhangi-raj-meesho shubhangi-raj-meesho changed the title Dev/enable loadtest checkbox Added an isLoadTested and grafana link field to the promote request API Feb 12, 2026
@shubhangi-raj-meesho shubhangi-raj-meesho changed the title Added an isLoadTested and grafana link field to the promote request API Added isLoadTested and grafana link field to the promote request API Feb 12, 2026
@shubhangi-raj-meesho shubhangi-raj-meesho force-pushed the dev/enable-loadtest-checkbox branch from 535de47 to 5b555c6 Compare February 18, 2026 13:03
Comment on lines 175 to 180
// Validate load test fields for promote requests
if requestType == PromoteRequestType && payloadObject.IsLoadTested {
if err := validateGrafanaLink(payloadObject.GrafanaLink); err != nil {
return constant.EmptyString, http.StatusBadRequest, err
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

No need to validate the grafana link, just check if empty. It will be shown on UI and will be checked there. And there can be cases where it is not a grafana link but is a different page for showing load test results.

Lets keep it generic, keep the name LoadTestResultsLink, json:load_test_results_link

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Resolved.

@coderabbitai
Copy link

coderabbitai bot commented Feb 19, 2026

Walkthrough

Extends the Payload struct with two new fields to track load testing status and results, and adds validation logic in the promote request handler to ensure that when load testing is flagged as completed, a valid results link is provided.

Changes

Cohort / File(s) Summary
Payload Model Extension
horizon/internal/predator/handler/model.go
Adds two new optional JSON fields to the Payload struct: IsLoadTested (boolean) and LoadTestResultsLink (string), enabling serialization of load test metadata without altering existing fields.
Promote Request Validation
horizon/internal/predator/handler/predator.go
Introduces validation logic that requires LoadTestResultsLink to be non-empty when a promote request has IsLoadTested set to true, returning HTTP 400 with a descriptive error if validation fails.
🚥 Pre-merge checks | ✅ 1 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Krd Checker ⚠️ Warning The PR template does not include KRD section or fields for KRD exemption information, and neither a KRD link nor exemption is present in PR objectives. Update PR description to include either a KRD link (format: KRD: [Google Doc URL]) or a KRD exemption with Pod Type and justification of at least 20 characters.
✅ Passed checks (1 passed)
Check name Status Explanation
Dynamic Configuration Validation ✅ Passed The pull request contains no changes to application-dyn-*.yml configuration files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
horizon/internal/predator/handler/predator.go (1)

175-180: Validation logic is correct; consider adding URL format validation.

The guard correctly ensures LoadTestResultsLink is required when IsLoadTested is true for promote requests. The placement after unmarshalling and before model name derivation is appropriate.

Consider validating that LoadTestResultsLink is a well-formed URL (e.g., starts with http:// or https://) to prevent garbage data from being stored and displayed to admins during review.

💡 Optional: Add basic URL validation
 		// Validate load test fields for promote requests
 		if requestType == PromoteRequestType && payloadObject.IsLoadTested {
 			if payloadObject.LoadTestResultsLink == constant.EmptyString {
 				return constant.EmptyString, http.StatusBadRequest, errors.New("load test results link is required when load tested is true for the model requested")
 			}
+			if !strings.HasPrefix(payloadObject.LoadTestResultsLink, "http://") && !strings.HasPrefix(payloadObject.LoadTestResultsLink, "https://") {
+				return constant.EmptyString, http.StatusBadRequest, errors.New("load test results link must be a valid URL starting with http:// or https://")
+			}
 		}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@horizon/internal/predator/handler/predator.go` around lines 175 - 180, Add
basic URL format validation for LoadTestResultsLink when handling
PromoteRequestType: after the existing check that payloadObject.IsLoadTested is
true and payloadObject.LoadTestResultsLink is non-empty, validate that
payloadObject.LoadTestResultsLink is a well-formed URL (e.g., begins with
"http://" or "https://", or use net/url.Parse and ensure Scheme is http/https
and Host is non-empty). If validation fails, return a Bad Request with a clear
error message. Update the block referencing PromoteRequestType,
payloadObject.IsLoadTested, and payloadObject.LoadTestResultsLink to include
this validation.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@horizon/internal/predator/handler/predator.go`:
- Around line 175-180: Add basic URL format validation for LoadTestResultsLink
when handling PromoteRequestType: after the existing check that
payloadObject.IsLoadTested is true and payloadObject.LoadTestResultsLink is
non-empty, validate that payloadObject.LoadTestResultsLink is a well-formed URL
(e.g., begins with "http://" or "https://", or use net/url.Parse and ensure
Scheme is http/https and Host is non-empty). If validation fails, return a Bad
Request with a clear error message. Update the block referencing
PromoteRequestType, payloadObject.IsLoadTested, and
payloadObject.LoadTestResultsLink to include this validation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants