Skip to content

[chore] Clean up and unify (most) git-based routes#4470

Open
jp-agenta wants to merge 7 commits into
release/v0.100.8from
refactor/unify-revision-request-fields
Open

[chore] Clean up and unify (most) git-based routes#4470
jp-agenta wants to merge 7 commits into
release/v0.100.8from
refactor/unify-revision-request-fields

Conversation

@jp-agenta
Copy link
Copy Markdown
Member

@jp-agenta jp-agenta commented May 28, 2026

No description provided.

Rename the wrapper field on revision commit/log request bodies so each
matches the snake_case form of its enclosing request class.

Outliers fixed:
- /workflows/revisions/commit: workflow_revision   -> workflow_revision_commit
- /workflows/revisions/log:    workflow            -> workflow_revisions_log
- /applications/revisions/log: application         -> application_revisions_log
- /evaluators/revisions/log:   evaluator           -> evaluator_revisions_log
- /environments/revisions/log: environment         -> environment_revisions_log
- /queries/revisions/log:      query_revisions     -> query_revisions_log
- /testsets/revisions/log:     testset_revision    -> testset_revisions_log

Updates the FastAPI request models, the routers that read those fields,
and the handwritten callers in:
- web/packages/agenta-entities/src/workflow/api/api.ts (commit bodies only;
  query/response uses of workflow_revision remain unchanged)
- sdks/python/agenta/sdk/managers/shared.py (history/ahistory log bodies)
- 11 workflow acceptance tests + 1 SDK workflow acceptance test (commit
  + log bodies)

Fern-generated clients regenerated separately.
@vercel
Copy link
Copy Markdown

vercel Bot commented May 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview, Comment May 31, 2026 2:39pm

Request Review

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. refactoring A code change that neither fixes a bug nor adds a feature labels May 28, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 13caef08-d6d9-4d52-9667-82b5b9c09408

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/unify-revision-request-fields

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@junaway junaway changed the title refactor(api): unify revision request body field names [chore] Clean up and unify (some of) the revision request field names May 28, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 28, 2026

Railway Preview Environment

Preview URL https://gateway-production-2cc4.up.railway.app/w
Project agenta-oss-pr-4470
Image tag pr-4470-0bcbf34
Status Deployed
Railway logs Open logs
Workflow logs View workflow run
Updated at 2026-05-31T14:43:45.016Z

@junaway junaway marked this pull request as draft May 28, 2026 07:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR standardizes the top-level wrapper field names in several revision commit/log request bodies so they match the snake_case form of their enclosing FastAPI request model names, and updates a subset of in-repo callers/tests accordingly.

Changes:

  • Renamed request wrapper fields for /workflows/revisions/commit and multiple */revisions/log endpoints (workflows, applications, evaluators, environments, queries, testsets).
  • Updated FastAPI request models + routers to read the renamed wrapper fields.
  • Updated handwritten callers (TS frontend workflow API, Python SDK history/ahistory) and acceptance tests to send the new wrapper keys.

Reviewed changes

Copilot reviewed 26 out of 26 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
web/packages/agenta-entities/src/workflow/api/api.ts Updates workflow revision commit request bodies to use workflow_revision_commit.
sdks/python/oss/tests/pytest/acceptance/workflows/test_embeds_integration.py Updates workflow commit acceptance-test payloads to use workflow_revision_commit.
sdks/python/agenta/sdk/managers/shared.py Updates application revisions log payload wrapper to application_revisions_log (sync + async).
api/oss/tests/pytest/acceptance/workflows/test_workflow_revisions_queries.py Updates workflow commit payload wrappers in revision query acceptance tests.
api/oss/tests/pytest/acceptance/workflows/test_workflow_revisions_basics.py Updates workflow commit payload wrapper in basic revisions test.
api/oss/tests/pytest/acceptance/workflows/test_workflow_retrieval_info.py Updates workflow commit payload wrappers in retrieval-info acceptance tests.
api/oss/tests/pytest/acceptance/workflows/test_workflow_lineage.py Updates workflow revisions log payload wrapper to workflow_revisions_log.
api/oss/tests/pytest/acceptance/workflows/test_workflow_embeds.py Updates workflow commit payload wrappers used by embed resolution tests.
api/oss/tests/pytest/acceptance/workflows/test_workflow_embeds_string.py Updates workflow commit payload wrappers used by string-embed tests.
api/oss/tests/pytest/acceptance/workflows/test_workflow_embeds_security.py Updates workflow commit payload wrappers used by embed security tests.
api/oss/tests/pytest/acceptance/workflows/test_workflow_embeds_retrieve_resolve.py Updates workflow commit payload wrappers used by retrieve/resolve embed tests.
api/oss/tests/pytest/acceptance/workflows/test_workflow_embeds_legacy.py Updates workflow commit payload wrappers used by legacy embed tests.
api/oss/tests/pytest/acceptance/workflows/test_workflow_embeds_errors.py Updates workflow commit payload wrappers used by embed error-handling tests.
api/oss/tests/pytest/acceptance/workflows/test_workflow_embeds_cross_entity.py Updates workflow commit payload wrappers used by cross-entity embed tests.
api/oss/src/apis/fastapi/workflows/router.py Reads workflow_revision_commit and workflow_revisions_log from request bodies.
api/oss/src/apis/fastapi/workflows/models.py Renames request model fields to workflow_revision_commit and workflow_revisions_log.
api/oss/src/apis/fastapi/testsets/router.py Reads testset_revisions_log from request body.
api/oss/src/apis/fastapi/testsets/models.py Renames log request wrapper field to testset_revisions_log.
api/oss/src/apis/fastapi/queries/router.py Reads query_revisions_log from request body.
api/oss/src/apis/fastapi/queries/models.py Renames log request wrapper field to query_revisions_log.
api/oss/src/apis/fastapi/evaluators/router.py Reads evaluator_revisions_log from request body.
api/oss/src/apis/fastapi/evaluators/models.py Renames log request wrapper field to evaluator_revisions_log.
api/oss/src/apis/fastapi/environments/router.py Reads environment_revisions_log from request body (also minor formatting change).
api/oss/src/apis/fastapi/environments/models.py Renames log request wrapper field to environment_revisions_log.
api/oss/src/apis/fastapi/applications/router.py Reads application_revisions_log from request body (also minor formatting change).
api/oss/src/apis/fastapi/applications/models.py Renames log request wrapper field to application_revisions_log.
Comments suppressed due to low confidence (8)

api/oss/src/apis/fastapi/workflows/models.py:251

  • This rename makes POST /workflows/revisions/commit reject the legacy wrapper key workflow_revision, which is still used by existing clients in this repo (e.g. generated TS client). To avoid an immediate breaking change, consider accepting the old key as a validation alias while keeping the new field name in the OpenAPI schema.
class WorkflowRevisionCommitRequest(BaseModel):
    workflow_revision_commit: WorkflowRevisionCommit = Field(
        description=(
            "Revision to append to a variant's history. Requires `workflow_variant_id` "
            "and optional `message`; `data` carries the new configuration."
        ),
    )

api/oss/src/apis/fastapi/workflows/models.py:369

  • This rename makes POST /workflows/revisions/log reject the legacy wrapper key workflow, which is still used by existing clients. If you want a non-breaking transition, accept the old key via a Pydantic validation_alias while documenting/serializing the new name.
class WorkflowRevisionsLogRequest(BaseModel):
    workflow_revisions_log: WorkflowRevisionsLog = Field(
        description=(
            "Log query. Supply `workflow_id`, `workflow_variant_id`, or "
            "`workflow_revision_id` to scope the log, and an optional `depth`."
        ),
    )

api/oss/src/apis/fastapi/applications/models.py:174

  • POST /applications/revisions/log will now reject the legacy wrapper key application. Since existing clients still send application, consider accepting it as a validation_alias to prevent a hard break while transitioning to application_revisions_log.
class ApplicationRevisionsLogRequest(BaseModel):
    """Request body for `POST /applications/revisions/log`.

    Returns the ordered list of revisions committed to a variant, newest first.
    Each entry carries commit metadata and the full revision record.
    """

    application_revisions_log: ApplicationRevisionsLog = Field(
        description=(
            "Filter for the log. Typically set `application_variant_id` to list "
            "the revision history of a single variant; optionally set "
            "`application_revision_id` + `depth` to walk back a bounded number "
            "of commits from a specific revision."
        ),
    )

api/oss/src/apis/fastapi/testsets/models.py:280

  • POST /testsets/revisions/log will now reject the legacy wrapper key testset_revision. If backwards compatibility is desired, accept the old key as a validation_alias while keeping the new field name for documentation.
class TestsetRevisionsLogRequest(BaseModel):
    testset_revisions_log: TestsetRevisionsLog = Field(
        description="Scope for the log: one of `testset_id`, `testset_variant_id`, or `testset_revision_id`. Optional `depth` limits how far back to walk.",
    )
    include_testcases: Optional[bool] = Field(
        default=None,
        description="Include full testcase objects for each returned revision.",
    )

api/oss/src/apis/fastapi/workflows/models.py:251

  • This rename makes POST /workflows/revisions/commit reject the legacy wrapper key workflow_revision, which is still used by existing clients in this repo (e.g. generated TS client). To avoid an immediate breaking change, consider accepting the old key as a validation alias while keeping the new field name in the OpenAPI schema.
class WorkflowRevisionCommitRequest(BaseModel):
    workflow_revision_commit: WorkflowRevisionCommit = Field(
        description=(
            "Revision to append to a variant's history. Requires `workflow_variant_id` "
            "and optional `message`; `data` carries the new configuration."
        ),
    )

api/oss/src/apis/fastapi/workflows/models.py:369

  • This rename makes POST /workflows/revisions/log reject the legacy wrapper key workflow, which is still used by existing clients. If you want a non-breaking transition, accept the old key via a Pydantic validation_alias while documenting/serializing the new name.
class WorkflowRevisionsLogRequest(BaseModel):
    workflow_revisions_log: WorkflowRevisionsLog = Field(
        description=(
            "Log query. Supply `workflow_id`, `workflow_variant_id`, or "
            "`workflow_revision_id` to scope the log, and an optional `depth`."
        ),
    )

api/oss/src/apis/fastapi/applications/models.py:174

  • POST /applications/revisions/log will now reject the legacy wrapper key application. Since existing clients still send application, consider accepting it as a validation_alias to prevent a hard break while transitioning to application_revisions_log.
class ApplicationRevisionsLogRequest(BaseModel):
    """Request body for `POST /applications/revisions/log`.

    Returns the ordered list of revisions committed to a variant, newest first.
    Each entry carries commit metadata and the full revision record.
    """

    application_revisions_log: ApplicationRevisionsLog = Field(
        description=(
            "Filter for the log. Typically set `application_variant_id` to list "
            "the revision history of a single variant; optionally set "
            "`application_revision_id` + `depth` to walk back a bounded number "
            "of commits from a specific revision."
        ),
    )

api/oss/src/apis/fastapi/testsets/models.py:280

  • POST /testsets/revisions/log will now reject the legacy wrapper key testset_revision. If backwards compatibility is desired, accept the old key as a validation_alias while keeping the new field name for documentation.
class TestsetRevisionsLogRequest(BaseModel):
    testset_revisions_log: TestsetRevisionsLog = Field(
        description="Scope for the log: one of `testset_id`, `testset_variant_id`, or `testset_revision_id`. Optional `depth` limits how far back to walk.",
    )
    include_testcases: Optional[bool] = Field(
        default=None,
        description="Include full testcase objects for each returned revision.",
    )

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread api/oss/src/apis/fastapi/evaluators/models.py
Comment thread api/oss/src/apis/fastapi/environments/models.py
Comment thread api/oss/src/apis/fastapi/queries/models.py
Comment thread api/oss/src/apis/fastapi/evaluators/models.py
Comment thread api/oss/src/apis/fastapi/environments/models.py
Comment thread api/oss/src/apis/fastapi/queries/models.py
@junaway junaway changed the base branch from feat/add-retrieval-info-to-api-and-sdk to release/v0.100.8 May 31, 2026 11:48
@junaway junaway marked this pull request as ready for review May 31, 2026 11:48
Copilot AI review requested due to automatic review settings May 31, 2026 11:48
@dosubot dosubot Bot added the Backend label May 31, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 26 out of 26 changed files in this pull request and generated 5 comments.

Comment on lines +1753 to 1757
application_revisions = await self.applications_service.log_application_revisions(
project_id=UUID(request.state.project_id),
#
application_revisions_log=application_revisions_log_request.application_revisions_log,
)
Comment on lines +1179 to 1183
environment_revisions = await self.environments_service.log_environment_revisions(
project_id=UUID(request.state.project_id),
#
environment_revisions_log=environment_revisions_log_request.environment_revisions_log,
)
Comment on lines 1726 to 1730
evaluator_revisions = await self.evaluators_service.log_evaluator_revisions(
project_id=UUID(request.state.project_id),
#
evaluator_revisions_log=evaluator_revisions_log_request.evaluator,
evaluator_revisions_log=evaluator_revisions_log_request.evaluator_revisions_log,
)
Comment on lines 949 to 953
query_revisions = await self.queries_service.log_query_revisions(
project_id=UUID(request.state.project_id),
#
query_revisions_log=query_revisions_log_request.query_revisions,
query_revisions_log=query_revisions_log_request.query_revisions_log,
)
Comment on lines 1575 to 1580
testset_revisions = await self.testsets_service.log_testset_revisions(
project_id=UUID(request.state.project_id),
#
testset_revisions_log=testset_revisions_log_request.testset_revision,
testset_revisions_log=testset_revisions_log_request.testset_revisions_log,
include_testcases=testset_revisions_log_request.include_testcases,
)
@junaway junaway changed the title [chore] Clean up and unify (some of) the revision request field names [chore] Clean up and unify (most) git-based routes May 31, 2026
@dosubot dosubot Bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels May 31, 2026
@junaway junaway requested a review from Copilot May 31, 2026 14:28
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 44 out of 44 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (2)

sdks/python/agenta/sdk/managers/shared.py:946

  • The request body wrapper key for POST /applications/revisions/log should match the FastAPI model (ApplicationRevisionsLogRequest.application_revisions). Using application_revisions_log will cause a 422 validation error.
    sdks/python/agenta/sdk/managers/shared.py:990
  • Same issue as the sync history() method: the request wrapper key should be application_revisions (per ApplicationRevisionsLogRequest) rather than application_revisions_log, otherwise the async call will 422.

revision_refs=environment_revision_refs,
#
application_refs=application_refs,
application_refs=references,
Comment on lines +709 to +711
The new variant starts from the source variant's head revision (or a
pinned revision if `query_revision_id` is provided). Provide `slug`
and `name` in the fork body to identify the new variant.
Comment on lines +991 to +993
The new variant starts from the source variant's head revision (or a
pinned revision if `testset_revision_id` is provided). Provide `slug`
and `name` in the fork body to identify the new variant.
Comment on lines +763 to +765
The new variant starts from the source variant's head revision (or a
pinned revision if `environment_revision_id` is provided). Provide
`slug` and `name` in the fork body to identify the new variant.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backend refactoring A code change that neither fixes a bug nor adds a feature size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants