Skip to content
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

✨ Support AI Service #630

Closed
jortel opened this issue Apr 26, 2024 · 1 comment · Fixed by #631
Closed

✨ Support AI Service #630

jortel opened this issue Apr 26, 2024 · 1 comment · Fixed by #631
Assignees
Labels
kind/feature Categorizes issue or PR as related to a new feature. priority/major Important over the long term, but may not be staffed and/or may need multiple releases to complete. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@jortel
Copy link
Contributor

jortel commented Apr 26, 2024

The AI Service needs

To synchronize analysis reports. This requires:

  • The archiving feature to be adjusted. Reports cannot be archived until KAI has retrieved them.
  • List analysis reports with filtering by id.

Solution

Fetch Analysis Reports

Add /analyses endpoint with filtering on id. Consistent with /applications/analyses returns a sparse report (empty issues). As a policy, the hub cannot hold an Analysis report in memory because each report can be very large. The is to prevent multiple/concurrent API requests from exceeding 2G memory limit. For this reason, endpoints cannot return arrays or large resources either.

Example: assumes URL encoding

/analyses?filter=id>45 

A stretch goal would be to add a kubernetes (like) watch mechanism (like we did in MTV).

Perhaps:

GET /watch/analyses
GET /watch/analyses?filter=id>18

For each resource returned, fetch the complete report using: /analyses/:id.

Retention Policy

Add a setting to define the analysis report retention policy. This will determine when an analysis report may be archived. Thinking the policy should be expressed as the number of un-archived reports for each application (beyond the latest). Values:

  • 0 (default) - previous reports archived immediately.
  • 1+ - number of previous ports to remain un-archived.
  • -1 - unlimited

A new endpoint will need to be added to archive a report (after synchronized by KAI).
Perhaps: POST /analyses/:id/archive

Commit (hash)

Add a field to the Analysis resource. In an effort to support both Git and Subversion, the filed would be named: commit. For git this would be a hash.

The addon-analyzer will need to set this field.

@konveyor-ci-bot konveyor-ci-bot bot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Apr 26, 2024
@konveyor-ci-bot
Copy link

This issue is currently awaiting triage.
If contributors determine this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.
The triage/accepted label can be added by org members.

@konveyor-ci-bot konveyor-ci-bot bot added needs-kind Indicates an issue or PR lacks a `kind/foo` label and requires one. needs-priority Indicates an issue or PR lacks a `priority/foo` label and requires one. labels Apr 26, 2024
@jortel jortel self-assigned this Apr 26, 2024
@jortel jortel mentioned this issue Apr 29, 2024
@jortel jortel added kind/feature Categorizes issue or PR as related to a new feature. triage/accepted Indicates an issue or PR is ready to be actively worked on. priority/major Important over the long term, but may not be staffed and/or may need multiple releases to complete. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-kind Indicates an issue or PR lacks a `kind/foo` label and requires one. needs-priority Indicates an issue or PR lacks a `priority/foo` label and requires one. labels Jun 6, 2024
jortel added a commit that referenced this issue Jun 11, 2024
closes #630 

- Added endpoint:
  - GET /applications/:id/analyses/issues
  - GET /analyses
  - GET /analyses/:id/issues
- Updated api.Analysis to omit issues, summary. Struct never used this
way.
- Add field: Analysis.Commit. migration=13.

Added IssueWriter to support new endpoints.

---
migration/14
```
diff -bur migration/v13/model/analysis.go migration/v14/model/analysis.go
--- migration/v13/model/analysis.go	2024-06-11 03:29:34.402853992 -0700
+++ migration/v14/model/analysis.go	2024-06-11 04:29:29.898613621 -0700
@@ -6,7 +6,8 @@
 type Analysis struct {
 	Model
 	Effort        int
-	Archived      bool             `json:"archived"`
+	Commit        string
+	Archived      bool
 	Summary       JSON             `gorm:"type:json"`
 	Issues        []Issue          `gorm:"constraint:OnDelete:CASCADE"`
 	Dependencies  []TechDependency `gorm:"constraint:OnDelete:CASCADE"`
diff -bur migration/v13/model/application.go migration/v14/model/application.go
--- migration/v13/model/application.go	2024-06-11 03:29:34.402853992 -0700
+++ migration/v14/model/application.go	2024-06-11 04:29:29.898613621 -0700
@@ -76,7 +76,7 @@
 	return
 }
 
-// Validation Hook to avoid cyclic dependencies.
+// BeforeCreate detects cyclic dependencies.
 func (r *Dependency) BeforeCreate(db *gorm.DB) (err error) {
 	var nextDeps []*Dependency
 	var nextAppsIDs []uint
@@ -96,11 +96,11 @@
 	return
 }
 
-// Custom error type to allow API recognize Cyclic Dependency error and assign proper status code.
+// DependencyCyclicError reports cyclic Dependency error.
 type DependencyCyclicError struct{}
 
-func (err DependencyCyclicError) Error() string {
-	return "cyclic dependencies are not allowed"
+func (e DependencyCyclicError) Error() string {
+	return "Cyclic dependencies are not permitted."
 }
 
 type BusinessService struct {

```

---------

Signed-off-by: Jeff Ortel <jortel@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. priority/major Important over the long term, but may not be staffed and/or may need multiple releases to complete. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

1 participant