Skip to content

[feat] Add retrieval_info and allow full environment references into traces#4469

Draft
jp-agenta wants to merge 5 commits into
release/v0.100.8from
feat/add-retrieval-info-to-api-and-sdk
Draft

[feat] Add retrieval_info and allow full environment references into traces#4469
jp-agenta wants to merge 5 commits into
release/v0.100.8from
feat/add-retrieval-info-to-api-and-sdk

Conversation

@jp-agenta
Copy link
Copy Markdown
Member

Summary

  • Moves RetrievalInfo (DTO + helpers) from api/oss/src/apis/fastapi/git/ to api/oss/src/core/git/, for symmetry with ResolutionInfo.
  • Threads retrieval_info through the six revisioned services as the third element of a (revision, resolution_info, retrieval_info) tuple; routers become pass-throughs.
  • Environment-backed retrieval now merges environment + target references inside the service, eliminating the duplicate retrieve_environment_revision DB call the routers previously made.
  • /revisions/retrieve and /revisions/resolve responses now carry retrieval_info for all six entities (workflows, applications, evaluators, environments, queries, testsets).
  • Queries and testsets gain thin retrieve_*_revision wrappers for symmetry with the other entities.

This is the first of two stacked PRs. It contains no request-field renames — only the internal refactor and the new retrieval_info on retrieve/resolve responses. The field-name unification follows in the stacked PR.

Test plan

  • Unit: api/oss/tests/pytest/unit/git/test_retrieval_info_utils.py + per-entity test_retrieve_resolve.py
  • Acceptance: per-entity test_*_retrieval_info.py (direct + environment-backed + resolve)
  • Full API suite green
  • Fern clients regenerate cleanly

🤖 Generated with Claude Code

jp-agenta added 2 commits May 26, 2026 18:33
Previously RetrievalInfo lived under api/oss/src/apis/fastapi/git/ and the
routers assembled it directly, including making duplicate environment-revision
DB calls to gather environment-side references.

This commit moves the DTO and helpers to api/oss/src/core/git/ for symmetry
with ResolutionInfo, threads retrieval_info through the services as the third
element of a (revision, resolution_info, retrieval_info) tuple, and lets the
routers act as pass-throughs.

Highlights:
- core/git/dtos.py: RetrievalInfo Pydantic model
- core/git/utils.py: build_retrieval_info / revision_references helpers
- Six services updated to return the 3-tuple; environment-backed paths merge
  environment + target references inside the service, no router-level DB call
- Queries and testsets gain thin retrieve_*_revision wrappers for symmetry
- /revisions/retrieve and /revisions/resolve responses carry retrieval_info
- Unit + acceptance test coverage for all six entities, both retrieve and
  resolve, direct and environment-backed

No request-field renames in this commit; only the internal refactor and the
new retrieval_info on retrieve/resolve responses.
@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 3:59pm

Request Review

@dosubot dosubot Bot added size:XL This PR changes 500-999 lines, ignoring generated files. Backend refactoring A code change that neither fixes a bug nor adds a feature labels May 28, 2026
@junaway junaway changed the title refactor(api): add RetrievalInfo at the core layer [feat] Add retrieval_info and allow full environment references into traces May 28, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Revision retrieval endpoints for applications, workflows, environments, evaluators, queries, and testsets now return metadata tracking artifact references used during retrieval.
    • SDK middleware updated to propagate retrieval reference data through tracing contexts.
  • Tests

    • Added comprehensive unit and acceptance test coverage for new retrieval metadata functionality.

Walkthrough

This PR adds retrieval provenance metadata to revision retrieval responses across multiple entity types (applications, environments, evaluators, workflows, queries, testsets). A new RetrievalInfo DTO captures which artifact/variant/revision references were actually used during retrieval, including optional environment-backed references and selector key. Services return 3-tuples including RetrievalInfo, routers unpack and forward it, response models expose it, and the Python SDK middleware propagates retrieval references into tracing context.

Changes

Retrieval Info Feature

Layer / File(s) Summary
Core retrieval info DTO and utilities
api/oss/src/core/git/dtos.py, api/oss/src/core/git/utils.py
RetrievalInfo model with references dict and optional key; revision_references() extracts typed refs from revision; build_retrieval_info() merges environment refs with revision refs and returns RetrievalInfo or None.
Service layer: Applications, Environments, Evaluators, Workflows
api/oss/src/core/applications/service.py, api/oss/src/core/environments/service.py, api/oss/src/core/evaluators/service.py, api/oss/src/core/workflows/service.py
Return type changed to 3-tuple (revision, resolution_info, retrieval_info); handle environment-backed reference extraction and key-based lookup; early-return (None, None, None) when refs or revisions missing; compute retrieval_info via build_retrieval_info().
Service layer: New retrieve methods for Queries and Testsets
api/oss/src/core/queries/service.py, api/oss/src/core/testsets/service.py
New async methods retrieve_query_revision() and retrieve_testset_revision() wrap existing fetch_* functions and return 2-tuple (revision, retrieval_info) with computed metadata.
Response models: Add retrieval_info field
api/oss/src/apis/fastapi/*/models.py (applications, environments, evaluators, workflows, queries, testsets)
All revision response models (including resolve variants) extended with optional retrieval_info: Optional[RetrievalInfo] field.
Router integration: Core 4 entity types
api/oss/src/apis/fastapi/applications/router.py, environments/router.py, evaluators/router.py, workflows/router.py
Unpack 3-tuple from services and include retrieval_info in response models; resolve endpoints construct retrieval_info locally via build_retrieval_info().
Router integration: Queries and Testsets
api/oss/src/apis/fastapi/queries/router.py, testsets/router.py
Handle both cache hits (derive retrieval_info locally) and cache misses (unpack from service); include in response models.
Legacy variants router compatibility
api/oss/src/apis/fastapi/legacy_variants/router.py
Update tuple unpacking in _fetch_variant_revision() and _fetch_environment_revision() to accommodate 3-tuple returns while discarding extra values.
Unit tests: Utilities and services
api/oss/tests/pytest/unit/git/test_retrieval_info_utils.py, applications/test_retrieve_resolve.py, environments/test_retrieve_resolve.py, evaluators/test_retrieve_resolve.py, workflows/test_retrieve_resolve.py, queries/test_retrieve.py, testsets/test_retrieve.py
Test revision_references() and build_retrieval_info() across edge cases and data merging scenarios; service tests cover direct, environment-backed, missing-key, and resolve paths with mocked DAOs.
Unit test updates: Router and mocks
api/oss/tests/pytest/unit/applications/test_router.py, workflows/test_flag_ownership.py, legacy_variants/test_configs_fetch.py
Add new router retrieval_info pass-through test; update existing mocks to return 3-tuples; update workflow test to unpack retrieval_info.
Acceptance tests: All entity types
api/oss/tests/pytest/acceptance/*/test_*_retrieval_info.py (applications, environments, evaluators, workflows, queries, testsets)
End-to-end validation that retrieve/resolve endpoints return retrieval_info with correct typed reference IDs; environment-backed tests verify reference merging and key handling; negative tests verify 404 on missing keys.

Python SDK Resolver Middleware Integration

Layer / File(s) Summary
SDK resolver middleware: Extract and propagate retrieval references
sdks/python/agenta/sdk/middlewares/running/resolver.py
New resolve_references_with_info() returns (revision, retrieval_references) tuple; refactored result parsing extracts references from retrieval_info.references via shared helpers; ResolverMiddleware calls resolve_references_with_info(), merges retrieval references into TracingContext via _merge_tracing_references(), then continues with hydrated revision.
SDK middleware test
sdks/python/oss/tests/pytest/utils/test_resolver_middleware.py
New test verifies ResolverMiddleware stores retrieval references on TracingContext after reference hydration; includes cleanup/context reset.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • Agenta-AI/agenta#4418: Both PRs modify the workflow-revision retrieve flow (api/oss/src/apis/fastapi/workflows/router.py and related workflow service logic), but main PR threads/returns retrieval_info while retrieved PR changes request validation and DAO guardrails to prevent ambiguous/incorrect workflow revisions.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.96% which is insufficient. The required threshold is 60.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title '[feat] Add retrieval_info and allow full environment references into traces' clearly and concisely summarizes the main change: adding retrieval_info and enabling full environment references in traces. It accurately reflects the core feature addition.
Description check ✅ Passed The description is well-structured, comprehensive, and directly related to the changeset. It explains what moved, what was threaded through, how environment-backed retrieval improved, response changes, and what was added for symmetry. It also notes this is part one of two stacked PRs.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/add-retrieval-info-to-api-and-sdk

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
Copy link
Copy Markdown
Contributor

junaway commented May 28, 2026

@mmabrouk
This PR should (help) resolve this issue.

@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:42.357Z

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 10

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
api/oss/src/core/applications/service.py (1)

595-627: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Derive the environment selector key before lookup.

This branch now returns None, None, None whenever key is omitted, even though the API contract in api/oss/src/apis/fastapi/applications/models.py (Lines 403-409) says the server derives it from application_ref. That breaks documented environment-backed retrievals like {application_slug}.revision.

Suggested fix
         environment_retrieval_info: Optional[RetrievalInfo] = None
         is_environment_backed = bool(
             environment_ref or environment_variant_ref or environment_revision_ref
         )

         if is_environment_backed:
+            if key is None and application_ref and application_ref.slug:
+                key = f"{application_ref.slug}.revision"
+
             environments_service = self.workflows_service.environments_service
             if not environments_service:
                 return None, None, None
api/oss/src/core/workflows/service.py (1)

1153-1233: 🛠️ Refactor suggestion | 🟠 Major | 🏗️ Heavy lift

Replace the positional 3-tuple with a typed result DTO.

This expands a brittle unpack-by-position contract across layers, and callers are already discarding elements positionally in _ensure_request_revision(). A dedicated BaseModel result would make the contract self-describing and safer to evolve.

As per coding guidelines, Service methods must return typed DTOs (Pydantic BaseModel subclasses), not raw dicts, tuples, or Any.

🧹 Nitpick comments (2)
api/oss/tests/pytest/unit/applications/test_router.py (1)

195-206: ⚡ Quick win

Assert the router actually delegates to applications_service.retrieve_application_revision.

This test validates the returned payload, but not the service invocation itself. Add an explicit await assertion to protect the router-to-service contract.

Proposed test hardening
     assert response.retrieval_info is not None
     assert response.retrieval_info.key == "demo-app.revision"
     assert response.retrieval_info.references["environment"].id == environment_id
     assert response.retrieval_info.references["environment_revision"].version == "7"
     assert (
         response.retrieval_info.references["application_revision"].id
         == application_revision_id
     )
+    applications_service.retrieve_application_revision.assert_awaited_once()
     # The router no longer does its own env round-trip; the applications service
     # owns environment lookup and reference assembly.
     environments_service.retrieve_environment_revision.assert_not_awaited()
api/oss/src/apis/fastapi/queries/models.py (1)

3-3: ⚡ Quick win

Document the new retrieval_info field in the public schema.

Line 152 adds a new response field, but unlike the other retrieval_info additions in this PR it has no Field(...) metadata, so the OpenAPI schema won't explain what clients should expect here.

Suggested patch
-from pydantic import BaseModel
+from pydantic import BaseModel, Field
@@
 class QueryRevisionResponse(BaseModel):
     count: int = 0
     query_revision: Optional[QueryRevision] = None
-    retrieval_info: Optional[RetrievalInfo] = None
+    retrieval_info: Optional[RetrievalInfo] = Field(
+        default=None,
+        description="References used to retrieve the top-level revision.",
+    )

Also applies to: 149-152


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c0dd2d2d-ca02-4739-a11b-d11dbc5678e5

📥 Commits

Reviewing files that changed from the base of the PR and between fec4391 and e3bb6b8.

📒 Files selected for processing (45)
  • api/oss/src/apis/fastapi/applications/models.py
  • api/oss/src/apis/fastapi/applications/router.py
  • api/oss/src/apis/fastapi/environments/models.py
  • api/oss/src/apis/fastapi/environments/router.py
  • api/oss/src/apis/fastapi/evaluators/models.py
  • api/oss/src/apis/fastapi/evaluators/router.py
  • api/oss/src/apis/fastapi/legacy_variants/router.py
  • api/oss/src/apis/fastapi/queries/models.py
  • api/oss/src/apis/fastapi/queries/router.py
  • api/oss/src/apis/fastapi/testsets/models.py
  • api/oss/src/apis/fastapi/testsets/router.py
  • api/oss/src/apis/fastapi/workflows/models.py
  • api/oss/src/apis/fastapi/workflows/router.py
  • api/oss/src/core/applications/service.py
  • api/oss/src/core/environments/service.py
  • api/oss/src/core/evaluators/service.py
  • api/oss/src/core/git/dtos.py
  • api/oss/src/core/git/utils.py
  • api/oss/src/core/queries/service.py
  • api/oss/src/core/testsets/service.py
  • api/oss/src/core/workflows/service.py
  • api/oss/tests/pytest/acceptance/applications/test_application_retrieval_info.py
  • api/oss/tests/pytest/acceptance/environments/test_environment_retrieval_info.py
  • api/oss/tests/pytest/acceptance/evaluators/test_evaluator_retrieval_info.py
  • api/oss/tests/pytest/acceptance/queries/test_query_retrieval_info.py
  • api/oss/tests/pytest/acceptance/testsets/test_testset_retrieval_info.py
  • api/oss/tests/pytest/acceptance/workflows/test_workflow_retrieval_info.py
  • api/oss/tests/pytest/unit/applications/__init__.py
  • api/oss/tests/pytest/unit/applications/test_retrieve_resolve.py
  • api/oss/tests/pytest/unit/applications/test_router.py
  • api/oss/tests/pytest/unit/environments/__init__.py
  • api/oss/tests/pytest/unit/environments/test_retrieve_resolve.py
  • api/oss/tests/pytest/unit/evaluators/test_retrieve_resolve.py
  • api/oss/tests/pytest/unit/git/__init__.py
  • api/oss/tests/pytest/unit/git/test_retrieval_info_utils.py
  • api/oss/tests/pytest/unit/legacy_variants/test_configs_fetch.py
  • api/oss/tests/pytest/unit/queries/__init__.py
  • api/oss/tests/pytest/unit/queries/test_retrieve.py
  • api/oss/tests/pytest/unit/testsets/__init__.py
  • api/oss/tests/pytest/unit/testsets/test_retrieve.py
  • api/oss/tests/pytest/unit/workflows/__init__.py
  • api/oss/tests/pytest/unit/workflows/test_flag_ownership.py
  • api/oss/tests/pytest/unit/workflows/test_retrieve_resolve.py
  • sdks/python/agenta/sdk/middlewares/running/resolver.py
  • sdks/python/oss/tests/pytest/utils/test_resolver_middleware.py

Comment thread api/oss/src/core/queries/service.py
Comment thread api/oss/src/core/testsets/service.py
Comment thread api/oss/tests/pytest/acceptance/environments/test_environment_retrieval_info.py Outdated
Comment thread api/oss/tests/pytest/acceptance/evaluators/test_evaluator_retrieval_info.py Outdated
Comment thread api/oss/tests/pytest/acceptance/queries/test_query_retrieval_info.py Outdated
Comment thread api/oss/tests/pytest/acceptance/testsets/test_testset_retrieval_info.py Outdated
@junaway junaway marked this pull request as draft May 28, 2026 07:36
@junaway junaway changed the base branch from main to release/v0.100.8 May 29, 2026 15:27
Resolved conflicts by keeping both import sets (RetrievalInfo/build_retrieval_info
from HEAD and validate_* functions from incoming) across all service and router
files. In environments/service.py, adopted the incoming simplification of
retrieve_environment_revision to delegate to fetch_environment_revision (which
includes the full validation set), restored build_retrieval_info call and fixed
the incorrect 2-tuple return to 3-tuple. In the SDK test file, kept HEAD's
test_stores_retrieval_references_on_tracing_context method and appended the
incoming TestResolverMiddlewareTracingParameters class. Dropped unused
VariantForkError import from all three routers (now handled by handle_git_exceptions).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@junaway junaway marked this pull request as ready for review May 29, 2026 15:52
Copilot AI review requested due to automatic review settings May 29, 2026 15:52
@dosubot dosubot Bot added the tests label May 29, 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

Refactor of the six revisioned services (workflows, applications, evaluators, environments, queries, testsets) to thread a new RetrievalInfo (third element of the return tuple) alongside the existing (revision, resolution_info). Environment-backed lookups now merge environment + target references inside the service, removing a duplicate retrieve_environment_revision call in the routers. retrieval_info is exposed on /revisions/retrieve and /revisions/resolve responses for all six entities. The SDK resolver middleware learns a resolve_references_with_info variant that merges returned references into the tracing context.

Changes:

  • Move RetrievalInfo DTO into core/git, add build_retrieval_info / revision_references utilities, and add retrieval_info fields to the relevant FastAPI response models.
  • Update all six services and their routers (plus legacy-variants pass-throughs) to produce/consume the 3-tuple, and add retrieve_query_revision / retrieve_testset_revision wrappers.
  • Extend SDK resolver middleware to merge server-provided retrieval references into TracingContext, and add unit + acceptance tests across all six entities.

Reviewed changes

Copilot reviewed 39 out of 45 changed files in this pull request and generated no comments.

Show a summary per file
File Description
api/oss/src/core/git/dtos.py Adds RetrievalInfo DTO with references + key.
api/oss/src/core/git/utils.py New build_retrieval_info / revision_references helpers.
api/oss/src/core/workflows/service.py Returns (revision, resolution_info, retrieval_info); merges env refs when env-backed.
api/oss/src/core/applications/service.py Same triple-tuple refactor for applications.
api/oss/src/core/evaluators/service.py Same triple-tuple refactor for evaluators.
api/oss/src/core/environments/service.py Returns triple and removes stale commented log.
api/oss/src/core/queries/service.py New retrieve_query_revision wrapper emitting retrieval_info.
api/oss/src/core/testsets/service.py New retrieve_testset_revision wrapper emitting retrieval_info.
api/oss/src/apis/fastapi/{workflows,applications,evaluators,environments,queries,testsets}/router.py Pass retrieval_info through; resolve endpoints synthesize it via build_retrieval_info.
api/oss/src/apis/fastapi/{workflows,applications,evaluators,environments,queries,testsets}/models.py Add retrieval_info field to response models.
api/oss/src/apis/fastapi/legacy_variants/router.py Updated all unpacks to the 3-tuple shape.
sdks/python/agenta/sdk/middlewares/running/resolver.py New resolve_references_with_info + _merge_tracing_references; existing resolve_references becomes a thin wrapper.
api/oss/tests/pytest/unit/git/test_retrieval_info_utils.py Unit tests for helper merging and key handling.
api/oss/tests/pytest/unit/{applications,evaluators,environments,workflows,queries,testsets}/test_retrieve_resolve.py (+ test_router.py, test_flag_ownership.py) New/updated service-level unit tests covering direct + env-backed paths.
api/oss/tests/pytest/unit/legacy_variants/test_configs_fetch.py Updated mock return values to 3-tuple.
api/oss/tests/pytest/acceptance/{applications,evaluators,environments,workflows,queries,testsets}/test_*_retrieval_info.py End-to-end acceptance coverage for the new field.
sdks/python/oss/tests/pytest/utils/test_resolver_middleware.py Asserts retrieval references are merged onto the tracing context.

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

@junaway junaway marked this pull request as draft May 29, 2026 16:05
@junaway junaway marked this pull request as ready for review May 29, 2026 16:06
Copilot AI review requested due to automatic review settings May 29, 2026 16:06
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 39 out of 45 changed files in this pull request and generated no new comments.

@junaway junaway marked this pull request as draft May 29, 2026 16:09
@junaway junaway requested a review from Copilot May 29, 2026 16:39
@junaway
Copy link
Copy Markdown
Contributor

junaway commented May 29, 2026

@CodeRabbit review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 29, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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 39 out of 45 changed files in this pull request and generated no new comments.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
api/oss/src/core/environments/service.py (1)

796-810: 🛠️ Refactor suggestion | 🟠 Major | 🏗️ Heavy lift

Return a typed result model here instead of another positional tuple.

This new 3-tuple is already forcing positional _ unpacking in downstream callers, and that coupling will keep spreading. Please wrap environment_revision, resolution_info, and retrieval_info in a Pydantic DTO and return that from the service.

📦 Suggested direction
+class EnvironmentRevisionRetrieveResult(BaseModel):
+    environment_revision: Optional[EnvironmentRevision] = None
+    resolution_info: Optional[ResolutionInfo] = None
+    retrieval_info: Optional[RetrievalInfo] = None
+
     async def retrieve_environment_revision(
         self,
         *,
         project_id: UUID,
         ...
-    ) -> tuple[
-        Optional[EnvironmentRevision],
-        Optional[ResolutionInfo],
-        Optional[RetrievalInfo],
-    ]:
+    ) -> EnvironmentRevisionRetrieveResult:
As per coding guidelines, "Service methods must return typed DTOs (Pydantic `BaseModel` subclasses), not raw dicts, tuples, or `Any`."
api/oss/src/core/applications/service.py (1)

591-610: 🛠️ Refactor suggestion | 🟠 Major | 🏗️ Heavy lift

Use a typed DTO for this retrieve contract instead of a positional tuple.

This API now carries three values and has already started leaking positional unpacking into callers. Please return a Pydantic result model with named fields for the revision, resolution metadata, and retrieval metadata.

📦 Suggested direction
+class ApplicationRevisionRetrieveResult(BaseModel):
+    application_revision: Optional[ApplicationRevision] = None
+    resolution_info: Optional[ResolutionInfo] = None
+    retrieval_info: Optional[RetrievalInfo] = None
+
     async def retrieve_application_revision(
         self,
         *,
         project_id: UUID,
         ...
-    ) -> tuple[
-        Optional[ApplicationRevision],
-        Optional[ResolutionInfo],
-        Optional[RetrievalInfo],
-    ]:
+    ) -> ApplicationRevisionRetrieveResult:
As per coding guidelines, "Service methods must return typed DTOs (Pydantic `BaseModel` subclasses), not raw dicts, tuples, or `Any`."

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 51a706b5-471b-4d0a-be11-d35fd2868e2b

📥 Commits

Reviewing files that changed from the base of the PR and between e3bb6b8 and 216e551.

📒 Files selected for processing (27)
  • api/oss/src/apis/fastapi/applications/models.py
  • api/oss/src/apis/fastapi/applications/router.py
  • api/oss/src/apis/fastapi/environments/models.py
  • api/oss/src/apis/fastapi/environments/router.py
  • api/oss/src/apis/fastapi/evaluators/models.py
  • api/oss/src/apis/fastapi/evaluators/router.py
  • api/oss/src/apis/fastapi/legacy_variants/router.py
  • api/oss/src/apis/fastapi/queries/models.py
  • api/oss/src/apis/fastapi/queries/router.py
  • api/oss/src/apis/fastapi/testsets/models.py
  • api/oss/src/apis/fastapi/testsets/router.py
  • api/oss/src/apis/fastapi/workflows/models.py
  • api/oss/src/apis/fastapi/workflows/router.py
  • api/oss/src/core/applications/service.py
  • api/oss/src/core/environments/service.py
  • api/oss/src/core/evaluators/service.py
  • api/oss/src/core/queries/service.py
  • api/oss/src/core/testsets/service.py
  • api/oss/src/core/workflows/service.py
  • api/oss/tests/pytest/acceptance/applications/test_application_retrieval_info.py
  • api/oss/tests/pytest/acceptance/environments/test_environment_retrieval_info.py
  • api/oss/tests/pytest/acceptance/evaluators/test_evaluator_retrieval_info.py
  • api/oss/tests/pytest/acceptance/queries/test_query_retrieval_info.py
  • api/oss/tests/pytest/acceptance/testsets/test_testset_retrieval_info.py
  • api/oss/tests/pytest/acceptance/workflows/test_workflow_retrieval_info.py
  • sdks/python/agenta/sdk/middlewares/running/resolver.py
  • sdks/python/oss/tests/pytest/utils/test_resolver_middleware.py
🚧 Files skipped from review as they are similar to previous changes (21)
  • api/oss/src/apis/fastapi/workflows/models.py
  • api/oss/src/apis/fastapi/applications/models.py
  • api/oss/src/apis/fastapi/evaluators/models.py
  • api/oss/src/apis/fastapi/environments/models.py
  • api/oss/src/apis/fastapi/queries/models.py
  • api/oss/src/apis/fastapi/evaluators/router.py
  • sdks/python/oss/tests/pytest/utils/test_resolver_middleware.py
  • api/oss/src/apis/fastapi/workflows/router.py
  • api/oss/src/apis/fastapi/applications/router.py
  • api/oss/src/apis/fastapi/queries/router.py
  • api/oss/src/core/testsets/service.py
  • api/oss/tests/pytest/acceptance/testsets/test_testset_retrieval_info.py
  • api/oss/tests/pytest/acceptance/environments/test_environment_retrieval_info.py
  • api/oss/src/core/queries/service.py
  • api/oss/tests/pytest/acceptance/workflows/test_workflow_retrieval_info.py
  • api/oss/src/core/evaluators/service.py
  • api/oss/tests/pytest/acceptance/evaluators/test_evaluator_retrieval_info.py
  • api/oss/tests/pytest/acceptance/queries/test_query_retrieval_info.py
  • api/oss/tests/pytest/acceptance/applications/test_application_retrieval_info.py
  • sdks/python/agenta/sdk/middlewares/running/resolver.py
  • api/oss/src/core/workflows/service.py

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. tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants