Skip to content

Conversation

@seefeldb
Copy link
Contributor

@seefeldb seefeldb commented Sep 19, 2025

  • ensure toJSONWithLegacyAliases no longer drops schema info while normalizing alias depths
  • add explanatory comments for the whole function
  • extend json-utils tests to cover regression scenario

Summary by cubic

Preserves schema metadata when rewriting legacy aliases in toJSONWithLegacyAliases, fixing missing tool schemas during recipe instantiation from defaults. Addresses CT-919.

  • Bug Fixes
    • Keep schema/rootSchema and other alias metadata when normalizing alias depth and expanding shadow refs.
    • Concatenate paths while preserving metadata for shadow-ref aliases; increment numeric cell levels without dropping schemas.
    • Added focused tests to cover the regression and explanatory comments for the function.

- ensure toJSONWithLegacyAliases no longer drops schema info while normalizing alias depths
- add explanatory comments for the whole function
- extend json-utils tests to cover regression scenario
@linear
Copy link

linear bot commented Sep 19, 2025

Copy link
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 in the toJSONWithLegacyAliases function where schema metadata was being dropped when rewriting legacy aliases. The fix ensures that when expanding shadow ref aliases and incrementing numeric alias cells, all metadata (including schema and rootSchema) is preserved.

  • Preserve metadata when expanding shadow ref aliases by using spread operator for all alias properties except cell
  • Preserve metadata when incrementing numeric alias cells by spreading the entire alias object before overriding specific properties
  • Add comprehensive tests to verify schema preservation in both scenarios

Reviewed Changes

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

File Description
packages/runner/src/builder/json-utils.ts Fix metadata preservation in toJSONWithLegacyAliases and add explanatory comments
packages/runner/test/json-utils.test.ts Add test coverage for schema preservation regression scenarios

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

2 issues found across 2 files

Prompt for AI agents (all 2 issues)

Understand the root cause of the following 2 issues and fix them.


<file name="packages/runner/src/builder/json-utils.ts">

<violation number="1" location="packages/runner/src/builder/json-utils.ts:78">
Typo in comment: &quot;is should&quot; should be &quot;it should&quot; for clarity.</violation>

<violation number="2" location="packages/runner/src/builder/json-utils.ts:159">
Comment contradicts the code: the code returns the result when the object is empty, not undefined.</violation>
</file>

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

seefeldb and others added 2 commits September 18, 2025 17:31
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
@seefeldb seefeldb merged commit 9f605a1 into main Sep 19, 2025
7 checks passed
@seefeldb seefeldb deleted the berni/ct-919-missing-tool-schema-on-recipe-instantiation-from-default branch September 19, 2025 00:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants