feat: add GET /jobs/{job_id}/findings and verify endpoints#30
Merged
Conversation
Owner
|
@anahaaaa Checks are failing. Also join our discord to connect with mentors : https://discord.gg/FcXuyw2Rs |
Contributor
Author
@ionfwsrijan Thanks for the heads-up. The CI failure was due to Ruff formatting checks. I've applied the required formatting changes and pushed a new commit. The workflow is awaiting approval and should rerun once approved. I'll also join the Discord server. Thanks. |
Owner
|
The code LGTM. Merging it now. Hope you joined our discord server already |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Linked issue
Closes #4
What this PR does
Adds two new API endpoints for retrieving persisted job data from SQLite:
GET /jobs/{job_id}/findingsGET /jobs/{job_id}/verifyThe findings endpoint returns all persisted findings associated with a job along with a finding count. The verify endpoint returns the latest verify outcome for a job. Both endpoints return a clear
404response when the providedjob_iddoes not exist.Type of change
ML tier (if applicable)
Changes
Backend
GET /jobs/{job_id}/findingsendpoint.GET /jobs/{job_id}/verifyendpoint.404for unknown job IDs.get_db()/close()pattern used elsewhere in the codebase.Frontend
New dependencies
Database / schema changes
jobs,findings, andverify_outcomestables.Testing
How did you test this?
Added unit tests covering:
404404when no verify outcome exists404for unknown job IDsExecuted:
Result:
Checklist
console.erroror unhandled Python exceptions introduced.pkl,.pt, etc.) were committedAnything reviewers should focus on
Please review the response structure and SQLite retrieval logic for the new
/jobs/{job_id}/findingsand/jobs/{job_id}/verifyendpoints.During manual testing, I observed two existing persistence-related issues in the scan flows:
/scancurrently encounters a SQLite connection error during persistence (RuntimeError: threads can only be started once) due to the current database connection pattern./scan-urldoes not currently persist jobs or findings to SQLite, so scans imported from GitHub URLs are not available through the new retrieval endpoints.These issues are outside the scope of this PR. The new endpoints correctly return
404when the requested job is not present in the database, as required by the issue.Screenshots (if UI changed)
N/A