Skip to content

Conversation

@dsf86
Copy link
Collaborator

@dsf86 dsf86 commented Nov 4, 2025

What type of PR is this?

Check the PR title.

  • This PR title match the format: [<type>][<scope>]: <description>. For example: [fix][backend] flaky fix
  • The description of this PR title is user-oriented and clear enough for others to understand.
  • Add documentation if the current PR requires user awareness at the usage level.
  • This PR is written in English. PRs not in English will not be reviewed.

(Optional) Translate the PR title into Chinese.

(Optional) More detailed description for this PR(en: English/zh: Chinese).

en:
zh(optional):

(Optional) Which issue(s) this PR fixes:

HymanShi and others added 30 commits September 22, 2025 19:46
Change-Id: I0efae3f7af582460e46ba629c0f470a10c326025
…ationSet, GetEvaluationSet, ListEvaluationSets

(LogID: 202509281948170100910941219983125)

Co-Authored-By: Coda <[email protected]>
… convertor

(LogID: 202509281948170100910941219983125)

Co-Authored-By: Coda <[email protected]>
…ic to separate methods

(LogID: 202509281948170100910941219983125)

Co-Authored-By: Coda <[email protected]>
…rate methods

(LogID: 202509281948170100910941219983125)

Co-Authored-By: Coda <[email protected]>
…unified method parameter

(LogID: 202509281948170100910941219983125)

Co-Authored-By: Coda <[email protected]>
…error tracking

(LogID: 202509281948170100910941219983125)

Co-Authored-By: Coda <[email protected]>
…DTO/xxxDTO2DO convention

(LogID: 202509281948170100910941219983125)

Co-Authored-By: Coda <[email protected]>
Change-Id: Ibfa77af15a79fc83b6fb5adc44dd132682fe1c05
…rchitecture

(LogID: 20250928231227010091094121028E1E4)

Co-Authored-By: Coda <[email protected]>
Change-Id: I54219f18349d50551302a3129d08ea25f1e15fa1
Change-Id: I4fc1842aea80465df2bfe1d9c7044905b7380cf1
Change-Id: Ic99ec4e867794d8f6d98c1d4bcad118158bb6969
Change-Id: I7d83bcded9ee778cd4baf63b2682053b88f42b44
Change-Id: Icbeb24eeebd9d6d5d67e1038b0f4acfce9d5759a
Change-Id: I7a78d11c6b3bdd59bb9a08d5cd9daf893c8afa15
Change-Id: I264264a0e8bbf776341fc2149377b7ba934d1c61
Change-Id: Iac21bc6194af354d9c4ad3a0e1a528cccd0f0c4f
Change-Id: I7972ba4c3b4b812652b86187366c2fdd03c7763e
Change-Id: I673a5dc343764edf228ec5d8a8219f0659d8278d
Change-Id: Ie1e50446c90172aea7292f134b117a37a84f0bce
Change-Id: Ia048d5d8836418597fa6ec48c602fbf48e197643
Change-Id: Ic21981040de379923d8a216a0f8fcf9b543072e6
dsf86 added 12 commits October 28, 2025 12:01
Change-Id: I5138eab223ff2f5b045df62e3114cb94ef2e4dea
Change-Id: Ib26795e281f4649629805c9bfe96e5563e290136
Change-Id: I859d856f1f678b9d2595328ef1af88f1d8d6e306
Change-Id: I2310d74be2d6fb9d7fde8b6f30bede6847b91d7c
Change-Id: I5450283b4f1d6c566f0a8db844217c200d826d20
Change-Id: I30f49052724400a4249826b0ee8bcf8bca4f843f
Change-Id: I936eb2de14600ab3e994d9589e7c8e8f2df3cc8f
Change-Id: I513b59202e18cc2a5388ba3a7f10eb67afecfe60
Change-Id: I17c1551cdb927585c03e7f7fb1131588643ce8a7
Change-Id: I23c834512a638830f06a3a33967b46b3c0a79a7a
Change-Id: I015f6fe4c57886e7c43893997965ed6cd75856c2
Change-Id: I98c166432c88491ea6e1c9768fff9a74ef2fbb5c
@dsf86 dsf86 changed the title Feat/open api eval other [feat] open api eval other Nov 4, 2025
Change-Id: I7a24dca0ed20c93c4c089ca652f7997f0c13a451
Copy link
Collaborator

@CozeLoop CozeLoop left a comment

Choose a reason for hiding this comment

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

Performed server-side Go code review focused on concurrency safety, correctness, and API functionality. See inline comments for Must-Fix and Should-Fix items.

Change-Id: I414db2543be683a1f9b56bd759e18fdeac323b8e
@dsf86
Copy link
Collaborator Author

dsf86 commented Nov 4, 2025

invalid

dsf86 and others added 4 commits November 5, 2025 11:42
Change-Id: I1261ff91f60d02aeb25d2999de62b93c347c2fe6
(LogID: 202511051154490100910941219725949)

Co-Authored-By: Coda <[email protected]>
(LogID: 202511051154490100910941219725949)

Co-Authored-By: Coda <[email protected]>
Change-Id: I69d0cc6c3bc31ef113c4ac64f07d4df3579904d6
@codecov
Copy link

codecov bot commented Nov 5, 2025

Codecov Report

❌ Patch coverage is 80.24928% with 206 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...uation/application/convertor/experiment/openapi.go 79.30% 96 Missing and 58 partials ⚠️
...odules/evaluation/infra/metrics/experiment/init.go 20.00% 20 Missing ⚠️
...modules/evaluation/application/eval_openapi_app.go 92.73% 10 Missing and 7 partials ⚠️
...api/handler/coze/loop/apis/eval_open_apiservice.go 0.00% 12 Missing ⚠️
...ckend/modules/evaluation/infra/rpc/data/dataset.go 0.00% 2 Missing ⚠️
...on/domain/service/target_source_loopprompt_impl.go 87.50% 0 Missing and 1 partial ⚠️

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #288      +/-   ##
==========================================
+ Coverage   68.07%   68.36%   +0.28%     
==========================================
  Files         568      570       +2     
  Lines       50554    51562    +1008     
==========================================
+ Hits        34414    35248     +834     
- Misses      13469    13576     +107     
- Partials     2671     2738      +67     
Flag Coverage Δ
unittests 68.36% <80.24%> (+0.28%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...evaluation/application/convertor/common/openapi.go 100.00% <100.00%> (ø)
...nd/modules/evaluation/domain/entity/expt_result.go 57.29% <ø> (ø)
backend/modules/evaluation/domain/entity/param.go 54.54% <ø> (ø)
...tion/domain/service/evaluation_set_version_impl.go 92.59% <100.00%> (ø)
...evaluation/domain/service/expt_result_aggr_impl.go 74.20% <100.00%> (+0.04%) ⬆️
...d/modules/evaluation/domain/service/target_impl.go 75.16% <ø> (ø)
...on/domain/service/target_source_loopprompt_impl.go 89.48% <87.50%> (-0.43%) ⬇️
...ckend/modules/evaluation/infra/rpc/data/dataset.go 0.00% <0.00%> (ø)
...api/handler/coze/loop/apis/eval_open_apiservice.go 0.00% <0.00%> (ø)
...modules/evaluation/application/eval_openapi_app.go 91.80% <92.73%> (+0.56%) ⬆️
... and 2 more

... and 3 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4f1afba...94867a8. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Collaborator

@CozeLoop CozeLoop left a comment

Choose a reason for hiding this comment

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

Summary: This PR introduces open API endpoints and application/domain changes, but several handlers return empty payloads instead of invoking the generated Kitex client, breaking functional correctness and contracts. Additionally, the dataset RPC adapter ignores the new exact version filter, risking wrong version selection; and the metrics initialization uses sync.Once in a way that can permanently block initialization if meter==nil on the first call. Please address the Must-Fix handler delegations, wire the version filter correctly, and adjust metrics initialization semantics. Route annotations should also be aligned with the actual router paths.

Comment on lines 88 to 98
var err error
var req openapi0.SubmitExperimentOApiRequest
err = c.BindAndValidate(&req)
if err != nil {
c.String(consts.StatusBadRequest, err.Error())
return
}

resp := new(openapi0.SubmitExperimentOApiResponse)

c.JSON(consts.StatusOK, resp)
Copy link
Collaborator

Choose a reason for hiding this comment

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

[P1] Handler bypasses service invocation and returns empty payload
This endpoint validates input but never calls the underlying EvalOpenAPIService client. It responds with an empty JSON object, which breaks functional correctness and observability (no metrics, no domain logic). For consistency with other handlers in this file that use invokeAndRender, please delegate to the generated Kitex client:

Suggested change
var err error
var req openapi0.SubmitExperimentOApiRequest
err = c.BindAndValidate(&req)
if err != nil {
c.String(consts.StatusBadRequest, err.Error())
return
}
resp := new(openapi0.SubmitExperimentOApiResponse)
c.JSON(consts.StatusOK, resp)
invokeAndRender(ctx, c, localEvalOpenAPIClient.SubmitExperimentOApi)

This ensures request binding, RPC execution, error mapping, and standard response handling align with the existing pattern.

Comment on lines 104 to 114
var err error
var req openapi0.GetExperimentsOApiRequest
err = c.BindAndValidate(&req)
if err != nil {
c.String(consts.StatusBadRequest, err.Error())
return
}

resp := new(openapi0.GetExperimentsOApiResponse)

c.JSON(consts.StatusOK, resp)
Copy link
Collaborator

Choose a reason for hiding this comment

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

[P1] Handler returns empty JSON instead of calling service
GetExperimentsOApi binds and validates the request but does not invoke the RPC service, returning an empty response. This breaks the endpoint contract and makes monitoring misleading. Align with existing handlers by delegating to the Kitex client:

Suggested change
var err error
var req openapi0.GetExperimentsOApiRequest
err = c.BindAndValidate(&req)
if err != nil {
c.String(consts.StatusBadRequest, err.Error())
return
}
resp := new(openapi0.GetExperimentsOApiResponse)
c.JSON(consts.StatusOK, resp)
invokeAndRender(ctx, c, localEvalOpenAPIClient.GetExperimentsOApi)

Comment on lines 120 to 130
var err error
var req openapi0.ListExperimentResultOApiRequest
err = c.BindAndValidate(&req)
if err != nil {
c.String(consts.StatusBadRequest, err.Error())
return
}

resp := new(openapi0.ListExperimentResultOApiResponse)

c.JSON(consts.StatusOK, resp)
Copy link
Collaborator

Choose a reason for hiding this comment

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

[P1] Handler does not execute business logic
ListExperimentResultOApi validates the request and returns an empty payload. It should call the EvaluationOpenAPIService.ListExperimentResultOApi method to fetch results and metrics. Please use the standard delegation pattern:

Suggested change
var err error
var req openapi0.ListExperimentResultOApiRequest
err = c.BindAndValidate(&req)
if err != nil {
c.String(consts.StatusBadRequest, err.Error())
return
}
resp := new(openapi0.ListExperimentResultOApiResponse)
c.JSON(consts.StatusOK, resp)
invokeAndRender(ctx, c, localEvalOpenAPIClient.ListExperimentResultOApi)

Comment on lines 136 to 146
var err error
var req openapi0.GetExperimentAggrResultOApiRequest
err = c.BindAndValidate(&req)
if err != nil {
c.String(consts.StatusBadRequest, err.Error())
return
}

resp := new(openapi0.GetExperimentAggrResultOApiResponse)

c.JSON(consts.StatusOK, resp)
Copy link
Collaborator

Choose a reason for hiding this comment

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

[P1] Aggregation endpoint returns empty response, missing service call
GetExperimentAggrResultOApi should invoke the RPC client to retrieve aggregator results. Returning an empty object will mislead clients and break contracts. Please delegate to the Kitex client:

Suggested change
var err error
var req openapi0.GetExperimentAggrResultOApiRequest
err = c.BindAndValidate(&req)
if err != nil {
c.String(consts.StatusBadRequest, err.Error())
return
}
resp := new(openapi0.GetExperimentAggrResultOApiResponse)
c.JSON(consts.StatusOK, resp)
invokeAndRender(ctx, c, localEvalOpenAPIClient.GetExperimentAggrResultOApi)

Comment on lines 152 to 162
var err error
var req openapi0.UpdateEvaluationSetOApiRequest
err = c.BindAndValidate(&req)
if err != nil {
c.String(consts.StatusBadRequest, err.Error())
return
}

resp := new(openapi0.UpdateEvaluationSetOApiResponse)

c.JSON(consts.StatusOK, resp)
Copy link
Collaborator

Choose a reason for hiding this comment

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

[P1] Update handler does not call service
UpdateEvaluationSetOApi currently binds input and returns an empty response without invoking domain logic. This should delegate to the generated client to update the set and return a proper response:

Suggested change
var err error
var req openapi0.UpdateEvaluationSetOApiRequest
err = c.BindAndValidate(&req)
if err != nil {
c.String(consts.StatusBadRequest, err.Error())
return
}
resp := new(openapi0.UpdateEvaluationSetOApiResponse)
c.JSON(consts.StatusOK, resp)
invokeAndRender(ctx, c, localEvalOpenAPIClient.UpdateEvaluationSetOApi)

dsf86 and others added 7 commits November 5, 2025 16:34
Change-Id: I4f9fd40ff29b70c80e077d5a0bc4e2db86c3100d
Change-Id: I669812745d8dd1db07558ea27ca58d405ac67faf
(LogID: 202511051154490100910941219725949)

Co-Authored-By: Coda <[email protected]>
Change-Id: I7f713f4db53dccf6670b386dd33c06c437c3d05d
Change-Id: I94f9594125bac2cce052f2ba7569c85142de04cb
(LogID: 20251106114148010091094121586687D)

Co-Authored-By: Coda <[email protected]>
Change-Id: I0d1b8598376f426f16ee68472003043231c5ca8b
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.

4 participants