feat: add evaluation api call (CM-1168)#4140
Conversation
|
|
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
0e24f35 to
f22ee1d
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit f22ee1d. Configure here.
There was a problem hiding this comment.
Pull request overview
This PR wires the projects evaluation worker to an external onboarding-evaluation API, persisting the returned decision into projectCatalog and extending the catalog “terminal” actions to include skip.
Changes:
- Replace the placeholder evaluator with an authenticated HTTP POST to
CROWD_PROJECT_EVALUATION_API_ENDPOINT, mapping results toonboard | skip | unsureand persistingevaluationResult/evaluationReason. - Treat
skipas a terminalprojectCatalog.actionin DAL upsert/bulk-upsert logic so projects aren’t moved back intoevaluate. - Add an activity-level idempotency guard and require the evaluation API env vars at worker startup.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| services/libs/data-access-layer/src/project-catalog/types.ts | Extends ProjectCatalogAction with skip. |
| services/libs/data-access-layer/src/project-catalog/projectCatalog.ts | Treats skip as terminal in upsert/bulk-upsert action resolution. |
| services/apps/projects_evaluation_worker/src/main.ts | Declares required evaluation API env vars for fail-fast boot. |
| services/apps/projects_evaluation_worker/src/evaluator/types.ts | Updates evaluator result/outcome types to support skip and new persisted fields. |
| services/apps/projects_evaluation_worker/src/evaluator/evaluator.ts | Implements the external API call and response-to-outcome mapping. |
| services/apps/projects_evaluation_worker/src/activities/activities.ts | Adds a pre-call re-fetch guard and persists evaluation fields on update. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>

Summary
Wires the projects evaluation worker to the external LFX AI onboarding-evaluation API, replacing the placeholder evaluator. Each pending project in
projectCatalogis sent to the API, and the response is persisted as the project'saction,evaluationResult, andevaluationReason.Changes
evaluator/evaluator.ts): real HTTP call toCROWD_PROJECT_EVALUATION_API_ENDPOINTwithBearerauth,application/x-www-form-urlencodedbody (message,stream=false,user_id). All failure modes (missing config, network error, non-2xx, JSON parse error) resolve tooutcome: 'unsure'withevaluationResult: 'error'and a descriptiveevaluationReason, so a single bad call never crashes the workflow.skipoutcome: extendedEvaluationOutcomeandProjectCatalogActionto include'skip'(when the API returnsonboard: false).'onboard' | 'skip' | 'unsure'are now treated as terminal inupsertProjectCatalog/bulkUpsertProjectCataloga re-discovered project will not be moved back toevaluate.IEvaluationResultnow carriesevaluationResult(stringifiedonboardflag) andevaluationReason(the API'snon_onboard_reason) instead of a singlereasonfield, matching the new columns persisted onprojectCatalog.activities/activities.ts): before calling the API, refetch the project viafindProjectCatalogByIdand short-circuit ifevaluatedAtis already set. Protects against double-billing if Temporal retries an activity after a successful API call but a failed DB write.main.ts): declares the three required env vars (CROWD_PROJECT_EVALUATION_API_ENDPOINT,CROWD_PROJECT_EVALUATION_API_USER_ID,CROWD_PROJECT_EVALUATION_API_SECRET) so the service fails fast on boot if any are missing.Type of change
JIRA ticket
ticket
Note
Medium Risk
Introduces an external HTTP dependency into the evaluation workflow and changes project
actionsemantics (new terminalskip), which could affect queue behavior and data correctness if the API misbehaves or responses change.Overview
Replaces the placeholder project evaluator with a real call to an external onboarding-evaluation API (env-configured endpoint/user/secret), mapping responses to
onboardvs the new terminalskip, and returningunsurewithevaluationResult='error'on all failure modes.Updates the evaluation activity to be idempotent by reloading the project on the writer DB and skipping the API call if
evaluatedAtis already set, and persistsevaluationResult/evaluationReasonalongsideactionwhen writing back.Extends
ProjectCatalogAction/EvaluationOutcomeand DAL upsert logic to treatskipas a terminal state (preventing reversion toevaluateon rediscovery), and declares the required API env vars for the worker to fail fast on boot.Reviewed by Cursor Bugbot for commit 0b5f491. Bugbot is set up for automated code reviews on this repo. Configure here.