fix: standardize manual HTTP tool array schemas - #7416
Conversation
Coverage Report
File CoverageNo changed files found. |
627f6e0 to
db435a9
Compare
There was a problem hiding this comment.
💡 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".
| updateOne: { | ||
| filter: { _id: document._id }, | ||
| update: { $set: { [fieldName]: result.nodes } } | ||
| } |
There was a problem hiding this comment.
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 👍 / 👎.
| baseQuery: { | ||
| appId: { $in: httpToolAppIds } | ||
| }, |
There was a problem hiding this comment.
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 👍 / 👎.
|
✅ Docs Preview Deployed! 🔗 👀 Click here to visit preview 🕒 Time: 2026-07-30 15:40:11 (UTC+8) |
|
✅ Admin Preview Image Ready! 🕒 Time: 2026-07-30 15:44:09 (UTC+8) |
|
✅ Build Successful - Preview fastgpt Image for this PR: 🕒 Time: 2026-07-30 15:50:52 (UTC+8) |
What changed
arrayString,arrayNumber, andarrayBoolean.POST /api/admin/4160/initHttpToolSchemamigration endpoint to clean manual HTTP tool schemas in bothapps.modulesandapp_versions.nodes.Root cause
The manual editor persisted FastGPT workflow value types such as
arrayStringdirectly into JSON Schema'stypefield. 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.git diff --checkpassed.ResourceLimits.storageSizeerrors outside this change.