Skip to content

[chore] Clean up and unify (some of) the revision request field names#4470

Draft
jp-agenta wants to merge 3 commits into
feat/add-retrieval-info-to-api-and-sdkfrom
refactor/unify-revision-request-fields
Draft

[chore] Clean up and unify (some of) the revision request field names#4470
jp-agenta wants to merge 3 commits into
feat/add-retrieval-info-to-api-and-sdkfrom
refactor/unify-revision-request-fields

Conversation

@jp-agenta
Copy link
Copy Markdown
Member

Summary

Stacked on #4469.

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

Endpoint Before After
/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:

  • web/packages/agenta-entities/src/workflow/api/api.ts — commit bodies only; query/response uses of workflow_revision are intentionally 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 are regenerated separately.

Test plan

🤖 Generated with Claude Code

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 29, 2026 4:06pm

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

Draft detected.

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: a2cb10ec-0818-4b4e-8f09-e0b8dee752df

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

Status Destroyed (PR converted to draft)

Updated at 2026-05-28T07:36:56.231Z

@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactoring A code change that neither fixes a bug nor adds a feature size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants