Summary
POST /api/testsets/revisions/{testset_revision_id}/upload (CSV and JSON) returns {"count": 0} and does not actually create a new revision or testcases. Repros on eu.cloud.agenta.ai.
Root cause (code-level)
In api/oss/src/apis/fastapi/testsets/router.py the upload handler create_testset_revision_from_file builds a TestsetRevisionCommit with only testset_revision_id and data:
testset_revision_commit = TestsetRevisionCommit(
testset_revision_id=testset_revision_id,
data=testset_revision_data,
)
commit_testset_revision in api/oss/src/core/testsets/service.py then assigns testcase.set_id = testset_revision_commit.testset_id (which is None) for every testcase being created, and passes the payload to testsets_dao.commit_revision. The upstream git DAO / blobs DAO requires artifact_id (the testset_id) to scope writes, so the commit no-ops and the endpoint returns {"count": 0}.
- Create a simple testset via
POST /api/simple/testsets/ — get testset_id and revision_id (HEAD).
POST /api/testsets/revisions/{revision_id}/upload with a CSV or JSON file (legacy __dedup_id__ or canonical testcase_dedup_id).
- Response:
{"count": 0}.
POST /api/testsets/revisions/log confirms no new revision was created.
POST /api/simple/testsets/{testset_id}/upload and POST /api/simple/testsets/upload (new testset) both work — they go through different code paths that set the testset_id correctly.
Expected
The upload should create a new revision with the uploaded testcases (same behavior as /simple/testsets/{id}/upload), and return the new revision payload with count: 1.
Suggested fix
In the upload handler, resolve the revision's testset_id from the testset_revision_id (or pass testset_id on the TestsetRevisionCommit) before calling commit_testset_revision. The delta commit path already does this resolution in _commit_testset_revision_delta.
Scope
Docs PR-5 (testsets) is not papering over this — the concept page and endpoint docstrings note that the structured upload endpoint currently does not commit correctly and will be fixed separately. Bug is filed so the fix isn't tied to the docs cycle.
Summary
POST /api/testsets/revisions/{testset_revision_id}/upload(CSV and JSON) returns{"count": 0}and does not actually create a new revision or testcases. Repros oneu.cloud.agenta.ai.Root cause (code-level)
In
api/oss/src/apis/fastapi/testsets/router.pythe upload handlercreate_testset_revision_from_filebuilds aTestsetRevisionCommitwith onlytestset_revision_idanddata:commit_testset_revisioninapi/oss/src/core/testsets/service.pythen assignstestcase.set_id = testset_revision_commit.testset_id(which isNone) for every testcase being created, and passes the payload totestsets_dao.commit_revision. The upstream git DAO / blobs DAO requiresartifact_id(the testset_id) to scope writes, so the commit no-ops and the endpoint returns{"count": 0}.Repro (against eu.cloud.agenta.ai)
POST /api/simple/testsets/— gettestset_idandrevision_id(HEAD).POST /api/testsets/revisions/{revision_id}/uploadwith a CSV or JSON file (legacy__dedup_id__or canonicaltestcase_dedup_id).{"count": 0}.POST /api/testsets/revisions/logconfirms no new revision was created.POST /api/simple/testsets/{testset_id}/uploadandPOST /api/simple/testsets/upload(new testset) both work — they go through different code paths that set the testset_id correctly.Expected
The upload should create a new revision with the uploaded testcases (same behavior as
/simple/testsets/{id}/upload), and return the new revision payload withcount: 1.Suggested fix
In the upload handler, resolve the revision's
testset_idfrom thetestset_revision_id(or passtestset_idon theTestsetRevisionCommit) before callingcommit_testset_revision. The delta commit path already does this resolution in_commit_testset_revision_delta.Scope
Docs PR-5 (testsets) is not papering over this — the concept page and endpoint docstrings note that the structured upload endpoint currently does not commit correctly and will be fixed separately. Bug is filed so the fix isn't tied to the docs cycle.