Skip to content

Conversation

@NeatGuyCoding
Copy link
Contributor

Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Summary

This PR fixes an incorrect logical operator in the database query filter for the AppMCPServer controller. The issue was in the get method where the filter condition was using the and operator incorrectly within a single filter statement, which would cause a logical error in the SQL query generation.

Changes made:

  • Split the combined filter condition AppMCPServer.id == server_id and AppMCPServer.tenant_id == current_user.current_tenant_id into two separate .filter() calls
  • This ensures proper SQLAlchemy query construction and prevents potential runtime errors

Technical details:

  • File: api/controllers/console/app
  • Method: get(self, server_id)
  • Lines changed: 95-96
  • Type: Bug fix

The change improves code reliability by following SQLAlchemy best practices for chaining multiple filter conditions.

Screenshots

Before After
N/A - Backend logic fix N/A - Backend logic fix

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jul 11, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jul 12, 2025
@crazywoola crazywoola merged commit 6c233e0 into langgenius:main Jul 12, 2025
6 checks passed
yijiaquan pushed a commit to yijiaquan/dify that referenced this pull request Jul 14, 2025
eggbrid2 pushed a commit to eggbrid2/dify that referenced this pull request Jul 15, 2025
* main: (533 commits)
  chore: bump nextjs to 15.3 (langgenius#22262)
  Provides a set of Kubernetes manifests supporting version 1.6.0 (langgenius#22287)
  improve opik workflow_trace span name to node name (langgenius#22356)
  fix: aliyun trace title&description (langgenius#22347)
  Update README.md (langgenius#22351)
  fix: close session before doing long latency operation (langgenius#22306)
  feat(api/repo): Allow to config repository implementation (langgenius#21458)
  Fix: Remove height and overflow style settings (langgenius#22327)
  Chore: Replace lodash/noop with lodash-es/noop (langgenius#22331)
  fix: error parsing object type parameters for code node (langgenius#22230)
  fix: prevent trigger form submit action when press 'enter' (langgenius#22313)
  Update README.md (langgenius#22305)
  test: add comprehensive unit tests for login decorator (langgenius#22294)
  fixing Enum part in backend and making it same as front end (langgenius#22296)
  test(web): add password regexp test case (langgenius#22308)
  fix(ui): prevent var icon hidden when only one var in list of start node (langgenius#22290)
  fix: tool's model selector and app selector not work (langgenius#22291)
  chore: bump ruff to 0.12.x (langgenius#22259)
  minor fix: wrong and (langgenius#22242)
  Add unit test for account service (langgenius#22278)
  ...

# Conflicts:
#	web/app/(commonLayout)/apps/AppCard.tsx
#	web/app/(commonLayout)/apps/Apps.tsx
#	web/app/(commonLayout)/apps/page.tsx
#	web/app/(commonLayout)/datasets/Container.tsx
#	web/app/components/base/logo/dify-logo.tsx
#	web/app/components/base/markdown.tsx
#	web/app/components/header/account-dropdown/workplace-selector/index.tsx
#	web/app/components/header/explore-nav/index.tsx
#	web/app/components/header/index.tsx
#	web/app/components/header/nav/index.tsx
#	web/app/components/header/plugins-nav/index.tsx
#	web/app/components/header/tools-nav/index.tsx
#	web/app/components/tools/provider-list.tsx
#	web/app/components/workflow/nodes/_base/panel.tsx
#	web/app/reset-password/layout.tsx
#	web/app/signin/_header.tsx
#	web/app/signin/layout.tsx
#	web/app/signin/normalForm.tsx
#	web/i18n/zh-Hans/common.ts
#	web/i18n/zh-Hans/explore.ts
#	web/package.json
#	web/pnpm-lock.yaml
#	web/themes/dark.css
#	web/themes/light.css
@NeatGuyCoding NeatGuyCoding deleted the minor-fix-wrong-and branch July 16, 2025 07:47
tutkun pushed a commit to tutkun/dify that referenced this pull request Aug 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants