Skip to content

refactor(frontend): extract agent payload and ReActStep mapping helpers#5995

Open
Ma77Ball wants to merge 4 commits into
apache:mainfrom
Ma77Ball:refactor/agent-service-mapping-helpers
Open

refactor(frontend): extract agent payload and ReActStep mapping helpers#5995
Ma77Ball wants to merge 4 commits into
apache:mainfrom
Ma77Ball:refactor/agent-service-mapping-helpers

Conversation

@Ma77Ball

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

  • Added a private mapApiAgentInfo(api) helper in AgentService and routed createAgent, getAgent, and getAllAgents through it, removing three identical inline ApiAgentInfo -> AgentInfo mappings (including the duplicated delegate sub-mapping).
  • Added a private convertApiReActSteps(steps) helper and routed the three steps.map(s => convertApiReActStep(s)) sites through it.
  • No behavior change: the produced AgentInfo and ReActStep[] values are identical to before.

Any related issues, documentation, discussions?

Closes: #5990

How was this PR tested?

  • Run cd frontend && yarn test --include='**/agent.service.spec.ts', expect the existing AgentService suite (including the createAgent cases that flush an API payload and assert the mapped AgentInfo) to pass.
  • Typecheck with cd frontend && npx tsc --noEmit -p tsconfig.json, expect no errors in agent.service.ts (the only error is a pre-existing unrelated missing-module in migration-llm.ts).

Was this PR authored or co-authored using generative AI tooling?

Co-authored with Claude Opus 4.8 in compliance with ASF

added a mapper convertApireActSteps... helper function to handle agent
get and create calls
@github-actions github-actions Bot added refactor Refactor the code frontend Changes related to the frontend GUI labels Jun 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @bobbai00
    You can notify them by mentioning @bobbai00 in a comment.

@codecov-commenter

codecov-commenter commented Jun 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.73%. Comparing base (db00f94) to head (099d649).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #5995      +/-   ##
============================================
+ Coverage     60.42%   60.73%   +0.31%     
+ Complexity     3353     3338      -15     
============================================
  Files          1133     1133              
  Lines         43979    43977       -2     
  Branches       4781     4779       -2     
============================================
+ Hits          26574    26710     +136     
+ Misses        15945    15786     -159     
- Partials       1460     1481      +21     
Flag Coverage Δ *Carryforward flag
access-control-service 70.00% <ø> (ø) Carriedforward from 7494414
agent-service 44.59% <ø> (ø) Carriedforward from 7494414
amber 65.51% <ø> (-0.35%) ⬇️ Carriedforward from 7494414
computing-unit-managing-service 0.00% <ø> (ø) Carriedforward from 7494414
config-service 52.30% <ø> (ø) Carriedforward from 7494414
file-service 63.97% <ø> (ø) Carriedforward from 7494414
frontend 53.11% <100.00%> (+1.07%) ⬆️
notebook-migration-service 78.57% <ø> (ø) Carriedforward from 7494414
pyamber 91.18% <ø> (ø) Carriedforward from 7494414
workflow-compiling-service 55.14% <ø> (ø) Carriedforward from 7494414

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Ma77Ball Ma77Ball marked this pull request as ready for review July 7, 2026 05:45
@Ma77Ball

Ma77Ball commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

/request-review @bobbai00

@github-actions github-actions Bot requested a review from bobbai00 July 7, 2026 05:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend Changes related to the frontend GUI refactor Refactor the code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deduplicate agent payload and ReActStep mapping in AgentService

2 participants