Skip to content

semantic-editing: Fix references in methods#25484

Merged
taylorsw04 merged 9 commits intomicrosoft:mainfrom
taylorsw04:fix-references-in-methods
Sep 18, 2025
Merged

semantic-editing: Fix references in methods#25484
taylorsw04 merged 9 commits intomicrosoft:mainfrom
taylorsw04:fix-references-in-methods

Conversation

@taylorsw04
Copy link
Copy Markdown
Contributor

Description

This PR fixes a bug in which references to schema types in exposed methods would be converted to void in the types shown to the agent. It also cleans up some code and removes some unnecessary optimizations in the type string generation.

@github-actions github-actions bot added area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct public api change Changes to a public API base: main PRs targeted against main branch labels Sep 18, 2025
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 fixes a bug where references to schema types in exposed methods would be converted to void in the types shown to agents. The fix involves updating the type generation system to properly track and include referenced types from method bindings. The changes also simplify the instanceOf utility by removing unnecessary caching optimizations.

  • Fixes bug where method parameter/return types were being converted to void instead of preserving schema type references
  • Removes caching optimization from instanceOf function and simplifies its implementation
  • Updates the type generation system to track and include types referenced by exposed methods

Reviewed Changes

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

Show a summary per file
File Description
packages/framework/tree-agent/src/utils.ts Removes caching from instanceOf function and adds error handling for unsupported zod effects
packages/framework/tree-agent/src/typeGeneration.ts Updates type generation to track referenced types from methods and iterate over multiple schemas
packages/framework/tree-agent/src/test/systemPrompt.spec.ts Adds test for method return types and refactors test helper
packages/framework/tree-agent/src/methodBinding.ts Updates ExposedMethods interface to track referenced types and provides instanceOf method
packages/framework/tree-agent/src/index.ts Removes instanceOf from exports
packages/framework/tree-agent/api-report/tree-agent.alpha.api.md Updates API to reflect instanceOf removal from exports and BindableSchema type changes

Copy link
Copy Markdown
Contributor

@alexvy86 alexvy86 left a comment

Choose a reason for hiding this comment

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

Mostly mechanical comments. The overall idea makes sense, but I suggest waiting for @noencke to have a look too.

@taylorsw04 taylorsw04 enabled auto-merge (squash) September 18, 2025 20:07
@github-actions
Copy link
Copy Markdown
Contributor

🔗 No broken links found! ✅

Your attention to detail is admirable.

linkcheck output


> fluid-framework-docs-site@0.0.0 ci:check-links /home/runner/work/FluidFramework/FluidFramework/docs
> start-server-and-test "npm run serve -- --no-open" 3000 check-links

1: starting server using command "npm run serve -- --no-open"
and when url "[ 'http://127.0.0.1:3000' ]" is responding with HTTP status code 200
running tests using command "npm run check-links"


> fluid-framework-docs-site@0.0.0 serve
> docusaurus serve --no-open

[SUCCESS] Serving "build" directory at: http://localhost:3000/

> fluid-framework-docs-site@0.0.0 check-links
> linkcheck http://localhost:3000 --skip-file skipped-urls.txt

Crawling...

Stats:
  235713 links
    1720 destination URLs
    1953 URLs ignored
       0 warnings
       0 errors


*/
function generateEditTypes(
schema: SimpleTreeSchema,
schemas: Iterable<SimpleTreeSchema>,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: Iterable<SimpleTreeSchema> is probably the "most correct" type here, but might just be simpler to use an array SimpleTreeSchema[] since it's common/familiar.

@taylorsw04 taylorsw04 merged commit 4fb43f2 into microsoft:main Sep 18, 2025
39 checks passed
anthony-murphy-agent pushed a commit to anthony-murphy-agent/FluidFramework that referenced this pull request Jan 14, 2026
## Description

This PR fixes a bug in which references to schema types in exposed
methods would be converted to void in the types shown to the agent. It
also cleans up some code and removes some unnecessary optimizations in
the type string generation.

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Alex Villarreal <716334+alexvy86@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct base: main PRs targeted against main branch public api change Changes to a public API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants