-
Notifications
You must be signed in to change notification settings - Fork 46
feat: Add subject to LMEval CRD's OCI outputs #530
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add subject to LMEval CRD's OCI outputs #530
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@sourcery-ai review |
Reviewer's GuideThis PR introduces a new optional “Subject” field to the OCISpec of LMEvalJob, updating the API type, CRD schema, pod‐creation logic to include OCI_SUBJECT when provided, and adds a corresponding unit test. Class diagram for updated OCISpec with Subject fieldclassDiagram
class OCISpec {
string path
string subject
corev1.SecretKeySelector* username
corev1.SecretKeySelector* password
string tag
// ... other fields
}
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @ruivieira - I've reviewed your changes - here's some feedback:
- Add a nil-check for job.Spec.Outputs and OCISpec before accessing Subject to avoid a potential runtime panic when OCISpec is not provided.
- The CRD’s validation pattern for Subject is very generic and only allows uppercase letters; consider tightening it (e.g. matching sha256:[a-f0-9]{64}) or at least allowing lowercase to match typical OCI digest formats.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Add a nil-check for job.Spec.Outputs and OCISpec before accessing Subject to avoid a potential runtime panic when OCISpec is not provided.
- The CRD’s validation pattern for Subject is very generic and only allows uppercase letters; consider tightening it (e.g. matching sha256:[a-f0-9]{64}) or at least allowing lowercase to match typical OCI digest formats.
## Individual Comments
### Comment 1
<location> `controllers/lmes/lmevaljob_controller_test.go:4011` </location>
<code_context>
+ t.Run("OCIWithSubject", func(t *testing.T) {
</code_context>
<issue_to_address>
Consider adding negative and edge case tests for OCI_SUBJECT.
Please add tests for cases where the Subject field is omitted, empty, or contains special/invalid characters, to ensure OCI_SUBJECT is handled correctly in all scenarios.
Suggested implementation:
```golang
t.Run("OCIWithSubject", func(t *testing.T) {
job := &lmesv1alpha1.LMEvalJob{
ObjectMeta: v1.ObjectMeta{
Name: "test-oci-subject",
Namespace: "default",
},
Spec: lmesv1alpha1.LMEvalJobSpec{
Model: "test",
TaskList: lmesv1alpha1.TaskList{
TaskNames: []string{"task1"},
},
},
// Add a valid subject
Subject: "valid-subject-123",
}
// ... existing test logic for valid subject ...
})
t.Run("OCIWithSubjectOmitted", func(t *testing.T) {
job := &lmesv1alpha1.LMEvalJob{
ObjectMeta: v1.ObjectMeta{
Name: "test-oci-subject-omitted",
Namespace: "default",
},
Spec: lmesv1alpha1.LMEvalJobSpec{
Model: "test",
TaskList: lmesv1alpha1.TaskList{
TaskNames: []string{"task1"},
},
},
// Subject field omitted
}
// ... test logic to assert OCI_SUBJECT is handled as expected when omitted ...
})
t.Run("OCIWithSubjectEmpty", func(t *testing.T) {
job := &lmesv1alpha1.LMEvalJob{
ObjectMeta: v1.ObjectMeta{
Name: "test-oci-subject-empty",
Namespace: "default",
},
Spec: lmesv1alpha1.LMEvalJobSpec{
Model: "test",
TaskList: lmesv1alpha1.TaskList{
TaskNames: []string{"task1"},
},
},
Subject: "",
}
// ... test logic to assert OCI_SUBJECT is handled as expected when empty ...
})
t.Run("OCIWithSubjectSpecialChars", func(t *testing.T) {
job := &lmesv1alpha1.LMEvalJob{
ObjectMeta: v1.ObjectMeta{
Name: "test-oci-subject-special",
Namespace: "default",
},
Spec: lmesv1alpha1.LMEvalJobSpec{
Model: "test",
TaskList: lmesv1alpha1.TaskList{
TaskNames: []string{"task1"},
},
},
Subject: "!@#$%^&*()_+|~=`{}[]:\";'<>?,./",
}
// ... test logic to assert OCI_SUBJECT is handled as expected with special/invalid characters ...
})
```
You will need to fill in the test logic for each new test case to assert the correct handling of the `OCI_SUBJECT` environment variable (e.g., check if it is set, unset, or sanitized as appropriate for your application). If there is a helper function or assertion pattern used in the original "OCIWithSubject" test, reuse it for consistency.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
tarilabs
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks a lot @ruivieira ! One comment below:
otherwise
/lgtm
|
PR image build and manifest generation completed successfully! 📦 PR image: 📦 LMES driver image: 📦 LMES job image: 📦 Guardrails orchestrator image: 🗂️ CI manifests |
33463bc
into
trustyai-explainability:dev/oci
…y#530) * feat: Add subject to LMEval CRD's OCI outputs * chore: Add more test cases
…y#530) * feat: Add subject to LMEval CRD's OCI outputs * chore: Add more test cases
Summary by Sourcery
Add support for an OCI subject in LMEvalJob outputs by extending the OCISpec type, updating the CRD schema, injecting the OCI_SUBJECT env var in pods, and adding a corresponding unit test
New Features:
Documentation:
Tests: