Skip to content

fix: use SQLAlchemy .is_(False) instead of Python is False in FileRecord queries#24

Open
devin-ai-integration[bot] wants to merge 1 commit intomasterfrom
devin/1775554751-fix-sqlalchemy-is-false-filter
Open

fix: use SQLAlchemy .is_(False) instead of Python is False in FileRecord queries#24
devin-ai-integration[bot] wants to merge 1 commit intomasterfrom
devin/1775554751-fix-sqlalchemy-is-false-filter

Conversation

@devin-ai-integration
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot commented Apr 7, 2026

Summary

Fixes a critical bug in core/jmeter.py where two SQLAlchemy queries use Python's identity operator (is False) instead of SQLAlchemy's .is_(False) method to filter FileRecord.is_deleted.

FileRecord.is_deleted is False performs a Python identity check — since a SQLAlchemy Column object is never the False singleton, this expression always evaluates to Python False. The resulting .filter(..., False) adds a WHERE false clause, so the query always returns zero rows. This means both execute_jmx_async() and execute_jmx_sync_dev() silently fail to find any uploaded JMX file, returning a 404 on every execution attempt.

Review & Testing Checklist for Human

  • Verify the fix by uploading a JMX file and then executing it via the /execute endpoint — confirm it no longer returns 404
  • Search the rest of the codebase for other instances of is False or is True on SQLAlchemy column attributes (e.g. grep -rn 'is False\|is True' --include='*.py') — there may be similar bugs elsewhere
  • Confirm that existing FileRecord rows in your database have is_deleted = false so the corrected query actually matches them

Notes

  • This change was not verified with a running test suite due to environment constraints — only lint (flake8, black, isort) was validated
  • The two affected methods are the only production code paths for JMeter file execution in JMeterManager

Link to Devin session: https://app.devin.ai/sessions/4a764a33364c48478f6bb95d29af0007
Requested by: @lihuacai168


Open with Devin

…ecord queries

The filter condition 'FileRecord.is_deleted is False' uses Python's identity
check ('is') instead of SQLAlchemy's comparison method. Since
FileRecord.is_deleted is a Column object (not the Python False singleton),
'is False' always evaluates to Python False, causing the filter to silently
match no rows.

This breaks both execute_jmx_async() and execute_jmx_sync_dev() — uploaded
JMX files can never be found for execution, resulting in spurious 404 errors.

Fix: replace 'is False' with '.is_(False)' which generates the correct
SQL 'IS FALSE' clause.

Co-Authored-By: 花菜 <lihuacai168@gmail.com>
@devin-ai-integration
Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link
Copy Markdown
Author

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

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.

1 participant