Skip to content

fix: standardize manual HTTP tool array schemas - #7416

Merged
c121914yu merged 5 commits into
labring:mainfrom
c121914yu:fix-http-schema
Jul 30, 2026
Merged

fix: standardize manual HTTP tool array schemas#7416
c121914yu merged 5 commits into
labring:mainfrom
c121914yu:fix-http-schema

Conversation

@c121914yu

Copy link
Copy Markdown
Collaborator

What changed

  • Convert manual HTTP tool parameter value types into standard JSON Schema when saving, including arrayString, arrayNumber, and arrayBoolean.
  • Restore standard array schemas to the corresponding editor value type when editing.
  • Add the internal POST /api/admin/4160/initHttpToolSchema migration endpoint to clean manual HTTP tool schemas in both apps.modules and app_versions.nodes.
  • Keep OpenAPI-imported HTTP toolsets unchanged and support dry-run, batched writes, and idempotent reruns.

Root cause

The manual editor persisted FastGPT workflow value types such as arrayString directly into JSON Schema's type field. Workflow runtime consumes the stored HTTP tool schema directly, so these non-standard values reached model tool definitions.

Impact

New manual HTTP tools now persist valid JSON Schema arrays. Existing manual tools can be migrated without adding runtime compatibility logic.

Validation

  • packages/global/test/core/app/tool/httpTool/utils.test.ts: 32 tests passed.
  • projects/app/test/pages/api/admin/4160/initHttpToolSchema.test.ts: 4 tests passed.
  • ESLint, Prettier, and git diff --check passed.
  • Full workspace tests were attempted; unrelated Admin large-batch performance tests timed out.
  • App typecheck remains blocked by existing Sandbox ResourceLimits.storageSize errors outside this change.

@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 18.37% 1629 / 8865
🔵 Statements 18.36% 1710 / 9310
🔵 Functions 16.12% 340 / 2109
🔵 Branches 15.1% 759 / 5026
File CoverageNo changed files found.
Generated in workflow #1842 for commit 3736b98 by the Vitest Coverage Report Action

@c121914yu
c121914yu marked this pull request as ready for review July 30, 2026 07:24
Copilot AI review requested due to automatic review settings July 30, 2026 07:24

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: db435a94a9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +170 to +173
updateOne: {
filter: { _id: document._id },
update: { $set: { [fieldName]: result.nodes } }
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Avoid overwriting concurrent HTTP-tool edits

When a user saves an HTTP tool after this cursor reads its document but before the batch is written, this $set replaces the entire modules array with the stale snapshot produced by the migration, silently discarding the user's update; the window is especially significant with batches of up to 5,000 documents. Use a compare-and-swap filter based on the value/version that was read, perform a targeted atomic transformation, or explicitly prevent concurrent writes while this migration runs.

Useful? React with 👍 / 👎.

Comment on lines +235 to +237
baseQuery: {
appId: { $in: httpToolAppIds }
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Chunk the app IDs used to scan versions

On deployments with a sufficiently large number of HTTP toolsets, every app ID is retained and placed into one $in query, so the advertised batchSize does not bound either this query or its memory usage; eventually the MongoDB command can exceed the BSON document-size limit and the migration will fail before processing any versions. Scan versions in bounded app-ID chunks, or use a query strategy that does not materialize all IDs in a single command.

Useful? React with 👍 / 👎.

@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown

Docs Preview Deployed!

🔗 👀 Click here to visit preview

ghcr.io/labring/fastgpt-docs-pr:3736b989f928afcbf6d640576f32c5f09834dc28

🕒 Time: 2026-07-30 15:40:11 (UTC+8)

@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown

Admin Preview Image Ready!

ghcr.io/labring/fastgpt-pr:admin_3736b989f928afcbf6d640576f32c5f09834dc28

🕒 Time: 2026-07-30 15:44:09 (UTC+8)

@github-actions

Copy link
Copy Markdown

Build Successful - Preview fastgpt Image for this PR:

ghcr.io/labring/fastgpt-pr:fastgpt_3736b989f928afcbf6d640576f32c5f09834dc28

🕒 Time: 2026-07-30 15:50:52 (UTC+8)

@c121914yu
c121914yu merged commit 132093f into labring:main Jul 30, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants