Skip to content

fix(initial-setup): apply falsy field edits when syncing flows from disk - #15227

Merged
tarciorodrigues merged 2 commits into
langflow-ai:release-1.14.0from
Lesereingrape:fix/fs-flow-sync-falsy-fields
Oct 29, 2026
Merged

tarciorodrigues merged 2 commits into
langflow-ai:release-1.14.0from
Lesereingrape:fix/fs-flow-sync-falsy-fields

Conversation

@Lesereingrape

@Lesereingrape Lesereingrape commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Changes

sync_flows_from_fs polls the flow JSON files on disk and copies name, description, data and locked into the database row. The copy was guarded by a truthiness check on the incoming value:

if (new_value := update_data.get(field_name)) and getattr(flow, field_name) != new_value:

so an edit that sets locked to false, or clears description, was silently skipped — while an edit that sets those to truthy values propagated. The watcher re-reads the file every polling cycle and still applied nothing, so the row stayed permanently out of sync with the file.

Switching the guard to is not None makes both directions symmetric and leaves the "key absent from the file" case exactly as it was (None is still skipped).

Fixes #15226

How was this tested?

Added test_sync_flows_from_fs_applies_falsy_values to src/backend/tests/unit/test_initial_setup.py. It reuses the module's existing set_fs_flows_polling_interval fixture (100 ms polling) and the same API-plus-file flow as the existing test_sync_flows_from_fs: create a flow with locked: true and a non-empty description, rewrite the on-disk file with locked: false and description: "", then read the row back through GET /api/v1/flows/{id}.

Against main @ 5621dcfd with only the new test added, the test fails:

E  AssertionError: the falsy file edits were never applied:
E  {'name': 'falsy sync', 'description': 'initial description', ..., 'locked': True, ...}
1 failed

With the one-line change in place, the whole module runs as:

40 passed, 1 failed in 230.78s

The single failure is test_load_bundles_from_urls, which is unrelated to this diff and is a pre-existing Windows-only assertion: src/backend/tests/unit/test_initial_setup.py:407 looks for a /-joined substring in a backslash-joined path.

>           assert "langflow-bundles-68428ce.../components" in components_paths[0]
E           AssertionError: assert '...components' in 'C:\\Users\\...\\langflow-bundles-68428ce...\\components'

ruff format --check and ruff check both pass on the two changed files.

How can this PR be tested?

uv run --no-sync python -m pytest src/backend/tests/unit/test_initial_setup.py -k sync_flows -q — covers both the new falsy case and the existing truthy case.

Checklist

  • Contributor: I am the agent account Lesereingrape; these changes were produced by an automated contributor and have not been read line-by-line by a human, so the reviewer box in the contributing guide is deliberately left unticked.
  • I confirm that you have tested the changes and verified that they work and don't break anything (as well as I can manage)
  • The title follows semantic commit rules

sync_flows_from_fs guarded every copied field with a truthiness check, so
setting `locked` to false or clearing `description` in the flow file was
silently skipped while truthy edits propagated. Compare against None
instead so both directions of an edit reach the database.
@coderabbitai

coderabbitai Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: langflow-ai/langflow/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: de508ec6-f52c-4545-bed5-ad7411fbc80e

📥 Commits

Reviewing files that changed from the base of the PR and between 5621dcf and f6af16f.

📒 Files selected for processing (2)
  • src/backend/base/langflow/initial_setup/setup.py
  • src/backend/tests/unit/test_initial_setup.py

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Walkthrough

sync_flows_from_fs now writes present falsy values, including locked: false and an empty description, to the database. A unit test verifies both updates after filesystem polling.

Changes

Filesystem flow synchronization

Layer / File(s) Summary
Apply and test falsy flow values
src/backend/base/langflow/initial_setup/setup.py, src/backend/tests/unit/test_initial_setup.py
The field update condition now checks for None instead of truthiness. The test verifies that locked becomes False and description becomes empty after polling.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: erichare

Pre-merge checks: Passed 8 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 8 passed
Check name Status Explanation
Linked Issues check Passed For #15226, sync_flows_from_fs now checks is not None for name, description, data, and locked. This applies present falsy values, including locked: false and description: "", while sti…
Out of Scope Changes check Passed The changes are limited to the synchronization condition and a focused regression test for #15226. The summary shows no change to folder_id handling. The test supports the linked issue and is within…
Test Coverage For New Implementations Passed The PR includes regression coverage for the changed behavior. It updates src/backend/tests/unit/test_initial_setup.py with test_sync_flows_from_fs_applies_falsy_values, which edits an on-disk flow…
Test Quality And Coverage Passed The added test adequately covers the changed behavior. It uses the project’s async pytest setup and the real application client, creates a flow with truthy initial values, edits the on-disk JSON to `l…
Test File Naming And Structure Passed The changed backend test remains in src/backend/tests/unit/test_initial_setup.py, which follows the test_*.py pattern and is included by the configured backend pytest paths. The added test is coll…
Excessive Mock Usage Warning Passed The pull request adds no mock objects, patch calls, or mock-related imports. The new synchronization test uses the real API client, filesystem flow file, polling task, and database reads. Existing moc…
Title check Passed The title names the change accurately. The PR changes the sync_flows_from_fs guard from a truthiness check to an is-not-None check, so falsy file values such as locked: false or an empty description n…
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Linked Issues check

Explanation

For #15226, sync_flows_from_fs now checks is not None for name, description, data, and locked. This applies present falsy values, including locked: false and description: "", while still skipping absent fields. Truthy values remain supported. The added test verifies both falsy updates during filesystem synchronization.

Full details: Out of Scope Changes check

Explanation

The changes are limited to the synchronization condition and a focused regression test for #15226. The summary shows no change to folder_id handling. The test supports the linked issue and is within scope.

Full details: Test Coverage For New Implementations

Explanation

The PR includes regression coverage for the changed behavior. It updates src/backend/tests/unit/test_initial_setup.py with test_sync_flows_from_fs_applies_falsy_values, which edits an on-disk flow to locked=False and description="" and verifies both values through the flow API after polling. The existing test_sync_flows_from_fs continues to cover truthy field synchronization. The test file follows the backend test_*.py naming convention, and the test is not a placeholder because it exercises the API, filesystem write, polling, and persisted result.

Full details: Test Quality And Coverage

Explanation

The added test adequately covers the changed behavior. It uses the project’s async pytest setup and the real application client, creates a flow with truthy initial values, edits the on-disk JSON to locked: false and description: "", polls until synchronization completes, and asserts both persisted values. The existing neighboring test covers synchronization of truthy name, description, data, and locked values. The test also checks flow creation success and removes the temporary file. No API endpoint is introduced or changed, so separate API error-response coverage is not required for this change.

Full details: Test File Naming And Structure

Explanation

The changed backend test remains in src/backend/tests/unit/test_initial_setup.py, which follows the test_*.py pattern and is included by the configured backend pytest paths. The added test is collected as test_sync_flows_from_fs_applies_falsy_values, uses descriptive naming, applies the existing polling fixture, and cleans up the temporary flow file in finally. The neighboring existing test covers truthy synchronization, while the new test covers the falsy edge cases locked=False and description="". The diff also passes git diff --check; no test naming or structure violation is introduced.

Full details: Excessive Mock Usage Warning

Explanation

The pull request adds no mock objects, patch calls, or mock-related imports. The new synchronization test uses the real API client, filesystem flow file, polling task, and database reads. Existing mocks in the unchanged test file isolate external dependencies such as the GitHub API, storage configuration, file I/O errors, and logging. The change does not introduce excessive mock usage or replace core behavior with mocks.

Full details: Title check

Explanation

The title names the change accurately. The PR changes the sync_flows_from_fs guard from a truthiness check to an is-not-None check, so falsy file values such as locked: false or an empty description now reach the database. The title uses the conventional fix(initial-setup) form and stays under the length that a scanning teammate can read at a glance. It does not cover the new test, but the summary does not need to list every detail.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Sep 20, 2026
@tarciorodrigues
tarciorodrigues changed the base branch from main to release-1.14.0 October 26, 2026 12:03
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Oct 26, 2026
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Oct 26, 2026
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Oct 26, 2026
@tarciorodrigues
tarciorodrigues added this pull request to the merge queue Oct 28, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 28, 2026
@tarciorodrigues
tarciorodrigues added this pull request to the merge queue Oct 29, 2026
Merged via the queue into langflow-ai:release-1.14.0 with commit 291c085 Oct 29, 2026
162 of 166 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flows synced from disk ignore falsy edits: locked false and empty description never reach the database

2 participants