Skip to content

feat(agent): automated agent healing process.#1281

Merged
samchon merged 5 commits into
mainfrom
fix/heal2
Apr 7, 2026
Merged

feat(agent): automated agent healing process.#1281
samchon merged 5 commits into
mainfrom
fix/heal2

Conversation

@samchon

@samchon samchon commented Apr 7, 2026

Copy link
Copy Markdown
Member

This pull request makes significant improvements to the Prisma/DTO authoring guides and strengthens schema validation for pagination and property naming. The main focus is on enforcing exact foreign key (FK) column names from the schema (never abbreviating), clarifying computed field handling, and improving validation for pagination DTO variants. It also updates the checklist and error documentation to help prevent common mistakes during implementation.

Prisma/DTO Authoring Guide Improvements

  • All guides (REALIZE_OPERATION_CORRECT.md, REALIZE_OPERATION_WRITE.md, REALIZE_TRANSFORMER_CORRECT.md, REALIZE_TRANSFORMER_WRITE.md) now emphasize that FK column names must be copied exactly from the schema (e.g., hrm_platform_organization_id, not organization_id), and never abbreviated. This is reinforced in checklists and code examples. [1] [2] [3] [4] [5] [6] [7] [8]
  • The guides clarify that computed/aggregation fields (e.g., total_hours, average_rating) must be derived in transform(), not selected directly; selecting them as columns will cause TS2353 errors. [1] [2] [3]
  • Prisma where filter syntax is further clarified: use direct null (not { equals: null }), logical operators must be uppercase (NOT, AND, OR), and relation filters must use the correct object structure. [1] [2] [3] [4]
  • Section numbers and checklists are updated to reflect the new rules and to make validation steps more explicit. [1] [2]

Schema Validation Enhancements

  • In AutoBeJsonSchemaFactory.ts, all $ref references to bogus .IPagination variants are rewritten to the canonical IPage.IPagination, preventing accidental use of invalid pagination types.
  • In AutoBeJsonSchemaValidator.ts, a new validatePaginationVariant function rejects any DTO type ending with .IPagination except IPage.IPagination, with a clear error message. The previously commented-out validateEmptyProperties is restored and called, ensuring all DTOs used in API operations have at least one property. [1] [2]

These changes will help prevent common mistakes, enforce stricter contract between schema and implementation, and provide clearer errors and guidance for future development.

@samchon samchon added the enhancement New feature or request label Apr 7, 2026
@samchon samchon added this to WrtnLabs Apr 7, 2026
@samchon samchon marked this pull request as ready for review April 7, 2026 10:28
Copilot AI review requested due to automatic review settings April 7, 2026 10:28

Copilot AI left a comment

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.

Pull request overview

This PR tightens interface-schema validation in the agent orchestrator (pagination typing + empty DTO detection) and updates the Realize authoring guides to reduce common Prisma/DTO mistakes (exact FK naming, computed field selection, and correct where syntax).

Changes:

  • Added schema validation to reject non-canonical .IPagination DTO variants and restored validation that flags empty object DTOs used in operations.
  • Updated schema factory to rewrite $ref values that incorrectly point to *.IPagination into the canonical IPage.IPagination.
  • Expanded Realize prompts/guides with stricter rules and examples for FK column naming, computed fields, and Prisma where clause syntax.

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/agent/src/orchestrate/interface/utils/AutoBeJsonSchemaValidator.ts Adds pagination-variant validation and re-enables empty-properties validation for DTOs used in operations.
packages/agent/src/orchestrate/interface/utils/AutoBeJsonSchemaFactory.ts Rewrites invalid .IPagination $ref targets to IPage.IPagination.
packages/agent/prompts/REALIZE_TRANSFORMER_WRITE.md Adds rules/examples for exact FK naming and computing derived fields in transform().
packages/agent/prompts/REALIZE_TRANSFORMER_CORRECT.md Adds diagnostics guidance for computed-field selection errors and reinforces exact FK naming.
packages/agent/prompts/REALIZE_OPERATION_WRITE.md Clarifies checklist and adds Prisma where syntax guidance (null + logical operators).
packages/agent/prompts/REALIZE_OPERATION_CORRECT.md Extends troubleshooting/checklist items for FK naming and where filter syntax.

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

Comment thread packages/agent/src/orchestrate/interface/utils/AutoBeJsonSchemaValidator.ts Outdated
Comment thread packages/agent/src/orchestrate/interface/utils/AutoBeJsonSchemaValidator.ts Outdated
@samchon samchon merged commit da4c937 into main Apr 7, 2026
7 checks passed
@samchon samchon deleted the fix/heal2 branch April 7, 2026 13:34
sunrabbit123 pushed a commit that referenced this pull request Apr 9, 2026
* feat(agent): automated agent healing process.

* check zero peropties

* turn off zero property checking due to gpt-5.4-mini

* Update packages/agent/src/orchestrate/interface/utils/AutoBeJsonSchemaValidator.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

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

Labels

enhancement New feature or request

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants