dify - ✅(Solved) Fix [Refactor/Chore] clean old api [3 pull requests, 6 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
langgenius/dify#35141Fetched 2026-04-15 06:45:53
View on GitHub
Comments
6
Participants
2
Timeline
20
Reactions
1
Timeline (top)
commented ×6blocked_by_added ×3cross-referenced ×3mentioned ×3
<img width="521" height="372" alt="Image" src="https://github.com/user-attachments/assets/80152b97-c0c6-4ef6-9037-8f715feac38a" />

need to update some api && clean a bit.

Root Cause

<img width="521" height="372" alt="Image" src="https://github.com/user-attachments/assets/80152b97-c0c6-4ef6-9037-8f715feac38a" />

need to update some api && clean a bit.

Fix Action

Fixed

PR fix notes

PR #35145: test: migrate document indexing task tests to SQLAlchemy 2.0 select API

Description (problem / solution / changelog)

Summary

  • Migrate remaining legacy ORM query usage in two document indexing integration test modules to SQLAlchemy 2.0 style.
  • Replace Session.query(...).first() with Session.scalar(select(...).limit(1)).
  • Replace Session.query(...).count() with Session.scalar(select(func.count()).select_from(...).where(...)).
  • Replace Session.query(...).all() with Session.scalars(select(...).where(...)).all().

Changes

Updated files

  • api/tests/test_containers_integration_tests/tasks/test_document_indexing_update_task.py
    • Added select and func imports.
    • Migrated document lookup and segment count assertions to SQLAlchemy 2.0 statement APIs.
  • api/tests/test_containers_integration_tests/tasks/test_disable_segments_from_index_task.py
    • Added select import.
    • Migrated segment reload query from query(...).all() to scalars(select(...)).all().

Related Issue

Changed files

  • api/tests/test_containers_integration_tests/tasks/test_disable_segments_from_index_task.py (modified, +4/-3)
  • api/tests/test_containers_integration_tests/tasks/test_document_indexing_update_task.py (modified, +6/-5)

PR #35146: test: migrate clean_dataset integration tests to SQLAlchemy 2.0 APIs

Description (problem / solution / changelog)

Summary

  • Migrate test_clean_dataset_task.py from legacy SQLAlchemy Query API usage to SQLAlchemy 2.0 statement APIs.
  • Replace fixture cleanup deletes from Session.query(...).delete() to Session.execute(delete(...)).
  • Replace read assertions from query(...).filter_by(...).all() / query(...).where(...).all() to Session.scalars(select(...).where(...)).all().

Changes

  • Updated file:
    • api/tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py
  • Added imports:
    • from sqlalchemy import delete, select
  • Refactored:
    • Database cleanup fixture delete operations.
    • Dataset/document/segment/metadata/upload-file verification queries across multiple test cases.
    • Read-only test assertions to use select/scalars patterns consistently.

Related Issue

Changed files

  • api/tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py (modified, +98/-49)

PR #35159: test: migrate clean notion task tests to SQLAlchemy 2.0 APIs

Description (problem / solution / changelog)

Summary

  • Migrate clean notion document task integration tests to SQLAlchemy 2.0 statement APIs
  • Replace legacy query/count assertions with select(func.count())-based checks
  • Keep test behavior unchanged while aligning with ongoing cleanup for #35141

Test plan

  • Lint diagnostics check on modified file reports no issues

Changed files

  • api/tests/test_containers_integration_tests/tasks/test_clean_notion_document_task.py (modified, +34/-140)
RAW_BUFFERClick to expand / collapse

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for refactors or chores; if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Description

<img width="521" height="372" alt="Image" src="https://github.com/user-attachments/assets/80152b97-c0c6-4ef6-9037-8f715feac38a" />

need to update some api && clean a bit.

Motivation

No response

Additional Context

No response

extent analysis

TL;DR

Update the API and perform a cleanup to resolve the issue.

Guidance

  • Review the API documentation to determine the necessary updates and ensure compatibility with the current implementation.
  • Perform a thorough cleanup of the codebase to remove any unnecessary or redundant elements.
  • Verify that the updates and cleanup do not introduce any new issues or break existing functionality.
  • Consider creating a backup or branch before making significant changes to the codebase.

Notes

The issue lacks specific details about the API updates and cleanup required, so it's essential to carefully review the code and documentation to determine the necessary changes.

Recommendation

Apply workaround: Update the API and perform a cleanup as needed, and thoroughly test the changes to ensure they resolve the issue without introducing new problems.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

dify - ✅(Solved) Fix [Refactor/Chore] clean old api [3 pull requests, 6 comments, 2 participants]