feat(agen): detailed guideline about realize phase.#1283
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR tightens “realize operation” generation/correction by (1) enforcing correct Transformer usage (select() + transform() pairing), and (2) improving transformer discovery for composite/paginated response DTOs by resolving “neighbor” transformers from response schemas.
Changes:
- Added
validateSelectTransformContractto detect mismatchedTransformer.select()/Transformer.transform()usage and integrated it into both write and overall correction orchestrators. - Introduced
getLocalTransformersto collect direct and neighbor transformers for complex response types, and centralized property-transformer resolution intointernal/resolvePropertyTransformer.ts. - Updated prompts and added unit tests covering composite/local transformer resolution and the new contract validator.
Reviewed changes
Copilot reviewed 21 out of 27 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| website/public/images/demonstrate/replay-openai-gpt-5.4.png | Adds/updates a demonstration image asset. |
| website/public/images/demonstrate/replay-openai-gpt-5.4-nano.png | Adds/updates a smaller demonstration image asset. |
| packages/agent/src/orchestrate/realize/programmers/internal/writeRealizeOperationTemplate.ts | Reuses the centralized property transformer resolver instead of inline logic. |
| packages/agent/src/orchestrate/realize/programmers/internal/resolvePropertyTransformer.ts | New shared resolver for $ref / array-of-$ref / nullable oneOf cases. |
| packages/agent/src/orchestrate/realize/programmers/AutoBeRealizeOperationProgrammer.ts | Adds getLocalTransformers and transformer select/transform contract validation. |
| packages/agent/src/orchestrate/realize/orchestrateRealizeOperationWrite.ts | Uses getLocalTransformers and runs the new contract validator during write. |
| packages/agent/src/orchestrate/realize/orchestrateRealizeOperationCorrectOverall.ts | Uses getLocalTransformers and runs the new contract validator during overall correction. |
| packages/agent/prompts/REALIZE_OPERATION_CORRECT.md | Documents the select/transform pairing rule and template-first guidance. |
| test/src/features/programmer/test_resolve_property_transformer_*.ts | Adds unit tests for the new shared property transformer resolver. |
| test/src/features/programmer/test_realize_operation_preliminary_*.ts | Adds unit tests for getLocalTransformers behavior (void, pagination, composite, no-match). |
| test/src/features/programmer/test_realize_operation_validate_contract_*.ts | Adds unit tests for the new select/transform contract validator. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
sunrabbit123
pushed a commit
that referenced
this pull request
Apr 9, 2026
* feat(agen): detailed guideline about realize phase. * add test cases * fix format * fix orchestrateRealizeCorrectWithRetry
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request significantly improves the handling and enforcement of Transformer usage patterns in the agent's realize operation code. It introduces stricter validation and clearer documentation to ensure that
Transformer.select()andTransformer.transform()are always used together, preventing common type mismatch errors. The changes also refactor and centralize logic for resolving property transformers, improving maintainability and correctness for composite response types.Validation and Enforcement of Transformer Usage:
validateSelectTransformContractto ensure everyTransformer.select()call is paired with a corresponding.transform()call (and vice versa), both in draft and final code. This prevents type mismatches due to improper usage.Improved Transformer Resolution for Responses:
getLocalTransformers, which resolves not only direct matches but also "neighbor" transformers for composite response types (e.g., dashboard endpoints), ensuring all relevant transformers are used for complex DTOs. [1] [2] [3]internal/resolvePropertyTransformer.ts, replacing inline implementations and improving code reuse and clarity. [1] [2] [3]Documentation and Prompt Updates:
These changes together provide better guidance and automated enforcement for correct Transformer usage, reducing common errors and improving the reliability of generated code.